:root {
  --bg: #efe3cf;
  --paper: rgba(255, 250, 240, 0.94);
  --panel: rgba(255, 255, 255, 0.7);
  --ink: #18211c;
  --muted: #647066;
  --accent: #1e7e61;
  --accent-strong: #11513f;
  --tab-active: #d92525;
  --line: rgba(24, 33, 28, 0.1);
  --danger: #bd4a3c;
  --warning: #cf7b30;
  --shadow: 0 26px 60px rgba(58, 51, 37, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(30, 126, 97, 0.17), transparent 24%),
    radial-gradient(circle at bottom left, rgba(207, 123, 48, 0.12), transparent 20%),
    linear-gradient(180deg, #f4eadb 0%, #efe3cf 100%);
}

a {
  color: inherit;
}

.page-shell,
.auth-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-card,
.panel,
.stat-card {
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

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

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 24px;
}

.hero-copy {
  display: grid;
  gap: 10px;
}

.hero h1,
.panel h2,
.auth-card h1 {
  margin: 8px 0 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.panel h2 {
  font-size: 1.6rem;
}

.hero-copy,
.muted,
.auth-switch {
  color: var(--muted);
}

.kicker,
.section-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  color: #1f2a24;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.brand-lockup.compact {
  margin-bottom: 8px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(145deg, #18211c 0%, #26342c 100%);
  color: #f4eadb;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-name {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.94;
  letter-spacing: -0.05em;
  font-weight: 800;
  color: var(--ink);
}

.brand-tag,
.hero-subtitle {
  color: var(--muted);
}

.hero-subtitle {
  margin: 0;
  font-size: 1rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.offline-banner {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(189, 74, 60, 0.12);
  border: 1px solid rgba(189, 74, 60, 0.18);
  color: #8d2b1f;
  font-weight: 700;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.sub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sub-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(24, 33, 28, 0.08);
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}

.sub-link.is-active {
  background: rgba(30, 126, 97, 0.1);
  border-color: rgba(30, 126, 97, 0.26);
  color: #0d654d;
}

.report-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 250, 240, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow);
}

.report-panel summary {
  cursor: pointer;
  list-style: none;
}

.report-panel summary::-webkit-details-marker {
  display: none;
}

.report-panel summary strong {
  display: block;
  margin: 4px 0 0;
  font-size: 1.35rem;
}

.report-panel summary::after {
  content: "Open filters";
  display: inline-flex;
  margin-top: 10px;
  color: var(--accent-strong);
  font-weight: 700;
}

.report-panel[open] summary::after {
  content: "Hide filters";
}

.report-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.report-help {
  margin: 0;
}

.quick-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  text-decoration: none;
  font-weight: 600;
  color: var(--ink);
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.quick-link.is-active {
  border-color: rgba(217, 37, 37, 0.62);
  background: rgba(217, 37, 37, 0.1);
  color: #9d1414;
  box-shadow: inset 0 0 0 2px rgba(217, 37, 37, 0.12);
}

.tab-panel[hidden] {
  display: none;
}

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

.span-two {
  grid-column: span 2;
}

.panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 18px;
}

.stat-card strong {
  display: block;
  font-size: 1.8rem;
  margin-bottom: 4px;
}

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

.compact-form {
  margin-top: 12px;
}

.single-column {
  grid-template-columns: 1fr;
}

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

