:root {
  color-scheme: light;
  --ink: #18211f;
  --muted: #62716e;
  --line: #d9e1df;
  --soft: #f5f7fa;
  --panel: #ffffff;
  --brand: #12483f;
  --brand-2: #0f766e;
  --accent: #d92d20;
  --amber: #b7791f;
  --green: #237a4b;
  --blue: #2563a9;
  --violet: #6750a4;
  --shadow: 0 16px 42px rgba(28, 44, 40, 0.11);
  --radius: 8px;
  --tap: 44px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--soft);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(18, 72, 63, 0.05), transparent 260px),
    var(--soft);
  color: var(--ink);
}

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

button {
  min-height: var(--tap);
}

button,
.button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  text-decoration: none;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
  white-space: nowrap;
}

button:hover,
.button:hover {
  background: #0d3c35;
  box-shadow: 0 8px 22px rgba(18, 72, 63, 0.18);
}

button:active,
.button:active {
  transform: translateY(1px);
}

button.secondary {
  background: #e9efed;
  color: var(--ink);
}

button.secondary:hover {
  background: #dfe8e5;
}

button.danger {
  background: var(--accent);
}

button.warning {
  background: var(--amber);
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.small {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 13px;
}

button:disabled {
  background: #aab8b5;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

a {
  color: var(--brand-2);
}

.boot {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.boot-panel {
  display: grid;
  gap: 14px;
  justify-items: center;
  color: var(--muted);
}

.login-screen {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 480px);
  background: var(--soft);
}

.login-brand {
  background:
    linear-gradient(135deg, rgba(18, 72, 63, 0.95), rgba(15, 118, 110, 0.86)),
    radial-gradient(circle at 26% 20%, rgba(247, 201, 72, 0.32), transparent 34%);
  color: #fff;
  padding: clamp(32px, 6vw, 78px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100svh;
}

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

.brand-lockup img {
  border-radius: 14px;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.16);
}

.login-brand h1 {
  font-size: clamp(32px, 5vw, 62px);
  line-height: 1.02;
  margin: 36px 0 16px;
  max-width: 780px;
  letter-spacing: 0;
}

.login-brand p {
  color: rgba(255, 255, 255, 0.85);
  max-width: 640px;
  font-size: clamp(17px, 2vw, 22px);
}

.login-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 34px;
  max-width: 720px;
}

.login-fact {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.login-fact strong {
  display: block;
  font-size: 24px;
}

.login-panel {
  padding: 24px;
  display: grid;
  align-content: center;
  gap: 18px;
}

.login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 34px);
}

.login-box h2 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: 0;
}

.login-box p {
  margin: 0 0 22px;
  color: var(--muted);
}

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

.app-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
  background: #0f2d28;
  color: #fff;
  min-height: 100svh;
  padding: 18px;
  position: sticky;
  top: 0;
  align-self: start;
}

.sidebar .brand-lockup {
  margin-bottom: 20px;
}

.sidebar .brand-lockup img {
  width: 42px;
  height: 42px;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 800;
}

.sidebar-subtitle {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  border: 1px solid transparent;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.sidebar-user {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  margin-top: 18px;
  padding-top: 18px;
  display: grid;
  gap: 10px;
}

.workspace {
  min-width: 0;
  padding: 20px;
}

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

.topbar h1 {
  margin: 0 0 6px;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: 0;
}

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

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.page {
  display: grid;
  gap: 18px;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 8px 24px rgba(33, 44, 41, 0.06);
}

.section.flat {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

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

.small-text {
  font-size: 13px;
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand-2);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 102px;
}

.metric strong {
  display: block;
  font-size: 30px;
  margin-top: 8px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

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

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

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

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

.field {
  display: grid;
  gap: 6px;
}

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

label {
  color: #34423f;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--brand-2);
}

input[type="file"] {
  padding: 8px;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: #eef4f2;
  font-size: 12px;
  color: #31423e;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #edf3f8;
  color: var(--blue);
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.tone-red {
  background: #fff0ed;
  color: var(--accent);
}

.tone-green {
  background: #eaf7ef;
  color: var(--green);
}

.tone-amber {
  background: #fff6df;
  color: var(--amber);
}

.tone-violet {
  background: #f1edff;
  color: var(--violet);
}

.tone-blue {
  background: #edf3fb;
  color: var(--blue);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  border-left: 3px solid var(--brand-2);
  padding-left: 12px;
  color: var(--muted);
}

.timeline-item strong {
  display: block;
  color: var(--ink);
}

.notice {
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand-2);
  border-radius: var(--radius);
  padding: 14px;
  background: #f4fbf9;
}

.notice.danger {
  border-left-color: var(--accent);
  background: #fff4f2;
}

.notice.warning {
  border-left-color: var(--amber);
  background: #fff8e8;
}

.notice.success {
  border-left-color: var(--green);
  background: #effaf3;
}

.driver-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.driver-result {
  display: grid;
  gap: 14px;
}

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

.handover-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.signature-wrap {
  border: 1px dashed var(--muted);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.signature-wrap canvas {
  width: 100%;
  height: 180px;
  display: block;
  touch-action: none;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 6px 9px;
  background: #fff;
  font-size: 12px;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(120%);
  background: #111d1a;
  color: #fff;
  padding: 12px 16px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mobile-menu {
  display: none;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.66);
}

@media (max-width: 1080px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: auto;
  }

  .login-facts {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    min-height: auto;
    border-radius: 0 0 12px 12px;
  }

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

  .workspace {
    padding: 14px;
  }

  .topbar {
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .grid-2,
  .grid-3,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .field.full {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .login-panel {
    padding: 14px;
  }

  .metric-grid,
  .nav,
  .demo-grid {
    grid-template-columns: 1fr;
  }

  .driver-search {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 14px;
  }

  .quick-actions,
  .form-actions,
  .top-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .quick-actions button,
  .form-actions button,
  .top-actions button {
    width: 100%;
  }
}
