@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Mono:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #1C1C1E;
  --surface: #26262A;
  --surface-2: #2E2E33;
  --border: #3A3A40;
  --text: #F2F0EA;
  --text-muted: #9A9A9E;
  --amber: #F5A623;
  --amber-dim: #7A5518;
  --blue-night: #5B9BD9;
  --green: #4CAF7D;
  --red: #D9694F;
  --radius: 14px;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', monospace;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top)) 20px 14px;
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { color: var(--amber); font-size: 18px; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.lang-switch { display: flex; gap: 4px; }
.lang-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
}
.lang-btn.active { color: var(--amber); border-color: var(--amber); }

.view { display: none; padding: 20px; flex: 1; }
.view.active { display: block; }

/* Signature LCD-style readout */
.readout {
  background: linear-gradient(180deg, #232326 0%, #1A1A1C 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.readout::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 50% -10%, rgba(245,166,35,0.08), transparent 60%);
  pointer-events: none;
}
.readout-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.readout-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 44px;
  letter-spacing: 0.01em;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(245,166,35,0.35);
  margin: 4px 0 2px;
  word-break: break-word;
}
.readout-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.shift-group { padding: 0; }
.shift-group summary {
  cursor: pointer;
  list-style: none;
  padding: 18px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.shift-group summary::-webkit-details-marker { display: none; }
.shift-group summary::after {
  content: "▾";
  font-size: 12px;
  color: var(--amber);
  transition: transform 0.15s ease;
}
.shift-group[open] summary::after { transform: rotate(180deg); }
.shift-group-body {
  padding: 0 18px 4px;
  border-top: 1px solid var(--border);
}
.shift-group-body .field-row:last-child { border-bottom: none; }

.card-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.field-row:last-child { border-bottom: none; }

.field-row label {
  font-size: 14.5px;
  color: var(--text);
  flex: 1;
}
.hint {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 400;
}

.field-row input[type="number"],
.field-row input[type="time"] {
  width: 100px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  padding: 9px 10px;
  border-radius: 9px;
  text-align: right;
}
.field-row input[type="time"] { color-scheme: dark; }
.field-row input[type="number"]:focus,
.field-row input[type="time"]:focus {
  outline: none;
  border-color: var(--amber);
}

.toggle-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--amber);
}

.btn-primary {
  width: 100%;
  background: var(--amber);
  color: #201400;
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  padding: 15px;
  border-radius: 12px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn-primary:active { transform: scale(0.98); filter: brightness(0.95); }

.breakdown .row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 14.5px;
  font-family: var(--font-mono);
}
.breakdown .row.muted { color: var(--text-muted); font-size: 13.5px; }
.breakdown .row.strong {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--green);
  padding-top: 10px;
}
.divider { height: 1px; background: var(--border); margin: 8px 0; }

.disclaimer {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 14px 0 0;
  line-height: 1.5;
}

.save-msg {
  text-align: center;
  font-size: 13px;
  color: var(--green);
  min-height: 18px;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}

.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 6px 0;
  cursor: pointer;
  border-radius: 10px;
}
.tab-icon { font-size: 19px; }
.tab.active { color: var(--amber); }

@media (min-width: 481px) {
  .app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary { transition: none; }
}
