/* ============================================================================
   FolksERP — design system (Claude warm aesthetic)
   Light surfaces, warm-orange clay accent, no dark sidebar.
   Theme variants via [data-theme]; nav variants via [data-nav]; KPI via [data-kpi].
   Ported from the client-approved Claude.ai design. Loaded LAST so it wins over
   Bootstrap collisions (.btn / .card / .badge / .content).
   ============================================================================ */

/* ---- self-hosted fonts (variable woff2 from the client-approved bundle) -----
   The Google Fonts CDN is unreachable in this environment, so Hanken Grotesk /
   Newsreader were falling back to system fonts. Self-host so they always render
   exactly like the approved design. */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/HankenGrotesk.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/Newsreader.woff2') format('woff2');
}

/* ---- tokens --------------------------------------------------------------- */
:root {
  --accent:        #C96442;
  --accent-2:      #D97757;
  --accent-hover:  #B5502F;
  --accent-soft:   #F4E6DE;
  --accent-softer: #FAF1EC;
  --accent-ring:   rgba(201,100,66,.22);

  --bg:        #F4F2EC;
  --surface:   #FFFFFF;
  --surface-2: #FAF9F5;
  --sidebar:   #EEEBE2;
  --sidebar-card: #FFFFFF;

  --text:      #221F1A;
  --text-2:    #4A463E;
  --muted:     #76716A;
  --faint:     #A39E94;

  --border:    #E6E1D6;
  --border-2:  #D7D1C4;

  --ok:    #4F7A4A;
  --ok-bg: #E7EFE4;
  --warn:  #B07A22;
  --warn-bg:#F4E9D4;
  --danger:#BB4F38;
  --danger-bg:#F5E1DB;
  --info:  #4A6FA0;
  --info-bg:#E2E9F2;

  --radius:    14px;
  --radius-sm: 10px;
  --radius-xs: 7px;

  --shadow-sm: 0 1px 2px rgba(50,42,28,.05);
  --shadow:    0 4px 18px rgba(50,42,28,.07);
  --shadow-lg: 0 22px 54px rgba(50,42,28,.16);

  --font:  'Hanken Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;

  --sidebar-w: 260px;
  --topbar-h: 64px;
}

/* theme variants ----------------------------------------------------------- */
[data-theme="slate"] {
  --accent:#4F6B8A; --accent-2:#5E7DA0; --accent-hover:#3E566F; --accent-soft:#E2E8F0; --accent-softer:#EEF2F7; --accent-ring:rgba(79,107,138,.22);
  --bg:#F1F3F6; --sidebar:#E9ECF1; --info-bg:#E2E9F2;
}
[data-theme="forest"] {
  --accent:#3F7A57; --accent-2:#4E906A; --accent-hover:#326244; --accent-soft:#E0ECE3; --accent-softer:#EDF4EF; --accent-ring:rgba(63,122,87,.22);
  --bg:#F1F4EF; --sidebar:#E8EEE6;
}
[data-theme="indigo"] {
  --accent:#5B57C2; --accent-2:#6F6BD0; --accent-hover:#4A46A6; --accent-soft:#E6E5F4; --accent-softer:#F0EFF8; --accent-ring:rgba(91,87,194,.22);
  --bg:#F2F1F7; --sidebar:#EAE9F2;
}

/* ---- base ----------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  /* !important to beat legacy NewLayoutStyle.css `body { font-family: Cairo Light !important }` */
  font-family: var(--font) !important;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
h1,h2,h3,h4 { margin: 0; font-weight: 600; }
::selection { background: var(--accent-soft); }
input, select, textarea, button { font-family: inherit; }
.serif { font-family: var(--serif); }

/* scrollbars */
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: rgba(80,66,40,.18); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(80,66,40,.32); background-clip: padding-box; }

/* ============================================================================
   APP SHELL
   ============================================================================ */
.app { display: flex; min-height: 100vh; }

