/* ============================================================
   ISP BILLING — Design tokens
   Konsep: panel kontrol jaringan. Palet gelap dengan aksen sinyal
   hijau-cyan (status "online/lunas") dan amber (status "perlu perhatian").
   Tipografi: monospace untuk angka/ID (kesan teknis, presisi),
   sans-serif netral untuk teks baca.
   ============================================================ */

:root {
  --bg: #0d1117;
  --bg-panel: #151b23;
  --bg-panel-raised: #1c2530;
  --border: #2a3441;
  --border-soft: #1f2730;

  --text-primary: #e6edf3;
  --text-secondary: #8b98a5;
  --text-muted: #5b6573;

  --signal-green: #3fb950;
  --signal-green-dim: rgba(63, 185, 80, 0.15);
  --signal-amber: #d29922;
  --signal-amber-dim: rgba(210, 153, 34, 0.15);
  --signal-red: #f85149;
  --signal-red-dim: rgba(248, 81, 73, 0.15);
  --signal-cyan: #39c5cf;
  --signal-cyan-dim: rgba(57, 197, 207, 0.15);
  --action-blue: #1677e8;
  --action-blue-hover: #0f68d4;
  --action-blue-pressed: #0b57b7;
  --action-blue-soft: rgba(22, 119, 232, 0.12);

  --font-mono: 'IBM Plex Mono', 'SF Mono', Consolas, monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius: 6px;
  --shadow-panel: 0 1px 0 rgba(255,255,255,0.03) inset, 0 8px 24px rgba(0,0,0,0.3);
}