.full-span {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 46px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

textarea {
  min-height: 108px;
  resize: vertical;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  min-height: 46px;
  padding: 12px 18px;
  text-decoration: none;
  cursor: pointer;
}

.primary-btn {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 700;
}

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

.danger-btn {
  border: 1px solid rgba(189, 74, 60, 0.3);
  background: rgba(189, 74, 60, 0.12);
  color: #8d2b1f;
  font-weight: 700;
}

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

.list-item,
.empty-state,
.flash {
  border-radius: 18px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid rgba(24, 33, 28, 0.08);
}

.edit-box {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.upload-field {
  display: grid;
  gap: 8px;
}

.upload-preview,
.attachment-preview {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.upload-preview img,
.attachment-preview img {
  width: min(100%, 260px);
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.upload-preview span,
.attachment-preview span {
  font-size: 0.92rem;
  color: var(--muted);
  word-break: break-word;
}

.edit-box summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent-strong);
}

.delete-form {
  margin-top: 12px;
}

.gps-actions,
.gps-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tracking-status,
.trip-card {
  border-radius: 18px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid rgba(24, 33, 28, 0.08);
}

.tracking-status {
  display: grid;
  gap: 16px;
}

.tracking-status__hero,
.tracking-grid,
.tracking-tips {
  display: grid;
  gap: 12px;
}

.tracking-status__hero {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

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

.tracking-pill,
.tracking-tip {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.tracking-pill strong,
.tracking-tip strong {
  font-size: 0.92rem;
}

.tracking-pill span,
.tracking-tip span,
.trip-note {
  color: var(--muted);
  line-height: 1.5;
}

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

.tracking-form {
  gap: 14px;
}

.tracking-error {
  margin: 0;
}

.map-link {
  width: fit-content;
}

.trip-map svg {
  width: 100%;
  max-width: 420px;
  display: block;
  margin-top: 10px;
  border-radius: 18px;
}

.item-head,
.item-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-title {
  font-size: 1.06rem;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.badge.active {
  background: rgba(30, 126, 97, 0.15);
  color: #0d654d;
}

.badge.warning {
  background: rgba(207, 123, 48, 0.16);
  color: #99540b;
}

.badge.danger {
  background: rgba(189, 74, 60, 0.15);
  color: #8d2b1f;
}

.flash.error {
  background: rgba(189, 74, 60, 0.12);
  color: #8d2b1f;
  margin-bottom: 16px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: end;
}

.checkbox-label input {
  width: auto;
}

@media (max-width: 1050px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .hero,
  .layout,
  .stats-grid,
  .split-grid,
  .form-grid,
  .report-form {
    grid-template-columns: 1fr;
    display: grid;
  }

  .page-shell,
  .auth-shell {
    width: min(100%, calc(100% - 14px));
    padding: 10px 0 20px;
  }

  .panel,
  .auth-card,
  .stat-card {
    border-radius: 20px;
  }

  .panel {
    padding: 14px;
  }

  .hero {
    gap: 12px;
    margin-bottom: 12px;
  }

  .hero h1,
  .auth-card h1 {
    font-size: clamp(1.65rem, 10vw, 2.35rem);
  }

  .panel h2 {
    font-size: 1.3rem;
  }

  .quick-links {
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 0 -7px 12px;
    padding: 8px 7px;
    overflow-x: auto;
    flex-wrap: nowrap;
    background: rgba(244, 234, 219, 0.94);
    backdrop-filter: blur(10px);
  }

  .quick-link {
    white-space: nowrap;
    min-height: 40px;
    padding: 9px 12px;
  }

  .span-two,
  .full-span {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  body {
    background: #f4eadb;
  }

  .kicker,
  .section-kicker {
    font-size: 0.68rem;
  }

  .hero {
    display: grid;
  }

  .brand-lockup {
    align-items: start;
  }

  .brand-name {
    font-size: 2.3rem;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions form,
  .hero-actions button,
  .hero-actions .ghost-btn {
    width: 100%;
  }

  .report-panel {
    margin-bottom: 12px;
    padding: 14px;
    border-radius: 18px;
  }

  .report-panel summary strong {
    font-size: 1.05rem;
  }

  .stats-grid {
    display: flex;
    gap: 10px;
    margin: 0 -7px 12px;
    padding: 0 7px 4px;
    overflow-x: auto;
  }

  .stat-card {
    min-width: 132px;
    padding: 12px;
    border-radius: 18px;
    box-shadow: none;
  }

  .stat-card strong {
    font-size: 1.3rem;
  }

  .layout {
    gap: 12px;
  }

  .tracking-status__hero,
  .tracking-grid,
  .tracking-tips {
    grid-template-columns: 1fr;
  }

  .panel-header {
    margin-bottom: 12px;
  }

  .list-item,
  .empty-state,
  .flash {
    padding: 14px;
  }

  input,
  select,
  textarea,
  .primary-btn,
  .ghost-btn,
  .danger-btn {
    min-height: 44px;
  }
}
