:root {
  --bg: #f0eadf;
  --panel: rgba(251, 246, 238, 0.96);
  --panel-strong: #f7f0e5;
  --ink: #1f2a1f;
  --muted: #647062;
  --line: rgba(31, 42, 31, 0.12);
  --brand: #234c35;
  --brand-strong: #173524;
  --accent: #cb8f2a;
  --accent-soft: rgba(203, 143, 42, 0.14);
  --danger: #b33c21;
  --danger-soft: rgba(179, 60, 33, 0.12);
  --success-soft: rgba(35, 76, 53, 0.1);
  --shadow: 0 20px 44px rgba(27, 40, 29, 0.12);
  --radius: 22px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(203, 143, 42, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(35, 76, 53, 0.14), transparent 30%),
    linear-gradient(180deg, #f4ede2 0%, #eadfcd 100%);
  min-height: 100vh;
}

.shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 30px 26px;
  background:
    linear-gradient(180deg, rgba(18, 40, 27, 0.98) 0%, rgba(28, 64, 43, 0.96) 100%);
  color: #f8f2e8;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), transparent 30%),
    repeating-linear-gradient(
      -35deg,
      transparent 0 28px,
      rgba(255, 255, 255, 0.025) 28px 30px
    );
  pointer-events: none;
}

.sidebar h1 {
  margin: 0;
  line-height: 1.05;
}

.sidebar h1 {
  font-size: 0.82rem;
  overflow-wrap: anywhere;
  color: rgba(248, 242, 232, 0.78);
  letter-spacing: 0.01em;
}

.brand-lockup {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 6px;
}

.brand-copy {
  min-width: 0;
}

.brand-logo {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  object-fit: contain;
  background: rgba(255, 248, 238, 0.96);
  padding: 9px;
  flex: 0 0 auto;
  margin-top: 2px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
}

.brand-title {
  margin: 0 0 6px;
  color: #f7cb72;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-copy {
  color: rgba(245, 239, 230, 0.72);
}

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

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  margin: 0 0 10px;
  color: var(--accent);
}

.card,
.table-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
  color: #425044;
}

input,
select,
textarea,
button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(31, 42, 36, 0.12);
  font: inherit;
}

input,
select,
textarea {
  color: var(--ink);
  background: rgba(255, 253, 249, 0.96);
}

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