/* ---- sidebar -------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column;
  transition: width .22s ease, flex-basis .22s ease;
}
.sidebar .brand {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 11px;
  padding: 0 20px; border-bottom: 1px solid var(--border);
}
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; display: grid; place-items: center; font-weight: 700;
  font-family: var(--serif); font-size: 18px; box-shadow: var(--shadow-sm);
}
.brand .word { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand .word b { color: var(--accent); font-weight: 700; }
.brand .word small { display: block; font-size: 10.5px; font-weight: 500; color: var(--faint); letter-spacing: .14em; text-transform: uppercase; margin-top: -2px; }

.nav { flex: 1; overflow-y: auto; padding: 12px 12px 28px; }
.nav-group { margin-bottom: 3px; }
.nav-head {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border: none; background: transparent; cursor: pointer;
  border-radius: var(--radius-sm); color: var(--text-2); font-size: 13.5px; font-weight: 600;
  text-align: left; transition: background .15s, color .15s;
}
.nav-head i.lead { font-size: 19px; width: 22px; text-align: center; color: var(--muted); transition: color .15s; }
.nav-head .label { flex: 1; color: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; letter-spacing: inherit; padding: 0; text-align: left; white-space: nowrap; border-radius: 0; }
.nav-head .chev { font-size: 12px; color: var(--faint); transition: transform .2s; }
.nav-head:hover { background: var(--sidebar-card); color: var(--text); }
.nav-head:hover i.lead { color: var(--accent); }
.nav-group.open > .nav-head { color: var(--text); }
.nav-group.open > .nav-head i.lead { color: var(--accent); }
.nav-group.open > .nav-head .chev { transform: rotate(90deg); }

.nav-sub { list-style: none; margin: 2px 0 6px; padding: 2px 0 2px 0; display: grid; gap: 2px; }
.nav-sub li a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 45px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13px; position: relative;
  transition: background .14s, color .14s;
}
.nav-sub li a i { font-size: 15px; color: var(--faint); width: 17px; text-align: center; }
.nav-sub li a:hover { background: var(--sidebar-card); color: var(--text); }
.nav-sub li a.active { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.nav-sub li a.active i { color: #fff; }

/* solo group (single page, no submenu) */
.nav-head.solo.active { background: var(--accent); color: #fff; }
.nav-head.solo.active i.lead { color: #fff; }

/* NAV variant: flat (no card hovers, denser, left accent bar on active) */
[data-nav="flat"] .nav-sub li a.active { background: var(--accent-soft); color: var(--accent-hover); box-shadow: none; }
[data-nav="flat"] .nav-sub li a.active i { color: var(--accent); }
[data-nav="flat"] .nav-sub li a.active::before { content:""; position:absolute; left:18px; top:50%; transform:translateY(-50%); width:4px; height:18px; border-radius:3px; background: var(--accent); }
[data-nav="flat"] .nav-head:hover, [data-nav="flat"] .nav-sub li a:hover { background: rgba(201,100,66,.07); }
[data-nav="flat"] .nav-head.solo.active { background: var(--accent-soft); color: var(--accent-hover); }
[data-nav="flat"] .nav-head.solo.active i.lead { color: var(--accent); }

/* NAV variant: rail (icon-only collapsed; expands on hover) */
[data-nav="rail"] .sidebar { width: 74px; flex-basis: 74px; }
[data-nav="rail"] .sidebar:hover { width: var(--sidebar-w); flex-basis: var(--sidebar-w); box-shadow: var(--shadow-lg); z-index: 40; }
[data-nav="rail"] .sidebar:not(:hover) .brand .word,
[data-nav="rail"] .sidebar:not(:hover) .nav-head .label,
[data-nav="rail"] .sidebar:not(:hover) .nav-head .chev,
[data-nav="rail"] .sidebar:not(:hover) .nav-sub { display: none; }
[data-nav="rail"] .sidebar:not(:hover) .nav-head { justify-content: center; padding: 11px; }

/* ---- main / topbar -------------------------------------------------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .search {
  display: flex; align-items: center; gap: 9px; flex: 0 1 360px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 15px; color: var(--muted);
  cursor: text; transition: border-color .15s, box-shadow .15s;
}
.topbar .search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.topbar .search input { border: none; background: transparent; outline: none; flex: 1; font-size: 13.5px; color: var(--text); }
.topbar .search kbd { font-size: 11px; background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: var(--faint); }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--text-2); cursor: pointer; position: relative;
  display: grid; place-items: center; font-size: 18px; transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; border-radius: 999px; cursor: pointer; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.user-chip:hover { background: var(--surface-2); border-color: var(--border); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.user-chip .meta { line-height: 1.15; }
.user-chip .meta b { font-size: 13px; font-weight: 600; }
.user-chip .meta span { display: block; font-size: 11px; color: var(--muted); }

/* dropdown menu */
.menu-pop { position: absolute; top: calc(var(--topbar-h) - 8px); right: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 230px; padding: 8px; z-index: 60; animation: pop .15s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.menu-pop .mi { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-2); font-size: 13.5px; }
.menu-pop .mi:hover { background: var(--surface-2); color: var(--text); }
.menu-pop .mi i { width: 18px; text-align: center; color: var(--muted); }
.menu-pop .mi.danger { color: var(--danger); }
.menu-pop .sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---- page content --------------------------------------------------------- */
/* override legacy NewLayoutStyle.css `main { background:#f5e1f2 !important }` / `.page {#f6e1e9}` so the
   content area is the warm cream body bg, exactly like the client-approved design (content is transparent over body). */
main, main.content, .content, .page { background: var(--bg) !important; }
.content { padding: 26px 30px 60px; max-width: 1500px; width: 100%; margin: 0 auto; }
.page-head { margin-bottom: 22px; }
.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.breadcrumb i { font-size: 10px; color: var(--faint); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.page-title { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.page-desc { color: var(--muted); font-size: 14px; margin-top: 4px; max-width: 720px; }

/* ---- panels --------------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 20px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; cursor: pointer; user-select: none; border-bottom: 1px solid transparent; transition: border-color .2s; }
.panel.open .panel-head { border-bottom-color: var(--border); }
.panel-head .pt { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.panel-head .pt i { color: var(--accent); font-size: 18px; }
.panel-head .chev { color: var(--faint); transition: transform .2s; font-size: 13px; }
.panel.open .panel-head .chev { transform: rotate(180deg); }
.panel-body { padding: 20px; }
.panel-accent { height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---- form grid ------------------------------------------------------------ */
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field > label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 13px; border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
  font-size: 13.5px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.textarea { height: auto; min-height: 80px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-ring); }
.input::placeholder { color: var(--faint); }
.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 12 12'%3E%3Cpath fill='%2376716A' d='M6 8L2 4h8z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 32px; }
.check-field { flex-direction: row; align-items: center; gap: 10px; height: 40px; padding: 0 13px; border: 1px dashed var(--border-2); border-radius: var(--radius-sm); background: var(--surface-2); }
.check-field input { width: 18px; height: 18px; accent-color: var(--accent); }
.check-field label { font-size: 13px; color: var(--text-2); cursor: pointer; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* spans */
.c2{grid-column:span 2}.c3{grid-column:span 3}.c4{grid-column:span 4}.c5{grid-column:span 5}.c6{grid-column:span 6}.c8{grid-column:span 8}.c12{grid-column:span 12}
@media (max-width: 1100px){ .c2,.c3,.c4{grid-column:span 6} .c5,.c8{grid-column:span 12} }
@media (max-width: 680px){ .form-grid > *{grid-column:span 12 !important} }

/* ---- buttons -------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn i { font-size: 16px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); border-color: transparent; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); border-color: var(--border-2); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); color: var(--text); }
.btn-soft { background: var(--accent-soft); color: var(--accent-hover); }
.btn-soft:hover { background: var(--accent-softer); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 9px; background: transparent; color: var(--muted); border: 1px solid transparent; }
.btn-icon:hover { background: var(--surface-2); color: var(--accent); border-color: var(--border); }
.btn-icon.danger:hover { color: var(--danger); }

/* ---- tables --------------------------------------------------------------- */
.table-tools { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.table-tools .left { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.table-tools select { height: 34px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface-2); padding: 0 8px; color: var(--text); }
.table-search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 999px; padding: 7px 14px; min-width: 240px; }
.table-search input { border: none; background: transparent; outline: none; flex: 1; font-size: 13px; color: var(--text); }
.table-search i { color: var(--faint); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th { background: var(--surface-2); color: var(--text-2); text-align: left; font-weight: 600; padding: 11px 14px; white-space: nowrap; border-bottom: 1px solid var(--border); position: sticky; top: 0; cursor: pointer; user-select: none; }
table.data thead th .sort { color: var(--faint); margin-left: 5px; font-size: 11px; }
table.data tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover td { background: var(--accent-softer); }
table.data td.actions { text-align: right; }
table.data td .row-actions { display: inline-flex; gap: 2px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.cellmoney { font-variant-numeric: tabular-nums; }
.cellmoney::before { content: "SAR "; color: var(--faint); font-size: 11px; }

.table-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; flex-wrap: wrap; gap: 10px; }
.table-foot .info { color: var(--muted); font-size: 12.5px; }
.pager { display: inline-flex; gap: 4px; }
.pager button { min-width: 32px; height: 32px; padding: 0 9px; border: 1px solid var(--border-2); background: var(--surface); border-radius: 8px; color: var(--text-2); cursor: pointer; font-size: 12.5px; }
.pager button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pager button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

/* ---- badges --------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent-hover); border-color: transparent; }
.badge .dotc { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- note / callout ------------------------------------------------------- */
.note { display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border); border-left-width: 4px; background: var(--surface-2); color: var(--text-2); font-size: 13px; line-height: 1.6; margin-top: 14px; }
.note > i { font-size: 18px; margin-top: 1px; flex: 0 0 auto; }
.note.info { background: var(--info-bg); border-color: var(--info); color: var(--info); }
.note.warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.note.danger { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.note.ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }

/* ---- empty / loading ------------------------------------------------------ */
.empty { text-align: center; padding: 48px 20px; color: var(--faint); }
.empty i { font-size: 40px; display: block; margin-bottom: 12px; opacity: .6; }

/* ============================================================================
   KPI CARDS  (variants via [data-kpi])
   ============================================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(218px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi { border-radius: var(--radius); padding: 18px 20px; position: relative; overflow: hidden; }

/* default: gradient tiles */
[data-kpi="tiles"] .kpi { color: #fff; box-shadow: var(--shadow); }
[data-kpi="tiles"] .kpi .k-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; opacity: .92; font-weight: 600; }
[data-kpi="tiles"] .kpi .k-value { font-family: var(--serif); font-size: 34px; font-weight: 600; line-height: 1.05; margin: 7px 0 2px; }
[data-kpi="tiles"] .kpi .k-sub { font-size: 12px; opacity: .9; }
[data-kpi="tiles"] .kpi .k-icon { position: absolute; right: 15px; top: 15px; font-size: 38px; opacity: .26; }
[data-kpi="tiles"] .kpi.g1 { background: linear-gradient(135deg, var(--accent-2), var(--accent)); }
[data-kpi="tiles"] .kpi.g2 { background: linear-gradient(135deg, #6E8B6A, #4F7A4A); }
[data-kpi="tiles"] .kpi.g3 { background: linear-gradient(135deg, #6E87AE, #4A6FA0); }
[data-kpi="tiles"] .kpi.g4 { background: linear-gradient(135deg, #C99A4E, #B07A22); }
[data-kpi="tiles"] .kpi.g5 { background: linear-gradient(135deg, #9B6FA8, #7C5687); }
[data-kpi="tiles"] .kpi.g6 { background: linear-gradient(135deg, #8A8278, #645D53); }

/* outline: minimal warm cards */
[data-kpi="outline"] .kpi { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
[data-kpi="outline"] .kpi .k-label { font-size: 12px; color: var(--muted); font-weight: 600; }
[data-kpi="outline"] .kpi .k-value { font-family: var(--serif); font-size: 32px; font-weight: 600; color: var(--text); margin: 6px 0 2px; }
[data-kpi="outline"] .kpi .k-sub { font-size: 12px; color: var(--faint); }
[data-kpi="outline"] .kpi .k-icon { position: absolute; right: 16px; top: 16px; font-size: 22px; color: var(--accent); opacity: .9; }
[data-kpi="outline"] .kpi::before { content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background: var(--accent); opacity:.9; }
[data-kpi="outline"] .kpi.g2::before{background:var(--ok)}[data-kpi="outline"] .kpi.g3::before{background:var(--info)}[data-kpi="outline"] .kpi.g4::before{background:var(--warn)}[data-kpi="outline"] .kpi.g5::before{background:#7C5687}[data-kpi="outline"] .kpi.g6::before{background:#645D53}
[data-kpi="outline"] .kpi.g2 .k-icon{color:var(--ok)}[data-kpi="outline"] .kpi.g3 .k-icon{color:var(--info)}[data-kpi="outline"] .kpi.g4 .k-icon{color:var(--warn)}

/* spark: stat + sparkline */
[data-kpi="spark"] .kpi { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
[data-kpi="spark"] .kpi .k-top { display:flex; align-items:center; gap:9px; }
[data-kpi="spark"] .kpi .k-chip { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 16px; }
[data-kpi="spark"] .kpi .k-label { font-size: 12px; color: var(--muted); font-weight: 600; }
[data-kpi="spark"] .kpi .k-value { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--text); margin: 10px 0 0; }
[data-kpi="spark"] .kpi .k-sub { font-size: 12px; color: var(--faint); }
[data-kpi="spark"] .kpi .k-icon { display:none; }
[data-kpi="spark"] .kpi .spark { margin-top: 8px; }

.k-trend { display:inline-flex; align-items:center; gap:3px; font-weight:600; }
.k-trend.up { color: var(--ok); } .k-trend.down { color: var(--danger); }
[data-kpi="tiles"] .k-trend.up, [data-kpi="tiles"] .k-trend.down { color: #fff; }

/* ---- chart cards ---------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
@media (max-width: 1000px){ .grid-2,.grid-3 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .hint { font-size: 12px; color: var(--faint); }
.section-label { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 6px 0 12px; display: flex; align-items: center; justify-content: space-between; }

/* quick action tiles */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 12px; }
.quick {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2);
  cursor: pointer; transition: transform .14s, box-shadow .14s, border-color .14s, background .14s;
}
.quick:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent-soft); background: var(--accent-softer); }
.quick .qi { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 18px; flex: 0 0 38px; }
.quick b { font-size: 13.5px; font-weight: 600; display: block; }
.quick span { font-size: 11.5px; color: var(--faint); }

/* ---- employee cards ------------------------------------------------------- */
.emp-card { display: flex; flex-direction: column; gap: 14px; margin-bottom: 0; }
.emp-top { display: flex; align-items: center; gap: 14px; }
.emp-photo { width: 60px; height: 60px; border-radius: 12px; object-fit: cover; border: 1px solid var(--border); flex: 0 0 60px; }
.emp-id { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.emp-name { font-size: 15px; font-weight: 600; color: var(--text); }
.emp-role { font-size: 12.5px; color: var(--faint); }
.emp-meta { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.emp-meta i { color: var(--accent); width: 16px; }
.emp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

/* ---- input with affix button (password reveal, etc.) ---------------------- */
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .input { width: 100%; padding-right: 40px; }
.affix-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--faint); cursor: pointer; padding: 4px 6px; font-size: 15px; }
.affix-btn:hover { color: var(--accent); }
.hint-ok { font-size: 12px; color: var(--ok); margin-top: 4px; }

/* ---- profile view --------------------------------------------------------- */
.profile-head { display: flex; align-items: center; gap: 18px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.profile-photo { width: 96px; height: 96px; border-radius: 16px; object-fit: cover; border: 1px solid var(--border); flex: 0 0 96px; }
.profile-id { display: flex; flex-direction: column; gap: 5px; }
.profile-name { font-size: 20px; font-weight: 700; color: var(--text); }
.profile-role { font-size: 13.5px; color: var(--accent); font-weight: 600; }
.profile-email { font-size: 13px; color: var(--faint); }
.profile-email i { color: var(--accent); margin-right: 4px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.kv { display: flex; flex-direction: column; gap: 4px; }
.kv label { font-size: 11.5px; letter-spacing: .03em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.kv span { font-size: 14px; color: var(--text); }
.kv-wide { grid-column: 1 / -1; }

/* ---- toasts --------------------------------------------------------------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 11px; min-width: 260px; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 13px 15px; font-size: 13.5px; animation: pop .18s ease; }
.toast.ok { border-left-color: var(--ok); } .toast.ok i { color: var(--ok); }
.toast.danger { border-left-color: var(--danger); } .toast.danger i { color: var(--danger); }
.toast.info { border-left-color: var(--info); } .toast.info i { color: var(--info); }
.toast i { font-size: 18px; }
.toast .x { margin-left: auto; cursor: pointer; color: var(--faint); }

/* ---- modal / slide-over --------------------------------------------------- */
.overlay { position: fixed; inset: 0; background: rgba(40,33,22,.34); z-index: 100; display: flex; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.overlay.center { align-items: center; justify-content: center; }
.overlay.right { justify-content: flex-end; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 460px; max-width: calc(100vw - 32px); max-height: calc(100vh - 60px); overflow: auto; animation: pop .18s ease; }
.slideover { background: var(--surface); width: 560px; max-width: 100vw; height: 100vh; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidein .22s ease; }
@keyframes slidein { from { transform: translateX(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head, .slideover-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3, .slideover-head h3 { font-size: 16px; font-weight: 600; }
.modal-body, .slideover-body { padding: 20px; overflow: auto; }
.slideover-body { flex: 1; }
.modal-foot, .slideover-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 15px 20px; border-top: 1px solid var(--border); }

/* ============================================================================
   LOGIN
   ============================================================================ */
.login-wrap { display: flex; min-height: 100vh; }
.login-aside { flex: 1.05; background: linear-gradient(150deg, #2A241C 0%, #3A2A1E 48%, var(--accent) 140%); color: #F4ECE3; padding: 56px 60px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.login-aside .glow { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .4; }
.login-aside .g-a { width: 320px; height: 320px; background: var(--accent-2); right: -80px; top: -60px; }
.login-aside .g-b { width: 260px; height: 260px; background: #C99A4E; left: -70px; bottom: 40px; opacity: .25; }
.login-aside .brand-lg { display: flex; align-items: center; gap: 13px; position: relative; z-index: 2; }
.login-aside .brand-lg .logo { width: 44px; height: 44px; font-size: 22px; }
.login-aside .brand-lg .word { font-size: 22px; color: #fff; }
.login-aside .brand-lg .word b { color: var(--accent-2); }
.login-aside .pitch { margin-top: auto; position: relative; z-index: 2; }
.login-aside .pitch h1 { font-family: var(--serif); font-size: 42px; font-weight: 500; line-height: 1.12; letter-spacing: -.01em; max-width: 460px; }
.login-aside .pitch p { color: rgba(244,236,227,.78); font-size: 15px; margin-top: 16px; max-width: 420px; line-height: 1.6; }
.login-stats { display: flex; gap: 34px; margin-top: 34px; position: relative; z-index: 2; }
.login-stats .s b { font-family: var(--serif); font-size: 26px; display: block; color: #fff; }
.login-stats .s span { font-size: 12px; color: rgba(244,236,227,.65); text-transform: uppercase; letter-spacing: .08em; }
.login-main { flex: .95; display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.login-main { flex: .95; display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 388px; }
.login-card h2 { font-family: var(--serif); font-size: 28px; font-weight: 600; }
.login-card .sub { color: var(--muted); margin: 6px 0 28px; font-size: 14px; }
.login-card .field { margin-bottom: 16px; }
.login-card .field > label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.login-card .field .ip { position: relative; }
.login-card .field .ip > input { padding-left: 38px; }
.login-card .field .ip > i.lead-ic { position: absolute; left: 13px; top: 12px; color: var(--muted); font-size: 15px; pointer-events: none; }
.login-card .field .ip > i.reveal { position: absolute; right: 13px; top: 12px; color: var(--muted); font-size: 15px; cursor: pointer; }
.login-card .field .ip > i.reveal:hover { color: var(--accent); }
.login-card .helper { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; margin: 4px 0 22px; }
.login-card .helper a { color: var(--accent); }
.login-card .btn-primary { width: 100%; justify-content: center; height: 44px; }
.login-hint { margin-top: 20px; padding: 12px 14px; background: var(--accent-softer); border: 1px dashed var(--accent-soft); border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-2); }
.login-hint b { color: var(--accent-hover); }
@media (max-width: 860px){ .login-aside { display: none; } }

/* utility */
.row-flex { display: flex; align-items: center; gap: 10px; }
.mt-8{margin-top:8px}.mb-0{margin-bottom:0}
.text-muted{color:var(--muted)}
.hide-sm { } @media (max-width: 760px){ .hide-sm { display: none !important; } .content { padding: 20px 16px 50px; } }
