:root {
  color-scheme: light;
  --bg: #07140b;
  --panel: #fffdf5;
  --panel-strong: #101711;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #d9cf9b;
  --green: #0a7a3d;
  --green-2: #1db954;
  --mint: #e2f7ea;
  --amber: #f5c542;
  --gold-soft: #fff4c7;
  --black: #1a1a1a;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 22% 0%, rgba(245, 197, 66, 0.28), transparent 240px),
    radial-gradient(circle at 100% 14%, rgba(29, 185, 84, 0.18), transparent 260px),
    radial-gradient(circle at 12% 78%, rgba(116, 171, 36, 0.18), transparent 290px),
    linear-gradient(180deg, #07140b 0, #0b1e11 46%, #0d2414 100%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-card {
  width: min(100%, 420px);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(245, 197, 66, 0.58);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 253, 245, 0.98), rgba(250, 246, 226, 0.96));
  box-shadow: var(--shadow);
}

.auth-logo {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 12px 30px rgba(3, 22, 12, 0.28);
}

.auth-card h1 {
  color: var(--black);
}

.auth-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.password-toggle {
  min-width: 74px;
}

.auth-message {
  min-height: 20px;
  font-size: 0.84rem;
}

.auth-message.is-error {
  color: #8b1f1f;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 92px;
}

.topbar,
.section-heading,
.hero-panel,
.tabs,
.two-col,
.report-grid {
  display: flex;
}

.topbar,
.section-heading,
.hero-panel {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  padding: 8px 2px 18px;
  color: #ffffff;
}

.brand-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.ddd-mark {
  display: block;
  width: 70px;
  height: 70px;
  flex: 0 0 auto;
  border-radius: 18px;
  object-fit: cover;
  object-position: center;
  box-shadow: 0 12px 30px rgba(245, 197, 66, 0.18);
}

.brand-lockup h1 {
  color: #ffffff;
  text-shadow: 0 1px 0 #000;
}

.tagline {
  margin: 5px 0 0;
  color: #f5df8a;
  font-size: 0.78rem;
  font-weight: 800;
}

.account-chip {
  display: grid;
  gap: 2px;
  min-width: 64px;
  justify-items: end;
}

.account-chip strong {
  font-size: 1rem;
  color: #ffffff;
}

.text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #f5df8a;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar .eyebrow {
  color: #d8d8d8;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.icon-button,
.ghost-button,
.primary-action,
.submit-button,
.tab {
  border: 0;
  cursor: pointer;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(245, 197, 66, 0.6);
  background: var(--black);
  color: var(--amber);
  font-size: 1.8rem;
  line-height: 1;
}

.hero-panel,
.entry-form,
.list-panel,
.metric {
  border: 1px solid rgba(245, 197, 66, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 253, 245, 0.98), rgba(250, 246, 226, 0.96));
  box-shadow: var(--shadow);
}

.hero-panel {
  margin-bottom: 16px;
  padding: 18px;
  border-color: rgba(245, 197, 66, 0.7);
  background:
    linear-gradient(135deg, rgba(245, 197, 66, 0.2), rgba(29, 185, 84, 0.12)),
    #fffdf5;
}

.hero-panel h2 {
  margin-bottom: 4px;
  font-size: 2rem;
}

.hero-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.primary-action,
.submit-button {
  min-height: 46px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--green-2), var(--green));
  color: #ffffff;
  font-weight: 800;
}

.primary-action:hover,
.submit-button:hover,
.icon-button:hover {
  background: var(--amber);
  color: var(--black);
}

.primary-action {
  padding: 0 18px;
  white-space: nowrap;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  gap: 6px;
  margin: 0 -4px 16px;
  padding: 8px 4px;
  background: rgba(7, 20, 11, 0.92);
  backdrop-filter: blur(10px);
}

.tab {
  flex: 1;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(245, 197, 66, 0.24);
  background: rgba(255, 253, 245, 0.16);
  color: #fff8dd;
  font-weight: 800;
}

.tab.active {
  background: var(--amber);
  color: var(--black);
}

.tab:hover {
  background: rgba(255, 253, 245, 0.28);
  color: #ffffff;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.day-picker {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(245, 197, 66, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 253, 245, 0.98), rgba(250, 246, 226, 0.96));
  box-shadow: var(--shadow);
}

.day-picker[data-day-state="past"] {
  border-color: rgba(107, 107, 107, 0.45);
}

