@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Inter:wght@400;500;600;700;800&family=Noto+Sans+TC:wght@400;500;600;700;800&family=Noto+Serif+TC:wght@500;600;700;800&family=Playfair+Display:wght@600;700;800&display=swap');

:root {
  --ink: #171717;
  --muted: #656560;
  --line: #171717;
  --paper: #f9f9f7;
  --surface: #fffefa;
  --soft-line: #c9c9c2;
  --editorial-red: #cc0000;
  --danger: #b32121;
  font-family: Inter, 'Noto Sans TC', sans-serif;
  background: var(--paper);
  color: var(--ink);
}
html { scroll-behavior: smooth; }
body { background: var(--paper); }
button, input, select, textarea { font-family: Inter, 'Noto Sans TC', sans-serif; }
button, a, input, select, textarea { border-radius: 0 !important; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--editorial-red);
  outline-offset: 3px;
}
a { color: var(--editorial-red); }
h1, h2, h3 {
  font-family: 'Playfair Display', 'Noto Serif TC', Georgia, serif;
  line-height: 1.35;
  letter-spacing: -.025em;
}
h1 { font-size: clamp(2rem, 3.5vw, 3.75rem); font-weight: 800; }
h2 { font-size: clamp(1.25rem, 2vw, 1.75rem); }
h3 { font-size: 1.05rem; }
.muted, .report-meta { color: var(--muted); }
.eyebrow, .nav-caption, .brand small, .hero-details small, .sidebar-foot, .page-footer {
  font-family: Inter, 'Noto Sans TC', sans-serif;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.eyebrow { color: var(--editorial-red); font-size: 11px; }

/* The desktop masthead and navigation remain on the left. */
.sidebar {
  width: 252px;
  padding: 0;
  background: var(--surface);
  border-right: 2px solid var(--ink);
  z-index: 35;
}
.brand {
  min-height: 116px;
  padding: 21px 22px;
  border-bottom: 4px double var(--ink);
  font-family: 'Noto Serif TC', Georgia, serif;
  font-size: 23px;
  line-height: 1.25;
}
.brand img { width: 42px; height: 42px; border-radius: 0; filter: grayscale(1) contrast(1.3); }
.brand small { color: var(--muted); margin-top: 7px; font-size: 8px; }
.nav-caption { margin: 28px 20px 11px; color: var(--editorial-red); }
#desktop-nav { padding: 0 13px; }
#desktop-nav button {
  min-height: 52px;
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--soft-line);
  color: var(--ink);
  font-weight: 600;
}
#desktop-nav button:hover { background: #eeeeea; }
#desktop-nav button.active {
  background: var(--ink);
  border-left: 5px solid var(--editorial-red);
  color: #fff;
  padding-left: 9px;
}
#desktop-nav button.active svg { color: #fff; }
.sidebar-foot {
  padding: 22px;
  border-top: 4px double var(--ink);
  color: var(--ink);
  line-height: 1.6;
  font-size: 10px;
}
.sidebar-foot small { color: var(--muted); letter-spacing: 0; font-weight: 500; }
.dot { background: var(--editorial-red); border-radius: 0; }
.shell { margin-left: 252px; }
.topbar {
  min-height: 65px;
  padding: 9px clamp(20px, 3.5vw, 60px);
  background: var(--surface);
  border-bottom: 2px solid var(--ink);
}
.desktop-label { color: var(--ink); font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.account, .secondary, .quiet {
  box-shadow: none;
  color: var(--ink);
  border: 1px solid var(--ink);
  background: transparent;
  font-weight: 700;
}
.quiet { border: 0; }
.quiet[data-status=synced] { color: #23623d; }
main { max-width: 1560px; padding: 34px clamp(20px, 3.5vw, 60px) 50px; }
.page-heading {
  margin-bottom: 26px;
  padding: 0 0 24px;
  border-bottom: 4px double var(--ink);
}
.page-heading h1 { margin: 6px 0 7px; }
.page-heading p { color: var(--muted); }
.actions { gap: 12px; }
.selection { border: 1px solid var(--ink); border-left: 5px solid var(--accent); }
.primary, .photo-upload {
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: 0;
  box-shadow: none;
  font-weight: 800;
  letter-spacing: .02em;
}
.primary:hover, .photo-upload:hover {
  background: var(--editorial-red);
  border-color: var(--editorial-red);
  box-shadow: 5px 5px 0 var(--ink);
  filter: none;
  transform: translate(-2px, -2px);
}
.primary:active { transform: translate(0); box-shadow: none; }
.secondary, .account, .quick-actions button, .resolve-button, .photo-remove {
  border: 1px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
  font-weight: 700;
}
.secondary:hover, .account:hover, .quick-actions button:hover, .resolve-button:hover, .photo-remove:hover {
  background: #efefea;
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  transform: translate(-2px, -2px);
}
.link-button { color: var(--editorial-red); font-weight: 700; }
.icon-button:hover { background: #efefea; }

.hero {
  background: var(--ink);
  border: 2px solid var(--ink);
  color: #fff;
  padding: clamp(24px, 3.5vw, 48px);
  margin-bottom: 0;
  border-radius: 0;
  transition: none;
}
.hero::after {
  inset: 0 0 0 auto;
  width: 35%;
  height: 100%;
  border: 0;
  border-left: 1px solid #ffffff45;
  border-radius: 0;
  background-image: radial-gradient(#ffffff28 1px, transparent 1px);
  background-size: 8px 8px;
  opacity: .5;
}
.hero .eyebrow { color: #e9a1a1; }
.hero h2 { font-size: clamp(1.75rem, 3vw, 3rem); }
.hero p, .hero-details small { color: #d4d4d0; }
.hero-details strong, .stat strong, .row-amount, .cost-bar strong {
  font-family: 'DM Mono', 'Noto Sans TC', monospace;
  letter-spacing: -.04em;
}
.hero-details strong { font-size: clamp(22px, 2.5vw, 36px); }
.hero select { background: #fff; color: var(--ink); border: 1px solid var(--ink); }
.hero-photo { border: 1px solid #fff; background: #fff; }
.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 28px;
  border: 1px solid var(--ink);
  border-top: 0;
}
.stat {
  border: 0;
  border-right: 1px solid var(--ink);
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
  animation: none;
}
.stat:last-child { border-right: 0; }
.stat-top, .stat p { color: var(--muted); }
.stat-top svg { color: var(--editorial-red); }
.stat strong { font-size: clamp(20px, 2.4vw, 32px); }
.grid-two { gap: 20px; }
.panel, .vehicle-card {
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 0;
  box-shadow: none;
  animation: none;
}
.panel-header {
  border-bottom: 1px solid var(--ink);
  background: #f2f2ee;
}
.panel-header h2 { font-size: 1.2rem; }
.panel-body { background: var(--surface); }
.row { border-bottom: 1px solid var(--soft-line); }
.record-symbol, .record-symbol.fuel, .record-symbol.expense, .record-symbol.charge {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
}
.row-info h3 { font-family: Inter, 'Noto Sans TC', sans-serif; letter-spacing: 0; }
.badge, .badge.overdue, .badge.soon, .badge.done {
  border: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  font-weight: 700;
}
.badge.overdue { color: var(--editorial-red); }
.badge.soon { color: #8b5816; }
.badge.done { color: var(--muted); }
.progress, .cost-bar .track { border-radius: 0; background: #e6e6e0; }
.progress span, .cost-bar .track i { background: var(--ink); }
.notice, .notice.warning {
  border: 1px solid var(--ink);
  border-left: 5px solid var(--editorial-red);
  border-radius: 0;
  background: #f2f2ee;
  color: var(--ink);
}
.quick-actions { margin: 0 0 22px; }
.quick-actions > span { color: var(--ink); }
.vehicle-grid { gap: 20px; }
.vehicle-card {
  border: 1px solid var(--ink);
  border-top: 5px solid var(--card-accent, var(--accent));
}
.vehicle-card:hover { box-shadow: 6px 6px 0 var(--ink); transform: translate(-3px, -3px); }
.vehicle-card-photo, .vehicle-photo-preview {
  border: 1px solid var(--ink);
  border-radius: 0;
  background: #f1f1ed;
  aspect-ratio: 3 / 2;
}
.vehicle-card-photo img, .vehicle-photo-preview img, .hero-photo img { object-fit: contain; }
.vehicle-photo-field, .fuel-receipt {
  border: 1px solid var(--ink);
  border-radius: 0;
  background: #f2f2ee;
}
.fuel-receipt .photo-upload { background: var(--ink); }
.fuel-receipt pre { border: 1px solid var(--ink); border-radius: 0; }
.theme-choice label span {
  border-radius: 0;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--ink);
}
.theme-choice input:checked + span { box-shadow: 0 0 0 3px var(--ink); }
.vehicle-form-section, .vehicle-facts { border-top-color: var(--ink); }
.vehicle-facts summary { color: var(--ink); }
.settings-grid { gap: 20px; }
.welcome { max-width: 1060px; }
.welcome .hero { min-height: 270px; }
.welcome-cards { gap: 0; border: 1px solid var(--ink); }
.welcome-cards .panel { border: 0; border-right: 1px solid var(--ink); }
.welcome-cards .panel:last-child { border-right: 0; }
.welcome-cards svg { color: var(--editorial-red); }
.empty svg { color: var(--ink); }
table { border: 1px solid var(--ink); }
th, td { border-bottom: 1px solid var(--soft-line); }
th { background: #ededE8; color: var(--ink); font-weight: 800; }
.chart text { fill: var(--muted); font-family: 'DM Mono', monospace; }
.legend i { border-radius: 0; background: var(--ink); }

input, select, textarea {
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
}
input[type=checkbox] { accent-color: var(--ink); }
fieldset { border: 1px solid var(--ink); border-radius: 0; }
.field > span, fieldset legend { font-weight: 700; }
.field input[type=date], .field input[type=time], .field input[type=datetime-local], .filter-dates input[type=date] {
  height: 44px;
  min-height: 44px;
}
.filters { padding: 0 0 18px; border-bottom: 1px solid var(--ink); }
.filter-dates input { width: 150px; }
dialog {
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--surface);
  box-shadow: 10px 10px 0 #17171770;
}
dialog::backdrop { background: #171717a3; backdrop-filter: none; }
.dialog-head { background: var(--paper); border-bottom: 2px solid var(--ink); }
.form-actions { border-top-color: var(--ink); }
#toast { border: 1px solid #fff; border-radius: 0; box-shadow: 5px 5px 0 var(--editorial-red); }
.page-footer { border-top: 4px double var(--ink); color: var(--muted); letter-spacing: .02em; }

@media (max-width: 1150px) {
  .sidebar { width: 208px; }
  .shell { margin-left: 208px; }
  .brand { font-size: 19px; min-height: 100px; padding: 20px 15px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 0; }
  .stat { border-bottom: 1px solid var(--ink); }
  .stat:nth-child(2) { border-right: 0; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .shell { margin-left: 0; }
  .topbar { border-bottom: 2px solid var(--ink); }
  .mobile-brand { font-family: 'Noto Serif TC', Georgia, serif; }
  .mobile-brand img { border-radius: 0; filter: grayscale(1) contrast(1.3); }
  .mobile-top-nav { display: none !important; }
  .mobile-nav {
    display: flex;
    background: var(--surface);
    border-top: 2px solid var(--ink);
    box-shadow: none;
  }
  .mobile-nav button {
    color: var(--ink);
    border-right: 1px solid var(--soft-line);
    border-radius: 0;
  }
  .mobile-nav button:last-child { border-right: 0; }
  .mobile-nav button.active {
    background: var(--ink);
    color: #fff;
    border-top: 3px solid var(--editorial-red);
    padding-top: 5px;
  }
  main { padding-bottom: 110px; }
}
@media (max-width: 650px) {
  h1 { font-size: 2rem; }
  .page-heading { align-items: flex-start; }
  .page-heading .actions { display: grid; grid-template-columns: minmax(0,1fr) auto; }
  .page-heading .actions .primary { margin: 0; }
  .topbar { min-height: 64px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 14px; }
  .stat strong { font-size: 20px; }
  .hero { padding: 24px 19px; }
  .hero::after { width: 45%; }
  .hero-details { align-items: flex-start; }
  .grid-two, .settings-grid { gap: 18px; }
  .welcome-cards { display: block; }
  .welcome-cards .panel { border-right: 0; border-bottom: 1px solid var(--ink); }
  .welcome-cards .panel:last-child { border-bottom: 0; }
  .form-grid, .vehicle-form-section .form-grid { grid-template-columns: minmax(0, 1fr); }
  .field { grid-column: 1 / -1; }
  .mobile-nav button { min-width: 0; padding: 8px 2px; }
}
@media (max-width: 380px) {
  .page-heading .actions { grid-template-columns: 1fr; }
  .page-heading .actions .primary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .hero { color: var(--ink); background: #fff; }
  .hero p, .hero-details small { color: var(--muted); }
}
