:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --surface: #121820;
  --surface-2: #17202a;
  --surface-3: #1d2732;
  --text: #f3f6f9;
  --muted: #9ba7b4;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #4ade80;
  --accent-2: #22c55e;
  --danger: #f87171;
  --warning: #facc15;
  --info: #7dd3fc;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: 0;
  color: var(--text);
  background: linear-gradient(180deg, #111821 0%, #080b10 100%);
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, dl, dd { margin: 0; }

.app-shell {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  justify-items: center;
  padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
}
.app-shell-nav { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.screen, .auth-screen {
  width: min(100%, 460px);
}
.screen { display: grid; gap: 16px; align-content: start; }
.auth-screen { min-height: 100svh; display: grid; align-content: center; gap: 18px; }

.topbar, .brand-lockup {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.brand-lockup { display: grid; justify-content: start; }
.compact-topbar h1, .topbar h1, .brand-lockup h1 {
  font-size: 32px;
  line-height: 1.08;
  font-weight: 850;
}
.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}
.subtext { margin-top: 6px; color: var(--muted); font-size: 15px; line-height: 1.42; }
.screen-footnote { color: var(--muted); text-align: center; font-size: 13px; }

.surface, .status-panel, .shift-focus-card, .metric-card, .notice-card, .quick-card, .fine-card-new, .rule-card, .checklist-card, .filter-panel, .menu-list a, .empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 24, 32, 0.94);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}
.surface { padding: 18px; }
.form-stack { display: grid; gap: 12px; }
.field-label, .panel-kicker, .filter-grid label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.button, .icon-link, .bottom-nav-item, .filter-panel summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  font-weight: 820;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease, opacity 140ms ease;
}
.button:active, .icon-link:active, .bottom-nav-item:active { transform: translateY(1px); }
.button-primary { color: #06100a; background: var(--accent); box-shadow: 0 12px 24px rgba(34, 197, 94, 0.2); }
.button-primary:hover { background: var(--accent-2); }
.button-soft { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.button-warning { color: #171104; background: var(--warning); }
.button-danger { color: #fff0f0; background: rgba(248, 113, 113, 0.14); border-color: rgba(248, 113, 113, 0.42); }
.button-ghost, .icon-link { color: var(--muted); background: rgba(255, 255, 255, 0.04); border-color: var(--line); }
.top-action { min-width: 100px; padding: 0 14px; }

.form-control, .code-input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: #0d131a;
  padding: 0 13px;
  font-size: 16px;
  font-weight: 720;
}
.code-input { min-height: 58px; font-size: 20px; font-weight: 850; }
.form-control::placeholder, .code-input::placeholder { color: #6f7a86; }
.form-control:focus, .code-input:focus { border-color: rgba(74, 222, 128, 0.76); box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.11); }
select.form-control { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 22px, calc(100% - 12px) 22px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 38px; }
.form-textarea { min-height: 116px; padding: 13px; resize: vertical; line-height: 1.45; }
.alert { padding: 13px 14px; border-radius: 8px; font-size: 14px; font-weight: 760; line-height: 1.45; }
.alert-danger { border: 1px solid rgba(248, 113, 113, 0.38); color: #ffdede; background: rgba(248, 113, 113, 0.1); }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 20;
  width: min(calc(100% - 24px), 460px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(14, 19, 26, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.bottom-nav-item { min-height: 56px; flex-direction: column; color: var(--muted); font-size: 11px; }
.nav-mark { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.55; }
.bottom-nav-item.is-active { color: var(--accent); background: rgba(74, 222, 128, 0.08); }

.status-panel, .shift-focus-card { display: grid; gap: 14px; padding: 18px; background: linear-gradient(180deg, rgba(29, 39, 50, 0.98), rgba(18, 24, 32, 0.98)); }
.status-panel.is-open, .shift-focus-card.is-open { border-color: rgba(74, 222, 128, 0.34); background: linear-gradient(180deg, rgba(22, 49, 36, 0.95), rgba(16, 28, 23, 0.96)); }
.status-panel h2, .shift-focus-card h2 { font-size: 25px; line-height: 1.15; }
.status-panel p, .shift-copy { color: var(--muted); font-size: 15px; line-height: 1.45; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.metric-card { min-height: 108px; display: grid; align-content: start; gap: 5px; padding: 14px; }
.metric-card span { font-size: 22px; font-weight: 900; color: var(--text); }
.metric-card p { color: var(--text); font-size: 13px; font-weight: 800; }
.metric-card small { color: var(--muted); font-size: 12px; }
.content-section { display: grid; gap: 10px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h2 { font-size: 19px; line-height: 1.2; }
.section-heading a, .section-heading span { color: var(--muted); font-size: 13px; font-weight: 800; }
.notice-list, .mini-list, .quick-grid, .menu-list, .checklist-list, .rule-list, .fine-list, .timeline { display: grid; gap: 10px; }
.quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quick-card { min-height: 64px; align-items: center; display: flex; padding: 14px; font-weight: 840; background: var(--surface-2); }
.notice-card { display: grid; gap: 4px; padding: 14px; }
.notice-card strong { font-size: 15px; }
.notice-card span { color: var(--muted); font-size: 13px; line-height: 1.35; }
.notice-card.important { border-color: rgba(74, 222, 128, 0.34); }
.notice-card.warning { border-color: rgba(250, 204, 21, 0.34); }
.mini-row { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.mini-row span { color: var(--muted); font-size: 14px; }
.mini-row strong { font-size: 15px; }
.empty-state { padding: 16px; color: var(--muted); font-size: 14px; line-height: 1.45; background: rgba(255, 255, 255, 0.04); }

.summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.summary-strip div { min-height: 84px; display: grid; align-content: center; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(18, 24, 32, 0.94); }
.summary-strip span { font-size: 22px; font-weight: 900; }
.summary-strip small { color: var(--muted); font-size: 12px; }
.period-tabs, .fine-tabs, .segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.period-tabs a, .fine-tabs a, .segmented span { min-height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 820; }
.period-tabs a.is-active, .fine-tabs a.is-active, .segmented input:checked + span { color: #06100a; background: var(--accent); }
.segmented { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.small-segmented { margin-top: 10px; }
.searchbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.searchbar .button { padding: 0 14px; }
.filter-panel { padding: 0; overflow: hidden; }
.filter-panel summary { justify-content: space-between; min-height: 52px; padding: 0 14px; color: var(--text); list-style: none; }
.filter-panel summary::-webkit-details-marker { display: none; }
.filter-grid { display: grid; gap: 10px; padding: 0 14px 14px; }
.filter-grid label { display: grid; gap: 6px; }
.filter-wide { grid-column: 1 / -1; }
.filter-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filter-actions .button-soft { grid-column: 1 / -1; }

.fine-card-new { overflow: hidden; background: linear-gradient(180deg, rgba(24, 33, 43, 0.96), rgba(15, 21, 29, 0.98)); }
.fine-card-new.is-deleted { opacity: 0.78; border-color: rgba(248, 113, 113, 0.26); }
.fine-card-link { display: grid; gap: 10px; padding: 15px; }
.fine-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fine-card-head h2 { font-size: 18px; line-height: 1.2; }
.fine-card-head p, .fine-meta-line { color: var(--muted); font-size: 13px; line-height: 1.35; }
.fine-card-head strong { color: #ffd6d6; font-size: 22px; line-height: 1; white-space: nowrap; }
.fine-reason { color: var(--text); font-size: 15px; font-weight: 790; line-height: 1.35; }
.fine-meta-line { display: flex; flex-wrap: wrap; gap: 8px; }
.fine-meta-line span { padding: 5px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); }
.fine-cancel { min-height: 42px; display: flex; align-items: center; justify-content: center; border-top: 1px solid var(--line); color: #ffdede; font-weight: 830; background: rgba(248, 113, 113, 0.1); }
.archive-reason { color: #ffdede; font-size: 13px; line-height: 1.4; }
.preview-card { margin-bottom: 12px; }

.fact-list, .detail-list { display: grid; gap: 8px; }
.fact-list div, .detail-list div { display: grid; grid-template-columns: minmax(92px, 0.44fr) minmax(0, 1fr); gap: 10px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.fact-list span, .detail-list dt { color: var(--muted); font-size: 13px; font-weight: 780; }
.fact-list strong, .detail-list dd { color: var(--text); font-size: 13px; font-weight: 820; overflow-wrap: anywhere; }
.info-box { display: grid; gap: 5px; padding: 12px; border-radius: 8px; border: 1px solid var(--line); font-size: 14px; }
.info-box span, .info-box a { color: var(--muted); }
.info-box.success { border-color: rgba(74, 222, 128, 0.32); background: rgba(74, 222, 128, 0.08); }
.info-box.warning { border-color: rgba(250, 204, 21, 0.32); background: rgba(250, 204, 21, 0.08); }
.photo-confirmation { display: none; gap: 10px; padding: 14px; border: 1px solid rgba(250, 204, 21, 0.34); border-radius: 8px; background: rgba(250, 204, 21, 0.08); }
.photo-confirmation.is-visible { display: grid; }
.photo-confirmation span, .client-message { color: var(--muted); font-size: 13px; line-height: 1.4; }
.client-message.is-error { color: #ffdede; }
.file-box { display: grid; gap: 8px; padding: 13px; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); background: #0d131a; font-size: 13px; font-weight: 800; }
.file-box input { width: 100%; color: var(--text); }

.detail-card { display: grid; gap: 14px; }
.detail-amount { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.detail-amount span { color: #ffd6d6; font-size: 30px; font-weight: 900; }
.detail-amount small { color: var(--muted); font-size: 13px; font-weight: 820; }
.photo-preview { min-height: 48px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface-2); font-weight: 820; }
.timeline > div { display: grid; gap: 4px; padding: 12px; border-left: 2px solid var(--accent); background: rgba(255, 255, 255, 0.04); border-radius: 0 8px 8px 0; }
.timeline span, .timeline p { color: var(--muted); font-size: 13px; line-height: 1.35; }

.rule-category { display: grid; gap: 10px; }
.rule-card { display: grid; gap: 9px; padding: 14px; }
.rule-card h3 { font-size: 16px; line-height: 1.3; }
.rule-card p { color: var(--muted); font-size: 14px; line-height: 1.45; }
.rule-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.fine-badge, .fine-amount { min-height: 28px; display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 830; }
.fine-badge { color: #fff1b8; background: rgba(250, 204, 21, 0.1); border: 1px solid rgba(250, 204, 21, 0.28); }
.fine-amount { color: #ffdede; background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.3); }
.checklist-card { display: grid; gap: 10px; padding: 14px; }
.checklist-card h2 { font-size: 17px; }
.checklist-card p { color: var(--muted); font-size: 13px; }
.checklist-card progress { width: 100%; height: 8px; accent-color: var(--accent); }
.menu-list a { display: grid; gap: 4px; padding: 15px; }
.menu-list strong { font-size: 16px; }
.menu-list span { color: var(--muted); font-size: 13px; line-height: 1.35; }

@media (max-width: 380px) {
  .app-shell { padding-left: 10px; padding-right: 10px; }
  .compact-topbar h1, .topbar h1, .brand-lockup h1 { font-size: 29px; }
  .metric-grid { grid-template-columns: 1fr; }
  .summary-strip { grid-template-columns: 1fr; }
  .quick-grid, .filter-actions, .searchbar { grid-template-columns: 1fr; }
  .fine-card-head, .detail-amount { flex-direction: column; align-items: flex-start; }
  .period-tabs, .fine-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
