/* ==========================================================================
   Maruti Infra PEB LLP — Design System (light theme)
   Fonts: Fraunces (display) + Space Grotesk (UI)
   ========================================================================== */

:root {
  --bg:        #f3f5fa;
  --bg-deep:   #eaeef6;
  --surface:   #ffffff;
  --surface-2: #f7f9fd;
  --border:    #e4e9f2;
  --border-2:  #d5dcea;
  --ink:       #131c30;
  --ink-2:     #3d4a66;
  --muted:     #71809e;
  --faint:     #9aa7c0;

  --accent:      #2b4fd8;
  --accent-deep: #1e3ab0;
  --accent-soft: #e9edfc;
  --amber:       #d97706;
  --amber-soft:  #fdf2e3;
  --good:        #178041;
  --good-soft:   #e6f6ec;
  --bad:         #d3303c;
  --bad-soft:    #fdecee;

  --font-display: 'Fraunces', Georgia, serif;
  --font-ui: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;

  --shadow-sm: 0 1px 2px rgb(19 28 48 / 0.05), 0 1px 1px rgb(19 28 48 / 0.03);
  --shadow-md: 0 4px 10px rgb(19 28 48 / 0.06), 0 2px 4px rgb(19 28 48 / 0.04);
  --shadow-lg: 0 18px 40px rgb(19 28 48 / 0.10), 0 4px 10px rgb(19 28 48 / 0.05);
  --shadow-accent: 0 8px 20px rgb(43 79 216 / 0.28), 0 2px 6px rgb(43 79 216 / 0.20);

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01';
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

::selection { background: var(--accent-soft); }

/* icon wrapper */
.icn { display: inline-flex; width: var(--isz, 18px); height: var(--isz, 18px); flex: none; vertical-align: -3px; }
.icn svg { width: 100%; height: 100%; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100dvh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 14px 18px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100dvh;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 20px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--accent) 0%, #6a3ce0 100%);
  color: #fff; display: grid; place-items: center;
  box-shadow: var(--shadow-accent);
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 16.5px; letter-spacing: -0.01em; line-height: 1.15; }
.brand-sub { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); font-weight: 500; }

.nav-section { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8.5px 10px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500; font-size: 13.5px;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
  position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); transform: translateX(2px); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 20%; bottom: 20%;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-badge { margin-left: auto; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 20px; padding: 1px 7px; }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px;
}
.user-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.user-role { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.logout-btn { margin-left: auto; }

/* main + topbar */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 32px 0;
}
.page-title { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 1px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.date-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 30px;
  padding: 7px 15px; font-size: 12.5px; color: var(--ink-2); font-weight: 500;
  box-shadow: var(--shadow-sm);
}

#view { padding: 22px 32px 48px; max-width: 1440px; width: 100%; margin: 0 auto; }

/* ==========================================================================
   Cards, buttons, chips
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 0; }
.card-head h3 { font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; }
.card-head .spacer { flex: 1; }
.card-hint { color: var(--muted); font-size: 12.5px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 13px; border-radius: 10px; padding: 8.5px 15px;
  transition: transform 160ms cubic-bezier(.34,1.56,.64,1), box-shadow 160ms ease, background 160ms ease, border-color 160ms;
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1.5px); box-shadow: var(--shadow-md); border-color: var(--faint); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--shadow-accent); }
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-good { background: var(--good); border-color: var(--good); color: #fff; }
.btn-ghost { border-color: transparent; box-shadow: none; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn-sm { padding: 5.5px 11px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.icon-btn {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 9px; border: none; background: transparent; color: var(--muted);
  transition: background 150ms, color 150ms;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.menu-btn { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 3.5px 10px; border-radius: 20px;
  background: color-mix(in srgb, var(--cc, var(--accent)) 10%, white);
  color: var(--cc, var(--accent));
  border: 1px solid color-mix(in srgb, var(--cc, var(--accent)) 22%, white);
  white-space: nowrap;
}
.chip-sm { font-size: 10.5px; padding: 2px 8px; }

.tag { font-size: 11px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-weight: 500; }

/* ==========================================================================
   KPI band (dashboard)
   ========================================================================== */
