/* ==========================================================================
   RIS TOV Business OS — Design System
   Brand: Deep Forest Green #18221D · Warm Ivory #F3EFE6 · Coffee Gold #B68B58 · Sage #E5E8E2
   All direction-sensitive rules use CSS logical properties so Arabic RTL and English LTR share one stylesheet.
   ========================================================================== */

:root {
  color-scheme: light;
  /* brand */
  --forest: #18221D; --forest-2: #223029; --forest-3: #2E3F36;
  --ivory: #F3EFE6; --gold: #B68B58; --gold-strong: #8C6539; --sage: #E5E8E2;
  /* surfaces */
  --bg: #F2F0EA; --surface: #FFFFFF; --surface-2: #F8F6F1; --surface-3: #F0EDE6; --sunken: #E9E5DC;
  --line: #ECE8DF; --line-strong: #D8D1C2;
  /* ink */
  --ink: #18221D; --ink-2: #47524B; --ink-3: #6E7770; --ink-inverse: #F3EFE6;
  /* actions */
  --primary: #18221D; --primary-hover: #2A3A31; --primary-ink: #F3EFE6;
  --accent: #B68B58; --accent-soft: #F2E7D8; --accent-ink: #7A5631;
  --focus: #B68B58;
  /* status — reserved, always shown with an icon or label */
  --ok: #2F7D5B; --ok-soft: #E1F0E8; --warn: #9A6412; --warn-soft: #F8EBD3;
  --bad: #B4433A; --bad-soft: #F7E1DE; --info: #355F99; --info-soft: #E2EAF5; --neutral-soft: #ECE9E1;
  /* charts (validated pairings, see docs/DESIGN-SYSTEM.md) */
  --series-1: #2F6E52; --series-2: #B68B58; --series-3: #4B6FA5; --grid: #E6E0D3;
  /* sidebar stays forest green in both themes */
  --side-bg: #FFFFFF; --side-ink: #3B463F; --side-ink-2: #8A928B; --side-hover: #F3F1EB; --side-active: #18221D; --side-active-ink: #F3EFE6;
  /* shape & depth */
  --r-sm: 10px; --r: 14px; --r-lg: 24px; --r-xl: 30px;
  --shadow-1: 0 1px 2px rgba(24,34,29,.03), 0 10px 30px -18px rgba(24,34,29,.18);
  --shadow-2: 0 14px 34px -14px rgba(24,34,29,.22), 0 2px 6px rgba(24,34,29,.05);
  --shadow-3: 0 24px 48px -12px rgba(24,34,29,.28);
  /* type */
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: var(--font);
  --fs-xs: 12px; --fs-sm: 13px; --fs: 14px; --fs-md: 16px; --fs-lg: 20px; --fs-xl: 26px; --fs-2xl: 34px;
  /* spacing scale (4px base) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;
  /* motion */
  --ease: cubic-bezier(.2,.7,.2,1); --t-fast: 120ms; --t: 200ms; --t-slow: 420ms;
  --sidebar-w: 264px;
  --card-border: transparent;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0D120F; --surface: #151D18; --surface-2: #1A231E; --surface-3: #212C26; --sunken: #0B100D;
    --line: #26322B; --line-strong: #34433A; --card-border: #222D27;
    --ink: #EEE9DE; --ink-2: #BDC4BC; --ink-3: #8E988F; --ink-inverse: #18221D;
    --primary: #D9B98E; --primary-hover: #E6CAA3; --primary-ink: #18221D;
    --accent: #C99D68; --accent-soft: #2E261B; --accent-ink: #E2BF92;
    --ok: #5DBB8F; --ok-soft: #173126; --warn: #E0A64A; --warn-soft: #33281A; --bad: #E8776D; --bad-soft: #3A1F1C;
    --info: #86A9E0; --info-soft: #1C2738; --neutral-soft: #222B26;
    --series-1: #5DB38B; --series-2: #D2A673; --series-3: #7FA3DB; --grid: #25302A;
    --side-bg: #131A16; --side-ink: #C9CFC8; --side-ink-2: #7F8A82; --side-hover: #1C2620; --side-active: #D9B98E; --side-active-ink: #18221D;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 8px 22px -8px rgba(0,0,0,.6); --shadow-3: 0 24px 48px -12px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0D120F; --surface: #151D18; --surface-2: #1A231E; --surface-3: #212C26; --sunken: #0B100D;
  --line: #26322B; --line-strong: #34433A; --card-border: #222D27;
  --ink: #EEE9DE; --ink-2: #BDC4BC; --ink-3: #8E988F; --ink-inverse: #18221D;
  --primary: #D9B98E; --primary-hover: #E6CAA3; --primary-ink: #18221D;
  --accent: #C99D68; --accent-soft: #2E261B; --accent-ink: #E2BF92;
  --ok: #5DBB8F; --ok-soft: #173126; --warn: #E0A64A; --warn-soft: #33281A; --bad: #E8776D; --bad-soft: #3A1F1C;
  --info: #86A9E0; --info-soft: #1C2738; --neutral-soft: #222B26;
  --series-1: #5DB38B; --series-2: #D2A673; --series-3: #7FA3DB; --grid: #25302A;
  --side-bg: #131A16; --side-ink: #C9CFC8; --side-ink-2: #7F8A82; --side-hover: #1C2620; --side-active: #D9B98E; --side-active-ink: #18221D;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 8px 22px -8px rgba(0,0,0,.6); --shadow-3: 0 24px 48px -12px rgba(0,0,0,.7);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: var(--fs);
  line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-feature-settings: "tnum" 0;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .92em; letter-spacing: .01em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--gold) 35%, transparent); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 8px; top: -60px; z-index: 100; background: var(--primary); color: var(--primary-ink); padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { top: 8px; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.muted { color: var(--ink-3); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s2); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: var(--s2); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* ------------------------------------------------------------------ app shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.app.collapsed { --sidebar-w: 76px; }
.sidebar {
  position: sticky; top: 0; height: 100vh; background: var(--side-bg); color: var(--side-ink); border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; padding: var(--s4) var(--s3); gap: var(--s2); overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; color: var(--ink); text-decoration: none !important; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-name { font-size: 18px; letter-spacing: .14em; font-weight: 700; line-height: 1; }
.brand-sub { font-size: 11px; color: var(--side-ink-2); letter-spacing: .04em; margin-top: 4px; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--side-ink-2); padding: 14px 12px 6px; }
[dir="rtl"] .nav-section { letter-spacing: 0; text-transform: none; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px;
  color: var(--side-ink); text-decoration: none !important; font-weight: 500; transition: background var(--t-fast);
}
.nav-link:hover { background: var(--side-hover); }
.nav-link.active { background: var(--side-active); color: var(--side-active-ink); box-shadow: 0 8px 18px -10px rgba(24,34,29,.55); }
.nav-link.active::before { display: none; }
.nav-link .icon { color: var(--side-ink-2); }
.nav-link.active .icon { color: var(--gold); }
.nav-badge { margin-inline-start: auto; font-size: 11px; background: var(--gold); color: var(--forest); border-radius: 20px; padding: 0 7px; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding-top: var(--s3); border-top: 1px solid var(--line); }
.app.collapsed .brand-text, .app.collapsed .nav-label, .app.collapsed .nav-section, .app.collapsed .nav-badge, .app.collapsed .side-user-text { display: none; }
.app.collapsed .nav-link { justify-content: center; padding: 10px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; color: var(--side-ink); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--s3);
  padding: 14px clamp(16px, 3vw, 36px); background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.topbar-search { position: relative; flex: 1 1 auto; max-width: 460px; }
.topbar-search input[type="search"] { width: 100%; height: 44px; padding-inline-start: 42px; background: var(--surface); border-radius: 999px; border-color: transparent; box-shadow: var(--shadow-1); }
.topbar-search .icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search-pop { position: absolute; top: calc(100% + 6px); inset-inline: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); padding: 6px; max-height: 60vh; overflow: auto; }
.search-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none !important; }
.search-item:hover, .search-item.active { background: var(--surface-3); }
.search-group { font-size: 11px; color: var(--ink-3); padding: 8px 10px 4px; text-transform: uppercase; letter-spacing: .06em; }
.content { padding: clamp(16px, 3vw, 32px); max-width: 1440px; width: 100%; margin: 0 auto; flex: 1; }
.page-enter { animation: page-in var(--t-slow) var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s6); }
.page-title { font-size: 30px; font-weight: 600; letter-spacing: -.02em; }
.page-sub { color: var(--ink-3); margin-top: 4px; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: var(--fs-sm); color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: 999px; border: 1px solid transparent; background: var(--surface); color: var(--ink); cursor: pointer;
  font-weight: 500; white-space: nowrap; text-decoration: none !important; user-select: none;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.loading { opacity: .6; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow-1); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-gold { background: var(--gold); color: #18221D; }
.btn-gold:hover { background: #C49867; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { filter: brightness(1.06); }
.btn-danger-ghost { background: transparent; color: var(--bad); }
.btn-danger-ghost:hover { background: var(--bad-soft); }
.btn-sm { height: 34px; padding: 0 14px; font-size: var(--fs-sm); border-radius: 999px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: var(--fs-md); border-radius: 999px; }
.btn-icon { width: 40px; padding: 0; }
.btn-round { width: 44px; height: 44px; padding: 0; background: var(--surface); box-shadow: var(--shadow-1); }
.btn-round:hover { background: var(--surface-2); }
.btn-icon.btn-sm { width: 34px; }
.btn-block { width: 100%; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); }
.req::after { content: " *"; color: var(--bad); }
.hint { font-size: var(--fs-xs); color: var(--ink-3); }
.field-error { font-size: var(--fs-xs); color: var(--bad); display: flex; gap: 4px; align-items: center; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="date"], input[type="tel"], input:not([type]), select, textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select { appearance: none; padding-inline-end: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-size: 5px 5px; background-repeat: no-repeat; background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; }
[dir="rtl"] select { background-position: 13px 50%, 18px 50%; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 25%, transparent); }
.invalid input, .invalid select, .invalid textarea, input.invalid { border-color: var(--bad) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 15%, transparent) !important; }
input[readonly] { background: var(--surface-2); color: var(--ink-2); }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: .85; }
.input-wrap { position: relative; }
.input-wrap .addon { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); }
.input-wrap input[type] { padding-inline-end: 44px; }
.input-prefix { position: relative; }
.input-prefix .pfx { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: var(--fs-sm); }
.input-prefix input[type] { padding-inline-start: 50px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--forest); margin: 0; }
[data-theme="dark"] .check input { accent-color: var(--gold); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s5); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { padding-bottom: var(--s5); border-bottom: 1px dashed var(--line); }
.form-section:last-child { border-bottom: 0; padding-bottom: 0; }
.form-section-title { font-size: var(--fs-md); font-weight: 600; margin-bottom: var(--s4); display: flex; align-items: center; gap: 8px; }
.form-actions { display: flex; justify-content: flex-end; gap: var(--s2); flex-wrap: wrap; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); font-size: var(--fs-sm); border: 1px solid transparent; }
.alert .icon { margin-top: 1px; }
.alert-error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-demo { background: repeating-linear-gradient(-45deg, var(--warn-soft), var(--warn-soft) 10px, color-mix(in srgb, var(--warn-soft) 70%, var(--surface)) 10px, color-mix(in srgb, var(--warn-soft) 70%, var(--surface)) 20px); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 2px; }
.strength span { height: 4px; border-radius: 4px; background: var(--line); transition: background var(--t); }
.strength.s1 span:nth-child(-n+1) { background: var(--bad); }
.strength.s2 span:nth-child(-n+2) { background: var(--warn); }
.strength.s3 span:nth-child(-n+3) { background: var(--gold); }
.strength.s4 span { background: var(--ok); }