.day-picker[data-day-state="future"] {
  border-color: rgba(29, 185, 84, 0.55);
}

.selected-day {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
}

.date-display,
.day-arrow,
.today-button {
  min-height: 42px;
  border: 1px solid #d6cca0;
  border-radius: 8px;
  background: #fffdf5;
  color: var(--black);
  cursor: pointer;
  font-weight: 900;
}

.date-display {
  display: flex;
  min-width: 210px;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 16px;
  font-size: 1rem;
}

.day-arrow {
  width: 44px;
  background: #e9dfc8;
  font-size: 1.25rem;
}

.today-button {
  grid-column: 1 / -1;
  color: #064f2b;
  background: #e8f4ee;
  border-color: #0a7a3d;
}

.day-status {
  grid-column: 1 / -1;
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #0a7a3d;
  border-radius: 8px;
  background: #e8f4ee;
  color: #064f2b;
  font-size: 0.84rem;
  font-weight: 900;
}

.day-picker[data-day-state="past"] .day-status {
  border-color: #b9ae86;
  background: #f0eadc;
  color: #5c5335;
}

.day-picker[data-day-state="future"] .day-status {
  border-color: #1db954;
  background: #ddf7e6;
  color: #064f2b;
}

.native-date {
  position: absolute;
  inset: auto 0 0 auto;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.entry-form,
.list-panel {
  margin-bottom: 16px;
  padding: 16px;
}

.log-module {
  display: grid;
  gap: 14px;
}

.setup-alert {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(180, 57, 57, 0.35);
  border-radius: 8px;
  background: #fff1e8;
  color: #4f2a13;
}

.setup-alert[hidden] {
  display: none;
}

.setup-alert strong {
  color: #8b1f1f;
}

.setup-alert span {
  color: #6a4a31;
  font-size: 0.86rem;
}

.toggle-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 8px;
  background: #f3ecd2;
}

.toggle-tab {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #614808;
  cursor: pointer;
  font-weight: 900;
}

.toggle-tab.active {
  background: var(--amber);
  color: var(--black);
}

.section-heading {
  margin-bottom: 14px;
}

