:root {
  --bg: #0b1220;
  --card: #121a2b;
  --card-2: #172239;
  --line: #2b3958;
  --text: #eef2ff;
  --muted: #a7b0c5;
  --accent: #38bdf8;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 18px;
  --shadow: 0 10px 24px rgba(0,0,0,.25);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: linear-gradient(180deg, #0b1220 0%, #0c1424 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}
body { min-height: 100vh; }
.app { max-width: 1220px; margin: 0 auto; padding: env(safe-area-inset-top) 14px env(safe-area-inset-bottom) 20px; }
.hero {
  display:flex; justify-content:space-between; gap:16px; align-items:flex-start;
  position: sticky; top: 0; z-index: 30;
  padding: 12px 0 14px;
  backdrop-filter: blur(12px);
  background: rgba(11,18,32,.88);
}
.hero h1 { margin: 0; font-size: 26px; }
.hero p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.hero-right { display:flex; align-items:center; gap: 8px; }
.hidden { display: none !important; }
.loading-card { margin-top: 10px; }
.tabs {
  display:grid; grid-template-columns: repeat(5, 1fr); gap:10px;
  margin: 10px 0 16px;
}
.tab-btn {
  border: 1px solid var(--line);
  background: #10192b;
  color: var(--text);
  border-radius: 14px;
  padding: 12px 10px;
  font-size: 14px;
  cursor: pointer;
}
.tab-btn.active {
  background: linear-gradient(180deg, #15314e 0%, #10243b 100%);
  border-color: #2b8ec4;
}
.tab { display: none; }
.tab.active { display: block; }
.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card, .grid.grid-2 > .card { min-width: 0; }
.section-title {
  display:flex; align-items:flex-start; justify-content:space-between; gap:10px;
  margin-bottom: 12px;
}
.section-title h2, .section-title h3 { margin: 0; font-size: 19px; }
.muted { color: var(--muted); }
.grid { display:grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
label { display:block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%;
  background: #0d1524;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
textarea { min-height: 96px; resize: vertical; }
button {
  border: 1px solid var(--line);
  background: #0f172a;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}
button.primary { background: linear-gradient(180deg, #1d84b5 0%, #10689d 100%); border-color: #3ab8f5; }
button.success { background: linear-gradient(180deg, #1c8d4f 0%, #126d3c 100%); border-color: #32d27a; }
button.danger { background: linear-gradient(180deg, #a12a2a 0%, #7b1d1d 100%); border-color: #ef4444; }
button.ghost { background: transparent; }
button.small { padding: 8px 10px; font-size: 13px; }
.row { display:flex; flex-wrap:wrap; gap:10px; }
.row > * { flex: 1; min-width: 180px; }
.btn-row { display:flex; flex-wrap:wrap; gap:10px; }
.toolbar-inline { display:flex; flex-wrap:wrap; gap:10px; align-items:center; min-width: min(420px, 100%); }
.toolbar-inline > * { flex:1; min-width: 160px; }
.top-space { margin-top: 12px; }
.pill {
  display:inline-flex; align-items:center; gap:8px;
  padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #0d1524;
  color: var(--muted); font-size: 13px;
}
.status-ok { color: #adf7c6; border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.14); }
.status-warn { color: #ffd7a3; border-color: rgba(245,158,11,.45); background: rgba(245,158,11,.14); }
.status-bad { color: #ffb3b3; border-color: rgba(239,68,68,.45); background: rgba(239,68,68,.14); }
.entries, .history-list, .directory-list { display:grid; gap: 10px; }
.worker-item, .vehicle-item, .directory-item {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(6,10,18,.22);
}
.inline-total { padding-top: 4px; font-size: 14px; color: var(--accent); font-weight: 600; }
.totals { display:grid; gap:12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: rgba(9,14,24,.4); }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 22px; margin-top: 6px; font-weight: 700; }
.entry-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(12,20,36,.5);
}
.entry-top { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.entry-title { font-weight: 700; margin-bottom: 6px; }
.entry-meta { color: var(--muted); font-size: 13px; }
.amount { font-weight: 700; font-size: 18px; white-space: nowrap; }
.session-summary { display:flex; flex-wrap: wrap; gap:8px; margin-top: 10px; }
.report-table-wrap { overflow:auto; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; background: rgba(12,20,36,.4); }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; background: rgba(255,255,255,.02); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
.empty {
  padding: 24px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 16px;
}
.help-list { margin: 0; padding-left: 18px; color: var(--muted); display:grid; gap: 8px; }
code { color: #d8f2ff; background: rgba(255,255,255,.06); padding: 2px 6px; border-radius: 6px; }
.manual-total-row { display:flex; flex-wrap:wrap; gap:10px; align-items:center; min-height: 48px; }
.manual-total-row .pill { min-height: 40px; }
.badge {
  display:inline-block; font-size: 12px;
  padding: 4px 8px; border-radius: 999px;
  border: 1px solid rgba(56,189,248,.35);
  color: #8edcff; background: rgba(56,189,248,.12);
}
@media (max-width: 980px) {
  .tabs, .totals, .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .hero { position: static; flex-direction: column; }
  .grid-2, .grid-3, .grid-4, .tabs, .totals { grid-template-columns: 1fr; }
  .toolbar-inline { min-width: 0; width: 100%; }
  .entry-top { flex-direction: column; }
  .amount { white-space: normal; }
}


.entry-card {
  position: relative;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  scroll-margin-top: 88px;
}
.entry-card-worker { border-left: 5px solid rgba(56,189,248,.9); }
.entry-card-vehicle { border-left: 5px solid rgba(34,197,94,.9); }
.entry-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}
.entry-index {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .2px;
}
.entries {
  display:flex;
  flex-direction:column;
  gap:16px;
}
.card .btn-row.top-space:last-child {
  position: sticky;
  bottom: 8px;
  padding-top: 10px;
  background: linear-gradient(180deg, rgba(18,26,43,0), rgba(18,26,43,.94) 40%);
}
@media (max-width: 700px) {
  .entry-head { align-items:flex-start; }
  .entry-head .small { width:auto; }
}


.inline-info {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: rgba(255,255,255,.02);
}
.compact-row { align-items: center; }
.compact-row button { flex: 1; }


.quick-pick-card {
  background: linear-gradient(180deg, rgba(56,189,248,.08), rgba(255,255,255,.02));
}
.quick-add-grid .compact-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--text);
}
.check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
}
.small-text {
  font-size: 13px;
}
.report-subline {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 760px) {
  .quick-add-grid .compact-row {
    grid-template-columns: 1fr;
  }
}


.section-title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.quick-status-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.sticky-summary-card {
  position: sticky;
  top: 8px;
  z-index: 12;
  margin-bottom: 14px;
  border-color: rgba(56,189,248,.35);
  background: linear-gradient(180deg, rgba(17,29,49,.96), rgba(12,20,36,.97));
  backdrop-filter: blur(12px);
}
.sticky-summary-head {
  margin-bottom: 10px;
}
.sticky-totals-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.sticky-totals-grid .value {
  font-size: 24px;
}
@media (max-width: 760px) {
  .sticky-summary-card {
    top: 6px;
  }
  .quick-status-wrap {
    justify-content: flex-start;
  }
  .sticky-totals-grid {
    grid-template-columns: 1fr;
  }
}


.compact-live-card {
  position: sticky;
  top: 8px;
  z-index: 18;
  padding: 10px 12px;
}
.compact-live-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.compact-live-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.compact-live-left strong {
  color: var(--text);
  font-size: 15px;
}
.compact-live-totals {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.compact-total {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(9,14,24,.55);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.compact-total span {
  color: var(--muted);
  font-size: 12px;
}
.compact-total strong {
  font-size: 15px;
}
.compact-grand {
  border-color: rgba(56,189,248,.35);
  background: rgba(56,189,248,.12);
}
.small-pill {
  padding: 4px 8px;
  font-size: 12px;
}
@media (max-width: 760px) {
  .compact-live-card {
    top: 0;
    padding: 8px 10px;
  }
  .compact-live-row {
    align-items: flex-start;
  }
  .compact-live-left strong {
    font-size: 14px;
  }
  .compact-total {
    padding: 5px 8px;
  }
  .compact-total strong {
    font-size: 14px;
  }
}