button {
  cursor: pointer;
  border: 0;
  background: var(--brand);
  color: white;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

button:hover {
  background: var(--brand-strong);
  transform: translateY(-1px);
}

.ghost-button {
  max-width: 140px;
  background: rgba(255, 248, 238, 0.7);
  color: var(--ink);
  border: 1px solid rgba(31, 42, 36, 0.16);
  box-shadow: none;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(31, 42, 36, 0.14);
  color: var(--ink);
  background: transparent;
  text-decoration: none;
}

.location-pin-button {
  width: auto;
  min-width: 56px;
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 1.05rem;
  line-height: 1;
  background: linear-gradient(180deg, #cb8f2a 0%, #b77b1d 100%);
}

.nav-list {
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.nav-list button {
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #f8f2e8;
  padding: 11px 13px;
  border-radius: 16px;
  font-weight: 700;
  box-shadow: none;
}

.nav-list button.active,
.nav-list button:hover {
  background: linear-gradient(180deg, rgba(203, 143, 42, 0.28), rgba(203, 143, 42, 0.16));
  border-color: rgba(247, 203, 114, 0.44);
  color: white;
}

.nav-list button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(248, 242, 232, 0.56);
  border-color: rgba(255, 255, 255, 0.06);
  transform: none;
}

.metadata-tab-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.metadata-tab-btn {
  width: auto;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(35, 76, 53, 0.08);
  color: var(--ink);
  border: 1px solid rgba(31, 42, 36, 0.12);
  box-shadow: none;
}

.metadata-tab-btn.active,
.metadata-tab-btn:hover {
  background: linear-gradient(180deg, rgba(203, 143, 42, 0.24), rgba(203, 143, 42, 0.14));
  border-color: rgba(203, 143, 42, 0.38);
  color: var(--ink);
}

.content {
  display: flex;
  flex-direction: column;
  padding: 26px 28px 24px;
  min-width: 0;
}

.app-footer {
  margin-top: auto;
  padding: 18px 4px 6px;
  color: rgba(31, 42, 31, 0.62);
  font-size: 0.84rem;
  text-align: center;
}

.content-tools {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 18px;
}

.profile-menu-shell {
  position: relative;
  display: inline-flex;
  justify-content: flex-end;
}

.profile-button {
  width: auto;
  min-width: 196px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #234c35, #173524);
  color: #fff7ec;
  border: 1px solid rgba(23, 53, 36, 0.36);
  box-shadow: 0 14px 28px rgba(23, 53, 36, 0.18);
}

.profile-button:hover {
  background: linear-gradient(180deg, #2b5c40, #173524);
}

.profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(247, 203, 114, 0.22);
  color: #f7cb72;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}

.profile-copy {
  display: grid;
  text-align: left;
  line-height: 1.15;
}

.profile-copy strong {
  font-size: 0.84rem;
  font-weight: 800;
}

.profile-copy span {
  font-size: 0.72rem;
  color: rgba(255, 247, 236, 0.76);
}

.profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  width: min(320px, calc(100vw - 56px));
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid rgba(31, 42, 36, 0.14);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.profile-menu.hidden {
  display: none;
}

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

.profile-menu-field span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-menu-action {
  width: 100%;
  background: rgba(35, 76, 53, 0.09);
  color: var(--ink);
  border: 1px solid rgba(31, 42, 36, 0.14);
  box-shadow: none;
}

.profile-menu-action:hover {
  background: rgba(35, 76, 53, 0.14);
}

.profile-menu-action.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.profile-menu-action.danger:hover {
  background: rgba(179, 60, 33, 0.18);
}

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

.message.success {
  background: var(--success-soft);
  color: var(--brand-strong);
}

.message.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: min(68vh, 720px);
}

.login-card {
  width: min(100%, 520px);
}

.login-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.login-logo {
  width: 74px;
  height: 74px;
  border-radius: 24px;
  object-fit: contain;
  background: rgba(255, 248, 238, 0.96);
  padding: 12px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.14);
}

.login-card h3 {
  margin: 0 0 8px;
  font-size: 1.28rem;
}

.top-gap {
  margin-top: 18px;
}

.hidden {
  display: none;
}

.stats-grid,
.two-column,
.three-column,
.form-grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

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

.three-column {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card,
.table-card {
  padding: 16px;
  min-width: 0;
}

.card h3,
.table-card h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.stat {
  display: grid;
  gap: 10px;
  background:
    linear-gradient(135deg, rgba(255, 247, 234, 0.95), rgba(246, 238, 226, 0.96));
  position: relative;
  overflow: hidden;
}

.stat strong {
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--accent), #f0bd58);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  min-width: 760px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.data-table th {
  color: #4c584e;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(35, 76, 53, 0.04);
}

.active-assignment-row {
  background: linear-gradient(90deg, rgba(203, 143, 42, 0.16), rgba(247, 203, 114, 0.08));
}

.active-assignment-row td {
  border-bottom-color: rgba(203, 143, 42, 0.2);
}

.pill {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(35, 76, 53, 0.12);
  color: var(--ink);
}

.pill.warn {
  background: rgba(203, 143, 42, 0.22);
}

.pill.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.section-stack {
  display: grid;
  gap: 18px;
}


.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

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

.table-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.table-actions.compact {
  margin-bottom: 10px;
}

.table-actions p {
  margin: 0;
  color: var(--muted);
}

.brand-copy,
.brand-copy h1,
.card h3,
.table-card h3,
.table-actions > div,
.table-actions > div > p,
.profile-copy,
.profile-copy strong,
.profile-copy span,
.notification-head strong,
.data-table th,
.data-table td {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table-card {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

a {
  color: var(--brand-strong);
  font-weight: 700;
}

.table-button {
  width: auto;
  padding: 8px 11px;
  border-radius: 12px;
}

.map-cell {
  min-width: 190px;
  display: grid;
  gap: 8px;
}

.vehicle-thumb {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(31, 42, 31, 0.12);
  background: #f5ede2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--brand-strong);
}

.vehicle-thumb.large {
  width: 168px;
  height: 112px;
}

.vehicle-thumb.placeholder {
  background: linear-gradient(135deg, rgba(203, 143, 42, 0.18), rgba(35, 76, 53, 0.12));
}

.vehicle-preview {
  display: flex;
  justify-content: flex-start;
}

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

.vehicle-identity.feature {
  padding: 12px;
  border: 1px solid rgba(31, 42, 31, 0.12);
  border-radius: 14px;
  background: rgba(255, 252, 247, 0.8);
}

.vehicle-identity.feature .vehicle-thumb {
  width: 120px;
  height: 84px;
}

.vehicle-identity-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.vehicle-identity-copy strong {
  font-size: 0.95rem;
}

.vehicle-identity-copy span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.vehicle-doc-list,
.notification-list {
  display: grid;
  gap: 10px;
}

.vehicle-doc-inputs {
  display: grid;
  gap: 10px;
}

.vehicle-doc-input-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr);
  gap: 10px;
}

.vehicle-doc-list a {
  display: inline-flex;
  width: fit-content;
}

.notifications-panel {
  margin-bottom: 18px;
}

.notification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notification-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(31, 42, 31, 0.08);
}