.export-actions {
  display: flex;
  gap: 8px;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.save-status {
  color: #0a7a3d;
}

.entry-form.is-collapsed {
  display: none;
}

.ghost-button {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(245, 197, 66, 0.5);
  background: #fff6d8;
  color: #614808;
  font-size: 0.82rem;
  font-weight: 800;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: #29342d;
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d6cca0;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

.two-col {
  gap: 10px;
}

.two-col > label {
  flex: 1;
  min-width: 0;
}

.quick-save-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: -2px 0 13px;
}

.calculated-miles {
  display: block;
  margin: 0 0 14px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid rgba(245, 197, 66, 0.55);
  background: #fff5ce;
  color: #4f3c08;
  font-size: 1.1rem;
  font-weight: 900;
  text-align: center;
}

.submit-button {
  width: 100%;
}

.item-list {
  display: grid;
  gap: 10px;
}

.empty-state,
.log-item,
.summary-row {
  border: 1px solid #ded4a5;
  border-radius: 8px;
  padding: 12px;
  background: #fffdf5;
}

.log-item {
  display: grid;
  gap: 6px;
}

.activity-payment {
  border-color: rgba(10, 122, 61, 0.35);
  background: #f4fbf6;
}

.log-item strong {
  font-size: 0.98rem;
}

.log-item span,
.empty-state {
  color: var(--muted);
  font-size: 0.88rem;
}

.inline-action {
  justify-self: start;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric {
  padding: 14px;
  border-color: rgba(245, 197, 66, 0.45);
  background:
    linear-gradient(180deg, #fffdf5, #fff8df);
}

.metric p {
  position: relative;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.metric strong {
  font-size: 1.35rem;
}

.info-button {
  display: inline-grid;
  width: 20px;
  height: 20px;
  margin-left: 4px;
  place-items: center;
  border: 1px solid rgba(10, 122, 61, 0.35);
  border-radius: 50%;
  background: #e8f4ee;
  color: #064f2b;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.info-popover {
  position: absolute;
  z-index: 5;
  width: min(260px, calc(100vw - 48px));
  margin-top: 6px;
  padding: 10px;
  border: 1px solid #d6cca0;
  border-radius: 8px;
  background: #fffdf5;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

.summary-table,
.month-ledger,
.sortable-list {
  display: grid;
  gap: 8px;
}

.summary-row,
.month-card,
.manager-item {
  display: grid;
  gap: 10px;
  align-items: center;
}

.summary-row {
  grid-template-columns: 1fr auto auto;
}

.month-card {
  border: 1px solid #ded4a5;
  border-radius: 8px;
  padding: 12px;
  background: #fffdf5;
}

.month-card summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.month-card summary::-webkit-details-marker {
  display: none;
}

.month-card strong,
.month-card span {
  display: block;
}

.month-card span,
.summary-row span {
  color: var(--muted);
  font-size: 0.84rem;
}

.month-detail {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eadfac;
}

.compact-item {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 8px;
  background: #f8f5e9;
}

.compact-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.inline-editor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(10, 122, 61, 0.35);
  border-radius: 8px;
  background: #f4fbf6;
}

.inline-editor input,
.inline-editor select,
.inline-editor textarea {
  min-height: 40px;
}

.inline-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.manager-block {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.settings-form {
  display: grid;
  gap: 16px;
}

.settings-header {
  margin: 0 0 -2px;
  padding: 0 2px;
  color: #ffffff;
}

.settings-header h2 {
  color: #ffffff;
}

.settings-header .save-status {
  color: #f5df8a;
}

.settings-module {
  display: grid;
  gap: 10px;
  margin-bottom: 0;
  padding: 16px;
  border: 1px solid rgba(245, 197, 66, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 253, 245, 0.98), rgba(250, 246, 226, 0.96));
  box-shadow: var(--shadow);
}

.settings-module h3 {
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #e7ddb4;
}

.manager-block h3 {
  margin: 0;
  font-size: 0.95rem;
}

.add-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.combo-field {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 42px;
}

.combo-field input {
  border-radius: 8px 0 0 8px;
}

.combo-button {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid #cfc7aa;
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: #f0eadc;
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
}

.combo-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid #cfc7aa;
  border-radius: 8px;
  background: #fffdf5;
  box-shadow: 0 14px 34px rgba(3, 22, 12, 0.18);
}

.combo-choice,
.combo-empty {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #eee6c9;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 10px 12px;
  font: inherit;
}

.combo-choice {
  cursor: pointer;
}

.combo-choice:hover,
.combo-choice:focus {
  background: #edf8f0;
  outline: none;
}

.combo-empty {
  color: var(--muted);
}

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

.vehicle-form[hidden] {
  display: none;
}

.vehicle-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid #ded4a5;
  border-radius: 8px;
  padding: 10px;
  background: #fffdf5;
}

.vehicle-item.is-active {
  border-color: var(--green);
  background: #edf8f0;
}

.vehicle-item.is-archived {
  border-color: #c8c0a1;
  background: #f0eadc;
  opacity: 0.78;
}

.vehicle-item span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.mini-button:disabled {
  cursor: default;
  opacity: 0.62;
}

.manager-item {
  grid-template-columns: auto 1fr auto auto;
  border: 1px solid #ded4a5;
  border-radius: 8px;
  padding: 8px;
  background: #fffdf5;
}

.manager-item.is-dragging {
  opacity: 0.55;
}

.drag-handle {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(245, 197, 66, 0.65);
  border-radius: 8px;
  background: var(--black);
  color: var(--amber);
  cursor: grab;
  font-size: 0.78rem;
  font-weight: 900;
}

.drag-handle:active {
  cursor: grabbing;
}

.mini-button {
  min-width: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  border: 1px solid rgba(245, 197, 66, 0.55);
  background: #fff6d8;
  color: #614808;
  cursor: pointer;
  font-weight: 900;
}

.mini-button:hover {
  background: var(--black);
  color: var(--amber);
}

.mini-button.danger {
  border-color: rgba(180, 57, 57, 0.35);
  color: #8b1f1f;
}

.mini-button.danger:hover {
  background: #8b1f1f;
  color: #ffffff;
}

.mini-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (max-width: 390px) {
  .app-shell {
    padding-inline: 12px;
  }

  .two-col {
    display: block;
  }

  .hero-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .primary-action {
    width: 100%;
  }

  .tab {
    font-size: 0.78rem;
  }

  .vehicle-item {
    grid-template-columns: 1fr;
  }

  .vehicle-item .mini-button {
    width: 100%;
  }

  .export-actions {
    width: 100%;
    flex-direction: column;
  }
}
