:root {
  --bg: #050814;
  --navy: #0a1424;
  --gold: #d4af37;
  --gold-light: #f0d78c;
  --blue: #2eb7ef;
  --text: #f4f7fb;
  --muted: #b8c4d4;
  --card: rgba(10, 20, 36, 0.92);
  --border: rgba(212, 175, 55, 0.28);
  --danger: #e85d4c;
  --ok: #3ecf8e;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif; }
body {
  background-image: radial-gradient(ellipse at top, #12203a 0%, #050814 55%);
}
button, input, select, textarea { font: inherit; }
a { color: var(--gold-light); }
.wrap { max-width: 980px; margin: 0 auto; padding: 16px 16px 120px; }
.kpi { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.brand-head { text-align: center; padding: 24px 12px 8px; }
.brand-head img.header { width: min(420px, 92vw); height: auto; border-radius: 10px; }
.brand-head img.mark { width: 120px; height: 120px; object-fit: contain; }
.sub { color: var(--muted); margin: 8px 0 0; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; margin: 12px 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
label { display: block; color: var(--muted); font-size: 0.85rem; margin: 8px 0 4px; }
input, select, textarea {
  width: 100%; background: #081018; color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 80px; }
.pin-wrap { position: relative; }
.pin-wrap input { padding-right: 108px; }
.pin-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: #2a3a52; color: #ffffff; border: 1px solid rgba(255,255,255,0.35);
  border-radius: 8px; padding: 6px 10px; font-size: 0.8rem; cursor: pointer; font-weight: 650;
}
.btn {
  appearance: none; border: 0; border-radius: 12px; padding: 12px 14px; font-weight: 650;
  background: linear-gradient(180deg, var(--gold-light), var(--gold)); color: #1a1404; cursor: pointer;
}
.btn.secondary { background: #132033; color: var(--gold-light); border: 1px solid var(--border); }
.btn.blue { background: linear-gradient(180deg, #5ecfff, var(--blue)); color: #04202c; }
.btn.danger { background: #5a2018; color: #ffc8c0; border: 1px solid #8a3a30; }
.btn:disabled { opacity: 0.5; }
.btn.block { width: 100%; margin-top: 8px; }
.seg { display: flex; gap: 8px; margin: 8px 0; }
.seg button {
  flex: 1; background: #132033; color: var(--muted); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 8px; cursor: pointer; font-weight: 650;
}
.seg button.active { color: #1a1404; background: linear-gradient(180deg, var(--gold-light), var(--gold)); border-color: transparent; }
.report-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 8px 0 12px; }
.report-table th, .report-table td { padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,0.08); text-align: left; }
.report-table th { color: var(--gold-light); font-weight: 650; }
.report-table .num { text-align: right; white-space: nowrap; }
.report-table tfoot td { font-weight: 650; color: var(--gold-light); border-bottom: 0; padding-top: 12px; }
.kpi div { background: #081018; border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.kpi b { display: block; font-size: 1.35rem; color: var(--gold-light); }
.kpi span { color: var(--muted); font-size: 0.8rem; }
.topbar { background: rgba(8, 16, 32, 0.9); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--border); }
.topbar-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.topbar img { height: 40px; width: 40px; object-fit: contain; flex-shrink: 0; }
.topbar strong { flex: 1; }
.topbar .who { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.topbar #logout { flex-shrink: 0; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 2px; padding: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: #070d18; border-top: 1px solid var(--border); z-index: 8;
}
.nav button { flex: 1; background: transparent; color: var(--muted); border: 0; padding: 8px 4px; font-size: 0.72rem; }
.nav button.active { color: var(--gold-light); }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: #081018; border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.item.clickable { cursor: pointer; }
.item.clickable:hover, .item.clickable:focus, .item.clickable.active { border-color: var(--gold); outline: none; }
.item small { color: var(--muted); }
.legal-links { text-align: center; padding: 8px 16px 28px; font-size: 0.85rem; }
body:has(.nav) .legal-links { padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px)); }
.legal .legal-links, .brand-head ~ .card .legal-links { padding-bottom: 28px; }
.legal ul { margin: 8px 0 0 18px; color: var(--text); }
.legal li { margin: 6px 0; }
.legal p { line-height: 1.45; }
.err { color: #ffb4aa; background: #3a1814; border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.ok { color: #b8ffd6; }
h1, h2 { font-weight: 650; color: var(--gold-light); margin: 0 0 8px; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
.check { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.status-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; background: #132033; color: var(--blue); }
.status-pill.pause { color: var(--gold-light); }
.status-pill.done { color: var(--ok); }
.qr-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.qr-card { text-align: center; }
.qr-img { width: min(260px, 70vw); height: auto; background: #fff; padding: 12px; border-radius: 12px; margin: 8px 0; }
@media (min-width: 720px) {
  .qr-grid { grid-template-columns: 1fr 1fr; }
}
@media print {
  body { background: #fff; color: #111; }
  .btn, a { display: none; }
  .qr-img { width: 240px; }
}
@media (min-width: 860px) {
  .nav {
    position: static;
    width: auto;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 0 8px;
    background: #070d18;
    border: 0;
    border-top: 1px solid var(--border);
  }
  .nav button {
    flex: 1 1 auto;
    padding: 10px 12px;
    font-size: 0.85rem;
    border-radius: 0;
    white-space: nowrap;
  }
  .nav button.active {
    color: var(--gold-light);
    background: rgba(212, 175, 55, 0.16);
    box-shadow: inset 0 -2px 0 var(--gold);
  }
  .wrap { margin-left: 0; padding: 20px 28px 32px; }
  main.wrap {
    max-width: none;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
    align-items: start;
  }
  main.wrap > h1,
  main.wrap > h2,
  main.wrap > .sub,
  main.wrap > #admin-detail,
  main.wrap > #shift-detail,
  main.wrap > #job-detail,
  main.wrap > #trip-detail,
  main.wrap > #plan-detail,
  main.wrap > .kpi {
    grid-column: 1 / -1;
  }
  .kpi { grid-template-columns: repeat(4, 1fr); }
  .legal-links { padding-bottom: 28px; }
}
html.windows-app .nav {
  position: static;
  width: auto;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 0 8px;
  background: #070d18;
  border: 0;
  border-top: 1px solid var(--border);
}
html.windows-app .nav button {
  flex: 1 1 auto;
  padding: 10px 12px;
  font-size: 0.85rem;
  border-radius: 0;
  white-space: nowrap;
}
html.windows-app .nav button.active {
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.16);
  box-shadow: inset 0 -2px 0 var(--gold);
}
html.windows-app .wrap { margin-left: 0; padding: 20px 28px 32px; }
html.windows-app main.wrap {
  max-width: none;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
  align-items: start;
}
html.windows-app main.wrap > h1,
html.windows-app main.wrap > h2,
html.windows-app main.wrap > .sub,
html.windows-app main.wrap > #admin-detail,
html.windows-app main.wrap > #shift-detail,
html.windows-app main.wrap > #job-detail,
html.windows-app main.wrap > #trip-detail,
html.windows-app main.wrap > #plan-detail,
html.windows-app main.wrap > .kpi {
  grid-column: 1 / -1;
}
html.windows-app .kpi { grid-template-columns: repeat(4, 1fr); }
html.windows-app .legal-links { padding-bottom: 28px; }