/* ------------------------------------------------------------------ cards, badges, avatars */
.card { background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-pad { padding: var(--s5); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s5) var(--s6) var(--s2); }
.card-title { font-size: var(--fs-md); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-body { padding: var(--s4) var(--s6) var(--s6); }
.card-foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-link { transition: border-color var(--t), box-shadow var(--t), transform var(--t); cursor: pointer; color: inherit; text-decoration: none !important; display: block; }
.card-link:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.grid { display: grid; gap: var(--s4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.span-2 { grid-column: span 2; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--neutral-soft); color: var(--ink-2); white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-gold { background: var(--accent-soft); color: var(--accent-ink); }
.badge-demo { background: var(--warn-soft); color: var(--warn); border: 1px dashed currentColor; font-weight: 600; letter-spacing: .04em; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: var(--fs-sm); cursor: pointer; }
.chip.active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

.avatar { position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-weight: 600; color: var(--forest); background: var(--sage); font-size: 14px; letter-spacing: .02em; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 26px; height: 26px; font-size: 11px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 64px; height: 64px; font-size: 20px; }
.avatar-xl { width: 112px; height: 112px; font-size: 34px; border: 4px solid var(--surface); box-shadow: var(--shadow-2); }
[data-theme="dark"] .avatar, .dark-sidebar .avatar { color: var(--forest); }
.avatar[data-tone="1"] { background: #E5E8E2; } .avatar[data-tone="2"] { background: #EADFCB; } .avatar[data-tone="3"] { background: #DCE4EC; } .avatar[data-tone="4"] { background: #E6DDE4; } .avatar[data-tone="5"] { background: #DDE8DF; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs); }
.table th { text-align: start; font-weight: 500; font-size: var(--fs-xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
[dir="rtl"] .table th { letter-spacing: 0; text-transform: none; font-size: var(--fs-sm); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table .num { text-align: end; }

/* ------------------------------------------------------------------ toolbar, tabs, pagination */
.toolbar { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin-bottom: var(--s4); }
.toolbar .search { position: relative; flex: 1 1 260px; max-width: 380px; }
.toolbar .search input[type="search"], .toolbar .search input { padding-inline-start: 38px; }
.toolbar .search .icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.toolbar select { width: auto; min-width: 150px; }
.seg { display: inline-flex; padding: 4px; background: var(--surface); box-shadow: var(--shadow-1); border-radius: 999px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { white-space: nowrap; flex: none; border: 0; background: transparent; height: 34px; padding: 0 14px; border-radius: 999px; cursor: pointer; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.seg button.active { background: var(--primary); color: var(--primary-ink); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: var(--s5); overflow-x: auto; scrollbar-width: none; }
.tab { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--ink-3); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--gold); }
.tab .count { font-size: 11px; background: var(--surface-3); border-radius: 10px; padding: 0 6px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s1); flex-wrap: wrap; }

/* ------------------------------------------------------------------ states */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--s3); padding: var(--s12) var(--s6); color: var(--ink-2); }
.state-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); }
.state-icon .icon { width: 26px; height: 26px; }
.state h3 { font-size: var(--fs-md); color: var(--ink); }
.state p { max-width: 420px; font-size: var(--fs-sm); }
.state-error .state-icon { background: var(--bad-soft); color: var(--bad); }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-line { height: 12px; margin: 6px 0; }
.sk-card { height: 120px; border-radius: var(--r-lg); }

/* ------------------------------------------------------------------ modal, drawer, toast, menu */
.overlay { position: fixed; inset: 0; background: rgba(12,18,15,.48); backdrop-filter: blur(3px); z-index: 80; display: grid; place-items: center; padding: var(--s4); animation: fade-in var(--t) var(--ease); }
.modal { width: min(640px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-3); border: 1px solid var(--line); animation: pop-in var(--t-slow) var(--ease); }
.modal-lg { width: min(880px, 100%); }
.modal-sm { width: min(440px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); padding: var(--s5) var(--s6) var(--s3); }
.modal-title { font-size: var(--fs-lg); font-weight: 600; }
.modal-body { padding: var(--s2) var(--s6) var(--s5); overflow-y: auto; }
.modal-foot { padding: var(--s4) var(--s6); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: var(--s2); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); flex-wrap: wrap; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-radius: 14px; background: var(--forest); color: var(--ivory); box-shadow: var(--shadow-3); animation: toast-in var(--t-slow) var(--ease); font-size: var(--fs-sm); }
.toast.leaving { animation: toast-out var(--t) ease-in forwards; }
.toast .icon { margin-top: 1px; }
.toast-ok .icon { color: #7FD1A8; } .toast-error .icon { color: #F2A097; } .toast-info .icon { color: var(--gold); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
.menu { position: absolute; z-index: 60; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); padding: 6px; animation: pop-in var(--t) var(--ease); }
.menu-item { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: start; color: var(--ink); text-decoration: none !important; }
.menu-item:hover { background: var(--surface-3); }
.menu-item.danger { color: var(--bad); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 0; }

/* ------------------------------------------------------------------ KPI & dashboard */
.kpi { padding: var(--s5); display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi-label { font-size: var(--fs-sm); color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-meta { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--ink-3); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: var(--fs-xs); padding: 1px 6px; border-radius: 6px; }
.delta-up { color: var(--ok); background: var(--ok-soft); }
.delta-down { color: var(--bad); background: var(--bad-soft); }
.kpi-spark { height: 36px; margin-top: 4px; }
.demo-ribbon { position: absolute; top: 12px; inset-inline-end: 12px; }
.welcome { background: var(--forest); color: var(--ivory); border-radius: var(--r-xl); padding: var(--s6) var(--s8); position: relative; overflow: hidden; border: 0; }
.welcome::after { content: ""; position: absolute; inset-inline-end: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%; border: 1px solid rgba(182,139,88,.35); box-shadow: 0 0 0 28px rgba(182,139,88,.06), 0 0 0 64px rgba(182,139,88,.04); }
.welcome h1 { font-size: var(--fs-xl); font-weight: 600; }
.welcome p { color: #BFC8C0; margin-top: 4px; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px var(--s6); border-bottom: 1px solid var(--line); color: inherit; text-decoration: none !important; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover, .list-item.clickable:hover { background: var(--surface-2); }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; margin-top: 7px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; font-size: var(--fs-sm); }
.bar-track { height: 10px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--series-1); transform-origin: left; animation: grow .8s var(--ease) both; }
[dir="rtl"] .bar-fill { transform-origin: right; }
@keyframes grow { from { transform: scaleX(0); } }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { overflow: visible; }
.chart .axis text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart-tip { position: absolute; pointer-events: none; background: var(--forest); color: var(--ivory); border-radius: 10px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow-2); white-space: nowrap; z-index: 5; transform: translate(-50%, -110%); }
.chart-tip .tip-row { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--ink-2); }
.legend-key { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ------------------------------------------------------------------ employees */
.emp-card { padding: var(--s5); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; position: relative; }
.emp-card .emp-code { position: absolute; top: 12px; inset-inline-start: 14px; font-size: 11px; color: var(--ink-3); }
.emp-card .status-dot { position: absolute; top: 14px; inset-inline-end: 14px; }
.emp-name { font-weight: 600; font-size: var(--fs-md); }
.emp-title { color: var(--ink-3); font-size: var(--fs-sm); min-height: 1.5em; }
.dept-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.dept-pill i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.profile-hero { position: relative; overflow: hidden; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.profile-cover { height: 120px; background: linear-gradient(120deg, #DCE3DA 0%, #C3CFC2 55%, #E8DAC4 100%); position: relative; overflow: hidden; }
[data-theme="dark"] .profile-cover { background: linear-gradient(120deg, #1C2822, #26352D 60%, #3A3024); }
.profile-cover::after { content: ""; position: absolute; inset-inline-end: 8%; top: -40px; width: 220px; height: 220px; border-radius: 50%; border: 1px dashed rgba(182,139,88,.45); }
.profile-main { display: flex; gap: var(--s5); padding: var(--s3) var(--s6) var(--s5); align-items: flex-start; flex-wrap: wrap; position: relative; }
.profile-avatar { position: relative; margin-top: -64px; }
.profile-main .grow { padding-top: 4px; }
.profile-name { font-size: var(--fs-xl); font-weight: 600; }
.dl { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 10px 16px; font-size: var(--fs); }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.locked-note { display: flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: var(--fs-sm); padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line-strong); }

/* org chart */
.org-viewport { position: relative; overflow: auto; border-radius: var(--r-lg); background:
  radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink-3) 25%, transparent) 1px, transparent 0) 0 0 / 22px 22px, var(--surface-2);
  border: 1px solid var(--line); min-height: 480px; cursor: grab; }
.org-viewport.dragging { cursor: grabbing; }
.org-canvas { transform-origin: 0 0; padding: 40px; display: inline-block; min-width: 100%; transition: transform var(--t) var(--ease); }
.org-tree, .org-tree ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; position: relative; }
.org-tree ul { padding-top: 28px; }
.org-tree li { position: relative; padding: 28px 10px 0; display: flex; flex-direction: column; align-items: center; }
.org-tree > li { padding-top: 0; }
.org-tree li::before, .org-tree li::after { content: ""; position: absolute; top: 0; width: 50%; height: 28px; border-top: 1.5px solid var(--line-strong); }
.org-tree li::before { inset-inline-end: 50%; }
.org-tree li::after { inset-inline-start: 50%; border-inline-start: 1.5px solid var(--line-strong); }
.org-tree li:only-child::before, .org-tree li:only-child::after { display: none; }
.org-tree li:only-child { padding-top: 28px; }
.org-tree li:only-child::after { display: block; border-top: 0; width: 0; inset-inline-start: 50%; }
.org-tree > li::before, .org-tree > li::after { display: none !important; }
.org-tree li:first-child::before, .org-tree li:last-child::after { border-top: 0; }
.org-tree li:last-child::before { border-inline-end: 1.5px solid var(--line-strong); border-start-end-radius: 10px; }
.org-tree li:first-child::after { border-start-start-radius: 10px; }
.org-tree ul::before { content: ""; position: absolute; top: 0; inset-inline-start: 50%; height: 28px; border-inline-start: 1.5px solid var(--line-strong); }
.org-node { width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; position: relative; transition: box-shadow var(--t), transform var(--t), border-color var(--t); cursor: pointer; }
.org-node:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); border-color: var(--line-strong); }
.org-node .stripe { position: absolute; top: 0; inset-inline: 16px; height: 3px; border-radius: 0 0 3px 3px; }
.org-node.ceo { background: var(--forest); color: var(--ivory); border-color: var(--forest); }
.org-node.ceo .muted { color: #BFC8C0; }
.org-node.dim { opacity: .3; }
.org-node.hit { box-shadow: 0 0 0 3px var(--gold), var(--shadow-2); }
.org-toggle { position: absolute; bottom: -13px; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; font-size: 11px; font-weight: 600; color: var(--ink-2); z-index: 2; }
.org-controls { position: absolute; z-index: 3; top: 12px; inset-inline-end: 12px; display: flex; gap: 6px; }

/* ------------------------------------------------------------------ products */
.prod-card { overflow: hidden; display: flex; flex-direction: column; }
.prod-thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.prod-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 14px; transition: transform var(--t-slow) var(--ease); }
.prod-card:hover .prod-thumb img { transform: scale(1.04); }
.prod-thumb .badge { position: absolute; top: 10px; inset-inline-start: 10px; }
.prod-noimg { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink-3); font-size: var(--fs-xs); }
.prod-body { padding: var(--s4); display: flex; flex-direction: column; gap: 6px; flex: 1; }
.prod-name { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; }
.price { font-weight: 600; font-variant-numeric: tabular-nums; }
.gallery { display: grid; grid-template-columns: 76px 1fr; gap: var(--s3); }
.gallery-main { aspect-ratio: 1 / 1; background: var(--surface-2); border-radius: var(--r-lg); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; position: relative; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; padding: 24px; animation: fade-in var(--t-slow); }
.gallery-thumbs { display: flex; flex-direction: column; gap: 8px; max-height: 520px; overflow-y: auto; }
.gallery-thumbs button { width: 76px; height: 76px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); padding: 4px; cursor: pointer; flex: none; }
.gallery-thumbs button.active { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: contain; }
.measure { display: flex; align-items: center; gap: 8px; color: var(--accent-ink); font-size: 12px; letter-spacing: .06em; }
.measure::before, .measure::after { content: ""; height: 1px; background: currentColor; flex: 1; opacity: .5; }
.spec-table { width: 100%; border-collapse: collapse; }
.spec-table td { padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: var(--fs); vertical-align: top; }
.spec-table td:first-child { color: var(--ink-3); width: 42%; padding-inline-end: 12px; }

