:root {
  --bg: #f2efe8;
  --panel: #fffdf8;
  --ink: #1f2a1f;
  --muted: #5f6b61;
  --accent: #1d6b57;
  --accent-soft: #d7ede6;
  --border: #d6d1c5;
  --danger: #b23a48;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(29, 107, 87, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(190, 124, 63, 0.18), transparent 30%),
    var(--bg);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.auth-page,
.dashboard-page {
  min-height: 100vh;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card,
.content-panel,
.sidebar {
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(36, 32, 20, 0.08);
}

.auth-card {
  width: min(100%, 420px);
  padding: 24px;
}

.subtitle,
.placeholder {
  color: var(--muted);
}

.stack-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 500;
  font-size: 0.95rem;
}

input,
button,
textarea,
select {
  font: inherit;
  font-size: 0.95rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.3);
  color: var(--ink);
  border: 1px solid var(--border);
}

.flash-list {
  margin-bottom: 16px;
}

.flash {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: #fbe9eb;
  color: var(--danger);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 12px;
  padding: 0 16px 16px;
}

.sidebar {
  padding: 8px;
  display: grid;
  gap: 4px;
  align-content: start;
}

.nav-item {
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
}

.nav-item.active {
  background: var(--accent-soft);
  border-color: rgba(29, 107, 87, 0.18);
}

.content-panel {
  min-height: calc(100vh - 110px);
  padding: 16px;
  overflow: auto;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.legend-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.legend-chip {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.legend-chip.report {
  background: #dff3e7;
  color: #0d6b3d;
}

.legend-chip.skip {
  background: #eef0f3;
  color: #4f5b68;
}

.legend-chip.manual {
  background: #f8e7d9;
  color: #8b4f18;
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.workspace-left {
  display: grid;
  gap: 12px;
}

.calendar-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.side-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.calendar-weekdays span {
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 2px 0;
}

.calendar-day {
  min-height: 48px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
}

.calendar-day.needs-report {
  background: #dff3e7;
}

.calendar-day.skip-report {
  background: #f2f4f6;
}

.calendar-day.manual-override {
  box-shadow: inset 0 0 0 2px rgba(190, 124, 63, 0.35);
}

.calendar-day.selected {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px rgba(29, 107, 87, 0.38);
}

.calendar-date {
  font-size: 0.9rem;
  font-weight: 600;
}

.calendar-mark {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(31, 42, 31, 0.38);
}

.day-editor {
  margin-top: 0;
}

.token-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.info-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.meta-list {
  display: grid;
  gap: 6px;
}

.meta-list div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
}

.meta-list dt {
  color: var(--muted);
}

.meta-list dd {
  margin: 0;
  word-break: break-all;
}

.meta-list.compact div {
  grid-template-columns: 86px 1fr;
  font-size: 0.94rem;
}

.mini-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.token-strip {
  display: grid;
  gap: 10px;
}

.token-strip-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.token-actions {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 8px;
}

.inline-form {
  display: grid;
  gap: 8px;
}

.token-note-card {
  border: 1px dashed rgba(29, 107, 87, 0.25);
  border-radius: 8px;
  padding: 10px;
  background: rgba(29, 107, 87, 0.06);
}

.full-span {
  grid-column: 1 / -1;
}

.action-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.action-row.align-left {
  justify-content: flex-start;
}

.log-list {
  display: grid;
  gap: 8px;
}

.log-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.settings-grid .full-span {
  grid-column: 1 / -1;
}

.settings-stack {
  display: grid;
  gap: 10px;
}

.settings-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.76);
  margin-bottom: 8px;
}

.settings-card h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.report-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tone-soft {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(29, 107, 87, 0.08);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.switch-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-slider {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: #d9dee4;
  transition: background 0.2s ease;
}

.switch-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(31, 42, 31, 0.18);
  transition: transform 0.2s ease;
}

.switch-checkbox:checked + .switch-slider {
  background: #1d6b57;
}

.switch-checkbox:checked + .switch-slider::after {
  transform: translateX(20px);
}

.switch-text {
  min-width: 32px;
  text-align: right;
  font-weight: 600;
}

.vehicle-list {
  display: grid;
  gap: 8px;
}

.compact-vehicle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr) auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
}

.hidden {
  display: none;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

@media (max-width: 900px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid,
  .token-actions,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .compact-vehicle {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