.kpi-band { display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.kpi {
  position: relative; overflow: hidden;
  padding: 18px 20px 16px;
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.kpi-value { font-family: var(--font-display); font-size: 31px; font-weight: 600; letter-spacing: -0.02em; margin-top: 8px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12px; color: var(--muted); margin-top: 6px; }
.kpi-hero {
  background: linear-gradient(132deg, #24409f 0%, var(--accent) 55%, #5f43d8 100%);
  border: none; color: #fff;
  box-shadow: var(--shadow-accent);
}
.kpi-hero .kpi-label, .kpi-hero .kpi-foot { color: rgb(255 255 255 / 0.75); }
.kpi-hero::after {
  content: ''; position: absolute; right: -34px; top: -34px; width: 130px; height: 130px;
  border-radius: 50%; background: rgb(255 255 255 / 0.09);
}
.kpi-hero::before {
  content: ''; position: absolute; right: 8px; bottom: -50px; width: 110px; height: 110px;
  border-radius: 50%; background: rgb(255 255 255 / 0.06);
}

/* stage funnel strip */
.funnel { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; margin-bottom: 14px; scrollbar-width: thin; }
.funnel-item {
  flex: none; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 30px;
  padding: 6.5px 14px 6.5px 8px; font-size: 12px; font-weight: 600; color: var(--ink-2);
  transition: transform 170ms ease, box-shadow 170ms ease;
  box-shadow: var(--shadow-sm);
}
.funnel-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.funnel-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--sc) 12%, white); color: var(--sc); }
.funnel-count { font-family: var(--font-display); font-size: 15px; color: var(--ink); }

/* dashboard body grid */
.dash-grid { display: grid; grid-template-columns: 1.9fr 1fr; gap: 16px; align-items: start; }

/* project rows */
.proj-row {
  display: grid; grid-template-columns: 44px 1.5fr 1fr auto; gap: 14px; align-items: center;
  padding: 14px 18px; border-top: 1px solid var(--border);
  transition: background 150ms ease;
  cursor: pointer;
}
.proj-row:hover { background: var(--surface-2); }
.proj-row:first-of-type { border-top: none; }
.avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 13.5px; }
.proj-title { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.proj-client { font-size: 12px; color: var(--muted); margin-top: 1px; }
.proj-money { text-align: right; font-size: 12px; color: var(--muted); line-height: 1.5; }
.proj-money b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* stage bar segments */
.stagebar { display: flex; gap: 3px; margin-top: 7px; }
.seg { height: 5px; flex: 1; border-radius: 3px; background: var(--bg-deep); position: relative; overflow: hidden; }
.seg-done { background: var(--sc); opacity: 0.85; }
.seg-now { background: var(--sc); }
.seg-now::after {
  content: ''; position: absolute; inset: 0; border-radius: 3px;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.75), transparent);
  animation: shimmer 1.8s infinite;
}
@keyframes shimmer { from { transform: translateX(-110%); } to { transform: translateX(110%); } }
.stagebar-sm .seg { height: 4px; }

/* alerts */
.alert-row { display: flex; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); align-items: flex-start; cursor: pointer; transition: background 150ms; }
.alert-row:hover { background: var(--surface-2); }
.alert-row:first-of-type { border-top: none; }
.alert-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; margin-top: 2px; }
.tone-warn .alert-ico { background: var(--amber-soft); color: var(--amber); }
.tone-bad .alert-ico { background: var(--bad-soft); color: var(--bad); }
.tone-good .alert-ico { background: var(--good-soft); color: var(--good); }
.tone-info .alert-ico { background: var(--accent-soft); color: var(--accent); }
.alert-text { font-size: 13px; font-weight: 600; line-height: 1.35; }
.alert-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* activity timeline */
.tl { padding: 6px 20px 16px; }
.tl-item { display: flex; gap: 13px; position: relative; padding: 9px 0; }
.tl-item::before { content: ''; position: absolute; left: 13px; top: 34px; bottom: -6px; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 27px; height: 27px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--ink-2); flex: none; z-index: 1; }
.tl-text { font-size: 12.5px; line-height: 1.4; }
.tl-meta { font-size: 11px; color: var(--faint); margin-top: 1px; }

