/* ============================================================
   TandooriOS — Workforce & Operations Platform
   Shared design system
   ============================================================ */

:root {
  /* Brand */
  --brand: #d9532b;          /* tandoori terracotta */
  --brand-600: #c0431f;
  --brand-700: #a3361a;
  --brand-soft: #fbeee7;
  --brand-tint: #fdf6f2;

  --accent: #1f6feb;
  --accent-soft: #e8f0fe;

  /* Neutrals */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --line: #e7e9ee;
  --line-soft: #eef0f3;

  --ink: #14181f;
  --ink-2: #3a414c;
  --muted: #6b7280;
  --muted-2: #9aa1ad;

  /* Status */
  --green: #1f9d55;
  --green-soft: #e3f5ec;
  --amber: #c98a06;
  --amber-soft: #fcf3df;
  --red: #d6402b;
  --red-soft: #fce8e6;
  --purple: #7c4dff;
  --purple-soft: #efeafe;
  --blue: #1f6feb;
  --blue-soft: #e8f0fe;

  /* Sidebar */
  --side-bg: #15171c;
  --side-bg-2: #1b1e24;
  --side-ink: #c7ccd6;
  --side-muted: #7e858f;
  --side-active: #ffffff;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow: 0 4px 14px rgba(16, 24, 40, .07), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-lg: 0 18px 50px rgba(16, 24, 40, .14);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--side-bg);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #2c2f37; border-radius: 6px; }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 20px 16px;
}
.brand-logo {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--brand) 0%, #e8743f 100%);
  display: grid; place-items: center;
  font-weight: 800; color: #fff; font-size: 17px;
  box-shadow: 0 4px 12px rgba(217, 83, 43, .4);
  flex-shrink: 0;
}
.brand-name { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: -.02em; }
.brand-sub { font-size: 11px; color: var(--side-muted); margin-top: 1px; }

.side-search {
  margin: 4px 14px 10px;
  display: flex; align-items: center; gap: 8px;
  background: #22252c;
  border: 1px solid #2c2f37;
  border-radius: 9px;
  padding: 8px 11px;
  color: var(--side-muted);
  font-size: 13px;
}
.side-search input {
  background: none; border: none; outline: none;
  color: var(--side-ink); font-family: inherit; font-size: 13px;
  width: 100%;
}
.side-search kbd {
  font-family: inherit; font-size: 10px; color: var(--side-muted);
  background: #2c2f37; border-radius: 4px; padding: 2px 5px;
}

