:root {
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Readex Pro', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --radius: 18px; --radius-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar: 268px;
}
[data-theme='dark'] {
  --bg: #060b18; --bg2: #0a1226; --surface: #0e1830; --surface2: #13203d; --glass: rgba(14, 24, 48, .74);
  --line: rgba(148, 163, 184, .13); --line2: rgba(148, 163, 184, .22);
  --text: #e8edf7; --muted: #8d99b5; --faint: #5d6886;
  --accent: #dcb468; --accent-ink: #1d1406; --accent-soft: rgba(220, 180, 104, .14);
  --gold: #f0c674; --gold-soft: rgba(240, 198, 116, .14);
  --navy: #6f9bff; --teal: #2dd4bf; --teal-soft: rgba(45, 212, 191, .13);
  --danger: #fb7185; --danger-soft: rgba(251, 113, 133, .13);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .13);
  --info: #60a5fa; --info-soft: rgba(96, 165, 250, .13);
  --violet: #a78bfa; --violet-soft: rgba(167, 139, 250, .14);
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, .7);
  --pattern-op: .05;
  color-scheme: dark;
}
[data-theme='light'] {
  --bg: #f5f2eb; --bg2: #ece7dc; --surface: #ffffff; --surface2: #f8f6f1; --glass: rgba(255, 255, 255, .78);
  --line: #e6e1d4; --line2: #d9d3c3;
  --text: #121829; --muted: #5d6781; --faint: #98a0b3;
  --accent: #9a6f1f; --accent-ink: #ffffff; --accent-soft: rgba(154, 111, 31, .1);
  --gold: #a87414; --gold-soft: rgba(168, 116, 20, .1);
  --navy: #1b3a7a; --teal: #0f766e; --teal-soft: rgba(15, 118, 110, .09);
  --danger: #e11d48; --danger-soft: rgba(225, 29, 72, .08);
  --warn: #c2410c; --warn-soft: rgba(194, 65, 12, .08);
  --info: #2563eb; --info-soft: rgba(37, 99, 235, .08);
  --violet: #7c3aed; --violet-soft: rgba(124, 58, 237, .08);
  --shadow: 0 18px 40px -22px rgba(30, 41, 59, .35);
  --pattern-op: .07;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; transition: background .35s var(--ease), color .35s var(--ease);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
::selection { background: var(--accent); color: var(--accent-ink); }
.hidden { display: none !important; }

/* ---------- geometric backdrop ---------- */
.backdrop { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.backdrop::before {
  content: ''; position: absolute; inset: -50%; opacity: var(--pattern-op);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%2394a3b8' stroke-width='1'%3E%3Cpath d='M40 10 L48 32 L70 40 L48 48 L40 70 L32 48 L10 40 L32 32 Z'/%3E%3Crect x='25' y='25' width='30' height='30' transform='rotate(45 40 40)'/%3E%3C/g%3E%3C/svg%3E");
  animation: drift 120s linear infinite;
}
.backdrop .orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; }
.backdrop .orb.a { width: 520px; height: 520px; background: radial-gradient(circle, var(--accent-soft), transparent 70%); top: -160px; inset-inline-end: -120px; }
.backdrop .orb.b { width: 460px; height: 460px; background: radial-gradient(circle, var(--gold-soft), transparent 70%); bottom: -180px; inset-inline-start: 10%; }
@keyframes drift { to { transform: translate(80px, 80px); } }

/* ---------- login ---------- */
.login { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { position: relative; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.login-hero h1 { font-size: clamp(34px, 4.4vw, 60px); line-height: 1.12; font-weight: 700; margin-top: 18px; }
.login-hero h1 .grad { background: linear-gradient(100deg, var(--accent), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hero p { color: var(--muted); max-width: 440px; font-size: 16px; margin-top: 18px; }
.hero-star { position: absolute; width: 520px; height: 520px; inset-inline-end: -140px; bottom: -120px; opacity: .9; animation: spin 60s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hero-chips { display: flex; gap: 10px; flex-wrap: wrap; position: relative; }
.hero-chips span { padding: 8px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); font-size: 13px; color: var(--muted); backdrop-filter: blur(10px); }
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-card {
  width: min(420px, 100%); background: var(--glass); border: 1px solid var(--line); border-radius: 26px; padding: 36px;
  backdrop-filter: blur(24px); box-shadow: var(--shadow); animation: rise .7s var(--ease) both;
}
.login-card h2 { font-size: 26px; }
.login-card .sub { color: var(--muted); margin: 6px 0 26px; }
.login-tools { position: absolute; top: 20px; inset-inline-end: 20px; display: flex; gap: 8px; z-index: 3; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; flex: none; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.1; }
.brand-sub { font-size: 12px; color: var(--muted); }

/* ---------- shell ---------- */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px;
  background: var(--glass); border-inline-end: 1px solid var(--line); backdrop-filter: blur(20px); z-index: 20;
}
.nav-sec { font-size: 11.5px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 0 12px; margin: 10px 0 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--muted); font-weight: 500;
  transition: all .2s var(--ease); position: relative; margin-bottom: 2px;
}
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: var(--surface2); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.nav a.on::before { content: ''; position: absolute; inset-inline-start: -16px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav .badge { margin-inline-start: auto; background: var(--gold-soft); color: var(--gold); font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.side-foot { margin-top: auto; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--line); }
.me .who { flex: 1; min-width: 0; }
.me .who b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who small { color: var(--muted); font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 12px; padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 20px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.search { position: relative; width: min(320px, 40vw); }
.search input { width: 100%; padding: 10px 40px 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: none; transition: border .2s; }
[dir='rtl'] .search input { padding: 10px 14px 10px 40px; }
.search input:focus { border-color: var(--accent); }
.search svg { position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--faint); }
.search-pop { position: absolute; top: calc(100% + 6px); inset-inline: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; max-height: 340px; overflow: auto; }
.search-pop button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 8px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: start; }
.search-pop button:hover { background: var(--surface2); }
.content { padding: 26px 28px 60px; animation: fade .4s var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.icon-btn.menu-btn { display: none; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 12px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; transition: transform .15s var(--ease), filter .2s, background .2s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--line2); background: var(--surface2); filter: none; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.soft-danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; padding: 13px; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; color: var(--muted); transition: all .2s var(--ease); flex: none;
}
.icon-btn:hover { color: var(--text); border-color: var(--line2); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.lang-btn { width: auto; padding: 0 12px; font-weight: 700; font-size: 13px; font-family: var(--display); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field label .req { color: var(--danger); }
.field small { color: var(--faint); font-size: 12px; }
.input, .field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); outline: none;
  transition: border .2s, box-shadow .2s;
}
.field textarea { min-height: 84px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
select.input, .field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d99b5' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
[dir='rtl'] select.input, [dir='rtl'] .field select { background-position: left 12px center; padding-right: 13px; padding-left: 34px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line2); border-radius: 99px; cursor: pointer; transition: .25s; }
.switch span::after { content: ''; position: absolute; width: 18px; height: 18px; top: 3px; inset-inline-start: 3px; background: #fff; border-radius: 50%; transition: .25s var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { inset-inline-start: 21px; }
.seg { display: inline-flex; background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { text-transform: capitalize; border: 0; background: none; padding: 6px 12px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13px; transition: .2s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
[data-theme='dark'] .seg button.on { background: var(--accent-soft); color: var(--accent); }

/* ---------- cards ---------- */
.card { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; backdrop-filter: blur(14px); }
.card-h { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-h h3 { font-size: 16px; font-weight: 600; }
.card-h .sub { color: var(--muted); font-size: 12.5px; }
.card-h .spacer { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.kpi { position: relative; overflow: hidden; padding: 18px 18px 16px; animation: rise .6s var(--ease) both; }
.kpi .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px; }
.kpi .ic svg { width: 20px; height: 20px; }
.kpi .v { font-family: var(--display); font-size: 28px; font-weight: 700; line-height: 1; }
.kpi .l { color: var(--muted); font-size: 13px; margin-top: 6px; }
.kpi::after { content: ''; position: absolute; width: 120px; height: 120px; border-radius: 50%; inset-inline-end: -40px; top: -40px; background: currentColor; opacity: .05; }
.tone-accent { color: var(--accent); } .tone-accent .ic { background: var(--accent-soft); }
.tone-gold { color: var(--gold); } .tone-gold .ic { background: var(--gold-soft); }
.tone-info { color: var(--info); } .tone-info .ic { background: var(--info-soft); }
.tone-violet { color: var(--violet); } .tone-violet .ic { background: var(--violet-soft); }
.tone-danger { color: var(--danger); } .tone-danger .ic { background: var(--danger-soft); }
.kpi .v, .kpi .l { color: var(--text); } .kpi .l { color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: 1fr 340px; gap: 18px; }
.dash-side { display: flex; flex-direction: column; gap: 18px; }

/* 3D chart */
.chart-card { padding: 0; overflow: hidden; }
.chart-card .card-h { padding: 18px 20px 0; }
.chart-wrap { position: relative; height: 440px; cursor: grab; touch-action: none; }
.chart-wrap:active { cursor: grabbing; }
.chart-wrap canvas { display: block; }
.chart-labels { position: absolute; inset: 0; pointer-events: none; }
.c3-val { font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--text); background: var(--glass); border: 1px solid var(--line); padding: 2px 8px; border-radius: 8px; backdrop-filter: blur(6px); white-space: nowrap; }
.c3-lbl { font-size: 11.5px; color: var(--muted); white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line2); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); font-size: 13px; min-width: 140px; transform: translate(-50%, -115%); transition: opacity .15s; z-index: 3; }
.chart-tip b { display: block; font-family: var(--display); font-size: 18px; }
.chart-tip .sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-inline-end: 6px; }
.chart-foot { display: flex; align-items: center; gap: 12px; padding: 12px 20px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); flex: 1; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-fallback { display: flex; align-items: flex-end; gap: 10px; height: 100%; padding: 30px; }
.chart-fallback div { flex: 1; border-radius: 8px 8px 0 0; min-height: 4px; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .meta { flex: 1; min-width: 0; }
.list-item .meta b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta small { color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.empty { text-align: center; color: var(--faint); padding: 34px 10px; }
.empty svg { width: 42px; height: 42px; opacity: .5; margin-bottom: 8px; }

/* avatar & chips */
.av { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; font-family: var(--display); }
.av.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.c-accent { background: var(--teal-soft); color: var(--teal); }
.chip.c-gold { background: var(--gold-soft); color: var(--gold); }
.chip.c-info { background: var(--info-soft); color: var(--info); }
.chip.c-danger { background: var(--danger-soft); color: var(--danger); }
.chip.c-violet { background: var(--violet-soft); color: var(--violet); }
.chip.c-muted { background: var(--surface2); color: var(--muted); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 7px; background: var(--surface2); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* toolbar & table */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input { width: auto; min-width: 160px; padding: 9px 12px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar .spacer { flex: 1; }
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: start; font-weight: 600; font-size: 12px; color: var(--muted); padding: 12px 14px; background: var(--surface2); border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
.t th.nosort { cursor: default; }
.t th .ar { opacity: .5; font-size: 10px; margin-inline-start: 4px; }
.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .15s; }
.t tbody tr:hover { background: var(--accent-soft); }
.t tbody tr.sel { background: var(--gold-soft); }
.t .person { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.t .person b { display: block; font-weight: 600; }
.t .person small { color: var(--muted); font-size: 12px; }
.t .acts { display: flex; gap: 6px; justify-content: flex-end; }
.t td.chk, .t th.chk { width: 40px; }
.pager { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pager .spacer { flex: 1; }
.bulkbar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 12px; border-radius: 14px; background: var(--gold-soft); color: var(--gold); font-weight: 600; animation: rise .3s var(--ease); }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 30; animation: rise .2s var(--ease); max-height: 360px; overflow: auto; }
.dropdown-menu button, .dropdown-menu label { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 9px; cursor: pointer; text-align: start; font-size: 13.5px; }
.dropdown-menu button:hover, .dropdown-menu label:hover { background: var(--surface2); }
.dropdown-menu svg { width: 16px; height: 16px; color: var(--muted); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }

/* modal & drawer */
.overlay { position: fixed; inset: 0; background: rgba(5, 8, 18, .55); backdrop-filter: blur(4px); z-index: 50; display: grid; place-items: center; padding: 20px; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: min(640px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); animation: pop .3s var(--ease); }
.modal.wide { width: min(860px, 100%); }
.modal.sm { width: min(420px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-h h3 { font-size: 17px; flex: 1; }
.modal-b { padding: 20px 22px; overflow: auto; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line); }
.form-sec { font-family: var(--display); font-size: 13px; font-weight: 600; color: var(--accent); margin: 4px 0 12px; display: flex; align-items: center; gap: 8px; }
.form-sec::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.drawer-ov { place-items: stretch; justify-items: end; padding: 0; }
.drawer { width: min(460px, 100%); height: 100%; background: var(--surface); border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; animation: slideIn .35s var(--ease); }
[dir='rtl'] .drawer-ov { justify-items: start; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
[dir='rtl'] .drawer { animation-name: slideInR; }
@keyframes slideInR { from { transform: translateX(-40px); opacity: 0; } }
.profile-head { padding: 26px 22px; display: flex; gap: 16px; align-items: center; background: linear-gradient(135deg, var(--accent-soft), var(--gold-soft)); border-bottom: 1px solid var(--line); }
.profile-head h3 { font-size: 20px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kv div { background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.kv small { display: block; color: var(--faint); font-size: 11.5px; }
.kv b { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }

/* toast */
.toasts { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
[dir='rtl'] .toasts { transform: translateX(50%); }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 500; box-shadow: var(--shadow); animation: rise .3s var(--ease); max-width: 90vw; }
.toast.err { background: var(--danger); color: #fff; }
.toast svg { width: 18px; height: 18px; flex: none; }

/* settings */
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.dropzone { border: 2px dashed var(--line2); border-radius: 16px; padding: 30px 18px; text-align: center; cursor: pointer; transition: .2s; color: var(--muted); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dropzone svg { width: 36px; height: 36px; color: var(--accent); margin-bottom: 8px; }
.sync-state { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; margin-bottom: 14px; }
.sync-state.on { background: var(--accent-soft); }
.sync-state.off { background: var(--warn-soft); }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 2s infinite; flex: none; }
.sync-state.off .pulse { background: var(--warn); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px transparent; } }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.weekdays { display: flex; gap: 6px; flex-wrap: wrap; }
.weekdays label { padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13px; }
.weekdays input { display: none; }
.weekdays label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.field-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface2); margin-bottom: 8px; }
.field-card .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.field-card .ic svg { width: 18px; height: 18px; }
.field-card .meta { flex: 1; min-width: 0; }
.field-card .meta small { color: var(--muted); }
.timeline .list-item .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.timeline .list-item .ic svg { width: 16px; height: 16px; }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; margin-bottom: 18px; background: var(--warn-soft); color: var(--warn); font-weight: 500; }
.banner svg { width: 20px; flex: none; }
.banner .spacer { flex: 1; }
.demo-ribbon { position: relative; z-index: 2; text-align: center; font-size: 12.5px; padding: 6px; background: linear-gradient(90deg, var(--accent), var(--gold)); color: #04131a; font-weight: 600; }
.map-table td { padding: 8px 10px; }
.map-table select { padding: 7px 10px; font-size: 13px; }
.preview-scroll { overflow: auto; max-height: 180px; border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; }
.preview-scroll table { font-size: 12px; }
.preview-scroll td, .preview-scroll th { padding: 6px 10px; white-space: nowrap; }
.spinner { width: 18px; height: 18px; border: 2.5px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.loading-screen { position: fixed; inset: 0; display: grid; place-items: center; z-index: 5; }
.loading-screen svg { width: 64px; animation: spin 3s linear infinite; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-side { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 960px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .set-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 32px 26px 0; min-height: auto; }
  .login-hero h1 { font-size: 34px; }
  .hero-star { width: 320px; height: 320px; top: -60px; bottom: auto; inset-inline-end: -110px; opacity: .55; }
  .hero-chips { margin-top: 20px; }
  .login-panel { padding: 24px 18px 40px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 282px; transform: translateX(-105%); transition: transform .35s var(--ease); box-shadow: var(--shadow); background: var(--surface); }
  [dir='rtl'] .sidebar { transform: translateX(105%); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 19; }
  .icon-btn.menu-btn { display: inline-grid; }
  .toolbar .grow { flex: 1 1 100%; }
  .toolbar select.input { flex: 1 1 40%; }
  .toolbar .seg { width: 100%; }
  .toolbar .seg button { flex: 1; }
  .topbar { padding: 12px 16px; gap: 8px; }
  .topbar h1 { font-size: 17px; }
  .search { display: none; }
  .content { padding: 18px 14px 80px; }
  .dash-side { grid-template-columns: 1fr; }
  .chart-wrap { height: 360px; }
  .grid2 { grid-template-columns: 1fr; }
  .toolbar .input { flex: 1; min-width: 0; }
  .hide-m { display: none !important; }
  /* table -> cards */
  .t.cards thead { display: none; }
  .t.cards, .t.cards tbody, .t.cards tr, .t.cards td { display: block; width: 100%; }
  .t.cards tr { padding: 12px 14px; border-bottom: 1px solid var(--line); position: relative; }
  .t.cards td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; }
  .t.cards td[data-l]::before { content: attr(data-l); color: var(--faint); font-size: 12px; }
  .t.cards td.chk { position: absolute; top: 14px; inset-inline-end: 12px; width: auto; }
  .t.cards td.main-cell { padding-bottom: 8px; }
  .t.cards td.main-cell::before { display: none; }
  .t.cards .acts { justify-content: flex-start; padding-top: 6px; }
  .modal { border-radius: 22px 22px 0 0; max-height: 92vh; align-self: end; }
  .overlay { padding: 0; place-items: end stretch; }
  .drawer-ov { place-items: stretch; }
  .drawer { width: 100%; }
  .modal-f { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) {
  .kpi .v { font-size: 23px; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kv { grid-template-columns: 1fr; }
  .lang-btn { padding: 0 9px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* ================= v2 additions ================= */
.logo-img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 6px 18px -8px rgba(0,0,0,.6); }
.logo-img.lg { width: 92px; height: 92px; }
.logo-img.xl { width: 150px; height: 150px; }
.brand-name { letter-spacing: .02em; }
.brand-name b { color: var(--accent); }
.login-hero .hero-logo { display: flex; align-items: center; gap: 18px; }
.login-card .co { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.login-card .co b { font-family: var(--display); }
.login-card .co small { display: block; color: var(--muted); font-size: 12px; }
.demo-accts { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.demo-accts small { color: var(--muted); display: block; margin-bottom: 8px; }
.demo-accts .btn-row button { font-size: 12px; }
.nav { overflow-y: auto; flex: 1; margin-inline: -6px; padding-inline: 6px; scrollbar-width: thin; }
.sidebar { gap: 16px; }
.nav a { padding: 8px 12px; }
.chip.c-custom { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.chip.c-teal { background: var(--teal-soft); color: var(--teal); }
/* bell */
.bell { position: relative; }
.bell .dotc { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.notif-panel { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: min(380px, 92vw); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); z-index: 40; animation: rise .2s var(--ease); }
.notif-panel .hd { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.notif-panel .hd b { flex: 1; font-family: var(--display); }
.notif { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; text-align: start; width: 100%; background: none; border-inline: 0; border-top: 0; }
.notif:hover { background: var(--surface2); }
.notif.unread { background: var(--accent-soft); }
.notif .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.notif .ic svg { width: 16px; height: 16px; }
.notif small { color: var(--muted); font-size: 11.5px; }
.notif.alert .ic { background: var(--warn-soft); color: var(--warn); }
/* welcome */
.welcome { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; padding: 18px 22px; background: linear-gradient(120deg, var(--accent-soft), transparent 60%), var(--glass); }
.welcome h2 { font-size: 22px; }
.welcome .dates { color: var(--muted); font-size: 13px; margin-top: 4px; }
.welcome .spacer { flex: 1; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
/* tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 18px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; }
.tabs button svg { width: 16px; height: 16px; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
/* permission matrix */
.perm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm-table th, .perm-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.perm-table th:first-child, .perm-table td:first-child { text-align: start; }
.perm-table td input { width: 17px; height: 17px; accent-color: var(--accent); }
.perm-table td.na { color: var(--faint); }
.role-card { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface2); margin-bottom: 8px; cursor: pointer; }
.role-card:hover { border-color: var(--accent); }
.role-card .meta { flex: 1; min-width: 0; }
.role-card small { color: var(--muted); }
.role-card input[type=radio], .field .role-card input[type=radio] { width: 18px; height: 18px; min-width: 18px; flex: 0 0 18px; padding: 0; margin: 0; border: 0; box-shadow: none; background: none; accent-color: var(--accent); }
.role-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
/* steps */
.steps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.steps .st { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; background: var(--surface2); border: 1px solid var(--line); color: var(--muted); }
.steps .st.done { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.steps .st.cur { background: var(--gold-soft); color: var(--gold); border-color: transparent; font-weight: 700; }
.steps .st.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.steps .arrow { color: var(--faint); }
[dir='rtl'] .steps .arrow { transform: scaleX(-1); display: inline-block; }
.req-card { padding: 16px 18px; margin-bottom: 12px; }
.req-card .top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.req-card .top .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.req-card .top .ic svg { width: 20px; height: 20px; }
.req-card .data { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); margin: 8px 0; }
.req-card .data b { color: var(--text); font-weight: 600; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.type-grid button { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 10px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface2); cursor: pointer; font-weight: 600; transition: .2s; }
.type-grid button:hover { border-color: var(--accent); transform: translateY(-2px); }
.type-grid button svg { width: 26px; height: 26px; color: var(--accent); }
/* builder rows */
.builder-row { display: grid; grid-template-columns: 1fr 1fr 130px auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.builder-row input, .builder-row select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); width: 100%; }
.step-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; }
.step-pill button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; display: grid; }
.step-pill svg { width: 14px; height: 14px; }
/* org chart */
.org-root { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 22px; text-align: center; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-inline-start: 30px; border-inline-start: 2px solid var(--line2); margin-inline-start: 22px; }
.tree li { position: relative; padding: 6px 0; }
.tree ul > li::before { content: ''; position: absolute; inset-inline-start: -30px; top: 34px; width: 26px; border-top: 2px solid var(--line2); }
.org-node { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); border-inline-start: 4px solid var(--c, var(--accent)); max-width: 560px; }
.org-node .meta { flex: 1; min-width: 0; }
.org-node .meta b { font-family: var(--display); font-size: 15px; }
.org-node .meta small { display: block; color: var(--muted); font-size: 12.5px; }
.org-node .count { font-family: var(--display); font-weight: 700; color: var(--c, var(--accent)); text-align: center; line-height: 1.1; }
.org-node .count small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.org-emps { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0 4px; max-width: 560px; }
.org-emps button { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface2); cursor: pointer; font-size: 12.5px; }
[dir='rtl'] .org-emps button { padding: 4px 4px 4px 10px; }
.org-emps .av { width: 24px; height: 24px; border-radius: 50%; font-size: 10px; }
/* sums */
.sumbar { display: flex; gap: 18px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface2); font-size: 13px; }
.sumbar b { font-family: var(--display); color: var(--accent); }
.calc-box { padding: 14px; border-radius: 14px; background: var(--accent-soft); margin-top: 6px; }
.calc-box .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13.5px; }
.calc-box .row.total { border-top: 1px dashed var(--accent); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 15px; }
.stars { display: inline-flex; gap: 2px; color: var(--gold); }
.stars svg { width: 14px; height: 14px; }
.days-left { font-weight: 700; }
.att-row { display: grid; grid-template-columns: 1fr 120px 100px 100px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.att-row select, .att-row input { padding: 6px 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface2); width: 100%; font-size: 13px; }
/* payslip / print */
.payslip { background: #fff; color: #111; border-radius: 14px; padding: 26px; font-size: 13.5px; }
.payslip .ph { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid #b8913e; padding-bottom: 14px; margin-bottom: 14px; }
.payslip table { width: 100%; border-collapse: collapse; }
.payslip td { padding: 7px 4px; border-bottom: 1px solid #eee; }
.payslip .net td { font-weight: 800; font-size: 16px; border-top: 2px solid #b8913e; color: #0e1830; }
@media print {
  body * { visibility: hidden !important; }
  .print-area, .print-area * { visibility: visible !important; }
  .print-area { position: fixed; inset: 0; padding: 20px; }
}
@media (max-width: 860px) {
  .builder-row { grid-template-columns: 1fr 1fr; }
  .att-row { grid-template-columns: 1fr 1fr; }
  .welcome { flex-wrap: wrap; padding: 16px; }
  .welcome .logo-img.lg { width: 60px; height: 60px; }
  .tree ul { padding-inline-start: 14px; margin-inline-start: 10px; }
  .tree ul > li::before { inset-inline-start: -14px; width: 12px; }
}
@media (max-width: 860px) {
  .notif-panel { position: fixed; top: 64px; inset-inline: 8px; width: auto; max-height: 75vh; }
}
.login-hero img.hero-star { opacity: .09 !important; width: 560px; height: 560px; bottom: -160px; }

/* ---------- Qiwa / GOSI ---------- */
.nit-hero { padding: 22px 22px 18px; margin-bottom: 18px; }
.nit-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.nit-l { color: var(--muted); font-size: 13px; }
.nit-v { font-family: var(--display); font-size: 44px; font-weight: 700; line-height: 1.1; }
.nit-bar { position: relative; height: 14px; border-radius: 99px; background: var(--surface2); margin: 22px 0 46px; }
.nit-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 99px; transition: width .6s var(--ease); }
.nit-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); opacity: .55; }
.nit-mark span { position: absolute; top: 24px; transform: translateX(50%); white-space: nowrap; font-size: 11px; color: var(--muted); text-align: center; line-height: 1.3; }
[dir='ltr'] .nit-mark span { transform: translateX(-50%); }
.nit-advice { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 14px; font-weight: 500; }
.nit-advice span { display: inline-flex; align-items: center; gap: 8px; }
.nit-advice svg { width: 18px; color: var(--accent); }
.nit-note { color: var(--faint); font-size: 12px; margin-top: 12px; }
.gov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.gov-sec { padding: 18px; margin-bottom: 18px; }
.gov-grid .gov-sec { margin-bottom: 0; }
.gov-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.gov-hd h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.gov-hd h3 svg { width: 18px; color: var(--accent); }
.mini-bar { display: inline-block; width: 70px; height: 6px; border-radius: 9px; background: var(--surface2); margin-inline-end: 8px; vertical-align: middle; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--accent); border-radius: 9px; }
@media (max-width: 900px) { .gov-grid { grid-template-columns: 1fr; } .nit-v { font-size: 36px; } }
@media (max-width: 600px) { .nit-mark span { font-size: 9.5px; } }
/* ---------- Letters ---------- */
.lt-grid { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 18px; align-items: start; margin-bottom: 18px; }
.lt-form { padding: 18px; }
.lt-lbl { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 8px; }
.lt-types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lt-types button { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); cursor: pointer; font: inherit; font-size: 13px; text-align: start; transition: .2s; }
.lt-types button svg { width: 17px; flex: none; color: var(--muted); }
.lt-types button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.lt-types button.on svg { color: var(--accent); }
.lt-types button:disabled { opacity: .4; cursor: not-allowed; }
.lt-emp { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--surface2); margin-bottom: 4px; }
.lt-emp.empty-emp { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 13px; }
.lt-emp.empty-emp svg { width: 20px; }
.lt-emp .kvs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.lt-emp .kvs small { display: block; color: var(--faint); font-size: 11px; }
.lt-emp .kvs b { font-size: 13px; font-weight: 600; word-break: break-word; }
.lt-warn { display: flex; gap: 6px; align-items: center; margin-top: 10px; color: var(--gold); font-size: 12px; }
.lt-warn svg { width: 15px; flex: none; }
.lt-actions { display: flex; gap: 8px; margin: 6px 0 8px; }
.lt-actions .btn { flex: 1; justify-content: center; }
.lt-preview { padding: 12px; position: sticky; top: 84px; background: #e9e4da; }
[data-theme='dark'] .lt-preview { background: #2a2620; }
.lt-scale { position: relative; overflow: hidden; }
.lt-scale iframe { width: 794px; height: 1123px; border: 0; background: #fff; transform-origin: top left; position: absolute; top: 0; left: 0; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
@media (max-width: 1000px) { .lt-grid { grid-template-columns: 1fr; } .lt-preview { position: static; } }
/* ---------- performance & hiring ---------- */
.chk-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.chk { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface2); cursor: pointer; font-size: 13px; }
.chk input { accent-color: var(--accent); }
.pbar { height: 8px; border-radius: 9px; background: var(--surface2); overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: 9px; transition: width .5s var(--ease); }
.cy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.cy-card { padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 10px; transition: .2s; }
.cy-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.cy-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.cy-top b { font-size: 15px; }
.cy-meta { color: var(--muted); font-size: 13px; }
.cy-foot { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); align-items: center; }
.cy-foot svg { width: 14px; vertical-align: -2px; }
.cy-deps { display: flex; flex-wrap: wrap; gap: 4px; }
.cy-actions { display: flex; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.sv-list { display: flex; flex-direction: column; gap: 8px; }
.sv-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface2); }
.sv-item small { display: flex; align-items: center; gap: 4px; color: var(--faint); font-size: 12px; margin-top: 2px; }
.sv-item small svg { width: 12px; }
.sv-q { display: grid; grid-template-columns: 26px 150px 1fr 1fr auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.sv-q .sv-opts { grid-column: 3 / 5; }
.sv-n { color: var(--faint); text-align: center; }
.sv-ask { margin-bottom: 18px; }
.sv-qt { font-weight: 600; margin-bottom: 10px; }
.sv-scale { display: flex; flex-wrap: wrap; gap: 6px; }
.sv-scale button { flex: 1; min-width: 44px; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); cursor: pointer; font: inherit; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: .15s; }
.sv-scale button small { font-weight: 400; font-size: 10.5px; color: var(--faint); }
.sv-scale button.on { background: var(--accent); border-color: var(--accent); color: #1a1408; }
.sv-scale button.on small { color: inherit; }
.sv-scale.nps button { min-width: 30px; padding: 9px 2px; }
.sv-scale.ch button, .sv-scale.yn button { flex: 0 1 auto; padding: 9px 18px; }
.sv-scale.small button { flex: 0 1 auto; padding: 6px 10px; font-size: 12.5px; }
.sv-nps-l { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 4px; }
.sv-res { padding: 16px; margin-bottom: 12px; }
.sv-avg { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.sv-avg b { font-family: var(--display); font-size: 30px; }
.sv-avg span { color: var(--muted); }
.sv-avg small { color: var(--faint); margin-inline-start: auto; }
.dist { display: grid; grid-template-columns: 130px 1fr 34px 40px; gap: 8px; align-items: center; font-size: 12.5px; margin-bottom: 6px; }
.dist small { color: var(--faint); }
.sv-texts { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.sv-texts div { background: var(--surface2); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.kanban { display: grid; grid-template-columns: repeat(6, minmax(168px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kb-col { background: var(--surface2); border: 1px solid var(--line); border-radius: 16px; padding: 10px; min-height: 320px; transition: .15s; }
.kb-col.over { border-color: var(--accent); background: var(--accent-soft); }
.kb-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding: 0 4px; color: var(--muted); font-size: 13px; }
.kb-body { display: flex; flex-direction: column; gap: 8px; }
.kb-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; transition: .15s; }
.kb-card:hover { border-color: var(--accent); }
.kb-card.drag { opacity: .4; }
.kb-name { display: flex; gap: 8px; align-items: center; }
.kb-name .av { width: 30px; height: 30px; font-size: 11px; }
.kb-name b { display: block; font-size: 13px; }
.kb-name small { color: var(--faint); font-size: 11.5px; }
.kb-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 8px; font-size: 11px; color: var(--muted); align-items: center; }
.kb-meta svg { width: 12px; vertical-align: -2px; }
.kb-meta .stars span { font-size: 11px; }
.kb-empty { color: var(--faint); text-align: center; padding: 20px 0; }
.stars span { color: var(--line); } .stars span.on { color: var(--gold); }
.iv-row { display: grid; grid-template-columns: 140px 1fr 140px 1.4fr auto; gap: 6px; margin-bottom: 6px; }
.cand-hd { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; }
.btn.ghost.danger { color: var(--danger); background: transparent; border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
@media (max-width: 760px) {
  .sv-q { grid-template-columns: 26px 1fr auto; } .sv-q select { grid-column: 2 / 4; } .sv-q input[data-k^=text] { grid-column: 1 / -1; } .sv-q .sv-opts { grid-column: 1 / -1; }
  .iv-row { grid-template-columns: 1fr 1fr; } .dist { grid-template-columns: 90px 1fr 30px 36px; }
}
/* ---------- GPS check-in ---------- */
.ci-wrap { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.ci-card { padding: 24px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ci-card > svg { width: 40px; color: var(--muted); }
.ci-date { color: var(--muted); font-size: 14px; }
.ci-clock { font-family: var(--display); font-size: 54px; font-weight: 700; line-height: 1.05; letter-spacing: 1px; direction: ltr; }
.ci-shift { color: var(--faint); font-size: 12.5px; }
.ci-live { min-height: 62px; display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 10px 0 6px; }
.ci-live small { color: var(--faint); font-size: 12px; }
.ci-state { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; font-weight: 600; font-size: 13.5px; }
.ci-state svg { width: 17px; }
.ci-state.good { background: var(--accent-soft); color: var(--teal, var(--accent)); }
.ci-state.bad { background: var(--danger-soft, rgba(251,113,133,.14)); color: var(--danger); }
.ci-state.warn { background: var(--warn-soft); color: var(--warn); }
.ci-state.wait { color: var(--muted); }
.ci-btn { width: 190px; height: 190px; border-radius: 50%; border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font: inherit; font-family: var(--display); font-size: 18px; font-weight: 700; color: #1a1408; transition: .2s; margin: 6px 0; }
.ci-btn svg { width: 54px; height: 54px; }
.ci-btn.in { background: radial-gradient(circle at 30% 30%, #f0d08a, var(--accent)); box-shadow: 0 0 0 10px var(--accent-soft), 0 14px 40px rgba(220,180,104,.35); }
.ci-btn.out { background: radial-gradient(circle at 30% 30%, #9fb7ff, #6f9bff); color: #0b1430; box-shadow: 0 0 0 10px rgba(111,155,255,.15), 0 14px 40px rgba(111,155,255,.3); }
.ci-btn:active:not(:disabled) { transform: scale(.96); }
.ci-btn:disabled { filter: grayscale(1); opacity: .45; cursor: not-allowed; box-shadow: none; }
.ci-today { padding: 16px 18px; }
.ci-list { display: flex; flex-direction: column; gap: 8px; }
.ci-list > div { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.ci-list small { color: var(--faint); margin-inline-start: auto; font-size: 12px; }
.ci-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.ci-dot.out { background: #6f9bff; }
.ci-note { display: flex; gap: 8px; align-items: flex-start; color: var(--faint); font-size: 12px; padding: 0 6px; }
.ci-note svg { width: 14px; flex: none; margin-top: 2px; }
.gps-site { display: grid; grid-template-columns: 1.3fr 1fr 1fr 110px auto auto auto; gap: 6px; margin-bottom: 8px; align-items: center; }
.gps-r { display: flex; align-items: center; gap: 4px; } .gps-r span { color: var(--faint); font-size: 12px; }
@media (max-width: 760px) { .gps-site { grid-template-columns: 1fr 1fr; } .gps-site input[data-k=name] { grid-column: 1 / -1; } }
.login.force { justify-content: center; }
.fc-ic { width: 54px; height: 54px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 4px 0 10px; }
.fc-ic svg { width: 26px; }
.fc-rules { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; padding-inline-start: 18px; }
/* ---------- accounting ---------- */
.acc-bars { display: flex; align-items: flex-end; gap: 12px; height: 190px; padding-top: 10px; }
.acc-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.acc-bar .b { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.acc-bar .b i { width: 40%; max-width: 26px; border-radius: 6px 6px 2px 2px; min-height: 2px; transition: height .6s var(--ease); }
.acc-bar small { color: var(--faint); font-size: 11px; }
.acc-leg { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.acc-leg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.acc-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.jv-lines td { padding: 4px; vertical-align: middle; }
.jv-lines .input { padding: 7px 9px; }
tr.jv-tot td { font-weight: 700; background: var(--surface2); }
tr.grp td { font-weight: 600; background: color-mix(in srgb, var(--surface2) 60%, transparent); }
.inv-tot { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin: 12px 0; }
.inv-tot div { display: flex; gap: 18px; min-width: 260px; justify-content: space-between; font-size: 13.5px; }
.inv-tot div.g { font-size: 16px; border-top: 1px solid var(--line); padding-top: 6px; }
.row-inline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-inline .input { flex: 1; }
.acc-big { font-family: var(--display); font-size: 24px; font-weight: 700; }
.cy-card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.acc-net.pos td { color: var(--teal); } .acc-net.neg td { color: var(--danger); }
.acc-ok, .acc-bad { margin-top: 10px; font-weight: 600; font-size: 13px; } .acc-ok { color: var(--teal); } .acc-bad { color: var(--danger); }
.coa-ic { width: 14px; height: 14px; color: var(--faint); vertical-align: -2px; margin-inline-end: 4px; }
td.num, th.n { text-align: end; }

/* idle lock screen — sits over the page so unsaved work underneath is kept */
.lock-screen { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); animation: fadeIn .2s; }
.lock-screen .co { display: flex; align-items: center; gap: 10px; }
.lock-screen .co small { display: block; color: var(--muted); }
/* accounting phase 2 */
.badge-n { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; margin-inline-start: 4px; }
.ex-img { max-width: 100%; max-height: 320px; border-radius: 10px; border: 1px solid var(--border); display: block; margin: 6px 0; object-fit: contain; background: var(--surface2); }
.ex-hist { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); border-inline-start: 2px solid var(--border); padding-inline-start: 10px; margin-bottom: 12px; }
.ex-post { padding: 12px; margin-top: 10px; background: var(--surface2); box-shadow: none; }
.fa-runs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin: 4px 0 12px; }
.fa-runs a { text-decoration: none; }
.bd-grid td, .bd-grid th { padding: 4px 5px; }
.bd-grid .bd-name { min-width: 190px; font-size: 12.5px; white-space: nowrap; position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; }
.bd-in { width: 82px; padding: 5px 6px; font-size: 12.5px; text-align: end; }
.bd-tot { font-weight: 700; white-space: nowrap; }
.bd-pct { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.bd-pct .pbar { flex: 1; }
.einv-qr { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 14px; }
.einv-qr .qr { width: 120px; height: 120px; flex: 0 0 120px; display: grid; place-items: center; background: #fff; border-radius: 10px; }
.einv-qr .qr svg { width: 100%; height: 100%; }
.vr-form .vr-in { width: 120px; padding: 6px 8px; text-align: end; }
.vr-form td:first-child { width: 36px; color: var(--muted); }
/* ZATCA e-invoicing page */
.zhead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; border-inline-start: 4px solid var(--faint); }
.zhead.test { border-inline-start-color: var(--gold); } .zhead.live { border-inline-start-color: var(--teal); }
.zhead-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: 0 0 46px; }
.zcounts { display: flex; gap: 18px; } .zcounts span { display: grid; text-align: center; font-size: 12px; color: var(--muted); } .zcounts b { font-size: 20px; color: var(--text); }
.zsteps { display: grid; gap: 12px; }
.zst { padding: 16px 18px; } .zst.done { opacity: .92; }
.zst-h { display: flex; align-items: center; gap: 10px; } .zst-h h3 { margin: 0; font-size: 15.5px; flex: 1; }
.zst-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--accent); color: #fff; flex: 0 0 30px; }
.zst.done .zst-n { background: var(--teal); } .zst-n svg { width: 16px; height: 16px; }
.zst-b { margin-top: 12px; padding-inline-start: 40px; }
.zp { color: var(--muted); font-size: 13px; margin: 0 0 10px; line-height: 1.7; }
.zsub { margin: 14px 0 8px; font-size: 14px; }
.zchks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.zchk { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.zchk.ok { background: color-mix(in srgb, var(--teal) 14%, transparent); color: var(--teal); }
.zol { margin: 0 0 12px; padding-inline-start: 20px; font-size: 13.5px; line-height: 1.9; }
.zotp .input { max-width: 200px; letter-spacing: 3px; text-align: center; font-size: 16px; }
.zdemo { margin-top: 14px; font-size: 13px; } .zdemo summary { cursor: pointer; color: var(--accent); }
.zres { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; } .zres li { padding: 8px 10px; border-radius: 10px; background: var(--surface2); font-size: 13px; }
.zres li.ok { color: var(--teal); } .zres li.bad { color: var(--danger); } .zres small { color: var(--muted); }
@media (max-width: 760px) { .zst-b { padding-inline-start: 0; } .zst .grid2 { grid-template-columns: 1fr !important; } .zcounts { width: 100%; justify-content: space-around; } }
/* dd/mm/yyyy date fields (datefield.js) */
.df-wrap { position: relative; display: inline-flex; align-items: center; min-width: 150px; vertical-align: middle; }
.field .df-wrap, .grid2 .df-wrap { display: flex; width: 100%; }
.df-wrap .df-text { width: 100%; padding-inline-end: 38px; text-align: left; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
[dir='rtl'] .df-wrap .df-text { text-align: right; }
.df-wrap .df-text.df-bad { border-color: var(--danger) !important; }
.df-btn { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px; }
.df-btn:hover { color: var(--accent); background: var(--accent-soft); }
.df-wrap .df-native { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; pointer-events: none; padding: 0 !important; border: 0 !important; }
.toolbar .df-wrap, .row-inline .df-wrap { flex: 0 0 auto; width: 165px; min-width: 0; }
/* clickable dashboard cards */
a.kpi-link { display: block; color: inherit; text-decoration: none; cursor: pointer; transition: box-shadow .2s, border-color .2s; }
a.kpi-link:hover { border-color: var(--accent); box-shadow: 0 10px 28px -14px var(--accent); }
a.kpi-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* KPI evaluations */
.kv-lines .input { padding: 7px 9px; }
.kv-lines td.ach { font-weight: 700; white-space: nowrap; }
.kv-hist { margin-top: 10px; font-size: 13px; } .kv-hist summary { cursor: pointer; color: var(--accent); }
.kv-hist ul { margin: 8px 0 0; padding-inline-start: 18px; line-height: 1.8; } .kv-hist small { color: var(--muted); }
.kv-lines select.input { min-width: 128px; }
.kv-lines td:first-child .input { min-width: 200px; }
.modal.wide:has(.kv-lines) { width: min(1100px, 100%); }
