/* =========================================================
   Hedaa Tech Client Portal – Stylesheet
   Gleiches Design-System wie die Hedaa-Website: Tokens, Light/Dark,
   Cairo (AR) / Tajawal (DE/EN), logische Properties für RTL.
   ========================================================= */

/* hidden-Attribut muss Komponenten-display (z. B. .modal { display:grid }) übersteuern */
[hidden] { display: none !important; }

:root {
  --font-latin: "Tajawal", "Segoe UI", system-ui, sans-serif;
  --font-arabic: "Cairo", "Segoe UI", Tahoma, sans-serif;
  --font: var(--font-latin);
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --radius: 4px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
  --bg: #f4f6f9; --bg-2: #ffffff; --bg-3: #eaeef3; --bg-ink: #0b1524;
  --text: #0b1524; --text-2: #3d4b5c; --muted: #66758a;
  --line: #dde3ea; --line-2: #c6cfd9;
  --accent: #0a84ff; --accent-2: #00c2c7; --accent-ink: #0068d6; --accent-soft: rgba(10,132,255,.09);
  --ok: #0f9d58; --ok-soft: rgba(15,157,88,.12); --warn: #d99a00; --warn-soft: rgba(217,154,0,.14); --bad: #d64545; --bad-soft: rgba(214,69,69,.12); --info-soft: rgba(10,132,255,.1);
  --shadow: 0 10px 30px -18px rgba(11,21,36,.25);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220; --bg-2: #111a2c; --bg-3: #172239; --bg-ink: #060b14;
  --text: #e9eef5; --text-2: #b9c4d2; --muted: #8a98ab;
  --line: #22304a; --line-2: #2f405e;
  --accent: #3fa4ff; --accent-2: #22d6d0; --accent-ink: #7cc0ff; --accent-soft: rgba(63,164,255,.14);
  --ok: #3ccf7a; --ok-soft: rgba(60,207,122,.14); --warn: #f2b632; --warn-soft: rgba(242,182,50,.16); --bad: #ff6b6b; --bad-soft: rgba(255,107,107,.14); --info-soft: rgba(63,164,255,.14);
  --shadow: 0 20px 40px -24px rgba(0,0,0,.7);
}
html[lang="ar"] { --font: var(--font-arabic); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.6; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; transition: background-color .4s, color .4s; }
html[lang="ar"] body { font-size: 15.5px; line-height: 1.75; }
a { color: inherit; text-decoration: none; }
a.link, .link { color: var(--accent-ink); font-weight: 600; }
a.link:hover { text-decoration: underline; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea, output { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.skip-link { position: absolute; top: -50px; inset-inline-start: 1rem; background: var(--text); color: var(--bg); padding: .5rem .9rem; z-index: 999; }
.skip-link:focus { top: .5rem; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.num { font-family: var(--font-latin); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.num-sm { font-size: 1rem !important; }
.mt { margin-top: 1rem; }
.ta-end { text-align: end; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.eyebrow { display: inline-block; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: .35rem; }
html[lang="ar"] .eyebrow { letter-spacing: 0; font-size: .8rem; }

/* ---- Shell ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--bg-2); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 60; transition: transform .45s var(--ease); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; height: var(--topbar-h); padding: 0 1.1rem; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .5rem; }
.brand img[data-logo="mark"] { height: 28px; width: auto; }
.brand img[data-logo="word"] { height: 14px; width: auto; }
.sidebar-close { display: none; }
.sidebar-nav { padding: .75rem .6rem; display: grid; gap: 2px; overflow-y: auto; flex: 1; }
.sidebar-nav a { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border-radius: var(--radius); color: var(--text-2); font-weight: 500; position: relative; transition: background .2s, color .2s; }
.sidebar-nav a:hover { background: var(--bg-3); color: var(--text); }
.sidebar-nav a.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.sidebar-nav a.is-active::before { content: ""; position: absolute; inset-inline-start: 0; top: 20%; bottom: 20%; width: 3px; background: var(--accent); border-radius: 2px; }
.sidebar-foot { padding: 1rem 1.1rem; border-top: 1px solid var(--line); display: grid; gap: .25rem; }
.role-tag { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--accent-ink); }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(6,11,20,.5); z-index: 55; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 50; height: var(--topbar-h); display: flex; align-items: center; gap: 1rem; padding: 0 clamp(1rem, 3vw, 2rem); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-title { font-size: 1.05rem; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: .6rem; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 50%; background: var(--bg-2); color: var(--text); transition: border-color .2s; }
.icon-btn:hover { border-color: var(--accent); }
.burger { display: none; align-content: center; gap: 4px; }
.burger span { display: block; width: 16px; height: 1.6px; background: currentColor; }
.lang-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--bg-2); }
.lang-switch a, .auth-lang a { min-width: 36px; height: 28px; display: grid; place-items: center; padding: 0 .5rem; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; color: var(--muted); font-family: var(--font-latin); transition: background .3s, color .3s; }
.lang-switch a.on { background: var(--text); color: var(--bg); }
:root[data-theme="dark"] .lang-switch a.on { background: var(--accent); color: #06111f; }
.tt-sun, .tt-rays, .tt-moon { transform-origin: 12px 12px; transition: transform .5s var(--ease), opacity .3s; }
.tt-moon { opacity: 0; transform: rotate(-90deg) scale(.6); }
:root[data-theme="dark"] .tt-sun, :root[data-theme="dark"] .tt-rays { transform: scale(0); opacity: 0; }
:root[data-theme="dark"] .tt-moon { opacity: 1; transform: none; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: .5rem; cursor: pointer; padding: 3px; padding-inline-end: .75rem; border: 1px solid var(--line-2); border-radius: 999px; background: var(--bg-2); }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: .72rem; font-weight: 800; letter-spacing: .04em; }
:root[data-theme="dark"] .avatar { background: var(--accent); color: #06111f; }
.user-name { font-size: .85rem; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 180px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: .35rem; display: grid; z-index: 70; }
.user-menu .menu a, .user-menu .menu button { display: block; width: 100%; text-align: start; padding: .55rem .75rem; border-radius: 3px; font-weight: 500; }
.user-menu .menu a:hover, .user-menu .menu button:hover { background: var(--bg-3); }

.content { padding: clamp(1rem, 3vw, 2rem); display: grid; gap: 1.25rem; align-content: start; flex: 1; }
.app-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; padding: 1rem clamp(1rem, 3vw, 2rem); border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.app-footer a { color: var(--text); font-weight: 700; border-bottom: 1px solid var(--accent); }

/* ---- Page head, flash ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.page-head h2 { font-size: clamp(1.4rem, 2.2vw, 1.85rem); font-weight: 800; letter-spacing: -.01em; line-height: 1.2; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
html[lang="ar"] .page-head h2 { letter-spacing: 0; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.count { font-size: .75rem; font-weight: 700; color: var(--muted); background: var(--bg-3); padding: .1rem .5rem; border-radius: 999px; font-family: var(--font-latin); }
.flash { padding: .8rem 1rem; border-radius: var(--radius); border: 1px solid; font-weight: 600; }
.flash-success { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.flash-error { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.flash-info { background: var(--info-soft); border-color: var(--accent); color: var(--accent-ink); }

/* ---- Buttons ---- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .65rem 1.1rem; min-height: 40px; border-radius: var(--radius); font-weight: 700; font-size: .9rem; line-height: 1; white-space: nowrap; overflow: hidden; isolation: isolate; transition: color .3s, box-shadow .3s; }
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--accent); transform: translateY(101%); transition: transform .35s var(--ease); }
.btn:hover::before { transform: none; }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { color: #fff; }
.btn-ghost { box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); background: var(--bg-2); }
.btn-ghost:hover { color: #fff; }
.btn-danger { box-shadow: inset 0 0 0 1px var(--bad); color: var(--bad); background: transparent; }
.btn-danger::before { background: var(--bad); }
.btn-danger:hover { color: #fff; }
.btn-sm { padding: .45rem .8rem; min-height: 32px; font-size: .82rem; }
.btn-block { width: 100%; }
.link-btn { color: var(--muted); font-weight: 700; padding: 0 .35rem; }
.link-btn:hover { color: var(--bad); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.seg a { padding: .5rem .9rem; font-size: .85rem; font-weight: 600; color: var(--muted); background: var(--bg-2); }
.seg a.on { background: var(--text); color: var(--bg); }

/* ---- Cards & grids ---- */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; display: grid; gap: .9rem; align-content: start; min-width: 0; }
.card-flush { padding: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.card-head.pad { padding: 1.25rem 1.25rem 0; }
.card-title { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
html[lang="ar"] .card-title { letter-spacing: 0; font-size: .85rem; }
.card-link { transition: border-color .2s, transform .3s var(--ease); }
.card-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-link h3 { font-size: 1.1rem; font-weight: 700; }
.card-foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.grid-2-1, .grid-1-1 { display: grid; gap: 1.25rem; align-items: start; }
@media (min-width: 1000px) { .grid-2-1 { grid-template-columns: 2fr 1fr; } .grid-1-1 { grid-template-columns: 1fr 1fr; } }
.stack { display: grid; gap: 1.25rem; align-content: start; min-width: 0; }
.empty { text-align: center; padding: 3rem 1rem; display: grid; gap: .75rem; justify-items: center; }
.empty-code { font-size: 4rem; font-weight: 800; color: transparent; -webkit-text-stroke: 1px var(--line-2); line-height: 1; font-family: var(--font-latin); }

/* ---- Stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1px solid var(--line); background: var(--bg-2); border-radius: var(--radius); overflow: hidden; }
.stat { padding: 1rem 1.15rem; display: grid; gap: .15rem; align-content: start; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: -1px; transition: background .2s; }
.stat:hover { background: var(--bg-3); }
.stat span { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
html[lang="ar"] .stat span { letter-spacing: 0; font-size: .8rem; }
.stat b { font-size: clamp(1.4rem, 2.2vw, 1.9rem); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.stat b.num { font-size: clamp(1.1rem, 1.8vw, 1.5rem); }
.stat small { color: var(--muted); font-size: .8rem; }
.stat-warn b { color: var(--bad); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
.table th, .table td { padding: .8rem 1rem; text-align: start; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; white-space: nowrap; background: var(--bg-3); }
html[lang="ar"] .table thead th { letter-spacing: 0; font-size: .78rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.table a b { color: var(--text); }
.table a:hover b { color: var(--accent-ink); }

/* ---- Badges, tags, dots ---- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 3px; font-size: .72rem; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--accent-ink); }
.badge-muted { background: var(--bg-3); color: var(--muted); }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .1rem .45rem; border: 1px solid var(--line-2); border-radius: 3px; color: var(--muted); }
html[lang="ar"] .tag { letter-spacing: 0; font-size: .75rem; }
.tag-relationships { border-color: var(--accent); color: var(--accent-ink); }
.tag-intermediaries { border-color: var(--accent-2); color: #0a8f93; }
:root[data-theme="dark"] .tag-intermediaries { color: var(--accent-2); }
.tag-search { border-color: var(--line-2); color: var(--text-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); margin-inline-end: .35rem; vertical-align: middle; }
.dot-ok { background: var(--ok); } .dot-bad { background: var(--bad); } .dot-muted { background: var(--line-2); }
.due { font-size: .75rem; font-weight: 700; color: var(--muted); }
.due-soon { color: var(--warn); } .due-late { color: var(--bad); }

/* ---- Lists ---- */
.list li { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.list li > a:first-child { flex: 1; min-width: 0; }
.list li > a:hover b { color: var(--accent-ink); }
.list li > span:last-child { text-align: end; white-space: nowrap; font-size: .9rem; }
.list-stack { flex-direction: column; align-items: stretch !important; gap: .4rem !important; }
.list-stack > span:last-child { text-align: start; white-space: normal; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; }
.dl dt { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding-top: .25rem; }
html[lang="ar"] .dl dt { letter-spacing: 0; font-size: .8rem; }
.dl dd { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.doc-list li { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.doc-list li:last-child { border-bottom: 0; }
.doc-list a { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.doc-list a:hover { color: var(--accent-ink); }
.doc-ico { display: inline-grid; place-items: center; min-width: 38px; height: 22px; padding: 0 .3rem; font-size: .62rem; font-weight: 800; letter-spacing: .05em; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 3px; font-family: var(--font-latin); }

/* ---- Progress ---- */
.progress { position: relative; height: 22px; background: var(--bg-3); border-radius: 3px; overflow: hidden; display: flex; align-items: center; }
.progress i { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: var(--w); background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 1s var(--ease); }
html[dir="rtl"] .progress i { background: linear-gradient(270deg, var(--accent), var(--accent-2)); }
.progress span { position: relative; z-index: 1; font-size: .72rem; font-weight: 700; padding-inline: .5rem; mix-blend-mode: difference; color: #fff; font-family: var(--font-latin); }
.progress-sm { height: 8px; }
.progress-sm span { display: none; }

/* ---- Funnel & donut ---- */
.funnel { display: grid; gap: .45rem; }
.funnel-row { display: grid; grid-template-columns: 7.5rem 1fr 2.5rem auto; align-items: center; gap: .75rem; font-size: .88rem; }
.funnel-label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.funnel-bar { height: 14px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.funnel-bar i { display: block; height: 100%; width: var(--w); min-width: 2px; background: var(--accent); transition: width 1s var(--ease); }
.funnel-row:nth-child(n+6) .funnel-bar i { background: var(--accent-2); }
.funnel-n { font-weight: 800; text-align: end; font-family: var(--font-latin); }
.funnel-v { font-size: .78rem; white-space: nowrap; font-family: var(--font-latin); }
.donut-wrap { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.donut { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.donut b { width: 80px; height: 80px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; font-size: 1.5rem; font-weight: 800; font-family: var(--font-latin); }
.legend { display: grid; gap: .4rem; flex: 1; min-width: 140px; }
.legend li { display: flex; align-items: center; gap: .5rem; font-size: .88rem; }
.legend i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.legend b { margin-inline-start: auto; font-family: var(--font-latin); }

/* ---- Activity ---- */
.activity li { display: grid; grid-template-columns: 12px 1fr; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.activity li:last-child { border-bottom: 0; }
.act-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); margin-top: .45rem; }
.act-created { background: var(--ok); } .act-status { background: var(--accent); } .act-deleted { background: var(--bad); } .act-uploaded { background: var(--accent-2); } .act-comment { background: var(--warn); }

/* ---- Forms ---- */
.form { display: grid; gap: 1.25rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem 1.25rem; }
.field { display: grid; gap: .35rem; min-width: 0; align-content: start; }
.field-full { grid-column: 1 / -1; }
.field label { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
html[lang="ar"] .field label { letter-spacing: 0; font-size: .8rem; }
.field label b { color: var(--bad); }
.field input, .field select, .field textarea, .output, .search input, .filters select, .task-add input, .task-add select, .comment-form textarea, .select-sm {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: .6rem .75rem; min-height: 42px; color: var(--text); transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus, .comment-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { resize: vertical; }
.field input[type="file"] { padding: .45rem; }
.field-check label { display: flex; align-items: center; gap: .6rem; text-transform: none; letter-spacing: 0; font-size: .95rem; color: var(--text); padding-top: 1.6rem; cursor: pointer; }
.field-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.hint { color: var(--muted); font-size: .78rem; }
.output { display: flex; align-items: center; background: var(--bg-3); font-weight: 700; }
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.form-compact { display: grid; gap: .75rem; padding-top: .75rem; }
.details summary { cursor: pointer; font-weight: 700; color: var(--accent-ink); font-size: .9rem; }
.search input { min-width: 220px; min-height: 40px; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.filters select { width: auto; min-height: 40px; padding-inline-end: 2rem; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 2rem !important; }
html[dir="rtl"] select { background-position: 14px 50%, 9px 50%; }
.select-sm { min-height: 32px; padding: .25rem .5rem; font-size: .8rem; width: auto; }

/* ---- Tasks ---- */
.tasks { display: grid; }
.task { display: grid; grid-template-columns: 28px 1fr auto; gap: .8rem; align-items: start; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.check { width: 24px; height: 24px; border: 2px solid var(--line-2); border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: #fff; transition: background .2s, border-color .2s; margin-top: .15rem; }
.check:hover { border-color: var(--accent); }
.task-done .check { background: var(--ok); border-color: var(--ok); }
.task-done .task-body b { text-decoration: line-through; color: var(--muted); }
.task-doing .check { border-color: var(--accent); border-style: dashed; }
.task-body { display: grid; gap: .25rem; min-width: 0; }
.task-actions { display: flex; align-items: center; gap: .35rem; }
.task-add { display: grid; grid-template-columns: 1fr auto auto auto; gap: .5rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.task-add input, .task-add select { min-height: 40px; }
@media (max-width: 640px) { .task-add { grid-template-columns: 1fr 1fr; } .task-add input[type="text"] { grid-column: 1 / -1; } }

/* ---- Pipeline board ---- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; scroll-snap-type: x proximity; }
.col { background: var(--bg-3); border-radius: var(--radius); display: grid; grid-template-rows: auto 1fr; min-height: 320px; scroll-snap-align: start; }
.col-head { display: flex; align-items: center; gap: .5rem; padding: .75rem .85rem; border-bottom: 2px solid var(--line-2); font-size: .82rem; }
.col-head b { flex: 1; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
html[lang="ar"] .col-head b { letter-spacing: 0; font-size: .8rem; }
.col-contract .col-head { border-color: var(--ok); } .col-lost .col-head { border-color: var(--bad); } .col-negotiation .col-head { border-color: var(--warn); }
.col-body { padding: .6rem; display: grid; gap: .6rem; align-content: start; }
.col.is-over .col-body { outline: 2px dashed var(--accent); outline-offset: -4px; }
.opp { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .85rem; display: grid; gap: .35rem; cursor: grab; transition: border-color .2s, box-shadow .2s; }
.opp:hover { border-color: var(--accent); }
.opp.is-dragging { opacity: .5; }
.opp a b { font-size: .92rem; line-height: 1.3; display: block; }
.opp-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.col-empty { text-align: center; padding: 1rem; }
.stagebar { display: inline-flex; gap: 3px; margin-top: .3rem; }
.stagebar span { width: 14px; height: 4px; background: var(--line-2); border-radius: 2px; }
.stagebar span.on { background: var(--accent); }
.stagebar.is-lost span { background: var(--bad); width: 30px; }

/* ---- Stepper ---- */
.stepper { display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem; counter-reset: s; }
.stepper-4 { grid-template-columns: repeat(4, 1fr); }
.stepper li { position: relative; padding-top: 1rem; font-size: .78rem; display: grid; gap: .15rem; }
.stepper li::before { content: ""; position: absolute; top: 4px; inset-inline: 0; height: 3px; background: var(--line-2); border-radius: 2px; }
.stepper li.done::before { background: var(--accent); }
.stepper li.current::before { background: var(--accent-2); }
.stepper li span { font-size: .65rem; letter-spacing: .1em; color: var(--muted); font-family: var(--font-latin); }
.stepper li b { font-weight: 700; color: var(--muted); line-height: 1.2; }
.stepper li.done b, .stepper li.current b { color: var(--text); }
.stepper li.current b { color: var(--accent-ink); }
@media (max-width: 720px) { .stepper { grid-template-columns: repeat(4, 1fr); } .stepper li b { font-size: .7rem; } }

/* ---- Comments ---- */
.thread { display: grid; gap: .75rem; }
.msg { padding: .75rem .9rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); max-width: 92%; }
.msg-admin { border-inline-start: 3px solid var(--accent); }
.msg-client { border-inline-start: 3px solid var(--accent-2); margin-inline-start: auto; }
.msg-head { display: flex; gap: .75rem; align-items: baseline; font-size: .8rem; margin-bottom: .25rem; }
.msg-head time { color: var(--muted); flex: 1; }
.comment-form { display: grid; gap: .6rem; justify-items: end; }
.comment-form textarea { resize: vertical; }

/* ---- Invoice sheet ---- */
.invoice-sheet { gap: 1.5rem; }
.inv-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; padding-bottom: 1rem; border-bottom: 2px solid var(--text); }
.inv-logo { width: 110px; height: auto; }
:root[data-theme="dark"] .inv-logo { filter: invert(1) hue-rotate(180deg); }
.inv-meta { text-align: end; font-size: .9rem; line-height: 1.6; }
.inv-to { line-height: 1.5; }
.inv-table th, .inv-table td { padding: .7rem 0; border-bottom: 1px solid var(--line); text-align: start; }
.inv-table thead th { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.inv-total td { font-weight: 800; font-size: 1.1rem; border-bottom: 2px solid var(--text); }
.inv-bank { font-size: .88rem; line-height: 1.6; padding-top: 1rem; border-top: 1px solid var(--line); }

/* ---- Auth ---- */
body.auth { min-height: 100vh; display: grid; place-items: center; background: var(--bg); }
.auth-wrap { width: min(980px, 100%); min-height: 100vh; display: grid; }
@media (min-width: 860px) { .auth-wrap { grid-template-columns: 1fr 1fr; min-height: auto; margin: 2rem; border: 1px solid var(--line); background: var(--bg-2); box-shadow: var(--shadow); } }
.auth-side { background: var(--bg-ink); color: #f2f6fb; padding: clamp(2rem, 5vw, 3.5rem); display: grid; align-content: space-between; gap: 2rem; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; inset-inline-end: -80px; bottom: -80px; width: 260px; height: 260px; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; }
.auth-logo { width: 160px; height: auto; }
.auth-side h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -.01em; }
.auth-side p { color: rgba(242,246,251,.75); max-width: 30ch; }
.auth-steps { counter-reset: a; display: grid; gap: .5rem; }
.auth-steps li { counter-increment: a; display: flex; gap: .75rem; align-items: baseline; font-weight: 600; padding: .5rem 0; border-top: 1px solid rgba(255,255,255,.1); }
.auth-steps li::before { content: counter(a, decimal-leading-zero); font-size: .7rem; letter-spacing: .1em; color: var(--accent-2); font-family: var(--font-latin); }
.auth-main { padding: clamp(1.5rem, 5vw, 3.5rem); display: grid; align-content: center; gap: 1.25rem; }
.auth-lang { display: flex; gap: .25rem; justify-content: flex-end; }
.auth-lang a.on { background: var(--text); color: var(--bg); }
.auth-form { display: grid; gap: 1rem; }
.auth-form h2 { font-size: 1.5rem; font-weight: 800; }
.auth-footer { color: var(--muted); font-size: .8rem; }
.auth-footer a { color: var(--text); font-weight: 700; border-bottom: 1px solid var(--accent); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; transform: translateX(-100%); box-shadow: var(--shadow); }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-close { display: grid; }
  .burger { display: grid; }
  .user-name { display: none; }
  .user-menu summary { padding-inline-end: 3px; }
}
@media (max-width: 640px) {
  .lang-switch { display: none; }
  .page-head h2 { font-size: 1.3rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .funnel-row { grid-template-columns: 5.5rem 1fr 2rem; }
  .funnel-v { display: none; }
  .topbar { gap: .6rem; }
  .content { padding: 1rem; }
  .board { grid-auto-columns: 82vw; }
}

/* ---- Print (invoice) ---- */
@media print {
  .sidebar, .topbar, .app-footer, .no-print, .comment-form, .thread, #comments, .sidebar-backdrop { display: none !important; }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  .grid-2-1 { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; }
}

/* ---- Tenders / taxonomy additions ---- */
.checks { display: flex; flex-wrap: wrap; gap: .4rem; align-items: flex-start; align-content: flex-start; }
.chk { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .65rem; border: 1px solid var(--line-2); border-radius: 999px; font-size: .85rem; cursor: pointer; text-transform: none !important; letter-spacing: 0 !important; color: var(--text) !important; background: var(--bg-2); }
.chk:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink) !important; }
.chk input { accent-color: var(--accent); margin: 0; width: 16px !important; height: 16px; min-height: 0 !important; padding: 0; }
.field .checks { padding-top: .1rem; }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.radio-cards label { display: grid; place-items: center; gap: .25rem; padding: .9rem; border: 1px solid var(--line-2); border-radius: var(--radius); cursor: pointer; text-align: center; }
.radio-cards label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.radio-cards input { position: absolute; opacity: 0; }
.inline-input { width: 100%; min-width: 110px; padding: .35rem .5rem; border: 1px solid var(--line-2); border-radius: 3px; background: var(--bg-2); font-size: .88rem; }
.inline-input.w-sm { min-width: 60px; width: 70px; }
.color-input { width: 40px; height: 30px; padding: 0; border: 1px solid var(--line-2); background: none; }
.stat-accent b { color: var(--accent-ink); }

/* =========================================================
   Enterprise-Erweiterung: Navigation, KPI, Wizard, Vergleich, Chat, Benachrichtigungen, Public, Modals
   ========================================================= */
.nav-section { display: block; padding: .9rem .8rem .3rem; font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
html[lang="ar"] .nav-section { letter-spacing: 0; font-size: .75rem; }
.nav-badge, .pill { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .66rem; font-weight: 800; font-family: var(--font-latin); margin-inline-start: auto; }
.pill { position: absolute; top: -4px; inset-inline-end: -4px; }
.pill.hidden, .hidden { display: none !important; }
.topbar-actions .icon-btn { position: relative; }
.notif-menu { position: relative; }
.notif-menu summary { list-style: none; }
.notif-menu summary::-webkit-details-marker { display: none; }
.notif-menu .menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 70; }
.menu-wide { width: min(380px, 92vw); display: grid; }
.menu-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem .9rem; border-bottom: 1px solid var(--line); font-size: .85rem; }
.menu-foot { display: block; text-align: center; padding: .6rem; font-size: .82rem; font-weight: 700; color: var(--accent-ink); border-top: 1px solid var(--line); }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-list li a { display: grid; gap: .1rem; padding: .6rem .9rem; border-bottom: 1px solid var(--line); font-size: .85rem; }
.notif-list li a:hover { background: var(--bg-3); }
.notif-list li.unread a { background: var(--accent-soft); }
.notif-list li a b { font-size: .86rem; }
.notif-page li { border-bottom: 1px solid var(--line); }
.notif-page li.unread { background: var(--accent-soft); }
.notif-item { display: grid; grid-template-columns: 12px 1fr auto; gap: .75rem; width: 100%; text-align: start; padding: .85rem 1.25rem; align-items: start; }
.notif-item .dot { margin-top: .45rem; }
.dot-accent { background: var(--accent); }
.toast-stack { position: fixed; bottom: 1rem; inset-inline-end: 1rem; display: grid; gap: .5rem; z-index: 200; }
.toast { background: var(--text); color: var(--bg); padding: .7rem 1rem; border-radius: var(--radius); box-shadow: var(--shadow); font-size: .88rem; opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s var(--ease); max-width: 320px; }
.toast.show { opacity: 1; transform: none; }
.toast-success { background: var(--ok); color: #fff; }
.flash-stack { display: grid; gap: .5rem; }
.flash-stack:empty { display: none; }
.flash { position: relative; padding-inline-end: 2.5rem; }
.flash-close { position: absolute; inset-inline-end: .6rem; top: .55rem; font-weight: 700; opacity: .7; }
.flash-warn { background: var(--warn-soft); border-color: var(--warn); color: #8a5a00; }
:root[data-theme="dark"] .flash-warn { color: var(--warn); }
.alerts { display: grid; gap: .5rem; }
.field-error { color: var(--bad); font-size: .78rem; font-weight: 600; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.auth-form-wide { max-width: 100%; }
.auth-form .card-title { margin-top: .5rem; }
.auth-top { display: flex; justify-content: flex-end; align-items: center; gap: .5rem; }
.auth-kicker { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); font-weight: 700; display: block; margin-bottom: .5rem; font-family: var(--font-latin); }
.auth-links { display: flex; gap: .6rem; font-size: .88rem; flex-wrap: wrap; }
@media (min-width: 860px) { .auth-wrap:has(.auth-form-wide) { width: min(1100px, 100%); grid-template-columns: 1fr 1.6fr; } }
.consents { display: grid; gap: .25rem; }
.consents .field-check label { padding-top: .2rem; }
.setup-steps { counter-reset: s; display: grid; gap: 1rem; }
.setup-steps li { counter-increment: s; position: relative; padding-inline-start: 2.4rem; display: grid; gap: .6rem; }
.setup-steps li::before { content: counter(s); position: absolute; inset-inline-start: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: .8rem; font-family: var(--font-latin); }
.qr-wrap { width: 200px; padding: 10px; background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius); }
.qr-wrap svg { width: 100%; height: auto; }
.secret { display: inline-block; padding: .4rem .6rem; background: var(--bg-3); border-radius: 3px; font-weight: 700; letter-spacing: .06em; font-size: .95rem; cursor: pointer; }
input.otp { font-family: var(--font-latin); font-size: 1.4rem !important; letter-spacing: .3em; text-align: center; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.codes li code { display: block; padding: .5rem; background: var(--bg-3); border-radius: 3px; text-align: center; font-weight: 700; font-size: 1rem; letter-spacing: .08em; }

/* KPI */
.stat-accent b { color: var(--accent-ink); }
.stat small { line-height: 1.3; }
.bars { display: grid; gap: .5rem; }
.bar-row { display: grid; grid-template-columns: 9rem 1fr 2rem; align-items: center; gap: .6rem; font-size: .85rem; }
.bar-track { height: 10px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.bar-track i { display: block; height: 100%; width: var(--w); min-width: 2px; background: var(--accent); transition: width 1s var(--ease); }
.bar-row b { text-align: end; font-family: var(--font-latin); }
@media (max-width: 640px) { .bar-row { grid-template-columns: 7rem 1fr 2rem; } }
.score { display: inline-grid; grid-template-columns: 54px auto; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 800; font-family: var(--font-latin); }
.score i { display: block; height: 8px; background: var(--bg-3); border-radius: 2px; position: relative; overflow: hidden; }
.score i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--muted); border-radius: 2px; }
.score-ok i::after { background: var(--ok); } .score-warn i::after { background: var(--warn); }
.score-ok b { color: var(--ok); } .score-warn b { color: var(--warn); }
.ring { --p: 0; width: 56px; height: 56px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--bg-3) 0); display: grid; place-items: center; }
.ring b { width: 42px; height: 42px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; font-size: .75rem; font-family: var(--font-latin); }
.page-meta { display: flex; align-items: center; gap: .6rem; }
.empty-state { text-align: center; padding: 2.5rem 1rem; display: grid; gap: .75rem; justify-items: center; }
.empty-inline { padding: .25rem 0; }
.pad { padding: 1rem 1.25rem !important; }
.card-head.pad { padding-bottom: 0 !important; }
.table-compact th, .table-compact td { padding: .55rem .9rem; font-size: .88rem; }
.row-ok td { background: var(--ok-soft) !important; }
.row-muted td { opacity: .55; }
.ta-center { text-align: center; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-6 { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.plain { display: grid; gap: .35rem; }
.tips { display: grid; gap: .6rem; font-size: .88rem; color: var(--text-2); }
.tips li { padding-inline-start: 1.2rem; position: relative; }
.tips li::before { content: ""; position: absolute; inset-inline-start: 0; top: .5em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); }
.rich { display: grid; gap: .35rem; }
.rich h4 { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-top: .5rem; }
html[lang="ar"] .rich h4 { letter-spacing: 0; font-size: .82rem; }
.rich p, .legal p { line-height: 1.7; }
.legal { gap: .6rem; }
.legal h2 { font-size: 1.5rem; font-weight: 800; }
.legal .rich h2, .legal .rich h3, .legal .rich h4 { text-transform: none; letter-spacing: 0; color: var(--text); font-size: 1.1rem; margin-top: 1rem; }
.legal ul { list-style: disc; padding-inline-start: 1.3rem; }
.timeline { display: grid; gap: .5rem; font-size: .88rem; }
.timeline li { padding-inline-start: 1rem; border-inline-start: 2px solid var(--line-2); }
.reasons { display: grid; gap: .3rem; font-size: .85rem; }
.reasons li { display: flex; justify-content: space-between; gap: .5rem; padding: .25rem .5rem; border-radius: 3px; background: var(--ok-soft); }
.reasons li.miss { background: var(--bg-3); color: var(--muted); }
.reasons.compact li { padding: .1rem .4rem; font-size: .78rem; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.25rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager-links { display: flex; gap: .3rem; }
.filters .search-input { min-width: 180px; min-height: 40px; }
.inline-input.w-sm { width: 90px; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btn.is-busy { opacity: .6; pointer-events: none; }
.radio-cards-3 { grid-template-columns: repeat(3, 1fr); }
.radio-cards-4 { grid-template-columns: repeat(4, 1fr); }
.radio-cards label { display: grid; gap: .2rem; align-content: center; position: relative; }
.radio-cards label span { font-weight: 400; }
@media (max-width: 720px) { .radio-cards-3, .radio-cards-4 { grid-template-columns: 1fr 1fr; } }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
html[dir="rtl"] .switch input:checked + i::after { transform: translateX(-18px); }
.switch.sm { width: 32px; height: 18px; } .switch.sm i::after { width: 12px; height: 12px; } .switch.sm input:checked + i::after { transform: translateX(14px); } html[dir="rtl"] .switch.sm input:checked + i::after { transform: translateX(-14px); }
.sector-group { padding: .5rem 0; border-bottom: 1px solid var(--line); }
.sector-group:last-of-type { border-bottom: 0; }
.chk-main { font-weight: 700; border-color: var(--line) !important; }
.checks.sub { padding: .4rem 0 0 1.5rem; }
html[dir="rtl"] .checks.sub { padding: .4rem 1.5rem 0 0; }
.matrix td code { font-size: .78rem; }
.checklist li { padding-inline-start: 1.4rem; position: relative; }
.checklist li::before { content: "✓"; position: absolute; inset-inline-start: 0; font-weight: 800; color: var(--ok); }
.checklist li.bad::before { content: "✕"; color: var(--bad); } .checklist li.warn::before { content: "!"; color: var(--warn); }
.tag-bad { border-color: var(--bad); color: var(--bad); } .tag-ok { border-color: var(--ok); color: var(--ok); }
.events li { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.inline-edit summary { cursor: pointer; }
.examples { margin-top: 1rem; }
.debug { text-align: start; font-size: .75rem; background: var(--bg-3); padding: 1rem; border-radius: var(--radius); overflow: auto; max-width: 100%; }

/* Wizard */
.wizard-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: .3rem; counter-reset: w; }
.wizard-steps li { position: relative; padding-top: 1rem; font-size: .8rem; display: grid; gap: .15rem; }
.wizard-steps li::before { content: ""; position: absolute; top: 4px; inset-inline: 0; height: 3px; background: var(--line-2); border-radius: 2px; }
.wizard-steps li.done::before { background: var(--accent); } .wizard-steps li.current::before { background: var(--accent-2); }
.wizard-steps li a { display: grid; gap: .15rem; }
.wizard-steps li span { font-size: .65rem; letter-spacing: .1em; color: var(--muted); font-family: var(--font-latin); }
.wizard-steps li b { color: var(--muted); } .wizard-steps li.done b, .wizard-steps li.current b { color: var(--text); } .wizard-steps li.current b { color: var(--accent-ink); }
@media (max-width: 640px) { .wizard-steps li b { font-size: .7rem; } }
.wizard-aside { align-self: start; position: sticky; top: calc(var(--topbar-h) + 1rem); }
.wizard-nav { justify-content: flex-end; }
.publish-box { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; border-color: var(--ok); background: var(--ok-soft); }
.award-box { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; border-color: var(--ok); border-width: 2px; }
.award-box h3 { font-size: 1.2rem; font-weight: 800; }
.approve-box { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; border-color: var(--warn); }
.decision .btn-row { padding: .25rem 0; }
.award-form { border-top: 1px solid var(--line); padding-top: 1rem; }
.cta-box { margin-top: 1.5rem; padding: 1.25rem; background: var(--bg-3); border-radius: var(--radius); display: grid; gap: .5rem; }
.stepper-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 720px) { .stepper-6 { grid-template-columns: repeat(3, 1fr); } }

/* Vergleich */
.compare-wrap { overflow: hidden; }
.compare th, .compare td { min-width: 200px; vertical-align: top; }
.compare .sticky-col { position: sticky; inset-inline-start: 0; background: var(--bg-3); z-index: 1; min-width: 150px; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
html[lang="ar"] .compare .sticky-col { letter-spacing: 0; font-size: .8rem; }
.compare thead th { background: var(--bg-2); }
.compare td.best { background: var(--ok-soft); }
.compare td.best b { color: var(--ok); }

/* Nachrichten */
.conv-list li a { display: grid; grid-template-columns: 36px 1fr auto; gap: .9rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line); align-items: center; }
.conv-list li a:hover { background: var(--bg-3); }
.conv-list li.unread a { background: var(--accent-soft); }
.conv-list li.unread b { color: var(--accent-ink); }
.conv-main { display: grid; gap: .1rem; min-width: 0; }
.conv-main .preview { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-meta { text-align: end; white-space: nowrap; }
.avatar.sm { width: 24px; height: 24px; font-size: .6rem; }
.chat { gap: 0; padding: 0; min-height: 60vh; grid-template-rows: 1fr auto; }
.chat-list { display: grid; gap: .6rem; padding: 1.25rem; overflow-y: auto; max-height: 65vh; align-content: start; }
.chat-msg { display: flex; }
.chat-msg.mine { justify-content: flex-end; }
.chat-msg .bubble { max-width: 78%; background: var(--bg-3); border-radius: var(--radius); padding: .6rem .85rem; display: grid; gap: .25rem; }
.chat-msg.mine .bubble { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.chat-msg.system .bubble { background: transparent; border: 1px dashed var(--line-2); color: var(--muted); font-size: .85rem; }
.chat-msg .msg-head { margin-bottom: 0; }
.chat-msg p { white-space: pre-wrap; overflow-wrap: anywhere; }
.attachment { display: inline-block; margin-top: .3rem; font-size: .82rem; font-weight: 700; color: var(--accent-ink); }
.chat-form { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; padding: .9rem 1.25rem; border-top: 1px solid var(--line); align-items: end; }
.chat-form textarea { width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: .6rem .75rem; min-height: 44px; resize: vertical; color: var(--text); }
.file-btn { cursor: pointer; } .file-btn.has-file { border-color: var(--accent); }

/* Modals & Tabs */
.modal { position: fixed; inset: 0; background: rgba(6,11,20,.55); display: grid; place-items: center; z-index: 150; padding: 1rem; }
.modal-box { width: min(760px, 100%); max-height: 92vh; overflow: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; display: grid; gap: 1rem; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 1.1rem; font-weight: 800; }
body.modal-open { overflow: hidden; }
.tabs { display: grid; gap: 1rem; }
.tab-list { display: inline-flex; gap: .25rem; border-bottom: 1px solid var(--line); }
.tab { padding: .6rem 1rem; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--accent-ink); border-color: var(--accent); }
.tab-panel { display: none; } .tab-panel.on { display: grid; }
.pop { position: absolute; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem; z-index: 40; min-width: 260px; margin-top: .4rem; }
details.inline { position: relative; }
details.inline summary { list-style: none; cursor: pointer; }
details.inline summary::-webkit-details-marker { display: none; }
.invoice-sheet.is-cancelled { position: relative; }
.invoice-sheet.is-cancelled::after { content: "STORNO"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 5rem; font-weight: 900; color: var(--bad); opacity: .12; transform: rotate(-18deg); pointer-events: none; font-family: var(--font-latin); }

/* Öffentliche Seiten */
body.public { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; background: var(--bg); }
.pub-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem clamp(1rem, 4vw, 3rem); background: var(--bg-2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pub-nav { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.pub-nav > a:not(.btn) { font-weight: 600; color: var(--text-2); }
.pub-main { width: min(1100px, 100%); margin: 0 auto; padding: clamp(1.25rem, 3vw, 2rem) clamp(1rem, 3vw, 2rem); display: grid; gap: 1.25rem; align-content: start; }
.pub-foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem clamp(1rem, 4vw, 3rem); border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.pub-foot a { color: var(--text); font-weight: 600; }
@media (max-width: 640px) { .pub-head .lang-switch { display: inline-flex; } .auth-top .lang-switch, .auth-lang { display: flex; } }

/* Druck */
@media print { .toast-stack, .flash-stack, .pager, .wizard-aside, .decision, .chat-form { display: none !important; } .codes li code { border: 1px solid #000; } }

/* Barrierefreiheit / Bewegung */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* Einfache Ausschreibung */
.client-picks { max-height: 260px; overflow: auto; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius); margin-top: .5rem; }
[data-client-search] { width: 100%; }
.recipient-preview { position: sticky; top: calc(var(--topbar-h) + 1rem); }
.preview-count b { font-size: 2rem; font-weight: 800; line-height: 1; }
.preview-names { list-style: none; padding: 0; margin: 0; display: grid; gap: .2rem; max-height: 320px; overflow: auto; }
.preview-names li::before { content: "• "; color: var(--accent); }

/* Kontakt zur ausschreibenden Stelle */
.stack-sm { display: grid; gap: .5rem; }
.contact-card .btn { justify-content: flex-start; }
.field-group > .form-grid { margin-top: .35rem; padding: .85rem; border: 1px solid var(--line); border-radius: var(--radius); }

/* Mobile App (Capacitor) */
html.in-app [data-print] { display: none; }

/* Benachrichtigungen/Benutzermenü auf schmalen Bildschirmen (Handy/App): an den Bildschirmrändern ausrichten statt am Button */
@media (max-width: 640px) {
  .notif-menu, .user-menu { position: static; }
  .notif-menu .menu, .user-menu .menu {
    position: fixed; inset-inline: 8px; top: calc(var(--topbar-h) + 4px);
    width: auto; min-width: 0; max-width: none;
    max-height: calc(100dvh - var(--topbar-h) - 16px); display: flex; flex-direction: column;
  }
  .notif-menu .notif-list { max-height: none; flex: 1 1 auto; overscroll-behavior: contain; }
  .notif-list li a { padding: .75rem 1rem; overflow-wrap: anywhere; }
  .notif-menu .menu-head { gap: .5rem; flex-wrap: wrap; }
}

.text-bad { color: var(--bad); }
.push-steps { padding-inline-start: 1.1rem; display: grid; gap: .5rem; }

/* ==========================================================================
   Enterprise HT – Design 2.6 (gleicher Stil wie die Anmeldeseite) · Hedaa Tech
   Wird an portal.css angehängt und überschreibt nur das Aussehen.
   ========================================================================== */
:root {
  --radius: 14px;
  --r-lg: 20px;
  --grad: linear-gradient(135deg, #0a84ff 0%, #2f6bff 50%, #00c2c7 100%);
  --grad-soft: linear-gradient(135deg, rgba(10,132,255,.12), rgba(0,194,199,.10));
  --bg: #eef3fb; --bg-2: #ffffff; --bg-3: #e7eef8; --bg-ink: #0b1730;
  --line: #dfe7f2; --line-2: #cbd6e5;
  --shadow: 0 1px 2px rgba(11,21,36,.04), 0 12px 32px -18px rgba(11,40,90,.22);
  --shadow-lg: 0 24px 60px -28px rgba(11,40,90,.35);
  --glass: rgba(255,255,255,.72);
}
:root[data-theme="dark"] {
  --bg: #070d1a; --bg-2: #0f182b; --bg-3: #16223a; --bg-ink: #050a14;
  --line: #1d2a44; --line-2: #2a3a5a;
  --text: #eef3fa; --text-2: #b8c4d6; --muted: #8494ac;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 16px 40px -22px rgba(0,0,0,.8);
  --shadow-lg: 0 30px 70px -30px rgba(0,0,0,.9);
  --glass: rgba(12,20,36,.72);
}

/* Grundfläche: dezente Farbverläufe wie auf der Anmeldeseite */
html { overflow-x: hidden; background: var(--bg); }
body { overflow-x: hidden; max-width: 100%; min-height: 100vh;
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(10,132,255,.10), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(0,194,199,.09), transparent 60%),
    var(--bg); }
:root[data-theme="dark"] body {
  background:
    radial-gradient(900px 520px at 100% -10%, rgba(10,132,255,.20), transparent 60%),
    radial-gradient(760px 520px at -10% 110%, rgba(0,194,199,.13), transparent 60%),
    radial-gradient(500px 400px at 50% 40%, rgba(109,92,255,.06), transparent 70%),
    var(--bg); }

/* ---------- Seitenleiste ---------- */
.sidebar { background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(140%); backdrop-filter: blur(20px) saturate(140%); border-inline-end: 1px solid var(--line); }
:root[data-theme="dark"] .sidebar { background: rgba(8,14,27,.82); }
.sidebar-head { padding-block: 1.1rem; }
.sidebar-nav { gap: 2px; padding-inline: .7rem; }
.sidebar-nav a { border-radius: 12px; padding: .62rem .8rem; color: var(--text-2); font-weight: 600; transition: background .2s, color .2s, transform .15s; }
.sidebar-nav a svg { opacity: .8; }
.sidebar-nav a:hover { background: var(--grad-soft); color: var(--text); }
.sidebar-nav a.is-active { background: var(--grad); color: #fff; font-weight: 800; box-shadow: 0 10px 24px -12px rgba(10,132,255,.7); }
.sidebar-nav a.is-active svg { opacity: 1; color: #fff; }
.sidebar-nav a.is-active::before { display: none; }
.sidebar-nav a.is-active .nav-badge, .sidebar-nav a.is-active .pill { background: rgba(255,255,255,.25); color: #fff; }
.nav-section { padding: 1.1rem .8rem .35rem; font-size: .64rem; letter-spacing: .16em; color: var(--muted); opacity: .9; }
.sidebar-foot { border-top: 1px solid var(--line); }
.role-tag { border-radius: 999px; }

/* ---------- Kopfzeile ---------- */
.topbar { background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%); border-bottom: 1px solid var(--line); }
.topbar-title { font-weight: 800; letter-spacing: -.01em; }
.icon-btn { border-radius: 12px; border-color: var(--line); background: var(--bg-2); box-shadow: var(--shadow); transition: border-color .2s, transform .15s, color .2s; }
.icon-btn:hover { border-color: rgba(10,132,255,.5); color: #0a84ff; }
.icon-btn:active { transform: scale(.95); }
.lang-switch { border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); padding: 3px; }
.lang-switch a.on, :root[data-theme="dark"] .lang-switch a.on { background: var(--grad); color: #fff; }
.avatar, :root[data-theme="dark"] .avatar { background: var(--grad); color: #fff; box-shadow: 0 6px 16px -8px rgba(10,132,255,.8); }
.user-menu summary { border-radius: 999px; }
.user-menu .menu, .notif-menu .menu { border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); overflow: hidden; }
.user-menu .menu a, .user-menu .menu button { border-radius: 10px; }
.pill, .nav-badge { background: var(--grad); color: #fff; border-radius: 999px; }

/* ---------- Inhalt ---------- */
.content { gap: 1.25rem; }
.page-head h2 { font-weight: 800; letter-spacing: -.02em; }
.eyebrow { color: #0a84ff; }
:root[data-theme="dark"] .eyebrow { color: #3fa4ff; }

/* Karten */
.card { border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--bg-2); box-shadow: var(--shadow); padding: 1.3rem 1.35rem; }
:root[data-theme="dark"] .card { background: linear-gradient(180deg, rgba(20,31,54,.9), rgba(13,21,38,.92)); }
.card-title { font-weight: 800; display: flex; align-items: center; gap: .55rem; }
.card-title::before { content: ""; width: 4px; height: 1.05em; border-radius: 4px; background: var(--grad); flex: none; }
.card-link { border-radius: var(--r-lg); transition: transform .2s, box-shadow .2s, border-color .2s; }
.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: rgba(10,132,255,.4); }
.card-head.pad, .card-foot { border-color: var(--line); }

/* Kennzahlen */
.stats { border: 0; background: transparent; gap: .85rem; overflow: visible; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-2); box-shadow: var(--shadow); padding: 1.05rem 1.15rem 1.1rem; margin: 0; transition: transform .2s, box-shadow .2s, border-color .2s; }
:root[data-theme="dark"] .stat { background: linear-gradient(180deg, rgba(20,31,54,.95), rgba(13,21,38,.95)); }
.stat::after { content: ""; position: absolute; inset-inline-end: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--grad); opacity: .10; }
.stat::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); opacity: .9; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: rgba(10,132,255,.35); background: var(--bg-2); }
.stat span { font-weight: 700; color: var(--muted); }
.stat b { background: linear-gradient(120deg, var(--text) 30%, #0a84ff 140%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-warn b { background: none; color: var(--warn); -webkit-text-fill-color: currentColor; }
.stat-accent b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Buttons */
.btn { border-radius: 12px; min-height: 42px; }
.btn-primary { background: var(--grad); background-size: 200% 100%; color: #fff; border: 0; box-shadow: 0 12px 26px -14px rgba(10,132,255,.85); transition: background-position .5s, box-shadow .3s, transform .15s; }
.btn-primary::before { display: none; }
.btn-primary:hover { background-position: 100% 0; color: #fff; box-shadow: 0 16px 30px -14px rgba(10,132,255,.95); }
.btn-primary:active, .btn-ghost:active { transform: scale(.98); }
.btn-ghost { border: 1px solid var(--line-2); background: var(--bg-2); border-radius: 12px; }
.btn-ghost::before { background: var(--grad-soft); }
.btn-ghost:hover { color: var(--text); border-color: rgba(10,132,255,.45); }
.btn-danger { border-radius: 12px; }
.seg { border-radius: 999px; padding: 3px; background: var(--bg-3); border: 1px solid var(--line); }
.seg a { border-radius: 999px; }
.seg a.on { background: var(--grad); color: #fff; box-shadow: 0 6px 16px -8px rgba(10,132,255,.8); }

/* Tabellen */
.table-wrap { border-radius: var(--r-lg); }
.table thead th { background: var(--bg-3); color: var(--muted); font-weight: 800; border-bottom: 1px solid var(--line); }
.table thead th:first-child { border-start-start-radius: 12px; }
.table thead th:last-child { border-start-end-radius: 12px; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover td { background: var(--grad-soft); }

/* Badges, Tags, Fortschritt */
.badge { border-radius: 999px; padding: .2rem .65rem; }
.tag { border-radius: 999px; padding: .12rem .55rem; border-color: var(--line-2); }
.progress, .funnel-bar, .bar-track, .score i { border-radius: 999px; overflow: hidden; }
.progress i, .funnel-bar i, .bar-track i { background: var(--grad); border-radius: 999px; }
.score i::after { border-radius: 999px; }
.due-late, .due.due-late { color: var(--bad); font-weight: 700; }

/* Listen */
.list li { border-color: var(--line); }
.list li > a:first-child { transition: color .15s; }
.list li > a:hover b { color: #0a84ff; }

/* Formulare */
.field input, .field select, .field textarea, .search input, .filters select, .select-sm, .comment-form textarea, .task-add input, .task-add select {
  border-radius: 12px; border-color: var(--line-2); background: var(--bg-2); transition: border-color .2s, box-shadow .2s; }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus, .comment-form textarea:focus { border-color: #0a84ff; box-shadow: 0 0 0 4px rgba(10,132,255,.16); }
:root[data-theme="dark"] .field input, :root[data-theme="dark"] .field select, :root[data-theme="dark"] .field textarea, :root[data-theme="dark"] .search input, :root[data-theme="dark"] .filters select { background: rgba(5,10,20,.55); }
.chk, .radio-cards label { border-radius: 12px; }
.chk:has(input:checked), .radio-cards label:has(input:checked) { border-color: #0a84ff; background: var(--grad-soft); }
.switch input:checked + i { background: var(--grad); }

/* Hinweise, Leerzustände, Dialoge */
.flash, .toast { border-radius: 14px; }
.empty, .empty-state { border-radius: var(--r-lg); }
.modal-box { border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.tab { border-radius: 10px; }
.tab.on { color: #0a84ff; }
.chat-msg .bubble { border-radius: 16px; }
.chat-msg.mine .bubble { background: var(--grad); color: #fff; border: 0; }
.notif-list li.unread a { background: var(--grad-soft); }
.app-footer { color: var(--muted); }

/* ---------- Handy / App ---------- */
@media (max-width: 640px) {
  .content { padding: 1rem .9rem 1.5rem; gap: 1rem; }
  .stats { grid-template-columns: 1fr 1fr; gap: .65rem; }
  .stat { padding: .85rem .9rem .95rem; border-radius: 16px; }
  .stat b { font-size: 1.45rem; }
  .card { padding: 1.05rem 1rem; border-radius: 18px; }
  .page-head { align-items: stretch; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .field input, .field select, .field textarea, .search input, .filters select, .select-sm { font-size: 16px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 1024px) {
  .sidebar { border-radius: 0 22px 22px 0; }
  html[dir="rtl"] .sidebar { border-radius: 22px 0 0 22px; }
  .sidebar-backdrop { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
}
@media (prefers-reduced-motion: reduce) { .stat, .card-link, .btn-primary { transition: none; } }
@media print { body { background: #fff !important; } .card, .stat { box-shadow: none !important; } }