/* wizard */
.wizard { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--s6); align-items: start; }
.steps { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; cursor: pointer; border: 0; background: none; text-align: start; color: var(--ink-2); width: 100%; }
.step:hover { background: var(--surface-3); }
.step[disabled] { cursor: not-allowed; opacity: .55; }
.step-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); font-size: 12px; font-weight: 600; flex: none; background: var(--surface); transition: all var(--t); }
.step.active { background: var(--surface); box-shadow: var(--shadow-1); color: var(--ink); }
.step.active .step-num { border-color: var(--gold); background: var(--gold); color: #18221D; }
.step.done .step-num { border-color: var(--ok); background: var(--ok); color: #fff; }
.step-label { font-weight: 500; }
.step-sub { font-size: 12px; color: var(--ink-3); }

/* uploader */
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); padding: var(--s8) var(--s5); text-align: center; background: var(--surface-2); transition: border-color var(--t), background var(--t); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dropzone:hover, .dropzone.over { border-color: var(--gold); background: var(--accent-soft); }
.dropzone .icon { width: 30px; height: 30px; color: var(--accent-ink); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); margin-top: var(--s4); }
.img-tile { position: relative; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); overflow: hidden; aspect-ratio: 1 / 1; transition: box-shadow var(--t), transform var(--t), opacity var(--t); }
.img-tile img { width: 100%; height: 100%; object-fit: contain; padding: 10px; background: var(--surface-2); }
.img-tile.main { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.img-tile.dragging { opacity: .4; }
.img-tile.drop-target { transform: scale(1.03); box-shadow: 0 0 0 2px var(--info); }
.img-tile .tile-bar { position: absolute; inset-inline: 0; bottom: 0; display: flex; justify-content: space-between; align-items: center; padding: 6px; background: linear-gradient(to top, rgba(12,18,15,.72), transparent); opacity: 0; transition: opacity var(--t); }
.img-tile:hover .tile-bar, .img-tile:focus-within .tile-bar { opacity: 1; }
.img-tile .tile-bar .btn { background: rgba(255,253,249,.92); color: #18221D; }
.img-tile .main-flag { position: absolute; top: 8px; inset-inline-start: 8px; }
.img-tile .order { position: absolute; top: 8px; inset-inline-end: 8px; background: rgba(24,34,29,.75); color: #fff; font-size: 11px; border-radius: 6px; padding: 0 6px; }
.img-tile .progress { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,253,249,.7); }
.img-tile .drag-handle { cursor: grab; }
@media (hover: none) { .img-tile .tile-bar { opacity: 1; } }

/* ------------------------------------------------------------------ login */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); background: var(--bg); }
.auth-brand { position: relative; overflow: hidden; background: #18221D; color: var(--ivory); display: flex; flex-direction: column; justify-content: space-between; padding: clamp(28px, 5vw, 64px); isolation: isolate; }
.auth-glow { position: absolute; inset: -20%; z-index: -1; background:
  radial-gradient(40% 35% at 25% 30%, rgba(182,139,88,.30), transparent 70%),
  radial-gradient(35% 30% at 75% 70%, rgba(94,130,108,.35), transparent 70%),
  radial-gradient(30% 25% at 60% 20%, rgba(229,232,226,.10), transparent 70%);
  animation: drift 18s ease-in-out infinite alternate; }
@keyframes drift { 0% { transform: translate3d(0,0,0) rotate(0deg); } 100% { transform: translate3d(-4%, 3%, 0) rotate(8deg); } }
.auth-rings { position: absolute; z-index: -1; inset-inline-end: -12%; bottom: -18%; width: 70%; aspect-ratio: 1; }
.auth-rings span { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(182,139,88,.28); animation: ripple 9s var(--ease) infinite; opacity: 0; }
.auth-rings span:nth-child(2) { animation-delay: 3s; }
.auth-rings span:nth-child(3) { animation-delay: 6s; }
@keyframes ripple { 0% { transform: scale(.35); opacity: 0; } 15% { opacity: 1; } 100% { transform: scale(1.1); opacity: 0; } }
.auth-logo { display: flex; align-items: center; gap: 14px; animation: logo-in 1.1s var(--ease) both; }
.auth-logo .brand-mark { width: 52px; height: 52px; }
.auth-logo .brand-name { font-size: 28px; }
.mark-ring { stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw 1.6s .2s var(--ease) forwards; }
.mark-line { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 1s .9s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes logo-in { from { opacity: 0; transform: translateY(10px); letter-spacing: .3em; } }
.auth-hero { max-width: 520px; animation: rise .9s .25s var(--ease) both; }
.auth-hero h1 { font-size: clamp(30px, 4vw, 46px); font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
.auth-hero p { color: #BFC8C0; margin-top: 14px; font-size: var(--fs-md); max-width: 440px; }
.auth-measure { display: flex; align-items: center; gap: 10px; color: var(--gold); font-size: 12px; letter-spacing: .14em; margin-bottom: 18px; }
.auth-measure::before { content: ""; width: 48px; height: 1px; background: currentColor; }
.auth-steam { position: absolute; inset-inline-start: 12%; bottom: 0; width: 140px; height: 220px; z-index: -1; opacity: .5; }
.auth-steam path { fill: none; stroke: rgba(243,239,230,.18); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 8 14; animation: steam 6s linear infinite; }
.auth-steam path:nth-child(2) { animation-duration: 7.5s; }
.auth-steam path:nth-child(3) { animation-duration: 9s; }
@keyframes steam { to { stroke-dashoffset: -220; } }
.auth-foot { font-size: 12px; color: #8E988F; display: flex; gap: 16px; flex-wrap: wrap; animation: rise .9s .5s var(--ease) both; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 72px clamp(24px, 5vw, 64px) 28px; position: relative; gap: 28px; }
.auth-note { margin-top: auto; text-align: center; }
.auth-tools { position: absolute; top: 20px; inset-inline-end: 20px; display: flex; gap: 6px; }
.auth-card { width: min(420px, 100%); animation: rise .8s .15s var(--ease) both; }
.auth-card h2 { font-size: 26px; font-weight: 600; }
.auth-card .sub { color: var(--ink-3); margin-top: 6px; margin-bottom: 28px; }
.auth-card form > * + * { margin-top: 16px; }
.auth-success { display: grid; place-items: center; gap: 12px; text-align: center; padding: 20px 0; animation: rise .5s var(--ease) both; }
.check-anim { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; }
.check-anim path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .6s .1s var(--ease) forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.shake { animation: shake .4s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ------------------------------------------------------------------ misc */
.perm-matrix th:not(:first-child), .perm-matrix td:not(:first-child) { text-align: center; }
.kbd { font-family: ui-monospace, monospace; font-size: 11px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--ink-3); }
.copy-box { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 8px 8px 12px; }
.copy-box code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 12px; direction: ltr; text-align: left; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.doc-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.divider { height: 1px; background: var(--line); margin: var(--s4) 0; }
.mobile-only { display: none; }
.backdrop { display: none; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wizard { grid-template-columns: 1fr; }
  .steps { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .step { width: auto; flex: none; }
  .step-sub { display: none; }
}
@media (max-width: 960px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); --sidebar-w: 280px; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; transform: translateX(-105%); transition: transform var(--t-slow) var(--ease); box-shadow: var(--shadow-3); }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(12,18,15,.45); z-index: 35; }
  .app.collapsed .brand-text, .app.collapsed .nav-label, .app.collapsed .nav-section { display: initial; }
  .mobile-only { display: inline-flex; }
  .desktop-only { display: none !important; }
  .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { min-height: 240px; padding: 28px 24px; }
  .auth-hero h1 { font-size: 28px; }
  .auth-hero p, .auth-foot, .auth-steam { display: none; }
  .gallery { grid-template-columns: 1fr; }
  .gallery-thumbs { flex-direction: row; order: 2; overflow-x: auto; }
}
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-title { font-size: 22px; }
  .topbar-search { max-width: none; }
  .modal { border-radius: 20px 20px 0 0; align-self: end; max-height: 92vh; }
  .overlay { padding: 0; place-items: end center; }
  .modal-foot { border-radius: 0; }
  .welcome { padding: var(--s5); }
  .kpi-value { font-size: 24px; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dt { margin-top: 8px; }
  .toolbar select, .toolbar .seg { flex: 1 1 auto; }
  .profile-main { flex-direction: column; align-items: flex-start; gap: var(--s3); }
  .hide-sm { display: none !important; }
  .content { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .mark-ring, .mark-line { stroke-dashoffset: 0; }
}
@media print {
  .sidebar, .topbar, .btn, .toolbar { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}

/* ==========================================================================
   Refresh (v1.1): bento dashboard, stat chips, profile card, dark task card, week strip, donut, bars
   ========================================================================== */
body { background:
  radial-gradient(60% 50% at 100% 0%, color-mix(in srgb, var(--sage) 70%, transparent), transparent 70%),
  radial-gradient(50% 40% at 0% 100%, color-mix(in srgb, var(--accent-soft) 70%, transparent), transparent 70%),
  var(--bg); background-attachment: fixed; }
.brand-chip { width: 38px; height: 38px; border-radius: 12px; background: var(--forest); display: grid; place-items: center; flex: none; }
.brand-chip .brand-mark { width: 28px; height: 28px; }
.hero-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s6); flex-wrap: wrap; margin-bottom: var(--s6); }
.hero-title { font-size: clamp(30px, 3.4vw, 46px); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.hero-title b { color: var(--accent-ink); font-weight: 600; }
.hero-sub { color: var(--ink-3); margin-top: 6px; }
.stat-trio { display: flex; gap: clamp(16px, 3vw, 40px); flex-wrap: wrap; }
.stat { display: grid; grid-template-columns: auto auto; column-gap: 12px; align-items: center; color: inherit; text-decoration: none !important; }
.stat-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow-1); color: var(--accent-ink); }
.stat-num { font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { grid-column: 1 / -1; text-align: center; color: var(--ink-3); font-size: var(--fs-sm); margin-top: 6px; }
.chips { display: flex; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s5); }
.pchip { display: flex; flex-direction: column; gap: 6px; min-width: 120px; flex: 1 1 120px; max-width: 220px; }
.pchip-label { font-size: var(--fs-sm); color: var(--ink-2); }
.pchip-track { position: relative; height: 34px; border-radius: 999px; background: repeating-linear-gradient(-45deg, var(--surface-3), var(--surface-3) 6px, var(--surface) 6px, var(--surface) 12px); border: 1px solid var(--line); overflow: hidden; }
.pchip-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 999px; background: var(--forest); min-width: 34px; animation: grow 1s var(--ease) both; transform-origin: left; }
[dir="rtl"] .pchip-fill { transform-origin: right; }
.pchip-fill.gold { background: var(--gold); }
.pchip-fill.sage { background: #8FA596; }
.pchip-val { position: absolute; inset-block: 0; inset-inline-start: 14px; display: flex; align-items: center; font-size: var(--fs-sm); font-weight: 600; color: #fff; mix-blend-mode: normal; }
.pchip-val.dark { color: var(--ink); }
.bento { display: grid; gap: var(--s4); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.b-3 { grid-column: span 3; } .b-4 { grid-column: span 4; } .b-5 { grid-column: span 5; } .b-6 { grid-column: span 6; } .b-7 { grid-column: span 7; } .b-8 { grid-column: span 8; } .b-9 { grid-column: span 9; } .b-12 { grid-column: span 12; }
.me-card { position: relative; overflow: hidden; border-radius: var(--r-lg); min-height: 290px; background: linear-gradient(160deg, #DCE3DA 0%, #C9D3C7 55%, #AEBDAF 100%); color: #fff; display: flex; align-items: flex-end; box-shadow: var(--shadow-1); text-decoration: none !important; }
.me-card img.me-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.me-card .me-initials { position: absolute; inset: 0; display: grid; place-items: center; font-size: 84px; font-weight: 600; color: rgba(24,34,29,.18); letter-spacing: .04em; }
.me-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(14,20,17,.78) 0%, rgba(14,20,17,.15) 45%, transparent 70%); }
.me-info { position: relative; z-index: 1; padding: var(--s5); display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s3); width: 100%; }
.me-name { font-size: 20px; font-weight: 600; }
.me-role { font-size: var(--fs-sm); opacity: .85; }
.glass { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: 14px; padding: 8px 12px; text-align: center; }
.glass b { display: block; font-size: 14px; }
.glass span { font-size: 11px; opacity: .85; }
.big-num { font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.tile-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tile-title { font-size: var(--fs-md); font-weight: 600; }
.arrow-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink); text-decoration: none !important; flex: none; }
.arrow-btn:hover { background: var(--surface-3); }
.arrow-btn .icon { transform: rotate(-45deg); }
[dir="rtl"] .arrow-btn .icon { transform: rotate(-135deg); }
.dark-card { background: var(--forest); color: var(--ivory); border-radius: var(--r-lg); padding: var(--s6); box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: var(--s3); }
[data-theme="dark"] .dark-card { background: #1F2B24; }
.dark-card .muted { color: #A9B3AB; }
.dark-card .tile-title { color: var(--ivory); }
.dtask { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.dtask-ico { width: 40px; height: 40px; border-radius: 50%; background: rgba(243,239,230,.1); display: grid; place-items: center; flex: none; color: var(--gold); }
.dtask-title { font-weight: 500; }
.dtask-title.done { text-decoration: line-through; opacity: .6; }
.ring-check { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid rgba(243,239,230,.6); background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--forest); flex: none; transition: background var(--t), border-color var(--t); }
.ring-check.on { background: var(--gold); border-color: var(--gold); }
.ring-check .icon { width: 14px; height: 14px; stroke-width: 2.6; opacity: 0; }
.ring-check.on .icon { opacity: 1; }
.dark-card input { background: rgba(243,239,230,.08); border-color: rgba(243,239,230,.18); color: var(--ivory); height: 40px; border-radius: 999px; }
.dark-card input::placeholder { color: #A9B3AB; }
.bars { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; height: 170px; padding-top: 34px; position: relative; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; position: relative; }
.bar-pill { width: 12px; border-radius: 999px; background: var(--series-1); opacity: .55; transform-origin: bottom; animation: rise-bar .9s var(--ease) both; }
.bar-pill.max { opacity: 1; background: var(--forest); }
[data-theme="dark"] .bar-pill.max { background: var(--gold); }
@keyframes rise-bar { from { transform: scaleY(0); } }
.bar-x { font-size: 11px; color: var(--ink-3); }
.bar-tag { position: absolute; top: -30px; background: var(--forest); color: var(--ivory); font-size: 11px; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.donut-wrap { display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-sm); flex: 1; min-width: 140px; }
.donut-legend a { display: flex; align-items: center; gap: 8px; color: inherit; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { display: flex; flex-direction: column; gap: 6px; min-height: 150px; }
.day-head { text-align: center; padding: 6px 0; border-radius: 14px; font-size: 12px; color: var(--ink-3); }
.day-head b { display: block; font-size: 16px; color: var(--ink); }
.day.today .day-head { background: var(--forest); color: #C9D2CA; }
.day.today .day-head b { color: var(--ivory); }
.day-ev { font-size: 11.5px; border-radius: 10px; padding: 6px 8px; background: var(--sage); color: var(--forest); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.day-ev.high { background: var(--accent-soft); color: var(--accent-ink); }
.day-ev.done { opacity: .5; text-decoration: line-through; }
[data-theme="dark"] .day-ev { background: #22302A; color: #CFE0D4; }
.kpi { padding: var(--s6); }
@media (max-width: 1180px) { .b-3, .b-4, .b-5 { grid-column: span 6; } .b-7, .b-8, .b-9 { grid-column: span 12; } }
@media (max-width: 760px) {
  .bento > * { grid-column: span 12 !important; }
  .stat-num, .big-num { font-size: 32px; }
  .week { grid-template-columns: repeat(7, 120px); overflow-x: auto; }
  .me-card { min-height: 220px; }
  .hero-head { align-items: flex-start; }
}
