/* ============================================================
   Aplikasi Data Karyawan Glosin — stylesheet
   ============================================================ */
:root {
  --navy-950: #0b1220;
  --navy-900: #0f172a;
  --navy-800: #16213a;
  --navy-700: #1e2b47;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --bg: #eef3f6;
  --card: #ffffff;
  --border: #e2e9ec;
  --emerald: #2f5fd0;
  --emerald-dark: #2547a8;
  --emerald-soft: #e9edfb;
  --blue: #2e3e96;
  --blue-soft: #e9ebf7;
  --amber: #d97706;
  --amber-soft: #fdf3e2;
  --red: #e10613;
  --red-soft: #fdeaec;
  --violet: #7c5cd6;
  --violet-soft: #f0ecfc;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 10px 25px -12px rgba(15, 23, 42, .18), 0 4px 10px -6px rgba(15, 23, 42, .08);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .35);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --sidebar-w: 264px;
  --btn-h: 38px;
  --btn-h-sm: 32px;
  --btn-icon: 18px;
  --btn-icon-sm: 15px;
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--navy-900);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd8e5; border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b5c1d3; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- layout ---------------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: var(--sidebar-w); }
.view { padding: 26px 32px 48px; max-width: 1600px; width: 100%; margin: 0 auto; }

/* ---------------- sidebar ---------------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: linear-gradient(178deg, #0c2038 0%, #0a1828 55%, #081420 100%);
  color: #dbe4f3; display: flex; flex-direction: column;
  padding: 22px 16px 18px; border-right: 1px solid rgba(255,255,255,.04);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 22px; }
.brand-logo { width: 44px; height: auto; flex: 0 0 auto; display: block; background: #fff; border-radius: 6px; padding: 2px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; letter-spacing: .06em; color: #fff; font-weight: 700; }
.brand-text span { font-size: 11px; color: #8fa6a0; letter-spacing: .08em; margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em;
  color: #667792; padding: 18px 12px 8px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 10px; color: #aebbd0; font-weight: 500; font-size: 13.5px;
  transition: background .16s ease, color .16s ease, transform .16s ease;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.055); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(47, 95, 208, .30), rgba(47, 95, 208, .08)); color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: #3b74e0;
}
.nav-icon { width: 19px; height: 19px; display: inline-flex; color: #8fa1bd; }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { color: #3b74e0; }
.nav-icon svg { width: 100%; height: 100%; }
.nav-count {
  margin-left: auto; font-size: 11px; min-width: 22px; text-align: center;
  background: rgba(255,255,255,.08); color: #cdd9ec; padding: 1px 7px; border-radius: 20px;
}
.sidebar-footer { padding-top: 18px; border-top: 1px solid rgba(255,255,255,.06); margin-top: 12px; }
.sidebar-version { padding: 0 8px; font-size: 10.5px; color: #5d6d88; }

/* ---------------- topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px;
  padding: 16px 32px; background: rgba(255,255,255,.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; flex-direction: column; min-width: 180px; }
.eyebrow { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--slate-400); font-weight: 600; }
.topbar-title h1 { font-size: 19px; letter-spacing: -.01em; font-weight: 650; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.global-search {
  display: flex; align-items: center; gap: 8px; background: var(--slate-50);
  border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; width: 260px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.global-search:focus-within { border-color: #a9c4f5; background: #fff; box-shadow: 0 0 0 3px rgba(59,111,224,.1); }
.global-search span { display: inline-flex; color: var(--slate-400); width: 16px; height: 16px; }
.global-search svg { width: 100%; height: 100%; }
.global-search input { border: 0; background: transparent; outline: none; padding: 9px 0; width: 100%; font-size: 13px; }
.icon-btn {
  width: var(--btn-h); height: var(--btn-h); border-radius: 10px; border: 1px solid var(--border);
  background: #fff; display: inline-grid; place-items: center; color: var(--slate-600);
  flex: 0 0 auto; padding: 0;
}
.icon-btn > svg { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .55; pointer-events: none; }
.menu-btn { display: none; }
.btn > span[data-icon], .icon-btn > span[data-icon] {
  width: var(--btn-icon); height: var(--btn-icon); display: inline-flex; flex: 0 0 auto;
}
.btn > span[data-icon] > svg, .icon-btn > span[data-icon] > svg { width: 100%; height: 100%; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--btn-h); padding: 0 16px; line-height: 1;
  border-radius: 10px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  flex: 0 0 auto; vertical-align: middle;
  transition: transform .12s ease, background .15s ease, border-color .15s, box-shadow .15s;
}
.btn > svg { width: var(--btn-icon); height: var(--btn-icon); flex: 0 0 auto; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, #3a6fd8, #2547a8); color: #fff; box-shadow: 0 6px 14px -8px rgba(37,71,168,.9); }
.btn-primary:hover { background: linear-gradient(180deg, #4b82e8, #1d3c93); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--slate-700); }
.btn-ghost:hover { background: var(--slate-50); border-color: var(--slate-200); }
.btn-soft { background: var(--emerald-soft); color: var(--emerald-dark); }
.btn-soft:hover { background: #d8f2e8; }
.btn-danger { background: #fff; border-color: #f3c7c7; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { height: var(--btn-h-sm); padding: 0 12px; font-size: 12px; border-radius: 8px; gap: 6px; }
.btn-sm > svg { width: var(--btn-icon-sm); height: var(--btn-icon-sm); }
.btn-sm > span[data-icon] { width: var(--btn-icon-sm); height: var(--btn-icon-sm); }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------------- page head ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 23px; font-weight: 650; letter-spacing: -.02em; }
.page-head p { color: var(--slate-500); font-size: 13px; margin-top: 5px; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ---------------- cards ---------------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.card-head h3 { font-size: 15px; font-weight: 650; }
.card-head p { font-size: 12px; color: var(--slate-500); margin-top: 3px; }
.card-body { padding: 18px 22px 22px; }
.card-link { color: var(--blue); font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.card-link:hover { text-decoration: underline; }
.card-link svg { width: 12px; height: 12px; }
.section-title svg { width: 14px; height: 14px; }
.family-row .fi svg { width: 16px; height: 16px; }

/* ---------------- KPI ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi { padding: 20px; position: relative; overflow: hidden; }
.kpi::after {
  content: ""; position: absolute; right: -38px; top: -38px; width: 110px; height: 110px;
  border-radius: 50%; background: var(--kpi-soft, var(--emerald-soft)); opacity: .8;
}
.kpi-icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--kpi-soft, var(--emerald-soft)); color: var(--kpi-color, var(--emerald)); margin-bottom: 16px;
  position: relative; z-index: 1;
}
.kpi-icon span, .kpi-icon svg { width: 19px; height: 19px; }
.kpi-label { font-size: 12px; color: var(--slate-500); font-weight: 550; position: relative; z-index: 1; }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.03em; margin-top: 2px; position: relative; z-index: 1; }
.kpi-sub { font-size: 11.5px; color: var(--slate-400); margin-top: 6px; position: relative; z-index: 1; }
.kpi-sub strong { color: var(--slate-600); font-weight: 600; }

/* ---------------- dashboard grid ---------------- */
.dash-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; margin-bottom: 16px; }
.dash-grid.three { grid-template-columns: 1.55fr 1fr; }
.dash-col { display: flex; flex-direction: column; gap: 16px; }