.nav { padding: 4px 12px 20px; flex: 1; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--side-muted); font-weight: 600;
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--side-ink);
  font-size: 13.5px; font-weight: 500;
  margin-bottom: 1px;
  transition: background .14s, color .14s;
  cursor: pointer;
}
.nav-item:hover { background: #22252c; color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(217,83,43,.35); }
.nav-item.active .ico { opacity: 1; }
.nav-item .ico { width: 18px; height: 18px; opacity: .8; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto;
  background: #2c2f37; color: #c7ccd6;
  font-size: 10.5px; font-weight: 600;
  border-radius: 20px; padding: 1px 7px;
}
.nav-item.active .badge { background: rgba(255,255,255,.22); color: #fff; }

.side-foot {
  border-top: 1px solid #262931;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
.side-foot .avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; }
.side-foot .nm { font-size: 13px; font-weight: 600; color: #fff; }
.side-foot .rl { font-size: 11px; color: var(--side-muted); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 64px;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 20;
}
.page-title h1 { font-size: 19px; }
.page-title p { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.topbar-spacer { flex: 1; }

.branch-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.branch-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.branch-pill svg { color: var(--muted-2); }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid; place-items: center;
  color: var(--ink-2); cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .dot-notif {
  position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--surface);
}

.content { padding: 26px 28px 60px; max-width: 1320px; width: 100%; }

/* ============================================================
   PRIMITIVES
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .14s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand); color: #fff; border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(217,83,43,.28);
}
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--line-soft); }
.btn svg { width: 15px; height: 15px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.card-head h3 { font-size: 15px; }
.card-head p { font-size: 12px; color: var(--muted); }
.card-head .spacer { flex: 1; }

.section-title {
  display: flex; align-items: center; gap: 10px;
  margin: 26px 0 13px;
}
.section-title h2 { font-size: 15.5px; }
.section-title .spacer { flex: 1; }
.section-title .link { font-size: 12.5px; color: var(--brand); font-weight: 600; }

/* Badges */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px;
  background: var(--line-soft); color: var(--ink-2);
}
.tag .dt { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.purple { background: var(--purple-soft); color: var(--purple); }
.tag.gray { background: var(--line-soft); color: var(--muted); }

.avatar {
  border-radius: 50%; object-fit: cover; flex-shrink: 0;
  background: var(--line-soft);
}
.avatar-txt {
  border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  font-weight: 700; color: #fff; font-size: 12px;
}

/* ============================================================
   KPI / STAT CARDS
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 18px;
  box-shadow: var(--shadow-sm);
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
}
.kpi-ico svg { width: 18px; height: 18px; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-top: 14px; }
.kpi-val { font-size: 26px; font-weight: 720; letter-spacing: -.02em; margin-top: 2px; }
.kpi-delta { font-size: 12px; font-weight: 600; margin-top: 7px; display: flex; align-items: center; gap: 5px; }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi-delta .muted { color: var(--muted); font-weight: 500; }

/* ============================================================
   TABLES
   ============================================================ */
.table { width: 100%; border-collapse: collapse; }
.table thead th {
  text-align: left;
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600;
  padding: 11px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.table tbody td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.cell-user { display: flex; align-items: center; gap: 11px; }
.cell-user .nm { font-weight: 600; }
.cell-user .sub { font-size: 11.5px; color: var(--muted); }

.progress { height: 7px; border-radius: 20px; background: var(--line-soft); overflow: hidden; min-width: 90px; }
.progress > span { display: block; height: 100%; border-radius: 20px; background: var(--brand); }
.progress.green > span { background: var(--green); }
.progress.amber > span { background: var(--amber); }
.progress.blue > span { background: var(--blue); }

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.row { display: flex; gap: 18px; }
.between { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--muted); }
.mt-0 { margin-top: 0; }

/* ============================================================
   CHARTS (pure CSS / inline svg)
   ============================================================ */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-stack { width: 100%; max-width: 34px; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; height: 100%; }
.bar { width: 100%; border-radius: 5px; background: var(--brand); min-height: 4px; }
.bar.soft { background: var(--brand-soft); }
.bar-x { font-size: 11px; color: var(--muted); font-weight: 500; }

.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { width: 132px; height: 132px; position: relative; flex-shrink: 0; }
.donut .ctr {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
}
.donut .ctr b { font-size: 24px; font-weight: 720; display: block; }
.donut .ctr span { font-size: 11px; color: var(--muted); }
.legend { display: flex; flex-direction: column; gap: 11px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-row .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-row .v { margin-left: auto; font-weight: 600; }

/* sparkline area */
.spark { width: 100%; height: 48px; display: block; }

/* ============================================================
   LIST / ACTIVITY
   ============================================================ */
.feed-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.feed-item:last-child { border-bottom: none; }
.feed-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.feed-ico svg { width: 16px; height: 16px; }
.feed-body { flex: 1; min-width: 0; }
.feed-body .t { font-size: 13px; font-weight: 550; }
.feed-body .t b { font-weight: 700; }
.feed-body .m { font-size: 12px; color: var(--muted); margin-top: 1px; }
.feed-time { font-size: 11.5px; color: var(--muted-2); white-space: nowrap; }

/* ============================================================
   FILTER BAR
   ============================================================ */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px;
  font-size: 13px; color: var(--muted);
  min-width: 250px; box-shadow: var(--shadow-sm);
}
.search-box input { border: none; outline: none; background: none; font-family: inherit; font-size: 13px; width: 100%; color: var(--ink); }
.seg { display: inline-flex; background: var(--line-soft); border-radius: 10px; padding: 3px; }
.seg button {
  border: none; background: none; font-family: inherit;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  padding: 6px 13px; border-radius: 8px; cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ============================================================
   MISC PANELS
   ============================================================ */
.banner {
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(110deg, #1b1e24, #2a2e38);
  color: #fff;
  box-shadow: var(--shadow);
}
.banner.ai { background: linear-gradient(110deg, #2b1d3a, #4a2d6b); }
.banner-ico {
  width: 46px; height: 46px; border-radius: 13px;
  background: rgba(255,255,255,.12);
  display: grid; place-items: center; flex-shrink: 0;
}
.banner h3 { font-size: 15px; color: #fff; }
.banner p { font-size: 12.5px; color: rgba(255,255,255,.7); margin-top: 2px; }
.banner .btn { background: #fff; color: var(--ink); border-color: #fff; }

.empty-hint { font-size: 12px; color: var(--muted-2); }

/* Avatars color helper classes */
.a1{background:linear-gradient(135deg,#f6724b,#e8743f)}
.a2{background:linear-gradient(135deg,#3b82f6,#2563eb)}
.a3{background:linear-gradient(135deg,#10b981,#059669)}
.a4{background:linear-gradient(135deg,#8b5cf6,#7c3aed)}
.a5{background:linear-gradient(135deg,#f59e0b,#d97706)}
.a6{background:linear-gradient(135deg,#ec4899,#db2777)}
.a7{background:linear-gradient(135deg,#14b8a6,#0d9488)}
.a8{background:linear-gradient(135deg,#64748b,#475569)}

/* scrollbar */
.content::-webkit-scrollbar { width: 10px; }

/* responsive-ish */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