.notification-item.unread {
  background: rgba(203, 143, 42, 0.12);
  border-color: rgba(203, 143, 42, 0.24);
}

.notification-item p {
  margin: 8px 0 6px;
}

.location-meta {
  display: grid;
  gap: 4px;
  min-width: 180px;
  font-size: 0.82rem;
  color: var(--muted);
}

.form-map-preview {
  margin-top: 10px;
  max-width: 360px;
}

.map-frame {
  width: 100%;
  height: 132px;
  border: 1px solid rgba(31, 42, 36, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
}

.map-meta {
  display: grid;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.nested-table-card {
  margin-top: 18px;
  padding: 0;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: none;
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button-row button {
  width: auto;
}

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

  .sidebar {
    padding: 18px 16px 10px;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .content {
    padding: 14px;
  }

  .app-footer {
    padding: 16px 4px 4px;
  }

  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .content-tools {
    width: 100%;
    justify-content: stretch;
    align-items: stretch;
  }

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

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

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

  .nav-list button {
    min-height: 42px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .sidebar h1 {
    font-size: 0.78rem;
  }

  .content {
    padding: 14px;
  }

  .app-footer {
    font-size: 0.8rem;
    padding: 14px 2px 2px;
  }

  .card,
  .table-card {
    padding: 12px;
    border-radius: 16px;
  }

  .form-grid,
  .three-column,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .vehicle-doc-input-row {
    grid-template-columns: 1fr;
  }

  .button-row {
    flex-direction: column;
  }

  .metadata-tab-nav {
    flex-direction: column;
  }

  .metadata-tab-btn {
    width: 100%;
  }

  .button-row button,
  .ghost-button,
  .table-button,
  .profile-menu-shell,
  .profile-button {
    width: 100%;
    max-width: none;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  .brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .brand-title {
    font-size: 0.86rem;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .map-cell {
    min-width: 0;
  }

  .form-map-preview {
    max-width: none;
  }

  .map-frame {
    height: 180px;
  }

  .data-table {
    min-width: 640px;
    font-size: 0.82rem;
  }
}