/* ==========================================================================
   Tables
   ========================================================================== */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.tbl th:first-child { border-radius: 10px 0 0 0; }
.tbl th:last-child { border-radius: 0 10px 0 0; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background 140ms; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tbl-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--border); }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea {
  border: 1px solid var(--border-2); border-radius: 10px; padding: 9px 12px;
  background: var(--surface); outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-err { color: var(--bad); font-size: 12.5px; font-weight: 600; min-height: 18px; }

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgb(19 28 48 / 0.42);
  backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
  opacity: 0; transition: opacity 240ms ease;
}
.modal-backdrop.open { opacity: 1; }
.modal {
  width: min(480px, 100%); max-height: 88dvh; overflow-y: auto;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(0.97); transition: transform 260ms cubic-bezier(.34,1.4,.64,1);
}
.modal-wide { width: min(680px, 100%); }
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 22px 4px; }
.modal-head h3 { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.modal-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 14px 22px 6px; }
.modal-foot { padding: 10px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* ==========================================================================
   Toast
   ========================================================================== */
#toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 500;
  padding: 11px 18px; border-radius: 30px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(14px); transition: opacity 300ms ease, transform 300ms cubic-bezier(.34,1.5,.64,1);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-good .icn { color: #6ee7a0; }
.toast-bad .icn { color: #fda4ab; }

/* ==========================================================================
   Entrance animations
   ========================================================================== */
[data-animate] { opacity: 0; transform: translateY(18px); }
[data-animate].visible { opacity: 1; transform: translateY(0); transition: opacity 550ms ease var(--d, 0ms), transform 550ms cubic-bezier(.22,.9,.32,1) var(--d, 0ms); }

.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 70px 0; color: var(--muted); font-size: 13px; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--border-2); border-top-color: var(--accent); animation: rot 0.8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ==========================================================================
   Login
   ========================================================================== */
.login-wrap { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero {
  position: relative; overflow: hidden; padding: 52px 56px;
  background:
    radial-gradient(900px 500px at -10% -20%, rgb(94 61 214 / 0.35), transparent 60%),
    radial-gradient(800px 600px at 110% 115%, rgb(28 160 170 / 0.30), transparent 55%),
    linear-gradient(150deg, #1c2f7d 0%, #2b4fd8 60%, #4438c9 100%);
  color: #fff; display: flex; flex-direction: column;
}
.login-hero::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgb(255 255 255 / 0.12) 1px, transparent 1px);
  background-size: 26px 26px; opacity: 0.5;
}
.login-hero > * { position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 13px; }
.login-brand .brand-mark { background: rgb(255 255 255 / 0.14); backdrop-filter: blur(8px); border: 1px solid rgb(255 255 255 / 0.25); box-shadow: none; width: 46px; height: 46px; }
.login-hero h1 {
  font-family: var(--font-display); font-weight: 570; margin-top: auto;
  font-size: clamp(2.1rem, 3.6vw, 3.3rem); line-height: 1.08; letter-spacing: -0.02em; max-width: 520px;
}
.login-hero h1 em { font-style: italic; color: #ffd08a; }
.login-hero p { margin-top: 18px; max-width: 430px; color: rgb(255 255 255 / 0.78); font-size: 14.5px; }
.login-flow { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 26px; max-width: 560px; }
.login-flow span {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  border: 1px solid rgb(255 255 255 / 0.25); background: rgb(255 255 255 / 0.10);
  padding: 4px 11px; border-radius: 20px; backdrop-filter: blur(6px);
}
.login-panel { display: grid; place-items: center; padding: 40px 28px; background: var(--bg); }
.login-card { width: min(390px, 100%); }
.login-card h2 { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.login-card > p { color: var(--muted); font-size: 13.5px; margin: 5px 0 24px; }
.role-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.role-chip {
  font-size: 11.5px; font-weight: 600; border: 1px solid var(--border-2); background: var(--surface);
  border-radius: 20px; padding: 5px 12px; color: var(--ink-2);
  transition: all 150ms ease;
}
.role-chip:hover, .role-chip.sel { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); }

/* ==========================================================================
   Project detail
   ========================================================================== */
.detail-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.detail-title h2 { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 7px; color: var(--muted); font-size: 12.5px; align-items: center; }
.money-strip { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.money-pill { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 15px; box-shadow: var(--shadow-sm); }
.money-pill .lbl { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.money-pill .val { font-family: var(--font-display); font-size: 16.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.money-pill.pos .val { color: var(--good); }
.money-pill.neg .val { color: var(--bad); }

/* stepper */
.stepper-card { padding: 18px 20px 14px; margin-bottom: 16px; overflow-x: auto; }
.stepper { display: flex; min-width: 900px; }
.step { flex: 1; text-align: center; position: relative; padding-top: 4px; }
.step::before {
  content: ''; position: absolute; top: 19px; left: -50%; width: 100%; height: 2.5px;
  background: var(--border-2); z-index: 0;
}
.step:first-child::before { display: none; }
.step.done::before, .step.now::before { background: var(--sc); }
.step-dot {
  width: 32px; height: 32px; border-radius: 50%; margin: 0 auto;
  display: grid; place-items: center; position: relative; z-index: 1;
  background: var(--surface); border: 2px solid var(--border-2); color: var(--faint);
  transition: all 200ms ease;
}
.step.done .step-dot { background: var(--sc); border-color: var(--sc); color: #fff; }
.step.now .step-dot { border-color: var(--sc); color: var(--sc); box-shadow: 0 0 0 5px color-mix(in srgb, var(--sc) 15%, white); animation: pulse-ring 2.2s infinite; }
@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--sc) 16%, white); }
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--sc) 8%, white); }
}
.step-lbl { font-size: 10px; font-weight: 600; margin-top: 7px; color: var(--faint); letter-spacing: 0.02em; }
.step.done .step-lbl, .step.now .step-lbl { color: var(--ink-2); }
.step.now .step-lbl { color: var(--sc); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  border: none; background: none; padding: 9px 15px; font-size: 13px; font-weight: 600;
  color: var(--muted); border-bottom: 2.5px solid transparent; margin-bottom: -1px;
  transition: color 150ms; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent-deep); border-bottom-color: var(--accent); }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.detail-grid .full { grid-column: 1 / -1; }