/* bar chart */
.barlist { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 135px 1fr 42px; gap: 12px; align-items: center; }
.bar-row .lbl { font-size: 12.5px; color: var(--slate-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 9px; border-radius: 10px; background: var(--slate-100); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 10px; background: linear-gradient(90deg, #3b74e0, #2e3e96); min-width: 3px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.bar-row .val { font-size: 12.5px; font-weight: 650; color: var(--slate-700); text-align: right; }
.bar-row.alt .bar-fill { background: linear-gradient(90deg, #7c8fd8, #4a63bd); }

/* donut */
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut { position: relative; width: 138px; height: 138px; flex: 0 0 auto; }
.donut svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-center strong { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.donut-center span { font-size: 10.5px; color: var(--slate-400); text-transform: uppercase; letter-spacing: .08em; }
.legend { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--slate-600); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.legend-item strong { margin-left: auto; color: var(--slate-800, #1e293b); font-weight: 650; }

/* monthly movement */
.movement { width: 100%; height: 210px; display: flex; align-items: flex-end; gap: 10px; padding-top: 12px; }
.month { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.month-bars { display: flex; align-items: flex-end; justify-content: center; gap: 4px; flex: 1; min-height: 0; width: 100%; }
.month-bars .m { width: 9px; min-height: 3px; border-radius: 4px 4px 2px 2px; }
.month-bars .in { background: linear-gradient(180deg, #3b74e0, #2e3e96); }
.month-bars .out { background: #f0b5b5; }
.month-label { font-size: 10px; color: var(--slate-400); white-space: nowrap; }
.movement-legend { display: flex; gap: 16px; font-size: 11.5px; color: var(--slate-500); margin-top: 12px; }
.movement-legend span { display: inline-flex; align-items: center; gap: 6px; }
.movement-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* mini list */
.mini-list { display: flex; flex-direction: column; }
.mini-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.mini-item:last-child { border-bottom: 0; padding-bottom: 0; }
.mini-item:first-child { padding-top: 4px; }
.mini-avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--slate-100); color: var(--slate-600); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: 0 0 auto; }
.mini-main { min-width: 0; flex: 1; }
.mini-main strong { display: block; font-size: 12.8px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-main span { display: block; font-size: 11.5px; color: var(--slate-400); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-side { text-align: right; flex: 0 0 auto; }
.mini-side strong { display: block; font-size: 12px; font-weight: 600; }
.mini-side span { display: block; font-size: 10.5px; color: var(--slate-400); margin-top: 2px; }

/* ---------------- badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 20px;
  padding: 3px 9px; font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--slate-100); color: var(--slate-600);
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.no-dot::before { display: none; }
.badge-green { background: var(--emerald-soft); color: var(--emerald-dark); }
.badge-blue { background: var(--blue-soft); color: #2e3e96; }
.badge-amber { background: var(--amber-soft); color: #a85c05; }
.badge-red { background: var(--red-soft); color: #b53434; }
.badge-violet { background: var(--violet-soft); color: #6344bd; }
.badge-gray { background: var(--slate-100); color: var(--slate-500); }

/* ---------------- filters ---------------- */
.filterbar { display: flex; gap: 10px; align-items: center; padding: 14px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.filter-search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--slate-50); padding: 0 12px; border-radius: 9px; min-width: 240px; flex: 1; max-width: 360px; }
.filter-search:focus-within { background: #fff; border-color: #a9c4f5; box-shadow: 0 0 0 3px rgba(59,111,224,.1); }
.filter-search span { display: inline-flex; width: 15px; height: 15px; color: var(--slate-400); }
.filter-search svg { width: 100%; height: 100%; }
.filter-search input { border: 0; background: none; outline: none; padding: 9px 0; width: 100%; font-size: 13px; }
.select {
  border: 1px solid var(--border); background: #fff; border-radius: 9px; padding: 8px 30px 8px 11px;
  font-size: 12.5px; color: var(--slate-600); outline: none; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select:focus { border-color: #a9c4f5; box-shadow: 0 0 0 3px rgba(59,111,224,.1); }
.filter-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------------- table ---------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--slate-400); font-weight: 650; padding: 11px 16px; background: #fbfcfe;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--slate-600); }
table.data th .sort-ind { margin-left: 4px; opacity: .6; font-size: 9px; }
table.data td { padding: 12px 16px; border-bottom: 1px solid #eef2f8; vertical-align: middle; font-size: 13px; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: #f8fbff; }
.cell-person { display: flex; align-items: center; gap: 11px; min-width: 210px; }
.avatar {
  width: 36px; height: 36px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: linear-gradient(145deg, #e9edfb, #d8e2fa); color: #2547a8;
}
.avatar.alt1 { background: linear-gradient(145deg, #e9f0fd, #d9e6fc); color: #2e3e96; }
.avatar.alt2 { background: linear-gradient(145deg, #f0ecfc, #e4ddf8); color: #6344bd; }
.avatar.alt3 { background: linear-gradient(145deg, #fdf3e2, #fae8cb); color: #a85c05; }
.avatar img, .mini-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.avatar.has-photo, .mini-avatar.has-photo { background: var(--slate-100); }
[hidden] { display: none !important; }
.cell-person .who { min-width: 0; }
.cell-person .who strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; }
.cell-person .who span { display: block; font-size: 11.5px; color: var(--slate-400); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.mono { font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace; font-size: 12px; color: var(--slate-600); }
.muted { color: var(--slate-400); }
.tiny { font-size: 11px; }
.strong { font-weight: 650; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-btn { width: var(--btn-h-sm); height: var(--btn-h-sm); border-radius: 8px; border: 1px solid transparent; background: transparent; display: inline-grid; place-items: center; color: var(--slate-400); flex: 0 0 auto; padding: 0; }
.row-btn:hover { background: var(--slate-100); color: var(--slate-700); }
.row-btn > svg { width: 16px; height: 16px; }

/* pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pagination .info { font-size: 12px; color: var(--slate-500); }
.pager { display: flex; gap: 5px; }
.pager button { min-width: var(--btn-h-sm); height: var(--btn-h-sm); border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--slate-600); font-size: 12.5px; font-weight: 600; padding: 0 7px; line-height: 1; }
.pager button:hover { background: var(--slate-50); }
.pager button.active { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.pager button[disabled] { opacity: .4; pointer-events: none; }

/* empty/loading */
.empty { padding: 54px 20px; text-align: center; color: var(--slate-400); }
.empty .empty-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--slate-100); display: grid; place-items: center; margin: 0 auto 14px; color: var(--slate-400); }
.empty .empty-icon span, .empty .empty-icon svg { width: 24px; height: 24px; }
.empty h4 { font-size: 14px; color: var(--slate-600); font-weight: 600; margin-bottom: 4px; }
.empty p { font-size: 12.5px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--slate-200); border-top-color: var(--emerald); animation: spin .7s linear infinite; margin: 0 auto; }
.loading-block { padding: 60px 20px; text-align: center; color: var(--slate-400); font-size: 12.5px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #eef2f8 25%, #f7f9fc 37%, #eef2f8 63%); background-size: 400% 100%; animation: shimmer 1.2s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------------- drawer ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(9,16,30,.42); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; backdrop-filter: blur(1px); }
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 94vw); background: #fff; z-index: 60;
  transform: translateX(103%); transition: transform .28s cubic-bezier(.22,.7,.2,1);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 24px 26px 0; display: flex; align-items: flex-start; gap: 14px; }
.drawer-head .avatar { width: 54px; height: 54px; border-radius: 16px; font-size: 17px; }
.drawer-id { flex: 1; min-width: 0; }
.drawer-id h2 { font-size: 20px; font-weight: 650; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drawer-id p { font-size: 12.5px; color: var(--slate-500); margin-top: 3px; }
.drawer-close { flex: 0 0 auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 26px 30px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 16px 0 18px; position: sticky; top: -18px; background: #fff; z-index: 2; padding-top: 4px; }
.tab { border: 0; background: none; padding: 9px 12px 11px; font-size: 13px; font-weight: 600; color: var(--slate-400); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--slate-600); }
.tab.active { color: var(--emerald-dark); border-bottom-color: var(--emerald); }
.tab .count { font-size: 10px; background: var(--slate-100); padding: 1px 6px; border-radius: 10px; margin-left: 4px; color: var(--slate-500); }
.tabs.page-tabs { position: static; margin: 18px 0 16px; padding-top: 0; }
.quick-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 6px; }
.quick-stat { background: var(--slate-50); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.quick-stat label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--slate-400); font-weight: 600; }
.quick-stat strong { display: block; font-size: 16px; font-weight: 650; margin-top: 4px; letter-spacing: -.01em; }
.quick-stat span { display: block; font-size: 11px; color: var(--slate-500); margin-top: 2px; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--slate-400); font-weight: 700; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title:first-child { margin-top: 4px; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.info { background: #fff; padding: 11px 14px; min-width: 0; }
.info label { display: block; font-size: 10.5px; color: var(--slate-400); font-weight: 600; margin-bottom: 2px; }
.info div { font-size: 12.8px; color: var(--slate-700); word-break: break-word; }
.info.full { grid-column: 1 / -1; }
.drawer-actions { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.family-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 11px; margin-bottom: 8px; }
.family-row .fi { width: 32px; height: 32px; border-radius: 9px; background: var(--violet-soft); color: var(--violet); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: 0 0 auto; }
.family-row .fm { flex: 1; min-width: 0; }
.family-row .fm strong { display: block; font-size: 12.8px; font-weight: 600; }
.family-row .fm span { font-size: 11.5px; color: var(--slate-400); }
.family-actions { display: flex; gap: 2px; }

/* ---------------- modal ---------------- */
.modal-root { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 28px; }
.modal-root.show { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(9,16,30,.5); backdrop-filter: blur(2px); }
.modal {
  position: relative; background: #fff; border-radius: 18px; width: min(880px, 100%);
  max-height: calc(100vh - 56px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: modalIn .22s cubic-bezier(.2,.8,.2,1);
}
.modal.narrow { width: min(500px, 100%); }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.99); } }
.modal > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.modal-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 12px; }
.modal-head h3 { font-size: 17px; font-weight: 650; }
.modal-head p { font-size: 12px; color: var(--slate-400); margin-top: 3px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 22px 24px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { padding: 15px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; background: #fbfcfe; border-radius: 0 0 18px 18px; }

/* forms */
.photo-editor { display: flex; align-items: center; gap: 16px; padding: 14px; margin-bottom: 20px; border: 1px dashed #cfd9e8; border-radius: 14px; background: var(--slate-50); flex-wrap: wrap; }
.photo-preview { width: 92px; height: 92px; border-radius: 18px; font-size: 24px; }
.photo-meta { min-width: 0; flex: 1 1 200px; }
.photo-meta strong { display: block; font-size: 13px; font-weight: 650; color: var(--slate-700); }
.photo-meta p { font-size: 11.5px; color: var(--slate-400); margin: 3px 0 10px; }
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.file-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.file-item { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--slate-50); }
.file-item .fi { width: 28px; height: 28px; border-radius: 7px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex: 0 0 auto; }
.file-item .fi svg { width: 14px; height: 14px; }
.file-item .fm { flex: 1; min-width: 0; }
.file-item .fm strong { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .fm span { font-size: 10.5px; color: var(--slate-400); }
.field input[type="file"] { padding: 7px 9px; background: var(--slate-50); font-size: 12px; }

.form-section { margin-bottom: 24px; }
.form-section:last-child { margin-bottom: 0; }
.form-section-head { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.form-section-head .fs-icon { width: 28px; height: 28px; border-radius: 8px; background: var(--slate-100); color: var(--slate-500); display: grid; place-items: center; }
.form-section-head .fs-icon span, .form-section-head .fs-icon svg { width: 14px; height: 14px; }
.form-section-head h4 { font-size: 12.5px; font-weight: 650; letter-spacing: .01em; color: var(--slate-700); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--slate-500); }
.field label .req { color: var(--red); }
.input, .field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px;
  font-size: 13px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 68px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #9cbdf5; box-shadow: 0 0 0 3px rgba(59,111,224,.1); }
.field small { font-size: 10.5px; color: var(--slate-400); }
.form-hint { background: var(--amber-soft); color: #8a5300; border-radius: 10px; padding: 10px 13px; font-size: 12px; margin-bottom: 16px; display: flex; gap: 8px; align-items: flex-start; }
.form-hint > svg, .form-hint > span { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }
.form-hint > svg { display: block; }
.form-hint > span { display: inline-flex; }
.form-hint > span svg { width: 100%; height: 100%; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--slate-600); }

/* tag editor */
.tag-editor { display: flex; flex-direction: column; gap: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 38px; padding: 7px; border: 1px dashed var(--border); border-radius: 10px; align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 6px; background: var(--slate-100); color: var(--slate-600); border-radius: 7px; padding: 4px 6px 4px 9px; font-size: 12px; }
.tag button { border: 0; background: none; color: var(--slate-400); padding: 0; width: 15px; height: 15px; display: inline-grid; place-items: center; border-radius: 4px; }
.tag button:hover { background: #e2e8f0; color: var(--red); }
.tag button svg { width: 11px; height: 11px; }
.tag-add { display: flex; gap: 7px; }
.tag-add input { flex: 1; height: var(--btn-h-sm); border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; font-size: 12.5px; outline: none; }
.tag-add input:focus { border-color: #9cbdf5; }

/* settings grid */
.settings-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.settings-stack { display: flex; flex-direction: column; gap: 16px; }
.master-item { border-bottom: 1px dashed var(--border); padding: 14px 0; }
.master-item:first-child { padding-top: 2px; }
.master-item:last-child { border-bottom: 0; padding-bottom: 0; }
.master-item h4 { font-size: 12.5px; font-weight: 650; margin-bottom: 8px; color: var(--slate-700); }
.source-box { display: flex; gap: 13px; align-items: flex-start; background: var(--slate-50); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.source-box .src-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--emerald-soft); color: var(--emerald); display: grid; place-items: center; flex: 0 0 auto; }
.source-box .src-icon span, .source-box .src-icon svg { width: 19px; height: 19px; }
.source-box .src-main { flex: 1; min-width: 0; }
.source-box strong { font-size: 12.5px; display: block; word-break: break-word; }
.source-box span { font-size: 11.5px; color: var(--slate-400); display: block; margin-top: 2px; }
.source-box .src-actions { margin-top: 11px; display: flex; gap: 8px; flex-wrap: wrap; }
.stat-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; }
.stat-line:last-child { border-bottom: 0; }
.stat-line span { color: var(--slate-500); }
.stat-line strong { font-weight: 650; }
.export-links { display: flex; flex-direction: column; gap: 8px; }
.export-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 12.5px; font-weight: 550; color: var(--slate-600); }
.export-link:hover { background: var(--slate-50); border-color: var(--slate-200); }
.export-link span, .export-link svg { width: 16px; height: 16px; color: var(--slate-400); }
.export-link svg { margin-left: auto; }

/* toast */
.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--navy-900); color: #eaf0fb; border-radius: 11px; padding: 11px 16px; font-size: 12.8px; display: flex; align-items: center; gap: 9px; box-shadow: var(--shadow-md); animation: toastIn .2s ease; max-width: 380px; }
.toast.success { background: #1d3c93; }
.toast.error { background: #8f2f2f; }
.toast span, .toast svg { width: 15px; height: 15px; flex: 0 0 auto; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- responsive ---------------- */
@media (max-width: 1240px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .global-search { width: 190px; }
}
@media (max-width: 1050px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; width: 264px; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .dash-grid, .dash-grid.three { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .view { padding: 18px 16px 40px; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar-title .eyebrow { display: none; }
  .topbar-title h1 { font-size: 17px; }
  .global-search { display: none; }
  .topbar-actions .btn-ghost .btn-label { display: none; }
  .topbar-actions .btn-ghost { width: var(--btn-h); padding: 0; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 15px; }
  .kpi-value { font-size: 24px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .quick-stats { grid-template-columns: 1fr 1fr; }
  .bar-row { grid-template-columns: 100px 1fr 32px; }
  .drawer { width: 100vw; }
  .modal-root { padding: 12px; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .toast-root { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; width: 100%; }
}
@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar-actions .btn-primary .btn-label { display: none; }
  .topbar-actions .btn-primary { width: var(--btn-h); padding: 0; }
}

/* ---------------- auth ---------------- */
.sidebar-actions { display: flex; flex-direction: column; gap: 4px; padding: 10px 8px 0; border-top: 1px solid rgba(255,255,255,.06); margin-top: 10px; }
.side-action {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  background: transparent; border: 0; border-radius: 8px; color: #aebbd0;
  font-size: 12.5px; text-align: left; transition: background .16s, color .16s;
}
.side-action:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-action svg { width: 16px; height: 16px; flex: 0 0 auto; }

.login-screen {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  padding: 24px; background: radial-gradient(circle at 20% 15%, #1b3f78 0%, #0d2038 45%, #081420 100%);
}
.login-screen[hidden] { display: none; }
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 20px;
  padding: 36px 32px 26px; box-shadow: 0 30px 80px -25px rgba(0,0,0,.55);
  text-align: center;
}
.login-logo { width: 76px; height: auto; display: block; margin: 0 auto 14px; }
.login-card h1 { font-size: 22px; color: var(--navy-900); letter-spacing: -.02em; }
.login-subtitle { font-size: 12.5px; color: var(--slate-500); margin-top: 6px; margin-bottom: 22px; }
.login-field { display: block; text-align: left; margin-bottom: 14px; }
.login-field span { display: block; font-size: 12px; font-weight: 600; color: var(--slate-600); margin-bottom: 6px; }
.login-field input {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--slate-200);
  border-radius: 10px; background: #f8fafc; font-size: 14px; outline: none;
}
.login-field input:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(47,95,208,.12); background: #fff; }
.login-error { min-height: 18px; font-size: 12px; color: var(--red); margin: -4px 0 8px; text-align: left; }
.login-submit { width: 100%; height: 44px; justify-content: center; font-size: 14px; }
.login-footer { margin-top: 20px; font-size: 11px; color: var(--slate-400); }
