/* =========================================================================
   BestLaptop ERP — premium dashboard theme
   Brand tokens from the reference app, elevated into a distinctive,
   professional look (dark sidebar + refined content surfaces).
   ========================================================================= */
:root {
  --radius: 0.625rem;
  --radius-lg: 0.875rem;

  --background: #ffffff;
  --foreground: #0a0a0a;
  --card: #ffffff;

  --primary: #1d65d7;
  --primary-foreground: #ffffff;
  --primary-hover: #1856bb;
  --primary-soft: #e8f0fd;

  --secondary: #f1f5f9;
  --muted: #f5f5f5;
  --muted-foreground: #6b7280;

  --destructive: #e40014;
  --destructive-soft: #fdecee;
  --success: #009588;
  --warning: #f59e0b;

  --border: #e7eaee;
  --input: #d8dde5;
  --ring: #1d65d7;
  --brand: #e40014;

  /* dark sidebar palette */
  --side-bg: #0e1626;
  --side-bg-2: #0b1220;
  --side-border: #1e293b;
  --side-text: #c4cedd;
  --side-muted: #6b7a90;
  --side-active-bg: rgba(29, 101, 215, 0.16);
  --side-hover-bg: rgba(148, 163, 184, 0.10);

  --chart-1: #f05100;
  --chart-2: #009588;
  --chart-3: #104e64;
  --chart-4: #fcbb00;
  --chart-5: #1d65d7;

  --app-bg: #f4f6fa;
  --sidebar-width: 268px;
  --topbar-height: 62px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 6px 18px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--app-bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
svg { display: block; }
button { font-family: inherit; }

/* ================================================================= shell */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.22s ease;
}
.app.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }

/* scrim is desktop-hidden and never participates in the grid */
.scrim { display: none; }

/* =============================================================== sidebar */
.sidebar {
  background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
  border-right: 1px solid var(--side-border);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  height: var(--topbar-height);
  padding: 0 20px;
  border-bottom: 1px solid var(--side-border);
  flex-shrink: 0;
}
.sidebar__brand .logo { width: 30px; height: 30px; flex-shrink: 0; filter: drop-shadow(0 2px 6px rgba(228,0,20,0.45)); }
.sidebar__brand-text { font-weight: 700; font-size: 16.5px; letter-spacing: -0.01em; color: #fff; }
.sidebar__brand-sub { font-size: 10.5px; color: var(--side-muted); letter-spacing: 0.04em; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 14px 14px 22px; }
.sidebar__nav::-webkit-scrollbar { width: 8px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: #243049; border-radius: 8px; }
.sidebar__nav::-webkit-scrollbar-track { background: transparent; }

.nav-main {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius);
  font-weight: 600; color: #e7edf6; margin-bottom: 8px;
  border: 1px solid transparent;
}
.nav-main:hover { background: var(--side-hover-bg); }
.nav-main .lucide { width: 18px; height: 18px; color: #9fb0c8; }

.nav-group { margin-top: 16px; }
.nav-group__label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--side-muted);
  padding: 0 12px; margin-bottom: 7px;
}

.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px; border-radius: var(--radius);
  color: var(--side-text); font-size: 13.5px;
  margin-bottom: 2px;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item:hover { background: var(--side-hover-bg); color: #fff; }
.nav-item .lucide { width: 17px; height: 17px; color: var(--side-muted); flex-shrink: 0; transition: color 0.12s ease; }
.nav-item:hover .lucide { color: #cdd8e8; }

.nav-item.active {
  background: var(--side-active-bg);
  color: #fff; font-weight: 600;
}
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-item.active .lucide { color: #6aa1f2; }

.sidebar__footer { border-top: 1px solid var(--side-border); padding: 12px 16px 16px; flex-shrink: 0; }
.logout-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; cursor: pointer;
  color: #ff6b76; font-weight: 600; font-size: 13.5px;
  padding: 8px 8px; border-radius: var(--radius);
}
.logout-btn:hover { background: rgba(228, 0, 20, 0.14); color: #ff8a93; }
.logout-btn .lucide { width: 17px; height: 17px; }

.user-card { margin-top: 8px; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); }
.user-card__avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: #fff; font-weight: 700; font-size: 13px;
}
.user-card__meta { min-width: 0; }
.user-card__name { font-weight: 600; font-size: 13px; color: #eef2f8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card__role { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; color: #6aa1f2; text-transform: uppercase; }

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

.topbar {
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.topbar__toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: none; background: none;
  border-radius: 9px; cursor: pointer; color: #475569;
}
.topbar__toggle:hover { background: var(--secondary); }

.topbar__search {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px; min-width: 240px;
  background: var(--secondary); border: 1px solid transparent;
  border-radius: 999px; color: var(--muted-foreground);
}
.topbar__search:focus-within { border-color: var(--input); background: #fff; }
.topbar__search .lucide { width: 16px; height: 16px; }
.topbar__search input { border: none; background: none; outline: none; font-size: 13.5px; width: 100%; color: var(--foreground); }

.topbar__spacer { flex: 1; }
.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: 1px solid var(--border);
  background: #fff; border-radius: 10px; cursor: pointer; color: #475569;
}
.icon-btn:hover { background: var(--secondary); }
.icon-btn .lucide { width: 18px; height: 18px; }
.icon-btn__dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--destructive); border: 2px solid #fff; }

.topbar__user { display: flex; align-items: center; gap: 9px; padding: 4px 4px 4px 4px; }
.topbar__user .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: #fff; font-weight: 700; font-size: 12.5px;
}
.topbar__user .name { font-weight: 600; font-size: 13px; }
.topbar__user .role { font-size: 11px; color: var(--muted-foreground); }

/* =============================================================== content */
.content { padding: 24px 28px 56px; max-width: 1440px; width: 100%; }

/* breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 7px; color: var(--muted-foreground); font-size: 12.5px; margin-bottom: 12px; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .lucide { width: 14px; height: 14px; opacity: 0.6; }
.breadcrumb .current { color: var(--foreground); font-weight: 600; }

/* page header with actions */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header__title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0; display: flex; align-items: center; gap: 12px; }
.page-header__title .title-ico {
  width: 42px; height: 42px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.page-header__title .title-ico .lucide { width: 22px; height: 22px; }
.page-header__subtitle { color: var(--muted-foreground); margin: 6px 0 0 54px; font-size: 14px; }
.page-header__actions { display: flex; gap: 10px; flex-shrink: 0; }

/* welcome banner */
.welcome {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg); padding: 26px 28px; margin-bottom: 26px;
  background: linear-gradient(120deg, #0e1626 0%, #14366e 60%, #1d65d7 130%);
  color: #fff; box-shadow: var(--shadow-md);
}
.welcome::after {
  content: ""; position: absolute; right: -40px; top: -60px; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(255,255,255,0.12), transparent 70%);
}
.welcome h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.02em; }
.welcome p { margin: 0; color: #c7d6ef; font-size: 14px; }
.welcome .chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18);
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.welcome .chip .lucide { width: 14px; height: 14px; }

/* stat row */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-xs); display: flex; align-items: center; gap: 14px;
}
.stat__ico { width: 44px; height: 44px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.stat__ico .lucide { width: 21px; height: 21px; }
.stat__label { font-size: 12.5px; color: var(--muted-foreground); }
.stat__value { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }

/* dashboard module groups + cards */
/* checkbox grids (user form) */
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.check-row { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 4px; }

/* document detail */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.info-grid__val { font-weight: 600; font-size: 14px; margin-top: 2px; }
.item-add { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.item-add .form-select { max-width: 280px; }

/* analytics */
.analytics { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 30px; }
.analytics__chart { flex: 2 1 360px; }
.analytics__side { flex: 1 1 260px; }
.analytics .panel { padding: 18px 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.panel-head__sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted-foreground); }
.chart-box { height: 240px; position: relative; }
.mini-list { list-style: none; margin: 0 0 4px; padding: 0; }
.mini-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.mini-list li:last-child { border-bottom: none; }
.mini-list__name { color: #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-list__num { font-weight: 700; }
.mini-list__empty { color: var(--muted-foreground); justify-content: center !important; }
.receivable-card { margin-top: 14px; padding: 14px; border-radius: var(--radius); background: var(--primary-soft); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
@media (max-width: 980px) { .analytics { grid-template-columns: 1fr; } }

.dash-group { margin-bottom: 30px; }
.dash-group__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.dash-group__ico { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.dash-group__ico .lucide { width: 16px; height: 16px; }
.dash-group__label { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #334155; }
.dash-group__count { font-size: 11.5px; color: var(--muted-foreground); background: var(--secondary); padding: 2px 9px; border-radius: 999px; font-weight: 600; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(264px, 1fr)); gap: 14px; }
.module-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.module-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.module-card__icon {
  width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.module-card__icon .lucide { width: 21px; height: 21px; }
.module-card__body { min-width: 0; flex: 1; }
.module-card__label { font-weight: 600; font-size: 14px; color: var(--foreground); }
.module-card__desc { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.module-card__arrow { color: #c0c8d4; transition: color 0.15s ease, transform 0.15s ease; }
.module-card:hover .module-card__arrow { color: var(--primary); transform: translateX(3px); }
.module-card__arrow .lucide { width: 18px; height: 18px; }

/* per-group accent colors */
.g-master   .icon-accent { background: #334155; }
.g-hr        .icon-accent { background: var(--chart-2); }
.g-finance   .icon-accent { background: var(--chart-3); }
.g-warehouse .icon-accent { background: var(--chart-1); }
.g-sales     .icon-accent { background: var(--primary); }
.g-other     .icon-accent { background: #64748b; }

/* ============================================================== module page */
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); overflow: hidden;
}
.toolbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.toolbar__search {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  background: var(--secondary); border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted-foreground); flex: 1 1 200px; min-width: 180px; max-width: 320px;
  transition: border-color .12s, box-shadow .12s;
}
.toolbar__search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.toolbar__search input { border: none; background: none; outline: none; width: 100%; font-size: 13.5px; color: var(--foreground); }
.toolbar__search .lucide { width: 16px; height: 16px; flex-shrink: 0; }

/* compact filter controls grouped to the right */
.toolbar__filters { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.filter-ctl {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; color: var(--muted-foreground);
  transition: border-color .12s, box-shadow .12s;
}
.filter-ctl:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.filter-ctl > .lucide { width: 15px; height: 15px; flex-shrink: 0; }
.filter-ctl select { border: none; background: none; outline: none; font-size: 13px; color: var(--foreground); height: 100%; padding-right: 2px; cursor: pointer; min-width: 92px; }
.filter-ctl--date input[type="date"] { border: none; background: none; outline: none; font-size: 12.5px; color: var(--foreground); width: 116px; }
.filter-ctl__dash { color: var(--muted-foreground); font-size: 12px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500; color: #475569; cursor: pointer;
}
.chip-btn:hover { background: var(--secondary); }
.chip-btn .lucide { width: 16px; height: 16px; }
.toolbar__spacer { flex: 1; }

table.data { width: 100%; border-collapse: collapse; }
table.data thead th {
  text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted-foreground); padding: 12px 16px; border-bottom: 1px solid var(--border); background: #fafbfc;
}
table.data tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.table-empty { padding: 56px 24px; text-align: center; }
.table-empty__icon {
  width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.table-empty__icon .lucide { width: 26px; height: 26px; }
.table-empty h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.table-empty p { margin: 0 auto; color: var(--muted-foreground); max-width: 420px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; background: var(--warning); color: #fff;
}
.badge .lucide { width: 13px; height: 13px; }
.badge--soft { background: #fff4e0; color: #b45309; }
.badge--ok { background: #e7f6f3; color: #047a6e; }
.badge--warn { background: #fff4e0; color: #b45309; }
.badge--danger { background: #fdecee; color: #c30012; }
.badge--info { background: #e8f0fd; color: #1856bb; }

/* table extras */
table.data tbody td.muted { color: var(--muted-foreground); }
table.data tbody tr:hover { background: #fafbfc; }
.table-foot { padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: 12.5px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar__select { width: auto; min-width: 160px; height: 38px; }
.toolbar__date { width: auto; height: 38px; min-width: 140px; }
.toolbar__dash { color: var(--muted-foreground); }
.table-totals { color: var(--foreground); font-size: 12.5px; }
.table-totals b { color: var(--muted-foreground); font-weight: 600; }
.pager { display: flex; align-items: center; gap: 4px; }
.pager__btn {
  min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border); background: #fff;
  border-radius: 8px; cursor: pointer; color: #475569; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.pager__btn:hover { background: var(--secondary); }
.pager__btn.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager__btn .lucide { width: 15px; height: 15px; }
.pager__dots { padding: 0 4px; color: var(--muted-foreground); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-act {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 1px solid var(--border); background: #fff;
  border-radius: 8px; cursor: pointer; color: #475569;
}
.icon-act:hover { background: var(--secondary); color: var(--foreground); }
.icon-act .lucide { width: 15px; height: 15px; }
.icon-act--danger:hover { background: var(--destructive-soft); color: var(--destructive); border-color: #f6c9ce; }

/* form fields (shared by modal forms) */
.form-input, .form-select {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--input);
  border-radius: var(--radius); font-size: 13.5px; font-family: inherit;
  background: var(--background); color: var(--foreground);
}
textarea.form-input { height: auto; padding: 10px 12px; resize: vertical; }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgba(29,101,215,0.15); }
.field-hint { font-size: 11.5px; color: var(--muted-foreground); margin-top: 4px; }
.field-error { font-size: 12px; color: var(--destructive); margin-top: 5px; }
.field .req { color: var(--destructive); }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(2, 6, 23, 0.5);
  display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto;
  animation: fade 0.12s ease;
}
.modal {
  width: 100%; max-width: 520px; background: var(--card); border-radius: 16px;
  box-shadow: var(--shadow-lg); animation: pop 0.14s ease;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal__head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.modal__close { width: 32px; height: 32px; border: none; background: none; border-radius: 8px; cursor: pointer; color: var(--muted-foreground); display: inline-flex; align-items: center; justify-content: center; }
.modal__close:hover { background: var(--secondary); color: var(--foreground); }
.modal__close .lucide { width: 18px; height: 18px; }
.modal__body { padding: 20px 22px; max-height: 62vh; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ================================================================ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid transparent; font-weight: 600; font-size: 13.5px; cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.btn--primary { background: var(--primary); color: var(--primary-foreground); box-shadow: 0 1px 2px rgba(29,101,215,0.3); }
.btn--primary:hover { background: var(--primary-hover); }
.btn--ghost { background: #fff; border-color: var(--border); color: #475569; }
.btn--ghost:hover { background: var(--secondary); }
.btn--block { width: 100%; }
.btn .lucide { width: 17px; height: 17px; }

/* ================================================================== login */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -20%, #16335f 0%, transparent 55%), #0e1626;
}
.auth-card {
  width: 100%; max-width: 410px; background: var(--card);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 34px 32px;
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 22px; }
.auth-brand .logo { width: 36px; height: 36px; filter: drop-shadow(0 3px 8px rgba(228,0,20,0.4)); }
.auth-brand span { font-weight: 700; font-size: 20px; }
.auth-card h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; text-align: center; }
.auth-card .sub { color: var(--muted-foreground); text-align: center; margin: 0 0 24px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 7px; }
.field input {
  width: 100%; height: 44px; padding: 0 13px; border: 1px solid var(--input);
  border-radius: var(--radius); font-size: 14px; font-family: inherit; background: var(--background); color: var(--foreground);
}
.field input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgba(29,101,215,0.15); }
.auth-error { background: var(--destructive-soft); color: var(--destructive); border: 1px solid #f6c9ce; border-radius: var(--radius); padding: 10px 12px; font-size: 13px; margin-bottom: 16px; }
.auth-hint { margin-top: 18px; text-align: center; font-size: 12px; color: var(--muted-foreground); }

/* ============================================================== responsive */
@media (max-width: 980px) {
  .topbar__search { min-width: 0; width: 38px; padding: 0; justify-content: center; }
  .topbar__search input { display: none; }
  .topbar__user .name, .topbar__user .role { display: none; }
}
@media (max-width: 860px) {
  .app, .app.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 60; width: var(--sidebar-width);
    transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg);
  }
  .app.sidebar-open .sidebar { transform: translateX(0); }
  .app.sidebar-open .scrim { display: block; position: fixed; inset: 0; background: rgba(2,6,23,0.5); z-index: 50; }
  .content { padding: 18px 16px 48px; }
  .page-header__subtitle { margin-left: 0; }
}

/* ============================================================== dark mode */
html[data-theme="dark"] {
  --background: #151e30;
  --foreground: #e6eaf2;
  --card: #151e30;
  --secondary: #1c2740;
  --muted: #1c2740;
  --muted-foreground: #9aa7bd;
  --border: #2a3650;
  --input: #33415c;
  --primary-soft: rgba(29, 101, 215, 0.20);
  --destructive-soft: rgba(228, 0, 20, 0.18);
  --app-bg: #0b1120;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 6px 18px rgba(0,0,0,.45);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.55);
}
html[data-theme="dark"] .topbar { background: rgba(21,30,48,0.82); }
html[data-theme="dark"] .topbar__toggle,
html[data-theme="dark"] .icon-btn,
html[data-theme="dark"] .icon-act,
html[data-theme="dark"] .chip-btn,
html[data-theme="dark"] .btn--ghost,
html[data-theme="dark"] .pager__btn { background: var(--card); color: #cbd5e1; }
html[data-theme="dark"] .icon-btn__dot { border-color: var(--card); }
html[data-theme="dark"] table.data thead th { background: #1a2336; }
html[data-theme="dark"] table.data tbody tr:hover { background: #1a2336; }
html[data-theme="dark"] .topbar__search:focus-within { background: var(--card); }
html[data-theme="dark"] .dash-group__label,
html[data-theme="dark"] .mini-list__name,
html[data-theme="dark"] .info-grid__val { color: #cdd6e6; }
html[data-theme="dark"] .module-card__arrow { color: #5b6678; }
html[data-theme="dark"] .pager__btn.is-active { color: #fff; }

/* ============================================================ notifications */
.notif-wrap { position: relative; }
.icon-btn__badge {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--destructive); color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--card);
}
.notif-panel {
  display: none; position: absolute; right: 0; top: 46px; width: 320px; z-index: 60;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.notif-wrap.open .notif-panel { display: block; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--foreground); }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--secondary); }
.notif-item__ico { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.notif-item__ico .lucide { width: 17px; height: 17px; }
.notif-danger { background: var(--destructive-soft); color: var(--destructive); }
.notif-warn { background: #fff4e0; color: #b45309; }
.notif-info { background: var(--primary-soft); color: var(--primary); }
.notif-item__text { flex: 1; font-size: 13px; }
.notif-item__arrow { width: 15px; height: 15px; color: #c0c8d4; }
.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 30px 16px; color: var(--muted-foreground); font-size: 13px; }
.notif-empty .lucide { width: 26px; height: 26px; color: var(--success); }

/* ---- Service Kanban ---- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban__col { flex: 0 0 240px; background: var(--muted); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; }
.kanban__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--border); }
.kanban__count { background: var(--primary); color: #fff; border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.kanban__cards { padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.kanban__card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.kanban__card-title { font-weight: 600; font-size: 13px; color: var(--primary); text-decoration: none; }
.kanban__card-sub { font-size: 13px; margin-top: 2px; }
.kanban__card-meta { font-size: 12px; color: var(--muted-foreground); }
.kanban__card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.kanban__tech { font-size: 11.5px; color: var(--muted-foreground); display: flex; align-items: center; gap: 4px; }
.kanban__tech .lucide { width: 13px; height: 13px; }
.kanban__empty { text-align: center; color: var(--muted-foreground); font-size: 12px; padding: 8px; }

/* ---- Stepper ---- */
.stepper { display: flex; gap: 6px; flex-wrap: wrap; }
.stepper__step { display: flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px; border-radius: 999px; background: var(--muted); font-size: 12.5px; color: var(--muted-foreground); }
.stepper__step--current { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.stepper__step--done { color: var(--success); }
.stepper__dot { width: 20px; height: 20px; border-radius: 50%; background: var(--border); color: var(--foreground); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.stepper__step--current .stepper__dot { background: var(--primary); color: #fff; }
.stepper__step--done .stepper__dot { background: var(--success); color: #fff; }
.stepper__dot .lucide { width: 12px; height: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.panel__title { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
.form-stack { display: flex; flex-direction: column; gap: 10px; }
.form-stack .field { display: flex; flex-direction: column; gap: 4px; }

/* ---- Login demo accounts ---- */
.demo-accounts { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.demo-accounts__title { font-size: 12px; color: var(--muted-foreground); display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.demo-accounts__title .lucide { width: 14px; height: 14px; }
.demo-accounts__list { display: flex; flex-direction: column; gap: 8px; }
.demo-acc { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--card); cursor: pointer; transition: border-color .12s, background .12s; text-align: left; }
.demo-acc:hover { border-color: var(--primary); background: var(--primary-soft); }
.demo-acc--on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary-soft); }
.demo-acc__role { font-size: 13px; font-weight: 600; color: var(--foreground); }
.demo-acc__user { font-size: 12px; color: var(--muted-foreground); font-family: ui-monospace, monospace; }

/* ---- Large modal (kanban service detail) ---- */
.modal--lg { max-width: 880px; width: 94vw; }
.modal__scroll { max-height: calc(86vh - 60px); overflow-y: auto; padding: 18px; }
.svc-detail__head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.svc-detail__title { font-size: 18px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.svc-detail__sub { margin: 4px 0 0; color: var(--muted-foreground); font-size: 13px; }
.modal__head h3 { display: flex; align-items: center; gap: 8px; }
.modal__head h3 .lucide { width: 17px; height: 17px; }

/* ---- Smooth page & modal transitions (GPU-composited) ---- */
.page-enter { animation: pageEnter .22s cubic-bezier(.16, 1, .3, 1); }
@keyframes pageEnter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.modal-overlay { animation: overlayIn .14s ease; }
.modal { animation: modalIn .2s cubic-bezier(.16, 1, .3, 1); }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
/* HTMX content swap fade for table/partials */
.htmx-swapping { opacity: .35; transition: opacity .1s ease; }
@media (prefers-reduced-motion: reduce) {
  .page-enter, .modal-overlay, .modal { animation: none; }
}

/* ---- Native View Transitions: smooth crossfade scoped to the content area only ---- */
#page { view-transition-name: page-main; }
@media (prefers-reduced-motion: no-preference) {
  /* keep the shell (sidebar/topbar) static — only the content area transitions */
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  ::view-transition-old(page-main) { animation: vtOut .18s ease both; }
  ::view-transition-new(page-main) { animation: vtIn .30s cubic-bezier(.16, 1, .3, 1) both; }
}
@keyframes vtOut { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* tabular numerals for right-aligned numeric/money columns */
.td-num { font-variant-numeric: tabular-nums; }

/* ---- Professional form grid + toolbar reset ---- */
.modal--form { max-width: 600px; width: 94vw; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .field { margin: 0; display: flex; flex-direction: column; gap: 5px; }
.form-grid .field--full { grid-column: 1 / -1; }
.form-grid .field label { font-size: 12.5px; font-weight: 600; color: var(--foreground); }
.form-grid .field input, .form-grid .field select, .form-grid .field textarea { width: 100%; }
.form-grid .field--invalid input, .form-grid .field--invalid select, .form-grid .field--invalid textarea { border-color: var(--destructive); }
.field-error { font-size: 11.5px; color: var(--destructive); }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* ---- Toolbar reset (shown only when a filter is active) ---- */
.toolbar__reset {
  display: none; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--destructive); cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.toolbar__reset:hover { background: var(--destructive); color: #fff; border-color: var(--destructive); }
.toolbar__reset.is-on { display: inline-flex; }
.toolbar__reset .lucide { width: 15px; height: 15px; }

/* ---- Report toolbar bits (period label + PDF action) ---- */
.toolbar__lbl { font-size: 12.5px; font-weight: 600; color: var(--muted-foreground); }
.toolbar__action {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 13px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--foreground); text-decoration: none; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.toolbar__action:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.toolbar__action .lucide { width: 15px; height: 15px; }
.filter-ctl--date input[type="date"]::-webkit-calendar-picker-indicator { opacity: .5; cursor: pointer; }

/* ============================ Customer Portal (public) ============================ */
body.portal { background: var(--app-bg); }
.portal__topbar {
  height: 64px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 18px; padding: 0 28px; position: sticky; top: 0; z-index: 20;
}
.portal__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.portal__brand img { width: 30px; height: 30px; }
.portal__brand small { font-weight: 600; color: var(--primary); font-size: 12px; }
.portal__nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.portal__nav a { padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--muted-foreground); }
.portal__nav a:hover { background: var(--secondary); color: var(--foreground); }
.portal__nav a.is-on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.portal__staff { display: inline-flex; align-items: center; gap: 6px; color: var(--foreground) !important; border: 1px solid var(--border); }
.portal__staff .lucide { width: 14px; height: 14px; }
.portal__main { max-width: 1080px; margin: 0 auto; padding: 28px 24px 48px; }
.portal__footer { max-width: 1080px; margin: 0 auto; padding: 20px 24px 36px; display: flex; justify-content: space-between; color: var(--muted-foreground); font-size: 12.5px; flex-wrap: wrap; gap: 8px; }

.portal-hero {
  background: linear-gradient(135deg, var(--side-bg) 0%, #16243d 100%); color: #fff;
  border-radius: 18px; padding: 44px 40px; margin-bottom: 32px;
}
.portal-hero__text h1 { font-size: 30px; margin: 0 0 10px; letter-spacing: -.02em; max-width: 620px; }
.portal-hero__text p { color: #b9c4d6; max-width: 560px; margin: 0 0 22px; }
.portal-hero__cta { display: flex; gap: 12px; flex-wrap: wrap; }
.portal-hero__stats { display: flex; gap: 36px; margin-top: 28px; }
.portal-hero__stats strong { font-size: 22px; display: block; }
.portal-hero__stats span { font-size: 12.5px; color: #93a2ba; }

.portal-section { margin-bottom: 28px; }
.portal-section__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.portal-section__head h2 { font-size: 19px; margin: 0; }
.portal-section__head a { color: var(--primary); font-weight: 600; font-size: 14px; }
.portal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.portal-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; transition: box-shadow .15s, transform .15s; }
.portal-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.portal-card__media { height: 120px; background: linear-gradient(135deg, var(--primary-soft), #f1f5fb); display: flex; align-items: center; justify-content: center; }
.portal-card__media .lucide { width: 46px; height: 46px; color: var(--primary); }
.portal-card__body { padding: 14px 16px; }
.portal-card__cat { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-foreground); }
.portal-card__body h3 { font-size: 15px; margin: 4px 0 8px; }
.portal-card__price { font-size: 17px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.portal-card__meta { display: flex; gap: 6px; flex-wrap: wrap; }

.portal-track { max-width: 680px; margin: 0 auto; }
.portal-track__head { text-align: center; margin-bottom: 22px; }
.portal-track__head h2 { display: inline-flex; align-items: center; gap: 8px; font-size: 22px; margin: 0 0 6px; }
.portal-track__head p { color: var(--muted-foreground); margin: 0; }
.portal-track__form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.portal-track__form .field { display: flex; flex-direction: column; gap: 5px; }
.portal-track__form .field label { font-size: 12.5px; font-weight: 600; }
@media (max-width: 620px) { .portal-track__form { grid-template-columns: 1fr; } }

.portal-result { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 22px; margin-top: 22px; }
.portal-result__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.portal-result__head h3 { margin: 4px 0; font-size: 18px; }
.portal-steps { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 0 18px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.portal-step { display: flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px; border-radius: 999px; background: var(--muted); font-size: 12.5px; color: var(--muted-foreground); }
.portal-step--current { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.portal-step--done { color: var(--success); }
.portal-step__dot { width: 20px; height: 20px; border-radius: 50%; background: var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.portal-step--current .portal-step__dot { background: var(--primary); color: #fff; }
.portal-step--done .portal-step__dot { background: var(--success); color: #fff; }
.portal-step__dot .lucide { width: 12px; height: 12px; }
.portal-result__info { display: flex; gap: 36px; flex-wrap: wrap; }
.portal-result__info span { display: block; font-size: 12px; }
.portal-result__ready { margin-top: 16px; padding: 12px 14px; background: var(--primary-soft); color: var(--primary); border-radius: 10px; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.portal-empty { text-align: center; padding: 40px 16px; color: var(--muted-foreground); }
.portal-empty .lucide { width: 34px; height: 34px; margin-bottom: 8px; }

/* ============================ Service Kanban Board (reference-style) ============================ */
.svc-filters { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.svc-filter { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; }
.svc-filter__lbl { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted-foreground); }
.svc-filter__lbl .lucide { width: 14px; height: 14px; }
.svc-filter__lbl--dl { color: var(--chart-1); }
.svc-filter input[type="date"] { border: 1px solid var(--border); border-radius: 7px; padding: 5px 8px; font-size: 12.5px; }

.svc-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.svc-col { flex: 0 0 290px; background: #eef1f6; border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 250px); }
.svc-col__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; color: #fff; font-weight: 700; font-size: 15px; border-radius: 12px 12px 0 0; }
.svc-col__count { background: rgba(255,255,255,.25); border-radius: 999px; padding: 1px 10px; font-size: 13px; }
.svc-col--slate .svc-col__head { background: #475569; }
.svc-col--blue .svc-col__head { background: var(--primary); }
.svc-col--green .svc-col__head { background: var(--success); }
.svc-col--red .svc-col__head { background: var(--destructive); }
.svc-col__body { overflow-y: auto; padding: 6px; }
.svc-sub { margin-bottom: 8px; }
.svc-sub__head { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-foreground); }
.svc-sub__count { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; }
.svc-dropzone { min-height: 40px; padding: 4px; border-radius: 8px; display: flex; flex-direction: column; gap: 8px; transition: background .12s; }
.svc-dropzone--over { background: var(--primary-soft); outline: 2px dashed var(--primary); }
.svc-dropzone__empty { text-align: center; color: #b8c0cc; font-size: 12px; padding: 6px; }

.svc-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(16,24,40,.05); transition: box-shadow .12s, transform .12s; }
.svc-card:hover { box-shadow: var(--shadow-md); }
.svc-card--dragging { opacity: .5; transform: rotate(1.5deg); }
.svc-card__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.svc-card__no { font-size: 11.5px; font-weight: 700; background: var(--secondary); border-radius: 6px; padding: 2px 7px; color: #334155; }
.svc-card__date { font-size: 11px; color: var(--success); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.svc-card__cabang { font-size: 11.5px; font-weight: 600; color: var(--destructive); margin-bottom: 4px; }
.svc-card__cust, .svc-card__dev { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 3px; }
.svc-card__cust { font-weight: 600; }
.svc-card__dev { color: var(--muted-foreground); font-size: 12.5px; }
.svc-card__cust .lucide, .svc-card__dev .lucide { width: 14px; height: 14px; flex-shrink: 0; color: var(--muted-foreground); }
.svc-card__deadline { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; color: #b45309; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 6px; padding: 3px 7px; margin: 5px 0; }
.svc-card__deadline .lucide { width: 12px; height: 12px; }
.svc-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.svc-card__tags { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.svc-card__invoice { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--primary); border: 1px solid var(--primary); border-radius: 6px; padding: 2px 7px; }
.svc-card__invoice .lucide { width: 12px; height: 12px; }
.svc-card__tech { display: flex; align-items: center; gap: 6px; }
.svc-card__techname { font-size: 11px; font-weight: 700; line-height: 1.1; text-align: right; }
.svc-card__techname small { display: block; font-weight: 500; color: var(--muted-foreground); font-size: 9.5px; }
.svc-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #3b82f6); color: #fff; font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

.recap-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.recap-row__head { display: flex; justify-content: space-between; align-items: center; }
.recap-row__subs { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; padding-left: 4px; }
.recap-row__subs > div { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted-foreground); }

/* ============================ Absensi — HR Dashboard (self check-in) ============================ */
.absen-clock-card { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 32px 24px; text-align: center; margin-bottom: 22px; }
.absen-clock-card__label { color: var(--muted-foreground); font-size: 13.5px; }
.absen-clock { font-size: 52px; font-weight: 800; letter-spacing: 1px; line-height: 1.1; margin: 6px 0; font-variant-numeric: tabular-nums; }
.absen-clock-card__date { color: var(--muted-foreground); font-size: 14px; }
.absen-shift { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 600; background: var(--secondary); border-radius: 999px; padding: 4px 14px; color: #475569; }
.absen-actions { margin-top: 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.absen-since { color: var(--muted-foreground); font-size: 13px; }
.btn--lg { height: 50px; padding: 0 40px; font-size: 16px; font-weight: 700; border-radius: 12px; }
.btn--success { background: var(--success); color: #fff; border: none; }
.btn--success:hover { filter: brightness(.95); }
.absen-done { display: inline-flex; align-items: center; gap: 8px; color: var(--success); font-weight: 600; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 12px; padding: 12px 20px; }
.absen-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }
.absen-stat { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 18px 14px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.absen-stat .lucide { width: 22px; height: 22px; margin-bottom: 4px; }
.absen-stat strong { font-size: 26px; font-weight: 800; }
.absen-stat span { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: var(--muted-foreground); }
@media (max-width: 900px) { .absen-stats { grid-template-columns: repeat(2, 1fr); } }

/* ============================ Service ticket detail modal (3-tab, reference) ============================ */
.modal--xl { max-width: 1080px; width: 96vw; }
.svc-modal { display: flex; flex-direction: column; max-height: 92vh; padding: 0; }
.svc-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; background: linear-gradient(135deg, #5b6b85, #475569); color: #fff; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.svc-modal__head h3 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.svc-modal__head .badge { background: rgba(255,255,255,.22); color: #fff; }
.modal__close--light { color: #fff; }
.svc-modal__scroll { padding: 18px 22px; overflow-y: auto; flex: 1; }
.svc-modal__foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: #fafbfc; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.svc-tags { display: flex; align-items: center; gap: 10px; padding: 10px 0 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.svc-tags__icon { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted-foreground); }
.svc-tags__icon .lucide { width: 15px; height: 15px; }
.svc-tags__chips { display: flex; gap: 5px; flex-wrap: wrap; }
.svc-tags .form-input { flex: 1; min-width: 180px; }

.svc-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.svc-tab { background: none; border: none; padding: 9px 16px; font-size: 14px; font-weight: 600; color: var(--muted-foreground); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.svc-tab:hover { color: var(--foreground); }
.svc-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

.svc-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.svc-row-biaya { display: grid; grid-template-columns: 1.7fr 1fr; gap: 14px; }
@media (max-width: 760px) { .svc-row2, .svc-row-biaya { grid-template-columns: 1fr; } }

.svc-pic { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.svc-avatar--lg { width: 40px; height: 40px; font-size: 14px; }
.svc-avatar--outlet { width: 40px; height: 40px; background: linear-gradient(135deg, #64748b, #94a3b8); }
.svc-avatar--outlet .lucide { width: 20px; height: 20px; color: #fff; }

.svc-panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.svc-panel__head { background: #0e1626; color: #fff; padding: 11px 16px; font-size: 13.5px; font-weight: 700; letter-spacing: .02em; }
.svc-panel__head--accent { background: #0e1626; }
.svc-panel__body { padding: 16px; }
.svc-panel__foot { padding: 0 16px 16px; text-align: right; }

.svc-complaint { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.svc-complaint:last-child { border-bottom: none; }
.svc-complaint b { display: block; font-size: 13px; color: var(--destructive); }
.svc-complaint .muted { font-size: 12px; }
.svc-complaint-add { display: flex; gap: 8px; margin-top: 10px; }
.svc-complaint-add .form-input:first-of-type { flex: 1; }

.svc-invoice__row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--border); }
.svc-invoice__row--total { border-bottom: none; border-top: 2px solid var(--border); margin-top: 4px; padding-top: 10px; font-size: 15px; }
.svc-invoice__row--total b { color: var(--primary); }
.svc-neg { color: var(--success); }

.svc-check { padding: 8px 0; border-bottom: 1px solid var(--border); }
.svc-check:last-child { border-bottom: none; }
.svc-check__top { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.svc-check__top span:first-of-type { flex: 1; }
.svc-genrow { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.svc-genrow label { width: 130px; font-size: 12.5px; color: var(--muted-foreground); flex-shrink: 0; }
.svc-genrow .form-input { flex: 1; }
.svc-empty-box { border: 1px dashed var(--border); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted-foreground); font-size: 12.5px; }
.badge--warn { background: #fff7ed; color: #b45309; }

/* ============================ CRUD summary cards + sortable headers ============================ */
.crud-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; padding: 16px 16px 4px; }
.sumcard { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; }
.sumcard__icon { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--secondary); color: var(--muted-foreground); }
.sumcard__icon .lucide { width: 18px; height: 18px; }
.sumcard__val { font-size: 19px; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; }
.sumcard__lbl { font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted-foreground); margin-top: 2px; }
.sumcard--primary .sumcard__icon { background: var(--primary-soft); color: var(--primary); }
.sumcard--success .sumcard__icon { background: #e7f7f3; color: var(--success); }
.sumcard--warning .sumcard__icon { background: #fef3e2; color: var(--warning); }
.sumcard--danger  .sumcard__icon { background: var(--destructive-soft); color: var(--destructive); }
.sumcard--info    .sumcard__icon { background: #e8eefc; color: var(--chart-5); }
.sumcard--muted   .sumcard__icon { background: var(--secondary); color: var(--muted-foreground); }

.th-sort { display: inline-flex; align-items: center; gap: 5px; background: none; border: none; padding: 0; font: inherit; font-weight: inherit; color: inherit; cursor: pointer; letter-spacing: inherit; text-transform: inherit; }
.th-sort .lucide { width: 13px; height: 13px; opacity: .4; transition: opacity .12s; }
.th-sort:hover { color: var(--primary); }
.th-sort:hover .lucide { opacity: .8; }
.th-sort.is-sorted { color: var(--primary); }
.th-sort.is-sorted .lucide { opacity: 1; }

/* summary cards used on non-CRUD pages (kanban + reports) */
.crud-summary--flush { padding: 14px 16px; }
.svc-board ~ .crud-summary, #kanban-board > .crud-summary--flush { padding: 0 0 14px; }

/* ---- 2FA enrolment (QR + secret) ---- */
.twofa-enroll { display: flex; gap: 18px; margin: 12px 0; align-items: flex-start; flex-wrap: wrap; }
.twofa-qr { flex-shrink: 0; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px; width: 188px; height: 188px; box-shadow: var(--shadow-sm); }
.twofa-qr svg { width: 100%; height: 100%; display: block; }
.twofa-enroll__body { flex: 1; min-width: 230px; }

/* ---- Styled native file inputs (Migrasi & import forms) ---- */
input[type="file"] { font-size: 13px; color: var(--muted-foreground); max-width: 100%; }
input[type="file"]::file-selector-button {
  margin-right: 12px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--secondary); color: var(--foreground); font-weight: 600; font-size: 13px; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
input[type="file"]::file-selector-button:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* ---- Help page ---- */
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 820px) { .help-grid { grid-template-columns: 1fr; } }
.help-card { padding: 18px 22px; }
.help-card h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.help-card h3 .lucide { width: 17px; height: 17px; color: var(--primary); }
.help-card ul { margin: 0; padding-left: 18px; color: #334155; line-height: 1.8; font-size: 13.5px; }
.help-modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.help-module { display: flex; align-items: center; gap: 11px; padding: 12px 14px; background: var(--secondary); border-radius: 10px; }
.help-module .lucide { width: 20px; height: 20px; color: var(--primary); }
.help-module b { display: block; font-size: 13.5px; }
.help-module span { font-size: 11.5px; color: var(--muted-foreground); }

/* ============================ Mobile responsive polish ============================ */
@media (max-width: 860px) {
  html, body { overflow-x: hidden; }
  /* sidebar is position:fixed on mobile (out of grid flow) -> single content column so
     .main fills the viewport instead of collapsing into the 0-width first grid track. */
  .app, .app.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 16px 14px 44px; }

  /* page header: compact title, full-width actions */
  .page-header__title { font-size: 20px; gap: 9px; }
  .page-header__title .title-ico { width: 34px; height: 34px; }
  .page-header__title .title-ico .lucide { width: 18px; height: 18px; }
  .page-header__subtitle { margin-left: 0; font-size: 13px; }
  .page-header__actions { width: 100%; }
  .page-header__actions .btn { flex: 1; }

  /* tables scroll horizontally inside their panel (page width stays fixed) */
  #table-wrap, #tb-table, #gl-body, #pnl-body, .panel > .modal__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #table-wrap table.data, .panel table.data { width: max-content; min-width: 100%; }
  table.data thead th, table.data tbody td { white-space: nowrap; }

  /* toolbar: stack search + filters, full width (don't let flex grow them vertically) */
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .toolbar__search { max-width: none; flex: 0 0 auto; }
  .filter-ctl, .filter-ctl--date { flex: 0 0 auto; }
  .toolbar__filters { margin-left: 0; flex-wrap: wrap; }
  .toolbar__filters > * { flex: 1 1 auto; }
  .svc-filters { flex-direction: column; }
  .svc-filter { flex-wrap: wrap; }

  /* summary cards: 2 per row */
  .crud-summary, .crud-summary--flush { grid-template-columns: repeat(2, 1fr); padding: 12px 0; }

  /* dashboard */
  .welcome { padding: 18px; }
  .welcome h1 { font-size: 19px; }
  .stat-row { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
  .analytics { display: block; }
  .analytics__chart, .analytics__side { margin-bottom: 16px; }
  .card-grid { grid-template-columns: 1fr; }

  /* kanban board: columns become near-full-width, board scrolls */
  .svc-board { gap: 12px; }
  .svc-col { flex-basis: 82vw; }
  .svc-row2, .svc-row-biaya { grid-template-columns: 1fr; }

  /* wide modals fill the screen */
  .modal--xl, .modal--lg { width: 96vw; }
  .modal-overlay { padding: 24px 12px; }
}
@media (max-width: 480px) {
  .stat-row, .absen-stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  /* page-header action rows wrap; search goes full width, buttons don't clip */
  .page-header__actions { flex-wrap: wrap; }
  .page-header__actions .toolbar__search { max-width: none !important; flex: 1 1 100%; }
  .page-header__actions .btn, .page-header__actions .toolbar__action { white-space: nowrap; }
  /* date-range pills shrink + wrap so they never overflow the viewport */
  .filter-ctl--date { flex-wrap: wrap; }
  .filter-ctl--date input[type="date"], .svc-filter input[type="date"] { width: auto; min-width: 0; flex: 1 1 116px; }
  .svc-filters { gap: 10px; }
}

/* Notification dropdown: anchor to viewport on phones so it never clips off the left edge */
@media (max-width: 560px) {
  .notif-panel {
    position: fixed; top: calc(var(--topbar-height) + 4px);
    left: 12px; right: 12px; width: auto;
  }
}

/* ---- Professional checkbox / boolean field in CRUD forms ---- */
.field--check { align-self: center; }
.check-row { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--secondary); transition: border-color .12s, background .12s; }
.check-row:hover { border-color: var(--primary); background: var(--primary-soft); }
.form-grid .field input.form-check-input, .form-check-input { width: 20px; height: 20px; margin: 0; flex-shrink: 0; accent-color: var(--primary); cursor: pointer; }
.check-row:has(.form-check-input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.check-row__text { display: flex; flex-direction: column; gap: 1px; }
.check-row__label { font-size: 13.5px; font-weight: 600; color: var(--foreground); }
.check-row__hint { font-size: 11.5px; color: var(--muted-foreground); }

/* ---- Serial input with barcode-scan button ---- */
.input-scan { display: flex; gap: 8px; align-items: stretch; }
.form-grid .field .input-scan input, .input-scan input.form-input { flex: 1 1 auto; width: auto; min-width: 0; }
.btn-scan { flex-shrink: 0; width: 44px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--secondary); color: var(--primary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background .12s, border-color .12s; }
.btn-scan:hover { background: var(--primary-soft); border-color: var(--primary); }
.btn-scan .lucide { width: 19px; height: 19px; }

/* ---- Camera barcode scanner overlay ---- */
.scan-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(2,6,23,.78); display: flex; align-items: center; justify-content: center; padding: 16px; }
.scan-box { background: var(--card); border-radius: 16px; width: 100%; max-width: 420px; overflow: hidden; box-shadow: var(--shadow-lg); }
.scan-box__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 15px; }
.scan-box__head span { display: inline-flex; align-items: center; gap: 8px; }
.scan-box__head .lucide { width: 18px; height: 18px; }
.scan-box__close { border: none; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted-foreground); }
.scan-box__close:hover { color: var(--foreground); }
.scan-stage { position: relative; background: #000; aspect-ratio: 4 / 3; }
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-reticle { position: absolute; inset: 20% 12%; border: 3px solid rgba(255,255,255,.9); border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0,0,0,.22); }
.scan-status { padding: 12px 18px; font-size: 13px; color: var(--muted-foreground); text-align: center; }

/* locked (auto-managed) input, e.g. serial-item stock */
.form-input.is-locked { background: var(--secondary); color: var(--muted-foreground); cursor: not-allowed; }
.field-hint--lock { color: var(--primary); }

/* ---- Financial statement tables (Laba Rugi / Neraca) ---- */
.fin-report td { padding: 9px 16px; }
.fin-report .td-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-section td { background: var(--secondary); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-foreground); padding: 9px 16px; }
.fin-subtotal td { font-weight: 700; border-top: 1px solid var(--border); }
.fin-total td { font-weight: 800; font-size: 15px; border-top: 2px solid var(--border); background: var(--primary-soft); color: var(--primary); }
.fin-eq td { font-weight: 800; border-top: 2px solid var(--border); }
.fin-balanced { color: var(--success); } .fin-unbalanced { color: var(--destructive); }

/* ---- Manual journal form ---- */
.jm-table td, .jm-table th { padding: 8px 10px; }
.jm-table select.form-select, .jm-table input.form-input { width: 100%; }
.jm-totalrow td { font-weight: 700; border-top: 2px solid var(--border); }