/* product cards */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 12px; padding: 16px 20px 20px; }
.prod-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 14px;
  background: var(--surface-2);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms;
  position: relative;
}
.prod-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-2); background: var(--surface); }
.prod-ico {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.prod-name { font-weight: 600; font-size: 13px; margin-top: 10px; line-height: 1.3; }
.prod-specs { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.prod-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }

/* material stock bars */
.stock-row td { padding: 10px 14px; }
.stock-bar { height: 6px; border-radius: 4px; background: var(--bg-deep); overflow: hidden; margin-top: 5px; min-width: 110px; }
.stock-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), #6a3ce0); transform-origin: left; transform: scaleX(0); transition: transform 800ms cubic-bezier(.22,.9,.32,1) 150ms; }
.stock-fill.warn { background: linear-gradient(90deg, var(--amber), #e8590c); }

/* ==========================================================================
   Kanban (production)
   ========================================================================== */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(215px, 1fr)); gap: 13px; overflow-x: auto; align-items: start; }
.kcol { background: var(--bg-deep); border-radius: 15px; padding: 10px; min-height: 200px; }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 10px; font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; }
.kcol-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--kc); }
.kcol-count { margin-left: auto; font-size: 11px; color: var(--muted); background: var(--surface); border-radius: 12px; padding: 1px 8px; font-weight: 600; }
.kcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 13px; margin-bottom: 9px; box-shadow: var(--shadow-sm);
  transition: transform 170ms ease, box-shadow 170ms ease;
}
.kcard:hover { transform: translateY(-2.5px); box-shadow: var(--shadow-md); }
.kcard-top { display: flex; gap: 9px; align-items: center; }
.kcard-ico { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-deep); display: grid; place-items: center; flex: none; }
.kcard-name { font-weight: 600; font-size: 12.5px; line-height: 1.25; }
.kcard-proj { font-size: 11px; color: var(--muted); margin-top: 1px; }
.kcard-specs { display: flex; gap: 9px; font-size: 11px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.kcard-act { margin-top: 10px; display: flex; gap: 6px; }
.kcard-act .btn { flex: 1; justify-content: center; }
.kcard-lock { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--amber); font-weight: 600; margin-top: 9px; }

