:root {
  --teal-900: #0b3d3a;
  --teal-700: #12564f;
  --teal-600: #0f6b8a;
  --teal-500: #1c9186;
  --mint-50: #f2f8f6;
  --ink: #1c2624;
  --ink-soft: #5b6b68;
  --line: #dde6e3;
  --card: #ffffff;
  --amber: #c9822a;
  --red: #b93a3a;
  --radius: 10px;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

html[data-color-scheme="teal_blue"] {
  --teal-900: #0b3d3a;
  --teal-700: #12564f;
  --teal-600: #0f6b8a;
  --teal-500: #1c9186;
}

html[data-color-scheme="teal_green"] {
  --teal-900: #0b4f40;
  --teal-700: #1a7869;
  --teal-600: #209574;
  --teal-500: #26b788;
}

* { box-sizing: border-box; }

html { height: 100%; }
body {
  margin: 0;
  background: var(--mint-50);
  color: var(--ink);
  height: 100%;
}

/* App shell is pinned to exactly the viewport height -- the sidebar and
   topbar never scroll away, and .content (below) becomes its own
   scrollable region, so a long table/list/form only scrolls itself
   (with an internal scrollbar) instead of stretching the whole page. */
.app-shell { display: flex; height: 100vh; flex-wrap: nowrap; overflow: hidden; }

.sidebar {
  width: 230px;
  background: linear-gradient(180deg, var(--teal-900), var(--teal-700));
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 10px;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; letter-spacing: 0.5px; font-size: 13px;
}
.brand-logo {
  width: 42px; height: 42px; object-fit: contain; flex: 0 0 auto;
  background: #fff; border-radius: 10px; padding: 4px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 14px; }
.brand-text span { font-size: 11px; opacity: 0.75; }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar nav a {
  color: #d9ece9; text-decoration: none; padding: 10px 12px;
  border-radius: 8px; font-size: 14px; font-weight: 500;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.08); }
.sidebar nav a.active { background: #fff; color: var(--teal-800, var(--teal-900)); font-weight: 700; }
.sidebar-foot { font-size: 11px; opacity: 0.6; margin-top: 12px; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px; margin-top: 18px;
  padding: 12px; background: rgba(255,255,255,0.08); border-radius: 10px;
}
.sidebar-user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--amber);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.sidebar-user-info { display: flex; flex-direction: column; line-height: 1.3; flex: 1; min-width: 0; }
.sidebar-user-info strong { font-size: 12.5px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-info span { font-size: 10.5px; color: #b9d8d3; }
.sidebar-logout {
  color: #d9ece9; text-decoration: none; font-size: 17px; flex: 0 0 auto;
  padding: 4px 6px; border-radius: 6px;
}
.sidebar-logout:hover { background: rgba(255,255,255,0.15); color: #fff; }

.role-pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.role-pill-administrator { background: #fde3d0; color: #8a4300; }
.role-pill-hrmanager { background: #ccd6f7; color: #1e2c80; }
.role-pill-accountant { background: #d3b6f2; color: #3d1a70; }
.role-pill-laboratory { background: #bfe8d8; color: #0d5c3c; }
.role-pill-viewer { background: #eee; color: #666; }

.lab-chart { display: flex; flex-direction: column; gap: 10px; }
.lab-chart-row { display: grid; grid-template-columns: 160px 1fr 90px; align-items: center; gap: 12px; }
.lab-chart-label { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-chart-bar-track { position: relative; background: var(--panel-soft, #f0f2f5); border-radius: 6px; height: 22px; overflow: hidden; }
.lab-chart-bar { position: absolute; top:0; left:0; bottom:0; background: var(--teal-600, #1c9186); border-radius: 6px; min-width: 3px; transition: width 0.3s ease; }
.lab-chart-bar-val { position: relative; z-index: 1; display: block; text-align: right; padding: 0 8px; line-height: 22px; font-size: 12px; font-weight: 700; color: var(--ink); }
.lab-chart-total { font-size: 12px; color: var(--ink-soft); text-align: right; }
html[data-theme="dark"] .lab-chart-bar-track { background: #262626; }

.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 14px; }
.role-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; border-left-width: 4px; }
.role-card-title { font-weight: 700; font-size: 13.5px; margin-bottom: 5px; }
.role-card-desc { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.role-admin { border-left-color: var(--amber); }
.role-hr { border-left-color: #2c3fbf; }
.role-acc { border-left-color: #7b2cbf; }
.role-lab { border-left-color: #0d8f5f; }
.role-view { border-left-color: #999; }

.content {
  flex: 1; padding: 28px 36px; width: 100%; max-width: none;
  height: 100vh; overflow-y: auto;
}

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.subtitle { color: var(--ink-soft); font-size: 13px; margin-bottom: 22px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-grid-4 { grid-template-columns: repeat(4, minmax(180px,1fr)); }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: block; text-decoration: none; color: inherit;
}
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--teal-700); }
.stat-card .num-present { color: #1b6b45; }
.stat-card .num-absent { color: var(--red); }
.stat-card .num-small { font-size: 17px; font-weight: 700; color: var(--teal-700); margin-top: 2px; }
.stat-card .num-small .port { color: var(--ink-soft); font-weight: 500; }
.stat-card .label { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.4px; }
.stat-card .stat-top { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.stat-card .sub-label { font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; }

.live-dot, .device-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #bbb; }
.live-dot { background: var(--teal-500); }
.live-dot.pulsing { animation: livePulse 1.4s ease-in-out infinite; }
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(28,145,134,0.55); }
  70% { box-shadow: 0 0 0 6px rgba(28,145,134,0); }
  100% { box-shadow: 0 0 0 0 rgba(28,145,134,0); }
}
.device-dot.device-on { background: #1b6b45; }
.device-dot.device-off { background: var(--red); }
.device-card { transition: box-shadow 0.15s, transform 0.15s; cursor: pointer; }
.device-card:hover { box-shadow: 0 2px 10px rgba(11,61,58,0.12); transform: translateY(-1px); }

/* Dashboard: Date/Time & Weather widget */
.datetime-weather-card {
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap; position: relative;
  background: linear-gradient(135deg, var(--teal-900), var(--teal-700));
  color: #fff; border: none;
}
.dt-block { min-width: 200px; }
.dt-time { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.5px; }
.dt-date { font-size: 13.5px; opacity: 0.9; margin-top: 2px; }
.dt-tz { font-size: 11px; opacity: 0.7; margin-top: 4px; }
.weather-block {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 220px;
  border-left: 1px solid rgba(255,255,255,0.25); padding-left: 24px;
}
.weather-icon { font-size: 38px; line-height: 1; }
.weather-temp { font-size: 22px; font-weight: 700; }
.weather-cond { font-size: 12.5px; opacity: 0.9; }
.weather-extra { font-size: 11.5px; opacity: 0.8; line-height: 1.5; }
.weather-city { font-size: 11px; opacity: 0.7; margin-left: auto; align-self: flex-end; }
.weather-loading { font-size: 12.5px; opacity: 0.85; }
.dt-settings-link {
  color: #fff; text-decoration: none; font-size: 12px; opacity: 0.85;
  background: rgba(255,255,255,0.14); padding: 6px 12px; border-radius: 20px;
  margin-left: auto; white-space: nowrap;
}
.dt-settings-link:hover { background: rgba(255,255,255,0.24); }
@media (max-width: 760px) {
  .weather-block { border-left: none; padding-left: 0; border-top: 1px solid rgba(255,255,255,0.25); padding-top: 12px; }
}

/* Name-list boxes: same footprint as the other stat-cards (fixed height,
   internal scroll) so the dashboard grid stays visually even. */
.stat-card.name-card { display: flex; flex-direction: column; height: 210px; }
.name-list { list-style: none; margin: 8px 0 0; padding: 0; overflow-y: auto; flex: 1; }
.name-list li {
  font-size: 13px; padding: 5px 0; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 7px;
}
.name-list li:last-child { border-bottom: none; }
.name-list .dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.name-list .dot.on { background: var(--teal-500); }
.name-list .dot.off { background: var(--red); }
.name-list .name-list-name { flex: 1 1 auto; }
.name-list .name-list-time { font-size: 11.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.name-list .empty-msg { font-size: 12.5px; color: var(--ink-soft); padding: 8px 0; }

/* Live Attendance table (Name / In / Out columns) inside a name-card box. */
.name-table { width: 100%; border-collapse: collapse; margin-top: 8px; overflow-y: auto; flex: 1; display: block; }
.name-table thead, .name-table tbody { display: table; width: 100%; table-layout: fixed; }
.name-table thead {
  position: sticky; top: 0; background: #fff;
}
.name-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--ink-soft); font-weight: 600; padding: 4px 0 6px; border-bottom: 1px solid var(--line);
}
.name-table th:first-child { width: 55%; }
.name-table td {
  font-size: 13px; padding: 5px 0; border-bottom: 1px solid var(--line);
  vertical-align: middle; font-variant-numeric: tabular-nums;
}
.name-table tbody tr:last-child td { border-bottom: none; }
.name-table td .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 7px; }
.name-table td .dot.on { background: var(--teal-500); }
.name-table td .dot.off { background: var(--red); }
.name-table .empty-row td { text-align: center; color: var(--ink-soft); font-size: 12.5px; }

/* Editable table cells (Payroll grid) */
.cell-edit {
  width: 100%; border: 1px solid transparent; background: transparent;
  padding: 5px 6px; border-radius: 6px; font-size: 13.5px; color: var(--ink);
  font-family: inherit;
}
.cell-edit.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-edit:hover { border-color: var(--line); background: #fff; }
.cell-edit:focus { outline: none; border-color: var(--teal-500); background: #fff; box-shadow: 0 0 0 2px rgba(28,145,134,0.15); }
.cell-edit.payable { font-weight: 700; color: var(--teal-700); }

/* Absent/Late/Leave boxes on the Payroll grid: a little bigger so the
   typed value is easy to see at a glance. */
.cell-edit.alv-input {
  width: 46px; min-width: 46px; padding: 7px 8px; font-size: 15.5px;
  font-weight: 600; border: 1px solid var(--line); background: #fff;
  border-radius: 7px; text-align: center;
}
.cell-edit.alv-input:hover { border-color: var(--teal-500); }
.cell-edit.alv-input:focus { box-shadow: 0 0 0 3px rgba(28,145,134,0.18); }

/* Fixed/auto-calculated cells (Payroll grid): not editable, shown plain */
td.fixed-cell { color: var(--ink-soft); }
td.fixed-cell.payable { font-weight: 700; color: var(--teal-700); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { background: var(--mint-50); font-weight: 600; color: var(--teal-900); white-space: nowrap; }
tr:hover td { background: #fafdfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px; border: none;
  background: var(--teal-600); color: #fff; font-size: 13.5px; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--teal-700); }
.btn.secondary { background: #fff; color: var(--teal-700); border: 1px solid var(--teal-500); }
.btn.secondary:hover { background: var(--mint-50); }
.btn.danger { background: #fff; color: var(--red); border: 1px solid var(--red); }
.btn.danger:hover { background: #fdf1f1; }
.btn.small { padding: 5px 10px; font-size: 12px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; }
label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 5px; font-weight: 600; }
input, select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px;
  font-size: 13.5px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--teal-500); border-color: var(--teal-500); }

.flash-stack { margin-bottom: 18px; }
.flash { padding: 10px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 8px; }
.flash-success { background: #e7f6ef; color: #1b6b45; border: 1px solid #b9e6cf; }
.flash-error { background: #fbeaea; color: var(--red); border: 1px solid #f0c2c2; }
.flash-warning { background: #fdf3e2; color: var(--amber); border: 1px solid #f3d9a5; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.pill-present { background: #c7ecd8; color: #0f4a2c; }
.pill-late { background: #fbe3ad; color: #7a4c00; }
.pill-halfday { background: #e3d3f7; color: #4a1f85; }
.pill-absent { background: #f6c6c6; color: #7a1f1f; }
.pill-leave { background: #ccd6f7; color: #1e2c80; }
.pill-none { background: #eee; color: #999; }
.pill-shift { background: #d7ecff; color: #0d4a87; }

/* Attendance grid day-cells use the same statuses but need a bit more
   contrast than the small text pills above, since they're the whole
   clickable cell -- kept a shade darker again for easy scanning. */
.day-cell.pill-present { background: #a9e2c3; color: #0f4a2c; }
.day-cell.pill-late { background: #f7d27e; color: #5c3a00; }
.day-cell.pill-halfday { background: #d3b6f2; color: #3d1a70; }
.day-cell.pill-absent { background: #ef9d9d; color: #5c1414; }
.day-cell.pill-leave { background: #aebbf2; color: #141d5c; }
.day-cell.pill-none { background: #e6e6e6; color: #888; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar form { display: flex; gap: 8px; align-items: center; }

.help-text { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

.att-grid { overflow-x: auto; }
.att-grid table { min-width: 900px; }
.day-cell { width: 30px; height: 30px; text-align: center; cursor: pointer; border-radius: 5px; font-size: 11px; font-weight: 700; }

dialog {
  border: none; border-radius: 12px; padding: 0; max-width: 420px; width: 92%;
}
dialog::backdrop { background: rgba(11,61,58,0.35); }
.dialog-body { padding: 22px; }

/* ---------- Print stylesheets (payslip / salary sheet) ---------- */
.print-page { background: #fff; max-width: 900px; margin: 0 auto; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); }
.print-header { text-align: center; border-bottom: 3px solid var(--teal-700); padding-bottom: 12px; margin-bottom: 18px; }
.print-header h1 { font-size: 24px; color: var(--teal-900); margin-bottom: 2px; letter-spacing: 0.5px; }
.print-header .addr { font-size: 12.5px; color: var(--ink-soft); }
.print-header .doc-title { margin-top: 10px; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--teal-700); }
.print-actions { max-width: 900px; margin: 0 auto 16px; display: flex; justify-content: flex-end; gap: 10px; }
.meta-row { display: flex; justify-content: space-between; margin-bottom: 16px; font-size: 13.5px; }
.meta-row div span { display: block; color: var(--ink-soft); font-size: 11px; text-transform: uppercase; }
.meta-row-full {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 18px;
  font-size: 12.5px;
}
.totals-row td { font-weight: 700; background: var(--mint-50); }
.sign-row { display: flex; justify-content: space-between; margin-top: 50px; font-size: 12.5px; }
.sign-row div { width: 30%; text-align: center; border-top: 1px solid var(--ink); padding-top: 6px; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .print-page { border: none; padding: 0; max-width: 100%; }
}

/* ---------- Payslip receipt design (with logo + attendance tab) ---------- */
.payslip-page {
  background: #fff; max-width: 640px; margin: 0 auto 24px;
  padding: 30px 32px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13.5px;
}
.payslip-header {
  display: flex; align-items: center; gap: 16px;
}
.payslip-logo { width: 62px; height: 62px; object-fit: contain; flex: 0 0 auto; }
.payslip-header-text { flex: 1; text-align: center; }
.payslip-header-text h1 {
  font-size: 21px; color: var(--teal-900); margin: 0 0 3px; letter-spacing: 0.4px;
}
.payslip-header-text .addr { font-size: 12px; color: var(--ink-soft); }
.payslip-header-text .contact-line {
  font-size: 11.5px; color: var(--ink-soft); margin-top: 3px;
  display: flex; justify-content: center; gap: 14px;
}
.payslip-header-doc { text-align: right; flex: 0 0 auto; min-width: 110px; }
.payslip-header-doc .doc-title {
  font-size: 13.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--teal-700);
}
.payslip-header-doc .doc-month {
  font-size: 12px; color: var(--ink-soft); margin-top: 2px; font-weight: 600;
}
.payslip-header-rule {
  height: 3px; margin: 14px 0 18px;
  background: linear-gradient(90deg, var(--teal-700), var(--teal-500), var(--amber));
  border-radius: 3px;
}

.payslip-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.payslip-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
.payslip-table tr:first-child td { border-top: 1px solid var(--line); }
.payslip-table td.num { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.payslip-table .totals-row td {
  font-weight: 800; background: var(--mint-50); font-size: 14.5px;
  border-top: 2px solid var(--teal-700); border-bottom: 2px solid var(--teal-700);
}
.payslip-footer {
  margin-top: 26px; padding-top: 10px; border-top: 1px dashed var(--line);
  text-align: center; font-size: 10.5px; color: var(--ink-soft); font-style: italic;
}

.attendance-tab {
  display: flex; gap: 10px; margin-top: 18px; padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.attendance-tab-item {
  flex: 1; text-align: center; padding: 10px 6px; border-radius: 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.attendance-tab-item .attendance-tab-num { font-size: 19px; font-weight: 800; }
.attendance-tab-item .attendance-tab-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700;
}
.attendance-tab-item.present { background: #c7ecd8; color: #0f4a2c; }
.attendance-tab-item.late { background: #fbe3ad; color: #7a4c00; }
.attendance-tab-item.absent { background: #f6c6c6; color: #7a1f1f; }
.attendance-tab-item.leave { background: #ccd6f7; color: #1e2c80; }

.attendance-detail-table { font-size: 12px; }
.attendance-detail-table th, .attendance-detail-table td { padding: 6px 8px; }

.page-break { page-break-after: always; break-after: page; }

@media print {
  .payslip-page { border: none; padding: 0; max-width: 100%; margin-bottom: 0; }
  .page-break { display: block; height: 0; }
}

/* ---------- Login page ---------- */
.login-body {
  background: linear-gradient(135deg, var(--teal-900), var(--teal-600) 42%, var(--teal-500) 78%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-shell {
  width: 100%; max-width: 920px; min-height: 520px;
  display: flex; background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(6, 30, 28, 0.35);
}
.login-brand-panel {
  flex: 1.05; position: relative; overflow: hidden;
  background: radial-gradient(circle at 25% 20%, var(--teal-600), var(--teal-900) 70%);
  color: #fff; padding: 46px 40px; display: flex; align-items: center;
}
.login-brand-pattern {
  position: absolute; inset: 0; opacity: 0.12; pointer-events: none;
  background-image:
    radial-gradient(circle, #fff 1.5px, transparent 1.5px);
  background-size: 22px 22px;
}
.login-brand-inner { position: relative; z-index: 1; }
.login-logo {
  width: 76px; height: 76px; object-fit: contain; background: #fff;
  border-radius: 18px; padding: 8px; margin-bottom: 18px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.2);
}
.login-brand-inner h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: 0.3px; }
.login-brand-sub { font-size: 12.5px; opacity: 0.8; margin-bottom: 14px; }
.login-brand-tag {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; background: rgba(255,255,255,0.16); padding: 6px 12px;
  border-radius: 20px; margin-bottom: 24px;
}
.login-brand-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.login-brand-points li {
  font-size: 12.5px; padding-left: 22px; position: relative; opacity: 0.92;
}
.login-brand-points li::before {
  content: "✓"; position: absolute; left: 0; top: 0; font-weight: 700; color: var(--amber);
}
.login-form-panel {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 36px;
}
.login-form { width: 100%; max-width: 320px; }
.login-form-head { margin-bottom: 26px; }
.login-logo-mobile { display: none; }
.login-form-head h2 { font-size: 21px; margin: 0 0 4px; color: var(--teal-900); }
.login-field { margin-bottom: 16px; }
.login-btn { width: 100%; padding: 11px; font-size: 14px; margin-top: 6px; }
.login-hint { font-size: 11.5px; color: var(--ink-soft); text-align: center; margin-top: 16px; }

@media (max-width: 760px) {
  .login-shell { flex-direction: column; max-width: 420px; min-height: 0; }
  .login-brand-panel { padding: 28px 26px 22px; }
  .login-brand-points { display: none; }
  .login-logo { display: none; }
  .login-logo-mobile {
    display: block; width: 54px; height: 54px; object-fit: contain;
    background: #fff; border-radius: 12px; padding: 6px; margin: 0 auto 12px;
  }
  .login-form-head { text-align: center; }
}

/* --------------------------------------------------------------------
   Dark theme
   -------------------------------------------------------------------- */
html[data-theme="dark"] {
  --mint-50: #101615;
  --ink: #e8f0ee;
  --ink-soft: #9db0ac;
  --line: #263230;
  --card: #182220;
}
html[data-theme="dark"] body { background: var(--mint-50); }
html[data-theme="dark"] th { background: #1d2826; }
html[data-theme="dark"] tr:hover td { background: #1b2523; }
html[data-theme="dark"] input, html[data-theme="dark"] select {
  background: #101615; color: var(--ink); border-color: var(--line);
}
html[data-theme="dark"] .btn.secondary { background: #182220; }
html[data-theme="dark"] .cell-edit:hover, html[data-theme="dark"] .cell-edit:focus { background: #101615; }
html[data-theme="dark"] .role-pill-viewer { background: #2a2a2a; color: #ccc; }
html[data-theme="dark"] .role-pill-laboratory { background: #123d2c; color: #7fe0bb; }

/* --------------------------------------------------------------------
   Settings: theme picker
   -------------------------------------------------------------------- */
.theme-choice { display: flex; gap: 18px; margin-top: 6px; }
.theme-option {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 22px; border: 2px solid var(--line); border-radius: 12px;
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink);
}
.theme-option input { width: auto; margin: 0 0 4px; }
.theme-option:has(input:checked) { border-color: var(--teal-500); background: var(--mint-50); }
.theme-swatch { font-size: 26px; line-height: 1; }

/* --------------------------------------------------------------------
   Network Devices: gateway banner + manual scan card
   -------------------------------------------------------------------- */
.gateway-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--teal-900), var(--teal-700)); color: #fff; border: none;
}
.gateway-banner .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; opacity: 0.85; }
.gateway-banner .num-small { color: #fff; font-size: 22px; }
.gateway-banner .help-text { color: rgba(255,255,255,0.85); max-width: 360px; }
.manual-scan-card input { max-width: 280px; }

/* --------------------------------------------------------------------
   Dashboard v2: icon stat cards + charts (inspired by reference design)
   -------------------------------------------------------------------- */
.dash-stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr));
  gap: 16px; margin-bottom: 24px;
}
.dash-stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 10px;
  text-decoration: none; color: inherit;
}
.dash-stat-top { display: flex; align-items: flex-start; justify-content: space-between; }
.dash-stat-icon {
  width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 17px; flex: 0 0 auto;
}
.dash-stat-icon.icon-blue { background: #e5edff; color: #3352e1; }
.dash-stat-icon.icon-teal { background: #dff4f0; color: var(--teal-600); }
.dash-stat-icon.icon-red { background: #fbe4e4; color: var(--red); }
.dash-stat-icon.icon-amber { background: #fbecd9; color: var(--amber); }
.dash-stat-icon.icon-purple { background: #ece2fb; color: #6c2cbf; }
html[data-theme="dark"] .dash-stat-icon.icon-blue { background: rgba(51,82,225,0.18); }
html[data-theme="dark"] .dash-stat-icon.icon-teal { background: rgba(28,145,134,0.18); }
html[data-theme="dark"] .dash-stat-icon.icon-red { background: rgba(185,58,58,0.18); }
html[data-theme="dark"] .dash-stat-icon.icon-amber { background: rgba(201,130,42,0.18); }
html[data-theme="dark"] .dash-stat-icon.icon-purple { background: rgba(108,44,191,0.18); }
.dash-stat-num { font-size: 26px; font-weight: 800; line-height: 1; }
.dash-stat-label { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.dash-stat-trend { font-size: 11px; color: var(--ink-soft); }
.dash-stat-trend.up { color: #1b6b45; }
.dash-stat-trend.down { color: var(--red); }

.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px; }
.chart-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.chart-card-head h2 { margin: 0; }
.chart-svg-wrap { width: 100%; overflow: hidden; }
.chart-svg-wrap svg { width: 100%; height: auto; display: block; }
.chart-point-label {
  font-size: 11px; font-weight: 700; fill: var(--teal-700);
}
.chart-axis-label { font-size: 9.5px; fill: var(--ink-soft); }
.bar-value-label { font-size: 11px; font-weight: 700; fill: var(--teal-700); }

/* --------------------------------------------------------------------
   Topbar: admin/user info moved from sidebar to top-right of content
   -------------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: flex-end;
  margin-bottom: 18px;
}
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 30px;
  padding: 6px 8px 6px 16px;
}
.topbar-user-info { display: flex; flex-direction: column; line-height: 1.25; text-align: right; }
.topbar-user-info strong { font-size: 13px; color: var(--ink); }
.topbar-user-info span { font-size: 11px; color: var(--ink-soft); }
.topbar-user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--amber);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.topbar-logout {
  text-decoration: none; font-size: 13px; font-weight: 700; flex: 0 0 auto;
  padding: 8px 12px; border-radius: 999px; background: var(--teal-600); color: #fff;
  border: 1px solid transparent; transition: background 0.2s ease;
}
.topbar-logout:hover { background: var(--teal-700); color: #fff; }