/* Server management console */
.server-console { --server-lime: #70d68b; --server-ink: #10231a; }
.server-kicker { display: inline-block; color: var(--server-lime); font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 700; letter-spacing: .14em; }
.server-setup-panel { border-color: rgba(112,214,139,.35); background: linear-gradient(135deg, rgba(112,214,139,.08), transparent 55%); }
.server-setup-panel h2 { margin: 9px 0 6px; }
.server-setup-panel p { max-width: 760px; color: var(--text-secondary); line-height: 1.65; }
.host-overview { display: grid; grid-template-columns: 1.35fr repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.host-hero, .server-metric { min-height: 160px; padding: 22px; border: 1px solid var(--border-soft); border-radius: 18px; background: var(--bg-panel); box-shadow: var(--shadow-panel); }
.host-hero { color: #eaffef; background: radial-gradient(circle at 85% 10%, rgba(112,214,139,.24), transparent 42%), linear-gradient(145deg, #132a1e, #09130e); }
.host-score { margin-top: 12px; font-family: 'IBM Plex Mono', monospace; font-size: 36px; font-weight: 700; line-height: 1; }
.host-hero p { margin: 7px 0 24px; color: #9eb5a6; font-size: 12px; }
.server-metric { display: flex; flex-direction: column; }
.server-metric > span { color: var(--text-secondary); font-size: 12px; }
.server-metric strong { margin-top: 16px; font-family: 'IBM Plex Mono', monospace; font-size: 29px; }
.server-metric strong.metric-text { font-size: 20px; }
.server-metric small { margin: 5px 0 auto; color: var(--text-muted); }
.meter { height: 6px; overflow: hidden; border-radius: 99px; background: rgba(127,148,137,.18); }
.meter span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #37a65b, var(--server-lime)); transition: width .5s ease; }
.meter.amber span { background: linear-gradient(90deg, #e38a31, #ffc45d); }
.container-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px; }
.container-card { padding: 16px; border: 1px solid var(--border-soft); border-radius: 14px; background: var(--bg-panel-raised); }
.container-card-top { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: start; gap: 10px; }
.container-card-top strong, .container-card-top small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.container-card-top small { margin-top: 3px; color: var(--text-muted); font-family: 'IBM Plex Mono', monospace; font-size: 10px; }
.container-state { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: #8a919b; box-shadow: 0 0 0 4px rgba(138,145,155,.12); }
.container-state.running { background: var(--server-lime); box-shadow: 0 0 0 4px rgba(112,214,139,.14); }
.container-card > p { margin: 13px 0; color: var(--text-secondary); font-size: 11px; }
.container-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.container-actions form { display: inline-flex; }
.caddy-editor form { margin: 0; }
.caddy-editor textarea { display: block; width: 100%; min-height: 430px; padding: 20px; resize: vertical; border: 0; border-top: 1px solid var(--border-soft); border-radius: 0; background: #0d1712; color: #ccebd5; font-family: 'IBM Plex Mono', monospace; font-size: 12px; line-height: 1.7; tab-size: 2; }
.caddy-editor textarea:focus { outline: 2px solid rgba(112,214,139,.5); outline-offset: -2px; }
.ajax-pagination-loading { opacity: .55; pointer-events: none; transition: opacity .15s ease; }
.editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-top: 1px solid var(--border-soft); color: var(--text-secondary); font-size: 11px; }
.host-live-strip { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); margin-bottom: 14px; overflow: hidden; border: 1px solid var(--border-soft); border-radius: 16px; background: var(--bg-panel); }
.host-live-strip > div { position: relative; display: grid; gap: 5px; min-width: 0; padding: 16px 18px; border-right: 1px solid var(--border-soft); }
.host-live-strip > div:last-child { border-right: 0; }
.host-live-strip small { color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.host-live-strip strong { overflow: hidden; font-family: 'IBM Plex Mono', monospace; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.host-live-strip span:not(.live-dot) { overflow: hidden; color: var(--text-secondary); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.live-dot { position: absolute; top: 18px; right: 18px; width: 7px; height: 7px; border-radius: 50%; background: var(--server-lime); box-shadow: 0 0 0 5px rgba(112,214,139,.12); }
.host-chart-panel { overflow: hidden; background: linear-gradient(180deg, rgba(112,214,139,.035), transparent 38%), var(--bg-panel); }
.chart-panel-header { align-items: flex-end; }
.chart-panel-header h2 { margin: 6px 0 3px; }
.range-switcher { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg-panel-raised); }
.range-switcher a { padding: 7px 10px; border-radius: 7px; color: var(--text-secondary); font-size: 10px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.range-switcher a:hover { color: var(--text-primary); }
.range-switcher a.active { background: var(--text-primary); color: var(--bg-panel); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.host-chart-wrap { height: 360px; padding: 20px 20px 8px; }
.host-load-chart { display: grid; grid-template-columns: 170px minmax(0,1fr); align-items: center; gap: 16px; margin: 8px 20px 20px; padding: 16px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--bg-panel-raised); }
.host-load-chart strong, .host-load-chart span { display: block; }
.host-load-chart span { margin-top: 4px; color: var(--text-muted); font-size: 10px; line-height: 1.4; }
.host-load-canvas { height: 105px; }
.chart-empty { display: grid; place-items: center; min-height: 310px; padding: 30px; text-align: center; }
.chart-empty strong { font-size: 16px; }
.chart-empty span { margin-top: 7px; color: var(--text-secondary); font-size: 12px; }
.docker-tabs { display: flex; gap: 5px; margin-bottom: 14px; padding: 5px; overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 13px; background: var(--bg-panel); }
.docker-tabs a { display: flex; align-items: center; gap: 8px; min-width: 112px; padding: 10px 13px; border-radius: 9px; color: var(--text-secondary); font-size: 12px; font-weight: 700; text-decoration: none; }
.docker-tabs a span { min-width: 20px; padding: 3px 5px; border-radius: 6px; background: var(--bg-panel-raised); color: var(--text-muted); font: 600 9px 'IBM Plex Mono',monospace; text-align: center; }
.docker-tabs a.active { background: var(--text-primary); color: var(--bg-panel); }
.docker-tabs a.active span { background: rgba(127,145,165,.18); color: inherit; }
.docker-resource-panel table { min-width: 900px; }
.docker-search { width: min(280px, 100%); }
.docker-name { color: var(--text-primary); font-weight: 700; text-decoration: none; }
.docker-name .container-state { display: inline-block; margin: 0 10px 1px 0; }
.host-facts, .container-stat-row { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.host-facts article, .container-stat-row article { display: grid; gap: 7px; padding: 18px; border: 1px solid var(--border-soft); border-radius: 14px; background: var(--bg-panel); }
.host-facts span, .container-stat-row span { color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.host-facts strong, .container-stat-row strong { overflow: hidden; font: 700 19px 'IBM Plex Mono',monospace; text-overflow: ellipsis; white-space: nowrap; }
.host-facts small, .container-stat-row small { overflow: hidden; color: var(--text-secondary); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.docker-fact-list { padding: 8px 16px 16px; }
.docker-fact-list > div { display: grid; grid-template-columns: minmax(130px,34%) minmax(0,1fr); gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.docker-fact-list > div:last-child { border-bottom: 0; }
.docker-fact-list span { color: var(--text-secondary); font-size: 11px; }
.docker-fact-list code { overflow-wrap: anywhere; text-align: right; }
.container-inspect .page-header h1 { display: flex; align-items: center; gap: 12px; }
.container-inspect .page-header h1 .container-state { flex: 0 0 auto; margin: 0; }
.container-stat-row { grid-template-columns: repeat(5,minmax(0,1fr)); }
.container-command-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.container-command-bar form { display: inline-flex; }
.inspect-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.env-list { max-height: 360px; padding: 8px 16px 16px; overflow: auto; }
.env-list > div { display: grid; grid-template-columns: minmax(120px,auto) auto minmax(0,1fr); gap: 7px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 10px; }
.env-list > div:last-child { border-bottom: 0; }
.env-list code:last-child { overflow-wrap: anywhere; color: var(--text-secondary); }
.env-list .secret-value { color: var(--signal-amber); letter-spacing: .12em; }
.shell-panel { border-color: rgba(112,214,139,.3); }
.shell-output-head { display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border-soft); background: #14251b; color: #a5cdb0; font-size: 10px; }
.shell-output, .container-log { max-height: 440px; margin: 0; padding: 18px; overflow: auto; border: 0; border-top: 1px solid #26382d; border-radius: 0; background: #09110c; color: #bfe0c8; font: 11px/1.65 'IBM Plex Mono',monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.shell-command { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 13px 16px; border-top: 1px solid var(--border-soft); background: #0d1712; color: var(--server-lime); font-family: 'IBM Plex Mono',monospace; }
.shell-command input { border-color: #294232; background: #101f16; color: #d4edda; font-family: inherit; }
.caddy-docker-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 14px; padding: 24px; overflow: hidden; border: 1px solid rgba(112,214,139,.28); border-radius: 18px; background: radial-gradient(circle at 90% 0,rgba(112,214,139,.18),transparent 40%),linear-gradient(145deg,#132a1e,#09130e); color: #eaffef; }
.caddy-docker-hero h2 { margin: 7px 0 5px; font-size: 24px; }
.caddy-docker-hero p { color: #9eb5a6; }
.caddy-runtime { display: grid; grid-template-columns: auto minmax(130px,1fr) auto; align-items: center; gap: 11px; min-width: 310px; padding: 14px; border: 1px solid rgba(255,255,255,.11); border-radius: 13px; background: rgba(0,0,0,.19); }
.caddy-runtime .container-state { margin: 0; }
.caddy-runtime strong,.caddy-runtime small { display: block; }
.caddy-runtime small { margin-top: 3px; color: #8da698; font-size: 10px; }
.caddy-manager-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(280px,.7fr); gap: 14px; }
.proxy-builder-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; padding: 18px; }
.proxy-builder-form .form-group { margin: 0; }
.proxy-builder-form .form-group small { display: block; margin-top: 6px; color: var(--text-muted); font-size: 10px; line-height: 1.45; }
.proxy-builder-form .form-actions { grid-column: 1/-1; margin: 0; }
.proxy-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 7px; padding: 20px 14px; }
.proxy-flow > div { min-width: 0; padding: 12px 7px; border: 1px solid var(--border-soft); border-radius: 10px; text-align: center; }
.proxy-flow > div span { display: grid; place-items: center; width: 20px; height: 20px; margin: 0 auto 8px; border-radius: 50%; background: var(--signal-green-dim); color: var(--signal-green); font: 700 9px 'IBM Plex Mono',monospace; }
.proxy-flow strong,.proxy-flow small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proxy-flow strong { font-size: 11px; }.proxy-flow small { margin-top: 4px; color: var(--text-muted); font-size: 8px; }.proxy-flow b { color: var(--signal-green); }
.catalog-header,.extension-info { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; padding: 24px; border: 1px solid var(--border-soft); border-radius: 17px; background: linear-gradient(135deg,rgba(22,119,232,.1),transparent 48%),var(--bg-panel); }
.catalog-header h2,.extension-info h2 { margin: 7px 0 5px; font-size: 24px; }.catalog-header p,.extension-info p { color: var(--text-secondary); }
.app-catalog-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.app-catalog-card { position: relative; display: flex; flex-direction: column; min-height: 300px; padding: 20px; overflow: hidden; border: 1px solid var(--border-soft); border-radius: 17px; background: var(--bg-panel); box-shadow: var(--shadow-panel); }
.app-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(145deg,#236bfe,#164aaf); color: #fff; font: 700 15px 'IBM Plex Mono',monospace; box-shadow: 0 9px 24px rgba(35,107,254,.25); }
.app-source { position: absolute; top: 20px; right: 20px; }.app-catalog-card h3 { margin: 18px 0 7px; font-size: 18px; }.app-catalog-card p { min-height: 44px; color: var(--text-secondary); font-size: 11px; line-height: 1.55; }
.app-image { margin: 10px 0; padding: 9px; overflow: hidden; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--bg-panel-raised); color: var(--text-secondary); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.app-meta { display: flex; gap: 14px; margin-bottom: 15px; color: var(--text-muted); font-size: 9px; }.app-meta b { color: var(--text-primary); }.app-card-actions { display: flex; gap: 7px; margin-top: auto; }.custom-app { justify-content: center; border-style: dashed; background: transparent; }.custom-app .app-mark { background: var(--bg-panel-raised); color: var(--text-primary); box-shadow: none; }
.deploy-container-form { padding: 18px; }.deploy-container-form fieldset { margin: 0 0 16px; padding: 17px; border: 1px solid var(--border-soft); border-radius: 13px; }.deploy-container-form legend { padding: 0 8px; color: var(--text-primary); font-size: 11px; font-weight: 700; }
.deploy-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }.deploy-form-grid .form-group { margin: 0; }.deploy-form-grid label span { color: var(--text-muted); font-weight: 400; }.deploy-form-grid textarea { min-height: 125px; font-family: 'IBM Plex Mono',monospace; font-size: 11px; }.deploy-form-grid small { display: block; margin-top: 6px; color: var(--text-muted); font-size: 9px; }.deploy-check { display: flex; align-items: center; }.deploy-check label { display: flex; align-items: center; gap: 8px; }.deploy-submit { display: flex; justify-content: flex-end; gap: 8px; }
.extension-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }.extension-command { margin: 14px 0; padding: 14px; overflow-x: auto; border: 1px solid #294232; border-radius: 9px; background: #0d1712; color: #bfe0c8; font: 11px 'IBM Plex Mono',monospace; }

@media (max-width: 1100px) {
  .host-overview { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .host-overview, .container-grid { grid-template-columns: 1fr; }
  .host-live-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .host-facts, .container-stat-row, .inspect-grid { grid-template-columns: 1fr; }
  .docker-resource-panel { overflow-x: auto; }
  .docker-resource-panel .panel-header { position: sticky; left: 0; }
  .container-command-bar { display: grid; }
  .container-command-bar form, .container-command-bar button { width: 100%; }
  .shell-command { grid-template-columns: auto minmax(0,1fr); }
  .caddy-docker-hero { align-items: stretch; flex-direction: column; }
  .caddy-runtime { min-width: 0; }
  .caddy-manager-grid,.proxy-builder-form { grid-template-columns: 1fr; }
  .app-catalog-grid,.deploy-form-grid,.extension-grid { grid-template-columns: 1fr; }
  .catalog-header,.extension-info { align-items: flex-start; flex-direction: column; }
  .deploy-submit { display: grid; }.deploy-submit .btn { width: 100%; }
  .proxy-builder-form .form-actions { grid-column: auto; }
  .shell-command button { grid-column: 1/-1; width: 100%; }
  .host-live-strip > div { border-bottom: 1px solid var(--border-soft); }
  .host-live-strip > div:nth-child(2) { border-right: 0; }
  .host-live-strip > div:nth-child(n+3) { border-bottom: 0; }
  .chart-panel-header { align-items: stretch; }
  .range-switcher { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
  .range-switcher a { padding: 8px 5px; text-align: center; }
  .host-chart-wrap { height: 310px; padding: 14px 8px 4px; }
  .host-load-chart { grid-template-columns: 1fr; margin: 8px 10px 12px; }
  .host-hero, .server-metric { min-height: 135px; }
  .editor-footer { align-items: stretch; flex-direction: column; }
  .caddy-editor textarea { min-height: 360px; font-size: 11px; }
}

[data-theme="light"] {
  --bg: #f5f7fb;
  --bg-panel: #ffffff;
  --bg-panel-raised: #eef3f8;
  --border: #c9d4df;
  --border-soft: #e1e8f0;

  --text-primary: #17202a;
  --text-secondary: #4c5b6b;
  --text-muted: #738294;

  --signal-green: #1f8f3a;
  --signal-green-dim: rgba(31, 143, 58, 0.12);
  --signal-amber: #a66b00;
  --signal-amber-dim: rgba(166, 107, 0, 0.13);
  --signal-red: #c9362e;
  --signal-red-dim: rgba(201, 54, 46, 0.12);
  --signal-cyan: #087f8c;
  --signal-cyan-dim: rgba(8, 127, 140, 0.12);
  --action-blue: #1677e8;
  --action-blue-hover: #0f68d4;
  --action-blue-pressed: #0b57b7;
  --action-blue-soft: rgba(22, 119, 232, 0.12);

  --shadow-panel: 0 1px 0 rgba(255,255,255,0.7) inset, 0 8px 24px rgba(31,45,61,0.08);
}

/* Android app presentation: the native shell owns navigation and site header. */
.android-app { color-scheme: light; }
.android-app body { background: #fff; }
.android-app .app-shell { display: block; min-height: 100%; }
.android-app .sidebar { display: none !important; }
.android-app .main {
  width: 100%;
  max-width: none;
  padding: 18px 18px 30px;
  background: #fff;
}
.android-app .page-header {
  margin-bottom: 24px;
  align-items: flex-start;
}
.android-app .page-header h1 {
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -.025em;
}
.android-app .page-header .desc { color: #8993a4; }
.android-app .stat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px;
}
.android-app .stat-card {
  border: 0;
  border-radius: 16px;
  box-shadow: none;
  background: #f5f7fa;
  padding: 16px;
}
.android-app .stat-card .label {
  color: #7c8798;
  font-size: 10px;
  letter-spacing: .035em;
}
.android-app .stat-card .value { font-family: var(--font-sans); font-size: 26px; }
.android-app .panel {
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  margin: 28px 0 0;
  overflow: visible;
}
.android-app .panel-header {
  padding: 0 0 14px;
  border: 0;
  flex-direction: row;
  align-items: center;
}
.android-app .panel-header h2 { font-size: 17px; font-weight: 700; }
.android-app .panel-header .btn {
  border: 0;
  background: transparent;
  color: #1677e8;
  min-height: 0;
  padding: 5px;
}
.android-app .filter-bar {
  padding: 0;
  border: 0;
  background: transparent;
}
.android-app input,
.android-app select,
.android-app textarea {
  border-color: #e6eaf0;
  border-radius: 12px;
  background: #f7f8fa;
}
.android-app .btn { border-radius: 10px; }
.android-app .btn-primary {
  border: 0;
  background: #1677e8;
  color: #fff;
}

/* Dark appearance for the Android-specific presentation. */
.android-app[data-theme="dark"] body,
.android-app[data-theme="dark"] .main {
  background: #0f1218;
  color: #f2f5f8;
}
.android-app[data-theme="dark"] .page-header .desc { color: #8d98aa; }
.android-app[data-theme="dark"] .stat-card {
  background: #181d25;
  border: 1px solid #242b36;
}
.android-app[data-theme="dark"] .stat-card .label { color: #8d98aa; }
.android-app[data-theme="dark"] .panel { background: #0f1218; }
.android-app[data-theme="dark"] table.responsive-table tbody tr {
  background: #181d25;
  border-color: #29313d;
}
.android-app[data-theme="dark"] table.responsive-table tbody td {
  border-color: #29313d;
}
.android-app[data-theme="dark"] input,
.android-app[data-theme="dark"] select,
.android-app[data-theme="dark"] textarea {
  color: #f2f5f8;
  background: #181d25;
  border-color: #29313d;
}
.android-app[data-theme="dark"] .filter-bar .btn:not(.btn-primary),
.android-app[data-theme="dark"] .btn:not(.btn-primary):not(.btn-success):not(.btn-danger) {
  color: #e7ebf0;
  background: #1c222c;
  border-color: #303947;
}
.android-app[data-theme="dark"] .badge.muted { background: #252c37; }
.android-app[data-theme="dark"] pre { background: #11161d; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

html { background: #d1d5db; color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }
.auth-document,
body.auth-page {
  background: #08102a;
  overscroll-behavior-y: none;
}

a { color: inherit; text-decoration: none; }
.mono { font-family: var(--font-mono); }

/* ====== Layout shell ====== */
.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-soft);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 16px;
}

.sidebar-menu {
  display: contents;
}

.mobile-menu-toggle {
  display: none;
}

.sidebar-brand .glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: var(--signal-cyan-dim);
  color: var(--signal-cyan);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  margin-right: 8px;
}
.sidebar-brand .logo-glyph {
  background: var(--bg-panel-raised);
  padding: 2px;
  overflow: hidden;
}
.sidebar-brand .logo-glyph img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sidebar-brand .name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.sidebar-brand .sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
  padding-left: 36px;
}

.nav-section {
  padding: 0 12px 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}

.nav-section:last-child { border-bottom: 0; }

.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 8px 7px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover { background: var(--bg-panel-raised); color: var(--text-primary); }
.nav-item.active { background: var(--signal-cyan-dim); color: var(--signal-cyan); }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.5; flex-shrink: 0; }
.nav-svg,.btn-svg,.heading-icon svg,.table-identity-icon svg,.permission-icon svg{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.nav-svg{width:18px;height:18px;flex:none;color:currentColor}.icon-heading{display:flex;align-items:center;gap:12px}.heading-icon{display:grid;place-items:center;width:44px;height:44px;border-radius:14px;background:var(--signal-cyan-dim);color:var(--signal-cyan);flex:none}.heading-icon svg{width:25px;height:25px}.btn-svg{width:17px;height:17px;flex:none}.btn{gap:7px}.table-identity-icon{display:inline-grid;place-items:center;width:32px;height:32px;margin-right:9px;border-radius:10px;background:var(--signal-cyan-dim);color:var(--signal-cyan);vertical-align:middle}.table-identity-icon svg{width:18px;height:18px}.permission-row{padding:12px 18px;border-bottom:1px solid var(--border-soft);display:flex;align-items:flex-start;gap:10px}.permission-icon{display:grid;place-items:center;width:30px;height:30px;border-radius:9px;background:var(--signal-cyan-dim);color:var(--signal-cyan);flex:none}.permission-icon svg{width:17px;height:17px}
.auto-svg,.auto-heading-svg,.auto-panel-svg,.empty-svg{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.auto-icon-heading{display:flex!important;align-items:center;gap:12px}.auto-heading-svg{box-sizing:content-box;width:25px;height:25px;padding:9px;border-radius:14px;background:var(--signal-cyan-dim);color:var(--signal-cyan);flex:none}.auto-panel-heading{display:flex;align-items:center;gap:9px}.auto-panel-svg{width:19px;height:19px;color:var(--signal-cyan);flex:none}.empty-svg{width:34px;height:34px;color:var(--signal-cyan)}
@media(max-width:600px){.auto-heading-svg{width:21px;height:21px;padding:8px}.auto-icon-heading{gap:9px}}

/* ============================================================
   Global web refresh — clean blue SaaS workspace
   Reference language: spacious white surfaces, rounded cards,
   blue primary actions and a calm neutral canvas.
   ============================================================ */
:root,
[data-theme="light"] {
  --bg: #f1f3f6;
  --bg-panel: #ffffff;
  --bg-panel-raised: #f6f7f9;
  --border: #dfe4eb;
  --border-soft: #edf0f4;
  --text-primary: #111a40;
  --text-secondary: #65738a;
  --text-muted: #96a1b3;
  --signal-green: #51a383;
  --signal-green-dim: rgba(81,163,131,.13);
  --signal-amber: #d88935;
  --signal-amber-dim: rgba(232,159,87,.16);
  --signal-red: #db695d;
  --signal-red-dim: rgba(238,130,115,.15);
  --signal-cyan: #236bfe;
  --signal-cyan-dim: rgba(35,107,254,.11);
  --action-blue: #236bfe;
  --action-blue-hover: #175be2;
  --action-blue-pressed: #104bc0;
  --action-blue-soft: rgba(35,107,254,.11);
  --radius: 14px;
  --shadow-panel: 0 14px 36px rgba(17,26,64,.055);
}

[data-theme="dark"] {
  --bg: #0c1433;
  --bg-panel: #111a40;
  --bg-panel-raised: #19244f;
  --border: #2c3968;
  --border-soft: #202d5a;
  --text-primary: #f8faff;
  --text-secondary: #b3bdd1;
  --text-muted: #7f8ba8;
  --signal-cyan: #6d9cff;
  --signal-cyan-dim: rgba(109,156,255,.15);
  --action-blue: #236bfe;
  --action-blue-hover: #4b84ff;
  --action-blue-pressed: #175be2;
  --action-blue-soft: rgba(35,107,254,.18);
  --shadow-panel: 0 18px 44px rgba(2,7,25,.24);
}

body { background: var(--bg); letter-spacing: -.008em; }
.app-shell { grid-template-columns: 270px minmax(0,1fr); gap: 0; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 14px 18px;
  border-right: 0;
  background: var(--bg-panel);
  overflow-y: auto;
}
.sidebar-brand { margin: 0 6px 18px; padding: 0 10px 22px; }
.sidebar-brand .glyph { width: 34px; height: 34px; border-radius: 11px; background: var(--action-blue); color: #fff; }
.sidebar-brand .name { font-size: 18px; color: var(--text-primary); }
.sidebar-brand .sub { padding-left: 42px; font-family: var(--font-sans); }
.nav-section { padding: 0 6px 10px; margin-bottom: 8px; }
.nav-label { padding: 12px 10px 8px; font-size: 10px; letter-spacing: .11em; }
.nav-item { min-height: 43px; padding: 10px 12px; border-radius: 13px; font-size: 13.5px; }
.nav-item:hover { background: var(--bg-panel-raised); color: var(--text-primary); }
.nav-item.active { background: #e8efff; color: #236bfe; font-weight: 700; }
[data-theme="dark"] .nav-item.active { background: rgba(35,107,254,.18); color: #8ab0ff; }
.nav-svg { width: 19px; height: 19px; }
.sidebar-footer { padding: 16px 12px 0; }
.theme-toggle,.btn-logout { min-height: 40px; border-radius: 12px; }
.user-chip { padding: 10px; border-radius: 14px; background: var(--bg-panel-raised); }
.user-chip .avatar { width: 34px; height: 34px; background: var(--action-blue); color: #fff; }

.main {
  width: auto;
  max-width: none;
  min-height: calc(100vh - 36px);
  margin: 18px;
  padding: 34px 38px 44px;
  border-radius: 28px;
  background: #f7f8fa;
}
[data-theme="dark"] .main { background: #0f1839; }
.page-header { align-items: center; margin-bottom: 28px; }
.page-header h1 { font-size: clamp(24px,2vw,32px); font-weight: 700; letter-spacing: -.035em; }
.page-header .desc { margin-top: 5px; font-size: 14px; }

.stat-grid { gap: 18px; margin-bottom: 26px; }
.stat-card,.panel {
  border: 1px solid rgba(223,228,235,.8);
  border-radius: 20px;
  background: var(--bg-panel);
  box-shadow: var(--shadow-panel);
}
[data-theme="dark"] .stat-card,[data-theme="dark"] .panel { border-color: var(--border-soft); }
.stat-card { min-height: 138px; padding: 22px; }
.stat-card .label { font-family: var(--font-sans); font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.stat-card .value { margin-top: 18px; font-family: var(--font-sans); font-size: 28px; }
.stat-card.has-stat-icon{position:relative;padding-right:72px}.stat-card-link{color:inherit;text-decoration:none;cursor:pointer;transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease}.stat-card-link::after{content:'›';position:absolute;right:25px;bottom:14px;color:var(--action-blue);font-size:18px;font-weight:700;opacity:0;transform:translateX(-4px);transition:opacity .18s ease,transform .18s ease}.stat-card-icon{position:absolute;right:18px;top:18px;display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:var(--action-blue-soft);color:var(--action-blue);transition:transform .18s ease,background .18s ease}.stat-card-svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.stat-card-link:hover{transform:translateY(-3px);border-color:rgba(35,107,254,.35);box-shadow:0 18px 42px rgba(35,107,254,.12)}.stat-card-link:hover .stat-card-icon{transform:scale(1.06);background:rgba(35,107,254,.16)}.stat-card-link:hover::after,.stat-card-link:focus-visible::after{opacity:1;transform:none}.stat-card-link:focus-visible{outline:3px solid var(--action-blue-soft);outline-offset:3px;border-color:var(--action-blue)}.stat-card-link:active{transform:translateY(-1px)}
.panel { margin-bottom: 22px; overflow: auto; }
.panel-header { min-height: 64px; padding: 18px 22px; }
.panel-header h2 { font-size: 17px; font-weight: 700; }
.panel-body { padding: 22px; }

table { border-collapse: separate; border-spacing: 0; }
thead th { padding: 14px 18px; background: var(--bg-panel-raised); font-family: var(--font-sans); font-size: 10.5px; }
thead th:first-child { border-radius: 12px 0 0 12px; }
thead th:last-child { border-radius: 0 12px 12px 0; }
tbody td { padding: 15px 18px; }
tbody tr:hover { background: rgba(35,107,254,.035); }
.badge { min-height: 26px; padding: 5px 10px; border-radius: 99px; font-family: var(--font-sans); }

.btn,.payroll-soft-btn,.payroll-primary-btn {
  min-height: 42px;
  padding: 9px 17px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-weight: 600;
}
.btn-primary,.payroll-primary-btn { background: #236bfe; border-color: #236bfe; box-shadow: 0 9px 20px rgba(35,107,254,.20); }
.btn-primary:hover,.payroll-primary-btn:hover { background: #175be2; box-shadow: 0 12px 26px rgba(35,107,254,.27); }
.btn-danger { color: #d9584c; }

.form-grid { gap: 20px; }
.form-group { margin-bottom: 20px; }
.form-group label,.modal-card label { margin-bottom: 8px; color: var(--text-primary); font-size: 13px; }
input,select,textarea {
  min-height: 48px;
  padding: 11px 15px;
  border-color: var(--border);
  border-radius: 14px;
  background: var(--bg-panel);
  box-shadow: 0 1px 0 rgba(17,26,64,.02);
}
textarea { min-height: 118px; resize: vertical; }
input:focus,select:focus,textarea:focus { border-color: #236bfe; box-shadow: 0 0 0 4px rgba(35,107,254,.10); }
.filter-bar { gap: 10px; padding: 16px 20px; background: var(--bg-panel); }
.alert { border-radius: 14px; padding: 13px 16px; }

.auth-shell { background: radial-gradient(circle at 20% 10%,#1d2d65 0,#111a40 42%,#08102a 100%); }
.auth-card { width: min(460px,calc(100vw - 32px)); padding: 40px; border: 0; border-radius: 30px; background: #fff; box-shadow: 0 30px 90px rgba(2,7,25,.35); color: #111a40; }
.auth-card .glyph-lg { border-radius: 16px; background: #236bfe; color: #fff; }
.auth-card h1 { margin-top: 18px; font-size: 25px; }
.auth-card .form-group label { color: #111a40; }
.auth-card input { background: #fff; color: #111a40; }

.photo-crop-modal,.payroll-modal { background: rgba(17,26,64,.78)!important; backdrop-filter: blur(8px); }
.photo-crop-dialog,.modal-card,dialog { border: 0!important; border-radius: 28px!important; background: var(--bg-panel)!important; box-shadow: 0 30px 90px rgba(2,7,25,.35)!important; }
.modal-card { padding: 34px!important; }
.payroll-page { --pay-blue:#236bfe!important; --pay-blue-2:#5c91ff!important; --pay-blue-soft:#e8efff!important; }
.payroll-kpis article,.payroll-panel,.payroll-status-grid article { border-color: var(--border-soft)!important; box-shadow: var(--shadow-panel)!important; }

@media(max-width:1100px) {
  .app-shell { grid-template-columns: 238px minmax(0,1fr); }
  .main { margin: 12px; padding: 28px 24px 38px; }
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:760px) {
  .app-shell { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; padding: 12px 16px; overflow: visible; }
  .sidebar-brand { margin: 0; padding: 4px 0; border: 0; }
  .main { min-height: calc(100vh - 84px); margin: 0; padding: 24px 16px 36px; border-radius: 24px 24px 0 0; }
  .page-header { align-items: flex-start; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { min-height: 120px; padding: 17px; }
  .auth-card { padding: 28px 22px; border-radius: 24px; }
}
@media(max-width:480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .main { padding-inline: 13px; }
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 20px 0;
  border-top: 1px solid var(--border-soft);
}

.language-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}
.language-picker select {
  width: 100%;
  min-height: 38px;
  padding: 6px 30px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-panel-raised);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}
.language-picker select:focus-visible {
  outline: 2px solid var(--signal-cyan);
  outline-offset: 2px;
}

.theme-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg-panel-raised);
  color: var(--text-secondary);
  border-radius: var(--radius);
  padding: 7px 10px;
  margin-bottom: 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--signal-cyan);
}
.theme-toggle-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--signal-cyan-dim);
  color: var(--signal-cyan);
  font-size: 12px;
}

.user-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-secondary);
  margin-bottom: 10px;
}
.user-chip .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-panel-raised);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--signal-cyan);
  flex: none; overflow: hidden;
}
.user-chip .avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }

.btn-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px; color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  width: 100%; text-align: center;
  background: none; cursor: pointer;
  margin-bottom: 16px;
}
.btn-logout .btn-svg { width: 18px; height: 18px; }
.btn-logout:hover { color: var(--signal-red); border-color: var(--signal-red); }

/* ====== Main content ====== */
.main {
  padding: 28px 36px;
  max-width: 1280px;
  min-width: 0;
}

.page-header {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  margin-bottom: 24px;
}
.page-header > div:last-child:not(:first-child) {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.page-header h1 {
  font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px;
}
.page-header .desc { color: var(--text-secondary); font-size: 13px; margin: 0; }

/* ====== Stat cards ====== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-panel);
}
.stat-card .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin-bottom: 8px;
}
.stat-card .value {
  font-family: var(--font-mono); font-size: 26px; font-weight: 700;
  letter-spacing: -0.02em;
}
.stat-card .value.green { color: var(--signal-green); }
.stat-card .value.amber { color: var(--signal-amber); }
.stat-card .value.red { color: var(--signal-red); }
.stat-card .value.cyan { color: var(--signal-cyan); }
.stat-card .sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.stat-card-link {
  display: block;
  cursor: pointer;
  position: relative;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.stat-card-link:hover {
  transform: translateY(-2px);
  border-color: var(--signal-cyan);
  box-shadow: 0 10px 28px rgba(0,0,0,.14);
}
.stat-card-link:active { transform: scale(.975); }
.stat-card-link:focus-visible { outline: 2px solid var(--signal-cyan); outline-offset: 2px; }
.card-arrow {
  float: right;
  color: var(--signal-cyan);
  font-size: 15px;
  font-weight: 700;
  opacity: .75;
  transition: transform .16s ease;
}
.stat-card-link:hover .card-arrow { transform: translateX(3px); opacity: 1; }

/* ====== Panels / Tables ====== */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.panel-header h2 { font-size: 14px; font-weight: 600; margin: 0; }
.panel-body { padding: 18px; }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600;
}
tbody td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-panel-raised); }
tbody td .primary { font-weight: 600; }
tbody td .secondary { color: var(--text-muted); font-size: 12px; }

/* ====== Badges ====== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
  font-family: var(--font-mono);
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--signal-green-dim); color: var(--signal-green); }
.badge.amber { background: var(--signal-amber-dim); color: var(--signal-amber); }
.badge.red { background: var(--signal-red-dim); color: var(--signal-red); }
.badge.cyan { background: var(--signal-cyan-dim); color: var(--signal-cyan); }
.badge.muted { background: var(--bg-panel-raised); color: var(--text-muted); }

/* ====== Buttons ====== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  justify-content: center;
  padding: 8px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-panel-raised);
  color: var(--text-primary);
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .08s ease;
}
.btn:hover { color: var(--action-blue); border-color: var(--action-blue); background: var(--action-blue-soft); }
.btn:active { transform: translateY(1px) scale(.985); color:#fff; border-color:var(--action-blue-pressed); background:var(--action-blue-pressed); }
.btn:focus-visible, button:focus-visible, [role="button"]:focus-visible { outline:3px solid var(--action-blue-soft); outline-offset:2px; border-color:var(--action-blue); }
.btn-primary { background: var(--action-blue); color: #fff; border-color: var(--action-blue); }
.btn-primary:hover { background: var(--action-blue-hover); border-color:var(--action-blue-hover); color:#fff; box-shadow:0 7px 18px rgba(22,119,232,.24); }
.btn-primary:active { background:var(--action-blue-pressed); border-color:var(--action-blue-pressed); }
.btn-danger { background: var(--signal-red-dim); color: var(--signal-red); border-color: transparent; }
.btn-danger:hover { background: var(--signal-red); color: #1a0504; }
.btn-success { background: var(--signal-green-dim); color: var(--signal-green); border-color: transparent; }
.btn-success:hover { background: var(--signal-green); color: #04140a; }
.btn-danger:active { background:#a92721; border-color:#a92721; color:#fff; }
.btn-success:active { background:#176f2d; border-color:#176f2d; color:#fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
button:not(:disabled), [role="button"], summary.btn { -webkit-tap-highlight-color:transparent; }

/* ====== Custom Select ====== */
.custom-select{position:relative;width:100%;min-width:0}.panel:has(.custom-select.is-open){overflow:visible}.custom-select-native{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}.custom-select-trigger{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:48px;padding:10px 14px;border:1px solid var(--border);border-radius:14px;background:var(--bg-panel);color:var(--text-primary);font:inherit;text-align:left;cursor:pointer;transition:border-color .16s ease,box-shadow .16s ease,background .16s ease}.custom-select-trigger:hover{border-color:var(--action-blue)}.custom-select-trigger:focus-visible,.custom-select.is-open .custom-select-trigger{outline:none;border-color:var(--action-blue);box-shadow:0 0 0 3px var(--action-blue-soft)}.custom-select-trigger.is-placeholder{color:var(--text-muted)}.custom-select-trigger:disabled{opacity:.55;cursor:not-allowed}.custom-select-value{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.custom-select-arrow{display:grid;place-items:center;flex:none;color:var(--text-muted);transition:transform .18s ease}.custom-select-arrow svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}.custom-select.is-open .custom-select-arrow{transform:rotate(180deg)}.custom-select-menu{position:absolute;z-index:1200;top:calc(100% + 7px);left:0;width:100%;min-width:210px;padding:7px;border:1px solid var(--border);border-radius:16px;background:var(--bg-panel);box-shadow:0 18px 42px rgba(15,23,42,.18)}.custom-select-menu[hidden]{display:none}.custom-select-search-wrap{padding:3px 3px 7px}.custom-select-search{min-height:38px!important;padding:7px 10px!important;border-radius:10px!important;background:var(--bg-panel-raised)!important}.custom-select-options{max-height:280px;overflow:auto;overscroll-behavior:contain}.custom-select-option{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:10px 12px;border:0;border-radius:11px;background:transparent;color:var(--text-primary);font:inherit;text-align:left;cursor:pointer}.custom-select-option:hover,.custom-select-option:focus-visible{outline:none;background:var(--bg-panel-raised)}.custom-select-option.is-selected{background:var(--action-blue-soft);color:var(--action-blue);font-weight:700}.custom-select-option:disabled{opacity:.42;cursor:not-allowed}.custom-select-check{visibility:hidden;color:var(--action-blue);font-weight:900}.custom-select-option.is-selected .custom-select-check{visibility:visible}.custom-select-empty{padding:16px 12px;text-align:center;color:var(--text-muted);font-size:12px}@media(max-width:600px){.custom-select-menu{position:fixed;z-index:2000;left:12px;right:12px;top:auto;bottom:12px;width:auto;max-height:min(70vh,520px);border-radius:20px;padding:10px}.custom-select-options{max-height:min(56vh,400px)}.custom-select-option{padding:13px 14px}}
.app-toast-container{position:fixed;z-index:12000;right:22px;top:22px;display:grid;gap:10px;width:min(390px,calc(100vw - 28px));pointer-events:none}.app-toast{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:11px;padding:13px 14px;border:1px solid var(--border-soft);border-radius:16px;background:var(--bg-panel);color:var(--text-primary);box-shadow:0 18px 45px rgba(15,23,42,.2);opacity:0;transform:translateY(-10px);transition:opacity .18s ease,transform .18s ease;pointer-events:auto}.app-toast.is-visible{opacity:1;transform:none}.app-toast.is-leaving{opacity:0;transform:translateY(-8px)}.app-toast-icon{display:grid;place-items:center;width:32px;height:32px;border-radius:10px;background:var(--signal-green-dim);color:var(--signal-green)}.app-toast.error .app-toast-icon{background:rgba(239,68,68,.12);color:#ef4444}.app-toast-icon svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.app-toast>span:nth-child(2){font-size:12px;font-weight:700;line-height:1.45}.app-toast>button{width:28px;height:28px;padding:0;border:0;border-radius:8px;background:transparent;color:var(--text-muted);font-size:20px;cursor:pointer}.app-toast>button:hover{background:var(--bg-panel-raised);color:var(--text-primary)}@media(max-width:600px){.app-toast-container{top:12px;right:14px;left:14px;width:auto}}

/* ====== Forms ====== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
}
.form-group .hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

input, select, textarea {
  width: 100%;
  max-width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: var(--font-sans);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--signal-cyan);
}
input.mono, select.mono { font-family: var(--font-mono); }

.form-actions { display: flex; gap: 10px; margin-top: 8px; }

.user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.user-actions form { margin: 0; }
.password-reset-form {
  display: flex;
  align-items: center;
  gap: 6px;
}
.password-reset-form input {
  width: 150px;
  min-width: 130px;
  padding: 6px 9px;
  font-size: 12px;
}
.asset-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.asset-form-grid .form-group { margin-bottom: 0; }
.asset-form-grid .full { grid-column: 1 / -1; }
.rental-form-heading { margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; }
.rental-form-heading h3 { margin: 0 0 5px; color: var(--navy); font-size: 18px; }
.rental-form-heading p { margin: 0; color: var(--text-muted); font-size: 14px; }
.rental-office-picker { grid-column: span 2; padding: 16px; border: 1px solid #dbe7ff; border-radius: 14px; background: #f6f9ff; }
.rental-office-picker .hint { margin-top: 7px; color: var(--text-muted); }
.asset-origin { display: flex; gap: 7px; align-items: center; margin-top: 7px; font-size: 12px; }
#customer-rental-asset-form input[readonly] { background: #f4f7fb; color: var(--navy); cursor: default; }
.rented-assets-filter input[type="search"],
.stock-assets-filter input[type="search"] { flex: 1 1 320px; }
.inventory-table-scroll,
.rented-assets-scroll {
  max-height: 520px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border-top: 1px solid var(--border-soft);
}
.inventory-table-scroll:focus,
.rented-assets-scroll:focus { outline: 3px solid rgba(35, 107, 254, .14); outline-offset: -3px; }
.inventory-table-scroll table,
.rented-assets-scroll table { min-width: 760px; }
.inventory-table-scroll thead th,
.rented-assets-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--border-soft);
}
.compact-grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 8px;
  min-width: 360px;
  max-width: 520px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-panel-raised);
}
.compact-grid-form textarea,
.compact-grid-form button {
  grid-column: 1 / -1;
}
.inline-editor {
  display: inline-block;
  margin-right: 6px;
  vertical-align: top;
}
.inline-editor > summary {
  list-style: none;
  cursor: pointer;
}
.inline-editor > summary::-webkit-details-marker { display: none; }
.inventory-editor[open]::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(10, 25, 58, .48);
  backdrop-filter: blur(3px);
}
body.inventory-modal-open { overflow: hidden; }
body.termination-modal-open { overflow: hidden; }
.customer-page-header { align-items: flex-start; gap: 28px; padding: 4px 0 2px; }
.customer-header-identity { display: flex; align-items: center; gap: 16px; min-width: 270px; }
.customer-header-identity h1 { max-width: 410px; margin: 0; line-height: 1.13; overflow-wrap: anywhere; }
.customer-header-identity .desc { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.customer-header-identity .desc span { color: var(--text-muted); }
.customer-header-actions { display: flex; justify-content: flex-end; align-items: flex-start; gap: 9px; margin-left: auto; }
.customer-action-dropdown { position: relative; }
.customer-action-dropdown>summary { display: flex; align-items: center; justify-content: space-between; gap: 11px; min-width: 148px; list-style: none; cursor: pointer; }
.customer-action-dropdown>summary::-webkit-details-marker { display: none; }
.customer-action-dropdown[open]>summary { border-color: var(--action-blue); box-shadow: 0 0 0 3px rgba(35,107,254,.1); }
.dropdown-chevron { font-size: 17px; transition: transform .18s ease; }
.customer-action-dropdown[open] .dropdown-chevron { transform: rotate(180deg); }
.customer-action-menu { position: absolute; z-index: 90; top: calc(100% + 9px); right: 0; width: 300px; padding: 7px; border: 1px solid var(--border-soft); border-radius: 16px; background: var(--bg-panel); box-shadow: 0 18px 48px rgba(10,25,58,.18); }
.customer-action-menu a,.customer-action-menu button { display: block; width: 100%; padding: 11px 12px; border: 0; border-radius: 11px; background: transparent; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
.customer-action-menu a:hover,.customer-action-menu button:hover { background: var(--action-blue-soft); }
.customer-action-menu strong,.customer-action-menu small { display: block; }
.customer-action-menu strong { font-size: 13px; }
.customer-action-menu small { margin-top: 2px; color: var(--text-muted); font-size: 11px; }
.customer-action-menu form { margin: 0; }
.customer-action-menu .is-danger strong { color: var(--signal-red); }
.customer-action-menu .is-danger:hover { background: var(--signal-red-dim); }
.customer-action-menu .is-success strong { color: var(--signal-green); }
.customer-action-menu .is-warning strong { color: var(--signal-amber); }
.customer-action-menu .is-warning:hover { background: rgba(245,158,11,.1); }
.customer-stat-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.customer-connection-list { display: grid; gap: 0; }
.customer-connection-item + .customer-connection-item { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--border); }
.customer-stat-grid-business { grid-template-columns: repeat(3,minmax(0,1fr)); align-items: start; }
.customer-stat-grid-business .customer-status-card { grid-column: 1; }
.customer-stat-grid-business .customer-package-card { grid-column: 2; }
.customer-stat-grid-business .customer-due-card { grid-column: 3; grid-row: 1; }
.customer-stat-grid-business .customer-mikrotik-card { grid-column: 1 / -1; grid-row: 2; min-height: 0; }
.customer-stat-grid-business .customer-connection-list { grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 14px; margin-top: 14px; }
.customer-stat-grid-business .customer-connection-item { min-width: 0; padding: 14px 16px; border: 1px solid var(--border-soft); border-radius: 14px; background: var(--bg-panel-raised); }
.customer-stat-grid-business .customer-connection-item + .customer-connection-item { margin-top: 0; }
.customer-stat-grid-business .customer-connection-item .value { margin-top: 0; overflow-wrap: anywhere; }
.customer-stat-grid-business .customer-connection-item .sub { overflow-wrap: anywhere; }
@media(max-width:1200px){.customer-page-header{flex-direction:column}.customer-header-actions{width:100%;margin-left:0;justify-content:flex-start}.customer-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:900px){.customer-stat-grid-business{grid-template-columns:repeat(2,minmax(0,1fr))}.customer-stat-grid-business .customer-status-card,.customer-stat-grid-business .customer-package-card,.customer-stat-grid-business .customer-due-card{grid-column:auto;grid-row:auto}.customer-stat-grid-business .customer-due-card{grid-column:1 / -1}.customer-stat-grid-business .customer-mikrotik-card{grid-row:auto}}
@media(max-width:680px){.customer-header-identity{align-items:flex-start;min-width:0}.customer-header-actions{width:100%;display:grid;grid-template-columns:1fr}.customer-action-dropdown,.customer-action-dropdown>summary{width:100%}.customer-action-menu{position:static;width:100%;margin-top:7px}.customer-stat-grid{grid-template-columns:1fr}}
.termination-modal { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 18px; }
.termination-modal[hidden] { display: none; }
.termination-backdrop { position: absolute; inset: 0; border: 0; background: rgba(10,25,58,.55); backdrop-filter: blur(4px); }
.termination-dialog { position: relative; width: min(590px,100%); max-height: 92vh; overflow-y: auto; display: grid; gap: 17px; padding: 28px; border-radius: 24px; background: var(--bg-panel); box-shadow: 0 30px 90px rgba(10,25,58,.28); }
.termination-dialog-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 15px; background: rgba(239,68,68,.12); color: var(--signal-red); font-size: 25px; font-weight: 900; }
.termination-eyebrow { color: var(--signal-red); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.termination-dialog h2 { margin: 5px 0 6px; color: var(--navy); }
.termination-dialog p { margin: 0; color: var(--text-muted); line-height: 1.55; }
.termination-warning { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid rgba(245,158,11,.25); border-radius: 14px; background: rgba(245,158,11,.08); }
.termination-warning span { color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.termination-actions { display: flex; justify-content: flex-end; gap: 10px; }
.pause-subscription-dialog-icon { background: rgba(245,158,11,.13); color: var(--signal-amber); }
.pause-subscription-eyebrow { color: var(--signal-amber); }
.pause-subscription-note { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid rgba(35,107,254,.2); border-radius: 14px; background: var(--action-blue-soft); }
.pause-subscription-note span { color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.btn-warning { border-color: #d99000; background: var(--signal-amber); color: #fff; }
.btn-warning:hover { background: #d99000; }
.subscription-pause-banner { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; padding: 16px 18px; border: 1px solid rgba(245,158,11,.3); border-radius: var(--radius); background: rgba(245,158,11,.08); }
.subscription-pause-icon { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 11px; background: rgba(245,158,11,.16); color: #b66b00; font-weight: 900; }
.subscription-pause-banner strong { color: var(--navy); }
.subscription-pause-banner p { margin: 4px 0; color: var(--text-secondary); font-size: 13px; line-height: 1.45; }
.subscription-pause-banner small { color: var(--text-muted); }
.value.amber { color: var(--signal-amber); }
@media(max-width:560px){.termination-dialog{padding:20px;border-radius:18px}.termination-actions{flex-direction:column-reverse}.termination-actions .btn{width:100%}}
.inventory-edit-form {
  position: fixed;
  z-index: 1101;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(820px, calc(100vw - 32px));
  max-height: min(88vh, 850px);
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  padding: 24px;
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  background: var(--bg-panel-raised);
  box-shadow: 0 28px 80px rgba(10, 25, 58, .24);
  text-align: left;
}
.inventory-edit-form .form-group { margin: 0; min-width: 0; }
.inventory-edit-form input,
.inventory-edit-form select,
.inventory-edit-form textarea { width: 100%; }
.inventory-edit-header { grid-column: 1 / -1; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border-soft); }
.inventory-edit-header .eyebrow { color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.inventory-edit-header h3 { margin: 4px 0; color: var(--navy); font-size: 22px; }
.inventory-edit-header p { margin: 0; color: var(--text-muted); font-size: 13px; }
.inventory-edit-close { width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--bg-soft); color: var(--navy); font-size: 24px; line-height: 1; cursor: pointer; }
.inventory-edit-wide { grid-column: 1 / -1; }
.inventory-edit-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.inventory-active-toggle { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 13px 15px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--bg-soft); cursor: pointer; }
.inventory-active-toggle input { width: auto; }
.inventory-active-toggle span { display: grid; gap: 2px; }
.inventory-active-toggle small { color: var(--text-muted); font-weight: 400; }
.ticket-replacement-card { padding: 20px; border: 1px solid #d7e5ff; border-radius: 18px; background: linear-gradient(135deg,#f7faff,#eef4ff); }
.ticket-replacement-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.ticket-replacement-heading span:first-child { color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.ticket-replacement-heading h3 { margin: 4px 0; color: var(--navy); font-size: 18px; }
.ticket-replacement-heading p { margin: 0; color: var(--text-muted); font-size: 13px; }
.ticket-replacement-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.ticket-replacement-grid .form-group { margin: 0; }
.ticket-replacement-grid small { display: block; margin-top: 6px; color: var(--text-muted); }
@media(max-width:700px){.ticket-replacement-grid{grid-template-columns:1fr}.ticket-replacement-heading{flex-direction:column}}

@media (max-width: 760px) {
  .inventory-edit-form { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 18px; }
}

@media (max-width: 520px) {
  .inventory-edit-form { grid-template-columns: 1fr; width: calc(100vw - 20px); max-height: 92vh; border-radius: 16px; }
  .inventory-edit-actions { flex-direction: column-reverse; }
  .inventory-edit-actions .btn { width: 100%; }
}
.test-channel-form {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg-panel-raised);
}
.test-channel-form h3 {
  margin: 0 0 12px;
  font-size: 14px;
}
.test-channel-form .form-group {
  margin-bottom: 12px;
}
.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.ticket-timeline {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}
.ticket-timeline-item {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg);
}
.ticket-timeline-item.internal {
  border-color: rgba(210, 153, 34, 0.35);
  background: var(--signal-amber-dim);
}
.ticket-timeline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.ticket-timeline-meta strong {
  color: var(--text-primary);
}
.ticket-timeline-body {
  white-space: pre-wrap;
}
.ticket-comment-form {
  border-top: 1px solid var(--border-soft);
  padding-top: 16px;
}
.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12.5px;
  margin: 0 0 12px;
}
.checkbox-row input {
  width: auto;
  margin: 0;
}
.playbook-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.playbook-toc {
  position: sticky;
  top: 18px;
}
.playbook-toc .panel-body {
  display: grid;
  gap: 4px;
}
.playbook-toc a {
  color: var(--text-secondary);
  padding: 7px 8px;
  border-radius: var(--radius);
  font-size: 13px;
}
.playbook-toc a:hover {
  background: var(--bg-panel-raised);
  color: var(--text-primary);
}
.playbook-section p,
.playbook-section li {
  color: var(--text-secondary);
}
.playbook-section h3 {
  font-size: 13px;
  margin: 22px 0 10px;
}
.playbook-section pre {
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px;
  margin: 12px 0 18px;
}
.playbook-section pre code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-primary);
  white-space: pre;
}
.playbook-section ol,
.playbook-section ul {
  padding-left: 22px;
}

/* ====== Alerts ====== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-error { background: var(--signal-red-dim); color: var(--signal-red); border-color: rgba(248,81,73,0.3); }
.alert-success { background: var(--signal-green-dim); color: var(--signal-green); border-color: rgba(63,185,80,0.3); }
.alert-info { background: var(--signal-cyan-dim); color: var(--signal-cyan); border-color: rgba(57,197,207,0.3); }

/* ====== Auth page ====== */
.auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 20%, rgba(57,197,207,0.06), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(63,185,80,0.05), transparent 40%);
}
.auth-card {
  width: 380px;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 32px;
  box-shadow: var(--shadow-panel);
}
.auth-card-wide { width: min(520px, calc(100vw - 32px)); }
.auth-card .glyph-lg {
  width: 44px; height: 44px;
  background: var(--signal-cyan-dim); color: var(--signal-cyan);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 18px;
  margin-bottom: 18px;
}
.auth-card .logo-glyph-lg {
  background: var(--bg-panel-raised);
  padding: 4px;
  overflow: hidden;
}
.auth-card .logo-glyph-lg img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.auth-card h1 { font-size: 18px; margin: 0 0 4px; }
.auth-card p.sub { color: var(--text-secondary); font-size: 13px; margin: 0 0 24px; }
.twofa-code-input {
  text-align: center;
  font-size: 22px;
  letter-spacing: 6px;
  font-weight: 700;
}
.twofa-secret-input {
  font-size: 16px;
  letter-spacing: 1px;
}
.twofa-setup-box {
  border: 1px solid var(--border-soft);
  background: var(--bg-panel-raised);
  border-radius: var(--radius);
  padding: 14px;
  margin: 16px 0;
}
.twofa-setup-box .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.twofa-setup-box .value {
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 3px;
}
.twofa-qr-card {
  display: grid;
  grid-template-columns: 156px 1fr;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--border-soft);
  background: var(--bg-panel-raised);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}
.twofa-qr-card img {
  width: 156px;
  height: 156px;
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  border: 1px solid var(--border-soft);
}
.twofa-qr-title {
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

/* ====== Empty state ====== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 28px; margin-bottom: 10px; opacity: 0.5; }

/* ====== Filter bar ====== */
.filter-bar {
  display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap;
}
.filter-bar select, .filter-bar input, .filter-bar > .custom-select { width: auto; min-width: 160px; flex: 0 1 220px; }

/* ====== Misc ====== */
.text-right { text-align: right; }
.muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
code.kv {
  font-family: var(--font-mono);
  background: var(--bg-panel-raised);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.logo-preview {
  width: 96px;
  height: 64px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}
.logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 220px 1fr; }
  .main { padding: 24px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
    max-height: 82vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-brand {
    padding: 0 4px 10px;
    margin-bottom: 8px;
    border-bottom: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .sidebar-brand > div {
    display: flex;
    align-items: center;
    min-width: 0;
  }

  .sidebar-brand .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-brand .sub { display: none; }

  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--bg-panel-raised);
    color: var(--text-primary);
    border-radius: var(--radius);
    padding: 7px 12px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
  }

  .sidebar-menu,
  .sidebar-footer {
    display: none;
  }

  .sidebar.mobile-open .sidebar-menu,
  .sidebar.mobile-open .sidebar-footer {
    display: block;
  }

  .sidebar-menu {
    border-top: 1px solid var(--border-soft);
    padding-top: 8px;
  }

  .nav-section {
    display: block;
    padding: 0;
    margin-bottom: 10px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
  }

  .nav-label {
    display: block;
    padding: 9px 12px;
    background: var(--bg-panel-raised);
    border-bottom: 1px solid var(--border-soft);
  }

  .nav-item {
    padding: 11px 12px;
    border-radius: 0;
    border-bottom: 1px solid var(--border-soft);
    background: transparent;
    white-space: normal;
    font-size: 12.5px;
  }

  .nav-item:last-child {
    border-bottom: none;
  }

  .sidebar-footer {
    border-top: 1px solid var(--border-soft);
    margin-top: 6px;
    padding: 10px 0 0;
  }

  .sidebar.mobile-open .sidebar-footer {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .theme-toggle {
    width: auto;
    min-width: 118px;
    margin-bottom: 0;
  }

  .user-chip {
    min-width: 0;
    flex: 1;
    margin-bottom: 0;
  }

  .user-chip > div {
    min-width: 0;
  }

  .user-chip > div > div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-footer form {
    flex: 0 0 auto;
  }

  .btn-logout {
    width: auto;
    margin-bottom: 0;
    padding: 7px 10px;
  }

  .main {
    padding: 20px;
    max-width: none;
    width: 100%;
    overflow-x: hidden;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-header > div:last-child:not(:first-child) {
    justify-content: flex-start;
    width: 100%;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-header > div {
    flex-wrap: wrap;
  }

  table {
    min-width: 720px;
  }

  .form-grid { grid-template-columns: 1fr; }
  .asset-form-grid { grid-template-columns: 1fr 1fr; }
  .rental-office-picker { grid-column: 1 / -1; }
  .ticket-layout { grid-template-columns: 1fr; }
  .playbook-layout { grid-template-columns: 1fr; }
  .playbook-toc { position: static; }

  .filter-bar select,
  .filter-bar > .custom-select,
  .filter-bar input,
  .filter-bar .btn {
    flex: 1 1 180px;
  }
}

@media (max-width: 560px) {
  body { font-size: 13px; }

  .main {
    padding: 14px 10px;
    width: 100%;
    min-width: 0;
  }

  .sidebar {
    padding: 10px;
    max-height: 54vh;
  }

  .stat-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px;
    margin-bottom: 18px;
    width: 100%;
  }

  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 22px; }

  .auth-shell {
    align-items: stretch;
    padding: 18px 12px;
  }

  .auth-card {
    width: 100%;
    max-width: 420px;
    margin: auto;
    padding: 24px;
  }

  .twofa-qr-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .twofa-qr-card img {
    margin: 0 auto;
  }

  .btn {
    min-height: 38px;
  }

  .form-actions {
    flex-direction: column;
  }

  .asset-form-grid,
  .compact-grid-form {
    grid-template-columns: 1fr;
    min-width: 0;
  }
  .rental-office-picker { grid-column: auto; }

  .form-actions .btn,
  .form-actions button,
  .form-actions a {
    width: 100%;
  }

  .filter-bar {
    flex-direction: column;
  }

  .filter-bar select,
  .filter-bar > .custom-select,
  .filter-bar input,
  .filter-bar .btn {
    width: 100%;
    flex-basis: auto;
  }

  .sidebar-footer {
    flex-wrap: wrap;
  }

  .theme-toggle {
    flex: 1 1 100%;
  }

  .btn-logout {
    width: 100%;
  }

  .page-header {
    gap: 12px;
    margin-bottom: 16px;
  }

  .page-header h1 { font-size: 19px; }

  .page-header > div,
  .page-header .btn,
  .panel,
  .panel-body,
  .panel-header {
    max-width: 100%;
    min-width: 0;
  }

  .panel {
    margin-bottom: 14px;
    border-radius: 8px;
  }

  .panel-header { padding: 12px; }
  .panel-body { padding: 12px; }

  /* Turn dense desktop tables into labelled mobile cards. */
  table.responsive-table {
    min-width: 0;
    width: 100%;
    display: block;
    padding: 8px;
  }

  table.responsive-table thead { display: none; }
  table.responsive-table tbody { display: block; }

  table.responsive-table tbody tr {
    display: block;
    padding: 6px 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--bg-panel);
  }

  table.responsive-table tbody tr:last-child { margin-bottom: 0; }

  table.responsive-table tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-soft);
    text-align: right;
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  table.responsive-table tbody td:last-child { border-bottom: none; }

  table.responsive-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 34%;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-align: left;
    text-transform: uppercase;
  }

  table.responsive-table tbody td > * { max-width: 64%; }

  pre,
  code,
  .mono {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  img,
  canvas,
  svg {
    max-width: 100%;
    height: auto;
  }
}
/* Employee management */
.employee-page{--employee-blue:#2563eb}.employee-toolbar,.employee-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}.employee-kpi-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin-bottom:18px}.employee-kpi{display:flex;align-items:center;gap:13px;padding:17px;border:1px solid var(--border);border-radius:18px;background:var(--surface);box-shadow:0 8px 26px rgba(15,23,42,.06)}.employee-kpi>span{display:grid;place-items:center;width:42px;height:42px;border-radius:14px;background:rgba(37,99,235,.12);color:#2563eb;font-size:20px}.employee-kpi strong,.employee-kpi small{display:block}.employee-kpi strong{font-size:24px;color:var(--text-primary)}.employee-kpi small{margin-top:2px;color:var(--text-secondary);font-size:11px}.employee-kpi .small-value{font-size:13px}.employee-filter{display:grid;grid-template-columns:minmax(220px,2fr) repeat(3,minmax(130px,1fr)) auto auto;gap:10px;padding:14px;margin-bottom:16px}.employee-table-wrap{overflow:auto}.employee-table{min-width:1120px}.employee-table td small{display:block;margin-top:5px;color:var(--text-secondary)}.employee-identity{display:flex;align-items:center;gap:11px;min-width:190px}.employee-avatar{display:grid;place-items:center;flex:none;width:42px;height:42px;border-radius:50%;background:linear-gradient(135deg,#2563eb,#38bdf8);color:white;font-weight:800;overflow:hidden}.employee-avatar img{width:100%;height:100%;object-fit:cover}.employee-avatar-lg{width:88px;height:88px;font-size:30px}.role-badge,.status-badge{display:inline-flex;padding:5px 9px;border-radius:999px;font-size:11px;font-weight:700;background:rgba(37,99,235,.12);color:#2563eb}.role-super_admin{background:rgba(220,38,38,.12);color:#ef4444}.role-teknisi{background:rgba(22,163,74,.12);color:#22c55e}.role-finance{background:rgba(147,51,234,.12);color:#a855f7}.role-customer_service{background:rgba(234,88,12,.12);color:#f97316}.status-badge.is-active{background:rgba(22,163,74,.12);color:#22c55e}.status-badge.is-inactive{background:rgba(220,38,38,.12);color:#ef4444}.online-dot{display:inline-block;width:7px;height:7px;border-radius:50%;margin-right:5px;background:#94a3b8}.online-dot.online{background:#22c55e;box-shadow:0 0 0 3px rgba(34,197,94,.13)}.form-section{padding:22px;margin-bottom:16px}.form-section h2{font-size:17px;margin:0 0 18px}.form-section h3{font-size:14px;margin:22px 0 8px}.employee-form-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.span-2{grid-column:span 2}.permission-card-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:10px}.permission-check{display:flex;gap:11px;padding:13px;border:1px solid var(--border);border-radius:16px;background:var(--surface-raised);cursor:pointer}.permission-check input{width:18px;height:18px;accent-color:#2563eb}.permission-check b,.permission-check small{display:block}.permission-check small{margin-top:4px;color:var(--text-secondary);line-height:1.4}.employee-profile{display:flex;align-items:center;gap:20px;padding:24px;margin-bottom:16px;background:linear-gradient(135deg,rgba(37,99,235,.12),var(--surface))}.employee-profile h2{margin:0 0 8px}.employee-profile p{color:var(--text-secondary);margin:9px 0 0}.employee-detail-grid{display:grid;grid-template-columns:1.2fr 1fr;gap:16px}.employee-dl{display:grid;grid-template-columns:1fr 1fr;gap:0 20px}.employee-dl div{padding:12px 0;border-bottom:1px solid var(--border)}.employee-dl dt{font-size:11px;color:var(--text-secondary);text-transform:uppercase}.employee-dl dd{margin:4px 0 0;font-weight:600}.permission-pills{display:flex;flex-wrap:wrap;gap:7px}.permission-pills span{padding:6px 9px;border-radius:10px;background:rgba(37,99,235,.1);color:#3b82f6;font-size:11px}.compact{grid-template-columns:1fr 1fr}.sticky-actions{position:sticky;bottom:10px;z-index:20;padding:12px;border:1px solid var(--border);border-radius:16px;background:var(--bg-panel);box-shadow:0 10px 30px rgba(0,0,0,.12)}
@media(max-width:900px){.employee-filter{grid-template-columns:1fr 1fr}.employee-form-grid,.employee-detail-grid{grid-template-columns:1fr}.span-2{grid-column:auto}}
@media(max-width:600px){.employee-filter{grid-template-columns:1fr}.employee-toolbar{width:100%}.employee-kpi-grid{grid-template-columns:1fr 1fr}.employee-profile{align-items:flex-start}.compact{grid-template-columns:1fr}.employee-table{min-width:0}.employee-table-wrap{overflow:visible}}
@media print{.sidebar,.employee-toolbar,.employee-filter,.employee-actions,.btn{display:none!important}.app-shell{display:block}.main{margin:0!important}.employee-table{min-width:100%}}

/* Permanent customer payment portal */
.payment-portal{min-height:100vh;display:grid;grid-template-columns:minmax(0,1.7fr) minmax(320px,.8fr);background:#fff;color:#26313d}.payment-portal-main{padding:54px clamp(24px,6vw,88px)}.payment-brand{display:flex;align-items:center;gap:16px;margin-bottom:64px}.payment-brand img{width:76px;height:48px;object-fit:contain}.payment-brand h1{margin:0;color:#1677e8;font-size:25px}.payment-brand p{margin:3px 0 0;color:#718096}.portal-heading>span{font-size:12px;font-weight:800;letter-spacing:.12em;color:#667085}.portal-heading h2{margin:12px 0 0;font-size:25px}.portal-heading p{margin:3px 0 22px;color:#718096}.portal-invoices{display:grid;gap:12px}.portal-invoice{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:20px 22px;border:1px solid #e5e9ef;border-radius:16px;background:#fff;box-shadow:0 4px 14px rgba(15,23,42,.06)}.portal-invoice>div:first-child{display:grid;gap:5px}.portal-invoice span{color:#718096;font-size:12px}.portal-invoice-pay{display:flex;align-items:center;gap:16px;text-align:right}.portal-invoice-pay>strong{white-space:nowrap}.payment-summary{padding:70px clamp(28px,5vw,72px);background:#f7f9fc;border-left:1px solid #e5e9ef}.payment-summary h2{font-size:28px;margin:0 0 8px}.payment-summary>p{color:#718096;line-height:1.7}.payment-summary dl{margin:42px 0;border-top:1px solid #dfe5ec}.payment-summary dl>div{display:flex;justify-content:space-between;gap:18px;padding:18px 0;border-bottom:1px solid #dfe5ec}.payment-summary dt{color:#718096}.payment-summary dd{margin:0;font-weight:700;text-align:right}.payment-note{padding:16px;border-radius:14px;background:rgba(22,119,232,.1);color:#0b57b7;line-height:1.6;font-size:13px}@media(max-width:850px){.payment-portal{grid-template-columns:1fr}.payment-portal-main{padding:30px 18px}.payment-brand{margin-bottom:38px}.payment-summary{padding:30px 20px;border-left:0;border-top:1px solid #e5e9ef}.portal-invoice{align-items:flex-start;flex-direction:column}.portal-invoice-pay{width:100%;justify-content:space-between}.portal-invoice-pay form,.portal-invoice-pay .btn{width:100%}}
.employee-pagination{display:flex;justify-content:flex-end;align-items:center;gap:12px;padding:14px}.employee-pagination span{font-size:12px;color:var(--text-secondary)}

/* Employee management: balanced dashboard, compact actions, responsive filters. */
.employee-svg-library{position:absolute;width:0;height:0;overflow:hidden}.employee-title{display:flex;align-items:center;gap:14px}.employee-title>span{display:grid;place-items:center;width:48px;height:48px;border-radius:15px;background:var(--action-blue-soft);color:var(--action-blue)}.employee-title svg,.employee-kpi svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.employee-title h1{margin:0}.employee-title .desc{margin-top:5px}.employee-toolbar .btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;white-space:nowrap}.employee-page .employee-kpi-grid:not(.compact){grid-template-columns:repeat(5,minmax(0,1fr));gap:14px}.employee-page .employee-kpi{min-height:108px;padding:18px;box-shadow:0 10px 28px rgba(15,23,42,.055)}.employee-page .employee-kpi>span{flex:none;width:44px;height:44px;font-size:0}.employee-page .employee-kpi strong{font-size:25px;line-height:1}.employee-page .employee-kpi small{margin-top:7px;font-size:11px;line-height:1.3}.employee-filter{align-items:center}.employee-filter>*{min-width:0}.employee-filter .custom-select{width:100%}.employee-filter .btn{justify-content:center}.employee-table-wrap{border-radius:20px}.employee-table th:last-child,.employee-table td:last-child{min-width:210px}.employee-actions{display:grid;grid-template-columns:repeat(2,minmax(88px,1fr));gap:7px;align-items:stretch}.employee-actions form{display:contents}.employee-actions .btn{display:inline-flex;width:100%;min-height:36px;align-items:center;justify-content:center;gap:6px;padding:7px 10px;white-space:nowrap}.employee-actions .btn-svg{width:15px;height:15px}.employee-pagination{justify-content:center;min-height:72px;border-top:1px solid var(--border-soft);background:var(--bg-panel)}.employee-pagination .btn{min-width:132px;justify-content:center}.employee-pagination span{min-width:88px;text-align:center;font-weight:700}
@media(max-width:1400px){.employee-page .employee-kpi-grid:not(.compact){grid-template-columns:repeat(3,minmax(0,1fr))}.employee-filter{grid-template-columns:minmax(240px,2fr) repeat(2,minmax(150px,1fr));}.employee-filter>.custom-select:nth-of-type(3){grid-column:1/2}.employee-filter .btn{min-width:120px}}
@media(max-width:900px){.employee-page .page-header{align-items:flex-start;gap:18px}.employee-page .employee-kpi-grid:not(.compact){grid-template-columns:repeat(2,minmax(0,1fr))}.employee-toolbar{width:100%}.employee-toolbar .btn{flex:1}.employee-filter{grid-template-columns:1fr 1fr}.employee-filter>.custom-select:nth-of-type(3){grid-column:auto}}
@media(max-width:600px){.employee-title>span{width:42px;height:42px}.employee-title svg{width:20px;height:20px}.employee-toolbar{display:grid;grid-template-columns:1fr 1fr}.employee-toolbar .btn-primary{grid-column:1/-1}.employee-page .employee-kpi-grid:not(.compact){grid-template-columns:1fr 1fr;gap:10px}.employee-page .employee-kpi{min-height:96px;padding:14px;gap:10px}.employee-page .employee-kpi>span{width:38px;height:38px;border-radius:12px}.employee-page .employee-kpi svg{width:19px;height:19px}.employee-page .employee-kpi strong{font-size:21px}.employee-pagination{display:grid;grid-template-columns:1fr 1fr}.employee-pagination span{grid-column:1/-1;grid-row:1}.employee-pagination .btn{min-width:0}}
.employee-page .employee-actions{display:flex}.employee-page .employee-actions form{display:block}.employee-page .employee-actions .btn{width:auto}.employee-table .employee-actions{display:grid;grid-template-columns:repeat(2,minmax(88px,1fr))}.employee-table .employee-actions form{display:contents}.employee-table .employee-actions .btn{width:100%}
/* Employee list table: fixed proportions keep identity, status and actions aligned. */
.employee-table{
  width:100%;
  min-width:1480px;
  table-layout:fixed;
}
.employee-table .employee-col-person{width:18%}
.employee-table .employee-col-contact{width:9%}
.employee-table .employee-col-position{width:10%}
.employee-table .employee-col-role{width:8%}
.employee-table .employee-col-status{width:11%}
.employee-table .employee-col-login{width:12%}
.employee-table .employee-col-joined{width:8%}
.employee-table .employee-col-actions{width:24%}
.employee-table th,
.employee-table td{
  padding-left:18px;
  padding-right:18px;
  vertical-align:middle;
}
.employee-table td{
  overflow-wrap:anywhere;
}
.employee-table .employee-identity{
  min-width:0;
}
.employee-table .employee-identity>div{
  min-width:0;
}
.employee-table .employee-identity b,
.employee-table .employee-identity small{
  overflow-wrap:anywhere;
}
.employee-table .role-badge,
.employee-table .status-badge{
  max-width:100%;
  line-height:1.25;
  text-align:center;
  white-space:nowrap;
}
.employee-table .status-badge.is-pending{
  border:1px solid rgba(245,158,11,.2);
  background:rgba(245,158,11,.13);
  color:#c77700;
}
.employee-table [data-presence-status]{
  display:flex;
  align-items:center;
  min-height:18px;
  white-space:nowrap;
}
.employee-table .employee-actions{
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
}
.employee-table .employee-actions .btn{
  min-width:0;
  min-height:38px;
  padding:7px 9px;
  font-size:12px;
}
@media(max-width:1600px){
  .employee-table{min-width:1380px}
  .employee-table th,.employee-table td{padding-left:14px;padding-right:14px}
  .employee-table .employee-actions .btn{font-size:11px}
}
.employee-table th:last-child{
  padding-right:28px;
  padding-left:18px;
}
.employee-table tbody td:last-child{
  box-sizing:border-box;
  padding:18px 28px 18px 18px;
}
.employee-table tbody td:last-child .employee-actions{
  width:100%;
}
@media(max-width:700px){
  .employee-table colgroup{display:none}
  .employee-table.responsive-table{table-layout:auto}
  .employee-table.responsive-table tbody td:last-child{
    display:block;
  }
  .employee-table.responsive-table tbody td:last-child::before{
    display:block;
    margin-bottom:10px;
  }
  .employee-table.responsive-table tbody td>.employee-actions{
    justify-self:stretch;
    width:100%;
    max-width:none;
  }
  .employee-table .role-badge,
  .employee-table .status-badge{
    white-space:normal;
  }
}
/* Employee list stays usable without horizontal scrolling on tablets/phones. */
@media(max-width:1100px){
  .employee-table-wrap{overflow:visible;background:transparent;border:0;box-shadow:none}
  .employee-table.responsive-table{display:block;width:100%;min-width:0;padding:0;background:transparent}
  .employee-table.responsive-table colgroup,
  .employee-table.responsive-table thead{display:none}
  .employee-table.responsive-table tbody{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;width:100%}
  .employee-table.responsive-table tbody tr{display:grid;align-content:start;width:100%;min-width:0;padding:16px;border:1px solid var(--border-soft);border-radius:18px;background:var(--bg-panel);box-shadow:var(--shadow-panel)}
  .employee-table.responsive-table tbody td,
  .employee-table.responsive-table tbody td:last-child{display:grid;grid-template-columns:minmax(96px,34%) minmax(0,1fr);align-items:start;gap:12px;width:100%;min-width:0;padding:9px 0;border-bottom:1px solid var(--border-soft);text-align:right}
  .employee-table.responsive-table tbody td::before,
  .employee-table.responsive-table tbody td:last-child::before{display:block;content:attr(data-label);color:var(--text-muted);font-size:10px;font-weight:800;letter-spacing:.045em;text-align:left;text-transform:uppercase}
  .employee-table.responsive-table tbody td:first-child{display:block;padding-top:0;text-align:left}
  .employee-table.responsive-table tbody td:first-child::before{display:none}
  .employee-table.responsive-table tbody td:last-child{display:block;padding:13px 0 0;border-bottom:0}
  .employee-table.responsive-table tbody td:last-child::before{margin-bottom:10px}
  .employee-table.responsive-table tbody td>*{max-width:100%;min-width:0;justify-self:end}
  .employee-table.responsive-table .employee-identity{width:100%;min-width:0}
  .employee-table.responsive-table .employee-identity>div{min-width:0}
  .employee-table.responsive-table .employee-identity b,
  .employee-table.responsive-table .employee-identity small{overflow-wrap:anywhere}
  .employee-table.responsive-table .employee-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;width:100%;max-width:none}
  .employee-table.responsive-table .employee-actions form{display:contents}
  .employee-table.responsive-table .employee-actions .btn{width:100%;min-height:42px;padding:8px 10px;font-size:11px}
  .employee-pagination{margin-top:14px;border:1px solid var(--border-soft);border-radius:18px}
}
@media(max-width:700px){
  .employee-page .page-header{display:grid}
  .employee-title{align-items:flex-start}
  .employee-title>div{min-width:0}
  .employee-title h1{font-size:22px}
  .employee-toolbar{display:grid;grid-template-columns:1fr 1fr;width:100%}
  .employee-toolbar .btn{width:100%;min-width:0;padding-inline:10px}
  .employee-toolbar .btn-primary{grid-column:1/-1}
  .employee-filter{grid-template-columns:1fr}
  .employee-filter>*,
  .employee-filter .btn{width:100%;min-width:0}
  .employee-page .employee-kpi-grid:not(.compact){grid-template-columns:repeat(2,minmax(0,1fr))}
  .employee-table.responsive-table tbody{grid-template-columns:1fr}
  .employee-pagination{grid-template-columns:1fr 1fr;padding:12px}
  .employee-pagination span{grid-column:1/-1;grid-row:1}
  .employee-pagination .btn{width:100%;min-width:0;padding-inline:8px}
}
@media(max-width:430px){
  .employee-page .employee-kpi-grid:not(.compact){grid-template-columns:1fr}
  .employee-table.responsive-table .employee-actions{grid-template-columns:1fr}
}
.employee-detail-actions{display:flex;align-items:center;gap:9px}.employee-detail-actions .btn{display:inline-flex;align-items:center;gap:7px}.employee-detail-page .employee-profile{position:relative;overflow:hidden;gap:24px;padding:28px;background:linear-gradient(135deg,rgba(35,107,254,.13),var(--bg-panel) 58%)}.employee-detail-page .employee-profile:after{content:'';position:absolute;right:-65px;top:-90px;width:230px;height:230px;border-radius:50%;background:rgba(35,107,254,.055)}.employee-profile-copy{position:relative;z-index:1;flex:1;min-width:0}.employee-profile-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.employee-profile-heading h2{margin:3px 0 0;font-size:25px}.employee-eyebrow{color:var(--action-blue);font-size:10px;font-weight:800;letter-spacing:.11em}.employee-profile-badges{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:10px}.employee-profile-badges>span:not(.role-badge){padding:5px 9px;border:1px solid var(--border-soft);border-radius:999px;background:var(--bg-panel);color:var(--text-secondary);font-size:11px;font-weight:600}.employee-detail-page .employee-dl div{padding:14px 0}.employee-detail-page .employee-dl dt{font-weight:700;letter-spacing:.055em}.employee-detail-page .employee-dl dd{overflow-wrap:anywhere}.platform-pills .enabled{background:rgba(34,197,94,.12);color:#15935b}.platform-pills .disabled,.permission-pills .disabled{background:var(--bg-panel-raised);color:var(--text-secondary)}.employee-trace-kpis svg,.employee-security-heading svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.employee-security{display:grid;grid-template-columns:minmax(260px,.75fr) minmax(480px,1.25fr);align-items:center;gap:28px}.employee-security-heading{display:flex;align-items:center;gap:13px}.employee-security-heading>span{display:grid;place-items:center;flex:none;width:42px;height:42px;border-radius:13px;background:var(--action-blue-soft);color:var(--action-blue)}.employee-security-heading h2{margin:0 0 5px}.employee-security-heading .desc{margin:0;line-height:1.45}.employee-security-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px}.employee-security-actions form:first-child{display:flex;flex:1;gap:8px}.employee-security-actions input{flex:1;min-width:180px}.employee-security-actions .btn{white-space:nowrap}@media(max-width:900px){.employee-detail-actions{width:100%}.employee-detail-actions .btn{flex:1;justify-content:center}.employee-security{grid-template-columns:1fr}.employee-security-actions{justify-content:flex-start}}@media(max-width:600px){.employee-detail-page .employee-profile{align-items:center;padding:20px}.employee-detail-page .employee-avatar-lg{width:72px;height:72px}.employee-profile-heading{display:block}.employee-profile-heading>.status-badge{margin-top:8px}.employee-detail-page .employee-dl{grid-template-columns:1fr}.employee-security-actions,.employee-security-actions form:first-child{display:grid;width:100%}.employee-security-actions input,.employee-security-actions .btn{width:100%}}
.privilege-label{display:inline-flex;margin-left:6px;padding:3px 7px;border-radius:999px;background:rgba(220,38,38,.12);color:#ef4444;font-size:9px;font-weight:700;text-transform:uppercase}.form-group .hint{display:block;margin-top:6px;color:var(--text-secondary);font-size:10px}

.role-permission-matrix{margin-top:8px;border:1px solid var(--border);border-radius:12px;overflow:hidden;background:var(--surface)}
.role-permission-head,.role-permission-feature{display:grid;grid-template-columns:minmax(240px,1fr) repeat(4,minmax(82px,110px));align-items:stretch}
.role-permission-head{background:var(--surface-2);border-bottom:1px solid var(--border);font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--text-secondary)}
.role-permission-head>span{padding:11px 12px;text-align:center}.role-permission-head>span:first-child{text-align:left}.role-permission-head small{display:block;margin-top:2px;font-size:9px;font-weight:500;text-transform:none;letter-spacing:0}
.role-permission-feature{border-bottom:1px solid var(--border)}.role-permission-feature:last-child{border-bottom:0}
.role-permission-feature-name{padding:12px 14px}.role-permission-feature-name strong{display:block;font-size:13px;color:var(--text-primary)}.role-permission-feature-name small{display:block;margin-top:3px;font-size:10px;line-height:1.35;color:var(--text-secondary)}
.role-permission-check{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;margin:0;padding:10px 6px;border-left:1px solid var(--border);cursor:pointer}.role-permission-check:hover{background:rgba(59,130,246,.05)}.role-permission-check input,.role-special-permission input{width:17px;height:17px;margin:0}.role-permission-check span{font-size:10px;color:var(--text-secondary)}
.role-special-permission-title{display:block;margin-top:22px}.role-special-permissions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:8px}.role-special-permission{display:flex;align-items:flex-start;gap:10px;margin:0;padding:12px;border:1px solid var(--border);border-radius:10px;cursor:pointer}.role-special-permission:hover{background:rgba(59,130,246,.05)}.role-special-permission span{min-width:0}.role-special-permission strong,.role-special-permission small{display:block}.role-special-permission strong{font-size:12px;color:var(--text-primary)}.role-special-permission small{margin-top:3px;font-size:10px;line-height:1.35;color:var(--text-secondary)}
@media(max-width:800px){.role-permission-matrix{overflow-x:auto}.role-permission-head,.role-permission-feature{min-width:620px}.role-special-permissions{grid-template-columns:1fr}}
.employee-photo-upload{grid-column:span 2}.photo-picker{display:flex;align-items:center;gap:16px;padding:14px;border:1px dashed var(--border);border-radius:18px;background:var(--surface-raised)}.photo-picker input[type=file]{max-width:100%;font-size:12px}
.photo-crop-modal[hidden]{display:none}.photo-crop-modal{position:fixed;inset:0;z-index:9999;display:grid;place-items:center;padding:18px;background:rgba(2,6,23,.72);backdrop-filter:blur(7px)}.photo-crop-dialog{width:min(94vw,560px);max-height:94vh;overflow:auto;padding:22px;border:1px solid var(--border);border-radius:26px;background:var(--surface);box-shadow:0 28px 80px rgba(0,0,0,.4);animation:crop-in .2s ease-out}.photo-crop-header{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.photo-crop-header h2{margin:0;font-size:20px}.photo-crop-header p{margin:5px 0 0;color:var(--text-secondary);font-size:12px}.photo-crop-header button{width:40px;height:40px;border:0;border-radius:50%;background:var(--surface-raised);color:var(--text-primary);font-size:24px;cursor:pointer}.photo-crop-stage{margin:18px auto 14px;overflow:hidden;max-width:440px;border-radius:22px;background:#0f172a;touch-action:none}.photo-crop-stage canvas{display:block;width:100%;height:auto;cursor:grab;touch-action:none}.photo-crop-stage canvas:active{cursor:grabbing}.photo-crop-zoom{display:flex;align-items:center;gap:12px;color:var(--text-secondary);font-size:12px}.photo-crop-zoom input{flex:1;accent-color:#2563eb}.photo-crop-tools,.photo-crop-actions{display:flex;gap:10px;margin-top:14px}.photo-crop-actions .btn{flex:1}.crop-open{overflow:hidden}@keyframes crop-in{from{opacity:0;transform:translateY(14px) scale(.98)}to{opacity:1;transform:none}}@media(max-width:600px){.photo-crop-modal{padding:0;align-items:end}.photo-crop-dialog{width:100%;max-height:96vh;border-radius:28px 28px 0 0;padding:18px}.photo-crop-stage{max-width:min(88vw,430px)}}
.notification-bell{position:relative;display:inline-grid;place-items:center;width:25px;height:25px}.notification-bell svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}.notification-count{position:absolute;right:-10px;top:-8px;display:grid;place-items:center;min-width:19px;height:19px;padding:0 4px;border:2px solid var(--surface);border-radius:999px;background:#ef4444;color:#fff;font-size:9px;font-weight:800;line-height:1}.notification-count.pulse{animation:notification-pop .22s ease-out}@keyframes notification-pop{from{opacity:0;transform:scale(.35)}to{opacity:1;transform:scale(1)}}.notification-list{display:grid;gap:13px}.notification-card{display:flex;gap:14px;align-items:flex-start;padding:17px;border:1px solid var(--border);border-radius:16px;background:var(--surface);box-shadow:0 8px 24px rgba(15,23,42,.06);transition:background .22s ease,transform .18s ease,opacity .18s ease;cursor:pointer}.notification-card:hover{transform:translateY(-1px)}.notification-card.is-unread{background:rgba(37,99,235,.09);border-color:rgba(37,99,235,.25)}.notification-card.is-unread h3{font-weight:800}.notification-icon{display:grid;place-items:center;flex:none;width:45px;height:45px;border-radius:14px;background:rgba(37,99,235,.12);font-size:21px}.notification-content{flex:1;min-width:0}.notification-top{display:flex;justify-content:space-between;gap:12px}.notification-top h3{margin:0;font-size:15px}.notification-top time{white-space:nowrap;color:var(--text-secondary);font-size:10px}.notification-content p{margin:6px 0 9px;color:var(--text-secondary);line-height:1.5}.notification-meta{display:flex;gap:8px;flex-wrap:wrap}.notification-meta span{padding:4px 7px;border-radius:8px;background:var(--surface-raised);color:var(--text-secondary);font-size:10px}.notification-card.is-unread .read-state{color:#2563eb}.notification-actions{display:flex;gap:4px}.notification-actions button{border:0;background:transparent;cursor:pointer;padding:5px}@media(max-width:700px){.notification-card{padding:14px}.notification-top{display:block}.notification-top time{display:block;margin-top:4px}.notification-actions{flex-direction:column}.filter-bar{overflow:auto}}

/* Final precedence layer for the shared web shell and legacy components. */
body{background:var(--bg);letter-spacing:-.008em}.app-shell{grid-template-columns:270px minmax(0,1fr);gap:0}.sidebar{position:sticky;top:0;height:100vh;padding:26px 14px 18px;border-right:0;background:var(--bg-panel);overflow-y:auto}.sidebar-brand{margin:0 6px 18px;padding:0 10px 22px}.sidebar-brand .glyph{width:34px;height:34px;border-radius:11px;background:var(--action-blue);color:#fff}.sidebar-brand .name{font-size:18px;color:var(--text-primary)}.nav-section{padding:0 6px 10px;margin-bottom:8px}.nav-item{min-height:43px;padding:10px 12px;border-radius:13px}.nav-item.active{background:#e8efff;color:#236bfe;font-weight:700}.main{width:auto;max-width:none;min-height:calc(100vh - 36px);margin:18px;padding:34px 38px 44px;border-radius:28px;background:#f7f8fa}[data-theme=dark] .main{background:#0f1839}[data-theme=dark] .nav-item.active{background:rgba(35,107,254,.18);color:#8ab0ff}.page-header{align-items:center;margin-bottom:28px}.page-header h1{font-size:clamp(24px,2vw,32px);font-weight:700;letter-spacing:-.035em}.stat-grid{gap:18px;margin-bottom:26px}.stat-card,.panel,.employee-kpi,.notification-card{border:1px solid var(--border-soft);border-radius:20px;background:var(--bg-panel);box-shadow:var(--shadow-panel)}.stat-card{min-height:138px;padding:22px}.stat-card .label{font-family:var(--font-sans);font-size:12px;font-weight:600;text-transform:none;letter-spacing:0}.stat-card .value{margin-top:18px;font-family:var(--font-sans);font-size:28px}.panel{margin-bottom:22px}.panel-header{min-height:64px;padding:18px 22px}.panel-header h2{font-size:17px;font-weight:700}.panel-body{padding:22px}thead th{padding:14px 18px;background:var(--bg-panel-raised);font-family:var(--font-sans)}tbody td{padding:15px 18px}.badge{min-height:26px;padding:5px 10px;font-family:var(--font-sans)}.btn{min-height:42px;padding:9px 17px;border-radius:999px}.btn-primary{background:#236bfe;border-color:#236bfe;box-shadow:0 9px 20px rgba(35,107,254,.2)}input,select,textarea{min-height:48px;padding:11px 15px;border-color:var(--border);border-radius:14px;background:var(--bg-panel)}textarea{min-height:118px}input:focus,select:focus,textarea:focus{border-color:#236bfe;box-shadow:0 0 0 4px rgba(35,107,254,.1)}.auth-shell{background:radial-gradient(circle at 20% 10%,#1d2d65 0,#111a40 42%,#08102a 100%)}.auth-card{padding:40px;border:0;border-radius:30px;background:#fff;box-shadow:0 30px 90px rgba(2,7,25,.35);color:#111a40}.photo-crop-dialog,.modal-card,dialog{border:0!important;border-radius:28px!important;background:var(--bg-panel)!important;box-shadow:0 30px 90px rgba(2,7,25,.35)!important}
@media(max-width:1100px) and (min-width:761px){.app-shell{grid-template-columns:238px minmax(0,1fr)}.main{margin:12px;padding:28px 24px 38px}.stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:760px){.app-shell{display:block}.sidebar{position:relative;width:100%;height:auto;padding:12px 16px;overflow:visible}.sidebar-brand{margin:0;padding:4px 0;border:0}.main{min-height:calc(100vh - 84px);margin:0;padding:24px 16px 36px;border-radius:24px 24px 0 0}.stat-grid{grid-template-columns:1fr 1fr;gap:12px}.stat-card{min-height:120px;padding:17px}.auth-card{padding:28px 22px;border-radius:24px}}
@media(max-width:480px){.stat-grid{grid-template-columns:1fr}.main{padding-inline:13px}}

/* Brand/logo treatment: keep the wide source logo legible without crowding navigation. */
.sidebar-brand>div{display:flex;align-items:center;gap:11px;min-width:0}.sidebar-brand .logo-glyph{display:flex;flex:0 0 86px;width:86px;height:56px;margin:0;padding:8px;border:1px solid #dbe6ff;border-radius:17px;background:linear-gradient(145deg,#fff 0%,#f1f6ff 100%);box-shadow:0 8px 20px rgba(35,107,254,.10);overflow:hidden}.sidebar-brand .logo-glyph img{display:block;width:100%;height:100%;object-fit:contain;filter:saturate(1.08) contrast(1.04)}.sidebar-brand .logo-glyph+.name{min-width:0;font-size:16px;font-weight:750;line-height:1.18;overflow-wrap:normal}.sidebar-brand:has(.logo-glyph) .sub{margin:7px 0 0 97px;padding:0;font-size:11px;line-height:1.2}.sidebar-brand:not(:has(.logo-glyph)) .sub{padding-left:45px}.auth-card .logo-glyph-lg{width:168px;height:76px;margin:0 auto 18px;padding:13px 16px;border:1px solid #dbe6ff;border-radius:22px;background:linear-gradient(145deg,#fff 0%,#edf4ff 100%);box-shadow:0 14px 34px rgba(35,107,254,.14)}.auth-card .logo-glyph-lg img{width:100%;height:100%;object-fit:contain}.payment-brand img{width:132px;height:64px;padding:8px 10px;border-radius:17px;background:#f3f7ff;box-shadow:0 8px 20px rgba(35,107,254,.08)}[data-theme=dark] .sidebar-brand .logo-glyph{border-color:#344778;background:linear-gradient(145deg,#fff 0%,#e8f0ff 100%)}
@media(max-width:1100px) and (min-width:761px){.sidebar-brand .logo-glyph{flex-basis:72px;width:72px;height:50px;padding:7px}.sidebar-brand .logo-glyph+.name{font-size:14px}.sidebar-brand:has(.logo-glyph) .sub{margin-left:83px}}
@media(max-width:760px){.sidebar-brand>div{min-height:52px}.sidebar-brand .logo-glyph{flex-basis:72px;width:72px;height:46px;border-radius:14px}.sidebar-brand .logo-glyph+.name{font-size:16px}.sidebar-brand:has(.logo-glyph) .sub{display:none}}

/* Square brand artwork must keep a square box; avoid horizontal distortion. */
.sidebar-brand .logo-glyph{flex:0 0 68px;width:68px;height:68px;padding:5px;border-radius:21px;background:#f7f9ff}.sidebar-brand .logo-glyph img{border-radius:16px}.sidebar-brand:has(.logo-glyph) .sub{margin-left:79px}.auth-card .logo-glyph-lg{width:112px;height:112px;padding:7px;border-radius:30px}.auth-card .logo-glyph-lg img{border-radius:23px}.payment-brand img{width:82px;height:82px;padding:5px;object-fit:contain}
@media(max-width:1100px) and (min-width:761px){.sidebar-brand .logo-glyph{flex-basis:60px;width:60px;height:60px}.sidebar-brand:has(.logo-glyph) .sub{margin-left:71px}}
@media(max-width:760px){.sidebar-brand .logo-glyph{flex-basis:52px;width:52px;height:52px;padding:4px;border-radius:17px}.sidebar-brand .logo-glyph img{border-radius:13px}}

/* Compact account activity cards on employee detail. */
.employee-detail-page .employee-kpi-grid.compact{gap:12px;margin-bottom:16px}.employee-detail-page .employee-kpi-grid.compact .employee-kpi{min-height:88px;padding:14px 16px;gap:12px;border-radius:16px}.employee-detail-page .employee-kpi-grid.compact .employee-kpi>span{width:38px;height:38px;border-radius:12px}.employee-detail-page .employee-kpi-grid.compact .employee-kpi svg{width:19px;height:19px}.employee-detail-page .employee-kpi-grid.compact .employee-kpi strong{font-size:20px;line-height:1.15}.employee-detail-page .employee-kpi-grid.compact .employee-kpi strong.small-value{font-size:14px;line-height:1.3;white-space:nowrap}.employee-detail-page .employee-kpi-grid.compact .employee-kpi small{margin-top:4px;font-size:10.5px}@media(max-width:1200px){.employee-detail-page .employee-kpi-grid.compact .employee-kpi strong.small-value{font-size:12px;white-space:normal}}@media(max-width:600px){.employee-detail-page .employee-kpi-grid.compact{grid-template-columns:1fr}.employee-detail-page .employee-kpi-grid.compact .employee-kpi{min-height:78px}}

/* Payment portal aligned with the current blue web UI. */
.payment-portal{background:#fff;color:#111a40}.payment-brand{margin-bottom:54px}.payment-brand img{border:1px solid #e3e8f2;border-radius:18px;background:#fff;box-shadow:0 10px 26px rgba(17,26,64,.08)}.payment-brand h1{color:#111a40}.portal-heading>span{color:#236bfe}.portal-heading h2{color:#111a40;font-size:30px}.portal-invoice{padding:18px 20px;border-color:#e3e8f2;border-radius:18px;box-shadow:0 10px 28px rgba(17,26,64,.06)}.portal-invoice:hover{border-color:rgba(35,107,254,.3);box-shadow:0 14px 34px rgba(35,107,254,.1)}.portal-invoice-copy{display:grid;gap:6px}.portal-invoice-copy>strong{color:#111a40}.portal-invoice-copy>span{color:#73809a;font-size:12px}.portal-invoice-pay{margin-left:auto}.payment-summary{background:#f6f8fc;border-left-color:#e3e8f2}.payment-summary-icon{margin-bottom:16px}.payment-summary h2{color:#111a40}.payment-summary dl{border-top-color:#e3e8f2}.payment-summary dl>div{border-bottom-color:#e3e8f2}.payment-note{background:#e8efff;color:#174fac}.payment-portal .btn-primary{background:#236bfe;border-color:#236bfe}@media(max-width:850px){.portal-invoice{flex-direction:row;align-items:center}.portal-invoice-pay{width:auto;flex-direction:column;align-items:flex-end}.portal-invoice-pay form,.portal-invoice-pay .btn{width:auto}}@media(max-width:600px){.portal-invoice{align-items:flex-start;flex-wrap:wrap}.portal-invoice-copy{width:calc(100% - 56px)}.portal-invoice-pay{width:100%;margin-left:54px;flex-direction:row;align-items:center}.portal-invoice-pay form,.portal-invoice-pay .btn{width:100%}}

/* Backup settings */
.settings-backup-panel{overflow:hidden}
.settings-backup-panel .backup-panel-header{min-height:88px;padding:20px 24px;align-items:flex-start;border-bottom:1px solid var(--border-soft)}
.settings-backup-panel .backup-panel-header h2{margin:0;font-size:18px;line-height:1.3}
.settings-backup-panel .backup-panel-header .desc{margin:6px 0 0;color:var(--text-secondary);font-size:13px;line-height:1.5}
.settings-backup-panel>.panel-body{display:grid;gap:16px;padding:24px}
.backup-section-heading{display:flex;align-items:end;justify-content:space-between;gap:16px;margin-top:2px}
.backup-section-heading h3,.backup-list-heading h3{margin:0;color:var(--text-primary);font-size:14px;font-weight:800;line-height:1.35}
.backup-section-heading p,.backup-list-heading p{margin:4px 0 0;color:var(--text-secondary);font-size:12px;line-height:1.45}
.backup-section-heading-danger{margin-top:8px;padding-top:20px;border-top:1px solid var(--border-soft)}
.backup-actions-grid,.backup-restore-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.backup-card{min-width:0;padding:18px;border:1px solid var(--border-soft);border-radius:16px;background:var(--bg-panel-raised)}
.backup-create-card{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:18px;align-items:center}
.backup-card-copy{display:grid;grid-template-columns:42px minmax(0,1fr);gap:4px 12px;align-items:center;min-width:0}
.backup-card-icon{display:grid;grid-row:1/3;place-items:center;width:42px;height:42px;border-radius:12px;background:var(--action-blue-soft);color:var(--action-blue);font-size:9px;font-weight:800;line-height:1;letter-spacing:0}
.backup-card label{display:block;margin:0;color:var(--text-primary);font-size:13px;font-weight:800;line-height:1.35}
.backup-card .hint{grid-column:2;margin:0;color:var(--text-secondary);font-size:12px;line-height:1.45}
.backup-card form{margin:0}
.backup-card .btn{display:inline-flex;align-items:center;justify-content:center;width:max-content;max-width:100%;white-space:nowrap}
.backup-restore-upload{display:grid;grid-template-rows:auto 1fr;gap:16px;background:var(--bg-panel)}
.backup-upload-form{display:grid;grid-template-columns:minmax(0,1fr) 152px;gap:10px;align-self:end;width:100%}
.backup-upload-form input[type=file]{grid-column:1/-1;width:100%;min-width:0;min-height:48px;padding:8px 10px;border:1px dashed var(--border);border-radius:12px;background:var(--bg-panel-raised);color:var(--text-secondary);font-size:12px}
.backup-upload-form input[type=file]::file-selector-button{margin-right:10px;padding:7px 11px;border:1px solid var(--border-soft);border-radius:9px;background:var(--bg-panel);color:var(--text-primary);font:inherit;font-weight:700;cursor:pointer}
.backup-upload-form input[type=file]::-webkit-file-upload-button{margin-right:10px;padding:7px 11px;border:1px solid var(--border-soft);border-radius:9px;background:var(--bg-panel);color:var(--text-primary);font:inherit;font-weight:700;cursor:pointer}
.backup-upload-form input[type=text]{width:100%;min-width:0;min-height:42px;padding:8px 12px;border-radius:11px;font-size:12px}
.backup-upload-form .btn{width:100%;min-height:42px;padding:8px 12px}
.backup-list-section{display:grid;gap:12px;margin-top:8px;padding-top:20px;border-top:1px solid var(--border-soft)}
.backup-list-heading{display:flex;align-items:center;justify-content:space-between;gap:16px}
.backup-list-heading span{flex:none;padding:6px 10px;border-radius:999px;background:var(--action-blue-soft);color:var(--action-blue);font-size:11px;font-weight:800}
.backup-table-wrap{overflow:auto;border:1px solid var(--border-soft);border-radius:14px;background:var(--bg-panel)}
.backup-table{width:100%;min-width:900px;border-collapse:separate;border-spacing:0}
.backup-table th:last-child,.backup-table td:last-child{width:390px;text-align:right}
.backup-table td{vertical-align:middle}
.backup-table .mono{overflow-wrap:anywhere}
.backup-row-actions,.backup-inline-restore{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.backup-row-actions{justify-content:flex-end}
.backup-row-actions .btn{display:inline-flex;align-items:center;justify-content:center;width:auto;min-height:36px;padding:7px 12px;border-radius:11px;line-height:1;white-space:nowrap}
.backup-inline-restore input{width:126px;min-height:36px;padding:7px 10px;border-radius:10px;font-size:12px}
.backup-empty-state{display:grid;place-items:center;gap:5px;min-height:108px;padding:22px;border:1px dashed var(--border);border-radius:14px;background:var(--bg-panel-raised);text-align:center}
.backup-empty-state strong{color:var(--text-primary);font-size:13px}
.backup-empty-state span{color:var(--text-secondary);font-size:12px;line-height:1.45}
@media(max-width:1180px){.backup-create-card{grid-template-columns:1fr;align-items:start}.backup-create-card .btn{width:100%}}
@media(max-width:980px){.backup-actions-grid,.backup-restore-grid{grid-template-columns:1fr}.backup-create-card{grid-template-columns:minmax(0,1fr) auto;align-items:center}.backup-create-card .btn{width:auto}}
@media(max-width:700px){.settings-backup-panel .backup-panel-header{min-height:0;padding:16px}.settings-backup-panel>.panel-body{gap:14px;padding:14px}.backup-section-heading-danger,.backup-list-section{padding-top:16px}.backup-actions-grid,.backup-restore-grid{gap:10px}.backup-card{padding:14px;border-radius:14px}.backup-create-card{grid-template-columns:1fr;gap:14px}.backup-create-card .btn{width:100%}.backup-card-copy{grid-template-columns:38px minmax(0,1fr)}.backup-card-icon{width:38px;height:38px;border-radius:11px}.backup-upload-form{grid-template-columns:1fr}.backup-upload-form input[type=file]{grid-column:auto}.backup-upload-form input[type=file],.backup-upload-form input[type=text],.backup-upload-form .btn{width:100%}.backup-list-heading{align-items:flex-start}.backup-table{min-width:0}.backup-table.responsive-table thead{display:none}.backup-table.responsive-table tbody,.backup-table.responsive-table tr,.backup-table.responsive-table td{display:block;width:100%}.backup-table.responsive-table tr{padding:12px 14px;border-bottom:1px solid var(--border-soft)}.backup-table.responsive-table tr:last-child{border-bottom:0}.backup-table.responsive-table td{display:grid;grid-template-columns:96px minmax(0,1fr);gap:10px;padding:6px 0;border:0;text-align:left}.backup-table.responsive-table td::before{content:attr(data-label);color:var(--text-secondary);font-size:11px;font-weight:700}.backup-table.responsive-table td:last-child{display:block}.backup-table.responsive-table td:last-child::before{display:none}.backup-row-actions{justify-content:flex-start;margin-top:4px}.backup-inline-restore{flex:1}.backup-inline-restore input{flex:1;width:auto;min-width:110px}}
@media(max-width:420px){.backup-list-heading{display:grid}.backup-list-heading span{width:max-content}.backup-row-actions>a{width:100%!important}.backup-inline-restore{display:grid;grid-template-columns:1fr auto;width:100%}}

/* Phone layout: final precedence for iPhone-sized web viewports. */
@media (max-width: 600px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  body {
    font-size: 14px;
    letter-spacing: 0;
    -webkit-text-size-adjust: 100%;
  }

  .app-shell {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: block;
    width: 100%;
    max-height: none;
    padding: max(8px, env(safe-area-inset-top)) 14px 8px;
    overflow: visible;
    border-bottom: 1px solid var(--border-soft);
    background: var(--bg-panel);
  }

  .sidebar-brand {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 54px;
    margin: 0;
    padding: 0;
  }

  .sidebar-brand > div {
    min-width: 0;
    min-height: 52px;
  }

  .sidebar-brand .logo-glyph {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }

  .sidebar-brand .logo-glyph img { border-radius: 10px; }
  .sidebar-brand .logo-glyph + .name { font-size: 15px; }

  .mobile-menu-toggle {
    min-width: 72px;
    min-height: 42px;
    padding: 8px 13px;
    border-radius: 12px;
  }

  .sidebar.mobile-open {
    max-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .sidebar-menu {
    max-height: calc(100dvh - 86px - env(safe-area-inset-top));
    padding: 10px 0 max(14px, env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .nav-section {
    margin-bottom: 10px;
    border-radius: 14px;
  }

  .nav-item {
    min-height: 46px;
    padding: 11px 13px;
    font-size: 13px;
  }

  .sidebar.mobile-open .sidebar-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .theme-toggle { grid-column: 1 / -1; width: 100%; }
  .user-chip { width: 100%; overflow: hidden; }
  .sidebar-footer form { min-width: 82px; }
  .btn-logout { width: 100%; min-height: 40px; }

  .main {
    width: 100%;
    min-width: 0;
    min-height: calc(100dvh - 70px);
    margin: 0;
    padding: 20px 14px max(32px, env(safe-area-inset-bottom));
    overflow-x: clip;
    border-radius: 0;
  }

  .main > *,
  .page-header > *,
  .panel > *,
  .panel-body > *,
  .form-grid > *,
  .filter-bar > * {
    min-width: 0;
    max-width: 100%;
  }

  .page-header {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
  }

  .page-header h1 {
    font-size: 22px;
    line-height: 1.25;
    letter-spacing: 0;
    overflow-wrap: anywhere;
  }

  .page-header .desc {
    margin-top: 5px;
    font-size: 12.5px;
    line-height: 1.55;
    overflow-wrap: anywhere;
  }

  .page-header > div:last-child:not(:first-child) {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 8px;
  }

  .page-header > div:last-child:not(:first-child) .btn,
  .page-header > .btn {
    width: 100%;
  }

  .stat-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .stat-card {
    min-height: 108px;
    padding: 16px;
    border-radius: 16px;
  }

  .stat-card .value { margin-top: 12px; }

  .panel {
    width: 100%;
    margin-bottom: 14px;
    overflow: hidden;
    border-radius: 16px;
  }

  .panel-header {
    display: grid;
    width: 100%;
    min-height: 0;
    gap: 10px;
    padding: 15px;
  }

  .panel-header h2 {
    font-size: 15px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .panel-header > div,
  .panel-header .btn { width: 100%; }
  .panel-header > div { display: grid; gap: 8px; }
  .panel-body { width: 100%; padding: 15px; }

  .form-grid,
  .asset-form-grid,
  .compact-grid-form {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px;
  }

  .form-group,
  .form-group.full,
  .rental-office-picker,
  .employee-photo-upload {
    grid-column: auto;
    width: 100%;
  }

  input,
  select,
  textarea,
  .custom-select,
  .custom-select-trigger {
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  input[type="checkbox"],
  input[type="radio"] {
    width: auto;
    min-height: 0;
  }

  .form-actions,
  .filter-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    gap: 9px;
  }

  .form-actions > *,
  .form-actions form,
  .form-actions .btn,
  .filter-bar > *,
  .filter-bar .btn {
    width: 100%;
    min-width: 0;
  }

  .alert {
    width: 100%;
    overflow-wrap: anywhere;
    line-height: 1.5;
  }

  table.responsive-table {
    display: block;
    width: 100%;
    min-width: 0 !important;
    padding: 8px;
  }

  table.responsive-table thead { display: none; }
  table.responsive-table tbody { display: grid; gap: 10px; width: 100%; }

  table.responsive-table tbody tr {
    display: grid;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 13px;
    background: var(--bg-panel);
  }

  table.responsive-table tbody td {
    display: grid;
    grid-template-columns: minmax(84px, 34%) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    width: 100%;
    min-width: 0;
    padding: 9px 0;
    text-align: right;
    overflow-wrap: anywhere;
  }

  table.responsive-table tbody td::before {
    min-width: 0;
    text-align: left;
  }

  table.responsive-table tbody td > * {
    max-width: 100%;
    min-width: 0;
    justify-self: end;
  }

  table.responsive-table tbody td > form,
  table.responsive-table tbody td > .user-actions,
  table.responsive-table tbody td > .invoice-row-actions,
  table.responsive-table tbody td > .backup-row-actions {
    justify-self: stretch;
    width: 100%;
  }

  .modal-card,
  .photo-crop-dialog,
  dialog {
    width: calc(100% - 24px) !important;
    max-width: none !important;
    max-height: calc(100dvh - 24px) !important;
    padding: 20px !important;
    border-radius: 20px !important;
    overflow-y: auto;
  }

  .auth-shell { padding: max(18px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom)); }
  .auth-card { width: 100%; padding: 24px 20px; border-radius: 22px; }

  img,
  video,
  canvas,
  iframe { max-width: 100%; }
}

/* Authentication helpers shared by login and password recovery. */
.auth-field-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:7px}
.auth-field-heading label{margin:0}
.auth-field-heading a,.auth-back-link{color:var(--action-blue);font-size:12px;font-weight:700;text-decoration:none}
.auth-field-heading a:hover,.auth-back-link:hover{text-decoration:underline}
.auth-card .auth-description{margin:7px 0 22px;line-height:1.55}
.auth-submit{width:100%;justify-content:center;padding:10px}
.auth-back-link{display:block;margin-top:20px;text-align:center}