/* consumption rows in modal */
.consume-row { display: grid; grid-template-columns: 1fr 92px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.consume-row:last-child { border-bottom: none; }
.consume-mat { font-size: 13px; font-weight: 600; }
.consume-avail { font-size: 11px; color: var(--muted); }
.consume-row input { border: 1px solid var(--border-2); border-radius: 8px; padding: 7px 10px; width: 100%; text-align: right; }

/* purchase line editor */
.line-editor { border: 1px dashed var(--border-2); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; background: var(--surface-2); }
.line-row { display: grid; grid-template-columns: 2fr 76px 84px 90px 30px; gap: 8px; margin-bottom: 8px; align-items: center; }
.line-row input, .line-row select { border: 1px solid var(--border-2); border-radius: 8px; padding: 7px 9px; width: 100%; background: var(--surface); }

/* dispatch queue */
.dq-group { border-top: 1px solid var(--border); padding: 14px 20px; }
.dq-group:first-of-type { border-top: none; }
.dq-head { display: flex; align-items: center; gap: 11px; margin-bottom: 9px; }
.dq-items { display: flex; flex-wrap: wrap; gap: 7px; }
.dq-item {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border-2); background: var(--surface); border-radius: 10px; padding: 7px 11px;
  cursor: pointer; transition: all 150ms ease; user-select: none;
}
.dq-item:hover { border-color: var(--accent); }
.dq-item.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); }

/* invoice progress */
.pay-prog { height: 7px; border-radius: 4px; background: var(--bg-deep); overflow: hidden; margin-top: 6px; }
.pay-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #1c9550, #2ec46e); transform-origin: left; transform: scaleX(0); transition: transform 800ms cubic-bezier(.22,.9,.32,1) 200ms; }

/* ==========================================================================
   Attachments & file viewer
   ========================================================================== */
.filedrop {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px dashed var(--border-2); border-radius: 12px;
  padding: 13px 15px; background: var(--surface-2); cursor: pointer;
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}
.filedrop:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); }
.filedrop .icn { flex: none; }
.filedrop-text em { font-style: normal; color: var(--faint); font-size: 12px; }
.filedrop-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.att-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 2px 26px; }
.att-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  border: 1px solid var(--border-2); background: var(--surface); border-radius: 9px;
  padding: 5px 10px; font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.att-chip:hover { border-color: var(--accent); color: var(--accent-deep); transform: translateY(-1.5px); box-shadow: var(--shadow-sm); }
.att-chip .icn { flex: none; color: var(--accent); }
.att-chip .att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.att-chip small { color: var(--faint); font-weight: 500; flex: none; }
.att-chip-new { cursor: default; border-style: dashed; }
.att-chip-new:hover { transform: none; border-color: var(--border-2); color: var(--ink-2); box-shadow: none; }

.viewer { min-height: 340px; }
.viewer-frame { width: 100%; height: 64dvh; min-height: 340px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }

/* zoom toolbar */
.viewer-bar {
  display: flex; align-items: center; gap: 7px; margin-bottom: 10px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 7px 10px;
}
.vbtn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  min-width: 32px; height: 30px; padding: 0 9px;
  border: 1px solid var(--border-2); background: var(--surface); border-radius: 8px;
  color: var(--ink-2); font-size: 12.5px; font-weight: 600;
  transition: background 140ms, border-color 140ms, color 140ms, transform 140ms;
}
.vbtn:hover { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); transform: translateY(-1px); }
.vbtn:active { transform: translateY(0) scale(0.97); }
.vbtn[data-z="out"] .icn { transform: rotate(45deg); }   /* reuse the × glyph as a minus */
.vbtn-txt { min-width: auto; }
.vzoom {
  min-width: 58px; text-align: center; font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.vsep { width: 1px; height: 20px; background: var(--border-2); margin: 0 3px; }
.vhint { margin-left: auto; font-size: 11.5px; color: var(--faint); }

.viewer-cad {
  position: relative; width: 100%; overflow: hidden;
  border: 1px solid var(--border); border-radius: 12px;
  background: #10192e; display: flex; align-items: center; justify-content: center;
  height: 60dvh; min-height: 320px;
  cursor: grab; touch-action: none;
}
.viewer-cad.grabbing { cursor: grabbing; }
/* fill the panel — AutoCAD thumbnails are small and must scale up to be readable */
.viewer-cad img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  transform-origin: center center; will-change: transform; user-select: none; -webkit-user-drag: none;
}
/* absolute so the canvas always inherits the container box, never collapses to 0 */
.viewer-cad canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.viewer-note { font-size: 12px; color: var(--muted); margin-top: 9px; display: flex; align-items: flex-start; gap: 6px; line-height: 1.5; }
.viewer-note .icn { color: var(--faint); flex: none; margin-top: 2px; }

/* wider modal for drawings, plus a true fullscreen mode */
.modal-xl { width: min(1180px, 100%); }
.modal.modal-fs {
  position: fixed; inset: 12px; width: auto; max-height: none; border-radius: 16px;
  display: flex; flex-direction: column; z-index: 55;
}
.modal.modal-fs .modal-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.modal.modal-fs .viewer { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.modal.modal-fs .viewer-cad { flex: 1; height: auto; min-height: 0; }
.modal.modal-fs .viewer-frame { flex: 1; height: auto; min-height: 0; }

/* ==========================================================================
   Department workstation pages
   ========================================================================== */
.dept-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px 22px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--dc, var(--accent));
}
.dept-badge {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--dc) 12%, white); color: var(--dc);
}
.dept-head h2 { font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.dept-head p { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.dept-stats { margin-left: auto; display: flex; gap: 22px; flex-wrap: wrap; }
.dept-stats > div { text-align: right; }
.dept-stats b { display: block; font-family: var(--font-display); font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.dept-stats span { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); font-weight: 600; }

.dept-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 16px; align-items: start; }
.dept-list { padding: 12px 16px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 10px; }

/* ==========================================================================
   Attendance
   ========================================================================== */
.att-list { padding: 6px 18px 16px; }
.att-row-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px dashed var(--border);
}
.att-row-item:last-child { border-bottom: none; }
.att-ot { display: flex; flex-direction: column; gap: 2px; }
.att-ot label { font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.att-ot input { width: 62px; padding: 5px 8px; border: 1px solid var(--border-2); border-radius: 8px; text-align: center; }
.att-btns { display: flex; gap: 5px; flex: none; }
.att-btn {
  width: 34px; height: 34px; border-radius: 9px; font-weight: 700; font-size: 13px;
  border: 1.5px solid var(--border-2); background: var(--surface); color: var(--muted);
  transition: all 150ms ease;
}
.att-btn:hover { border-color: var(--sc); color: var(--sc); transform: translateY(-1px); }
.att-btn.sel { background: var(--sc); border-color: var(--sc); color: #fff; box-shadow: var(--shadow-sm); }

/* ==========================================================================
   Drawing analysis + purchase autofill
   ========================================================================== */
.an-note {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 25%, white);
  border-radius: 12px; padding: 11px 14px; margin-bottom: 12px; font-size: 12.5px; line-height: 1.5;
  color: #7c4708;
}
.an-note .icn { color: var(--amber); flex: none; margin-top: 1px; }
.an-tb { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; font-size: 12.5px; color: var(--ink-2); }
.an-tb b { color: var(--faint); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; margin-right: 5px; }

.autofill-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 20%, white);
  border-radius: 11px; padding: 9px 12px; margin-bottom: 12px;
}
.autofill-bar .card-hint { color: var(--accent-deep); }

/* ==========================================================================
   Face camera
   ========================================================================== */
.face-wrap { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start; }
.face-stage {
  position: relative; border-radius: 14px; overflow: hidden; background: #0d1424;
  aspect-ratio: 4 / 3; display: grid; place-items: center;
}
.face-stage video, .face-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.face-stage canvas { pointer-events: none; }
.face-pose {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  background: linear-gradient(transparent, rgb(4 10 22 / 0.85));
  color: #fff; font-size: 13.5px; font-weight: 600; text-align: center; padding: 26px 14px 12px;
}
.face-side { display: flex; flex-direction: column; }
.face-count { display: flex; align-items: baseline; gap: 8px; }
.face-count b { font-family: var(--font-display); font-size: 32px; font-weight: 600; }
.face-count span { font-size: 12px; color: var(--muted); }
.face-bar { height: 7px; border-radius: 4px; background: var(--bg-deep); overflow: hidden; margin-top: 8px; }
.face-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #3ddc84); transform-origin: left; transform: scaleX(0); transition: transform 260ms ease; }
.face-tips { margin: 12px 0 0 16px; padding: 0; color: var(--muted); font-size: 12px; line-height: 1.9; }

.face-hit { min-height: 96px; border: 1px dashed var(--border-2); border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); }
.face-hit-empty { text-align: center; color: var(--faint); }
.face-hit-empty p { font-size: 12px; margin-top: 6px; }
.face-hit-card {
  display: flex; align-items: center; gap: 13px; width: 100%; padding: 14px 16px;
  background: var(--good-soft); border-radius: 14px; color: var(--good);
  animation: pop 320ms cubic-bezier(.34,1.5,.64,1);
}
.face-hit-card.dup { background: var(--amber-soft); color: var(--amber); }
.face-hit-name { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--ink); }
.face-hit-sub { font-size: 12.5px; margin-top: 1px; }
@keyframes pop { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
.face-log { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.face-log-row { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 8px; background: var(--surface-2); }
.face-log-row.good .icn { color: var(--good); }
.face-log-row.dup { color: var(--muted); }

/* ==========================================================================
   Backup
   ========================================================================== */
.restore-warn {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 22%, white);
  border-radius: 12px; padding: 11px 14px; font-size: 12.5px; line-height: 1.55; color: #8d1b24;
}
.restore-warn .icn { color: var(--bad); flex: none; margin-top: 1px; }

@media (max-width: 900px) { .face-wrap { grid-template-columns: 1fr; } }

/* empty state */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .icn { color: var(--faint); }
.empty h4 { font-family: var(--font-display); font-size: 17px; color: var(--ink-2); margin: 12px 0 4px; font-weight: 600; }
.empty p { font-size: 13px; max-width: 320px; margin: 0 auto; }

/* filter pills */
.filters { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.fpill {
  border: 1px solid var(--border-2); background: var(--surface); border-radius: 20px;
  padding: 6px 14px; font-size: 12px; font-weight: 600; color: var(--ink-2);
  transition: all 150ms ease;
}
.fpill:hover { border-color: var(--faint); }
.fpill.sel { background: var(--ink); border-color: var(--ink); color: #fff; }

/* project card grid (projects page) */
.pcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.pcard { padding: 18px 20px; cursor: pointer; transition: transform 190ms ease, box-shadow 190ms ease; }
.pcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.pcard-top { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.pcard-money { display: flex; gap: 18px; margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--border); }
.pcard-money > div { flex: 1; }
.pcard-money .lbl { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.pcard-money .val { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 1px; }

/* responsive */
@media (max-width: 1100px) {
  .kpi-band { grid-template-columns: 1fr 1fr; }
  .dash-grid, .detail-grid { grid-template-columns: 1fr; }
  .kanban { display: flex; overflow-x: auto; }
  .kanban .kcol { min-width: 230px; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 45; transform: translateX(-100%); transition: transform 250ms ease; width: 240px; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { min-height: 34dvh; padding: 30px; }
  #view { padding: 16px 16px 40px; }
  .topbar { padding: 14px 16px 0; }
  .menu-btn { display: grid; border: 1px solid var(--border); background: var(--surface); }
  .proj-row { grid-template-columns: 44px 1fr; }
  .proj-row .proj-money, .proj-row .chev { display: none; }
  .proj-row > div:nth-child(3) { grid-column: 2; display: flex; align-items: center; gap: 10px; }
  .proj-row > div:nth-child(3) .proj-client { margin-top: 0; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
}
