:root {
  color-scheme: dark;
  --surface: #031427;
  --surface-lowest: #000f21;
  --surface-low: #0b1c30;
  --surface-panel: #102034;
  --surface-high: #1b2b3f;
  --surface-highest: #26364a;
  --text: #d3e4fe;
  --text-muted: #c6c6cd;
  --outline: #45464d;
  --outline-strong: #909097;
  --primary: #bec6e0;
  --primary-strong: #7bd0ff;
  --primary-soft: rgba(123, 208, 255, 0.14);
  --primary-dark: #0f172a;
  --warning: #ffb690;
  --warning-strong: #ec6a06;
  --danger: #ffb4ab;
  --danger-bg: #93000a;
  --ok: #93e6b2;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(123, 208, 255, 0.06);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(180deg, rgba(3, 20, 39, 0.98), rgba(0, 15, 33, 1));
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.label,
.eyebrow,
.status-chip,
.metric-card span,
th,
.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

.label,
.eyebrow,
.metric-card span,
th {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hidden {
  display: none !important;
}

.admin-layout {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 100vh;
  padding: 28px 18px;
  border-right: 1px solid rgba(144, 144, 151, 0.18);
  background: rgba(16, 32, 52, 0.96);
}

.fleet-title {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--primary);
}

.fleet-title .material-symbols-outlined {
  font-size: 34px;
}

.fleet-title strong {
  display: block;
  font-size: 20px;
  line-height: 26px;
}

.section-label {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  text-decoration: none;
}

.nav-item span:last-child {
  min-width: 0;
  font-size: 13px;
  font-weight: 750;
}

.nav-item:hover {
  background: rgba(38, 54, 74, 0.7);
  color: var(--text);
}

.nav-item.active {
  background: rgba(15, 23, 42, 0.68);
  color: var(--primary);
  box-shadow: inset -2px 0 0 var(--primary);
}

.sidebar-bottom {
  display: grid;
  gap: 8px;
  margin-top: auto;
  border-top: 1px solid rgba(144, 144, 151, 0.14);
  padding-top: 16px;
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 10px;
  color: var(--primary-strong);
}

.logout-button {
  border: 0;
}

.admin-main {
  min-width: 0;
  background: var(--surface-lowest);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  border-bottom: 1px solid rgba(144, 144, 151, 0.18);
  background: rgba(3, 20, 39, 0.95);
  backdrop-filter: blur(10px);
  padding: 0 32px;
}

.topbar h1,
.page-head h2,
.login-card h1 {
  margin: 0;
  color: var(--text);
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 24px;
  line-height: 30px;
  font-weight: 750;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--primary);
  font-size: 12px;
  line-height: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.compact-link {
  width: auto;
  text-decoration: none;
}

.content-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 34px 40px 56px;
}

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

.page-head h2 {
  font-size: 32px;
  line-height: 40px;
  font-weight: 760;
}

.page-head p,
.login-head p {
  margin: 6px 0 0;
  max-width: 720px;
  color: var(--text-muted);
  line-height: 24px;
}

h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 24px;
  font-weight: 650;
}

.tab-page {
  display: none;
}

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

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

.split-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.86fr) minmax(480px, 1.45fr);
  gap: 20px;
  margin-bottom: 20px;
}

.panel,
.metric-card {
  border: 1px solid rgba(144, 144, 151, 0.2);
  border-radius: 8px;
  background: rgba(16, 32, 52, 0.72);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.metric-card {
  min-height: 142px;
  padding: 24px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.metric-card[role="button"] {
  cursor: pointer;
}

.metric-card[role="button"]:hover,
.metric-card[role="button"]:focus-visible {
  border-color: rgba(123, 208, 255, 0.56);
  background: rgba(27, 43, 63, 0.86);
}

.metric-card span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 16px;
}

.metric-card strong {
  color: var(--primary-strong);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 34px;
  line-height: 40px;
}

.storage-overview {
  margin-top: 20px;
}

.storage-gauge-row {
  display: flex;
  align-items: center;
  gap: 22px;
}

.storage-gauge {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, var(--surface-panel) 0 58%, transparent 59%),
    conic-gradient(var(--primary) calc(var(--value) * 1%), rgba(144, 144, 151, 0.2) 0);
  border: 1px solid rgba(144, 144, 151, 0.2);
}

.storage-gauge span {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 22px;
  color: var(--primary-strong);
}

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

.form-grid {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 16px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(144, 144, 151, 0.3);
  border-radius: 4px;
  background: rgba(38, 54, 74, 0.72);
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-strong);
  box-shadow: 0 0 0 3px rgba(123, 208, 255, 0.12);
}

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

.check-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px;
  border: 1px solid rgba(144, 144, 151, 0.2);
  border-radius: 4px;
  background: rgba(0, 15, 33, 0.38);
}

.check-grid input {
  width: 16px;
  min-height: 16px;
  padding: 0;
  accent-color: var(--primary-strong);
}

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

.toolbar-inline {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  min-width: min(460px, 100%);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid rgba(123, 208, 255, 0.32);
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
}

.status-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.status-chip.muted {
  border-color: rgba(198, 198, 205, 0.24);
  background: rgba(198, 198, 205, 0.08);
  color: var(--text-muted);
}

.status-chip.ok {
  border-color: rgba(147, 230, 178, 0.4);
  background: rgba(147, 230, 178, 0.12);
  color: var(--ok);
}

.status-chip.warning {
  border-color: rgba(255, 182, 144, 0.5);
  background: rgba(236, 106, 6, 0.14);
  color: var(--accent);
}

.status-chip.danger {
  border-color: rgba(255, 180, 171, 0.52);
  background: rgba(147, 0, 10, 0.2);
  color: var(--danger);
}

.compact-select {
  width: min(260px, 100%);
}

.compact-input {
  width: min(280px, 100%);
}

.field-hint {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 16px;
}

.separated-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(144, 144, 151, 0.14);
}

.tab-button,
.ghost-button,
.primary-button,
.danger-button {
  min-height: 40px;
  border-radius: 4px;
  border: 1px solid rgba(144, 144, 151, 0.3);
  padding: 8px 12px;
  color: var(--text);
  background: rgba(27, 43, 63, 0.72);
}

.primary-button {
  border-color: rgba(123, 208, 255, 0.72);
  background: var(--primary);
  color: var(--primary-dark);
  font-weight: 800;
}

.danger-button {
  border-color: rgba(255, 180, 171, 0.72);
  background: rgba(147, 0, 10, 0.46);
  color: var(--danger);
}

.ghost-button {
  color: var(--text-muted);
}

.ghost-button:hover,
.tab-button:hover {
  border-color: rgba(123, 208, 255, 0.48);
  color: var(--text);
}

.nav .tab-button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 0 10px;
}

.nav .tab-button:hover {
  background: rgba(38, 54, 74, 0.7);
  color: var(--text);
}

.nav .tab-button.active {
  background: rgba(15, 23, 42, 0.68);
  color: var(--primary);
  box-shadow: inset -2px 0 0 var(--primary);
}

.table-panel {
  min-width: 0;
}

.table-wrap {
  max-height: 560px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.audit-table {
  table-layout: fixed;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(144, 144, 151, 0.13);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #102034;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 16px;
}

td.mono,
.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

.audit-table td {
  white-space: pre-line;
}

.audit-table th:nth-child(1),
.audit-table td:nth-child(1) {
  width: 120px;
}

.audit-table th:nth-child(2),
.audit-table td:nth-child(2) {
  width: 178px;
}

.audit-table th:nth-child(3),
.audit-table td:nth-child(3) {
  width: 150px;
}

.audit-table th:nth-child(4),
.audit-table td:nth-child(4) {
  width: 168px;
  overflow-wrap: anywhere;
}

.audit-table th:nth-child(5),
.audit-table td:nth-child(5) {
  overflow-wrap: anywhere;
}

.muted-line {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 18px;
}

.role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 5px 4px 8px;
  border: 1px solid rgba(123, 208, 255, 0.28);
  border-radius: 4px;
  background: rgba(123, 208, 255, 0.1);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 16px;
}

.role-chip span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mini-danger {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 180, 171, 0.48);
  border-radius: 4px;
  background: rgba(147, 0, 10, 0.42);
  color: var(--danger);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  line-height: 18px;
  padding: 0;
}

.request-list {
  display: grid;
  gap: 10px;
  max-height: 640px;
  overflow: auto;
}

.request-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(144, 144, 151, 0.2);
  border-radius: 6px;
  background: rgba(0, 15, 33, 0.42);
}

.request-item.is-grounded {
  border-color: rgba(255, 180, 171, 0.42);
  background: rgba(147, 0, 10, 0.14);
}

.request-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.request-title strong {
  color: var(--primary-strong);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

.request-meta {
  display: grid;
  gap: 4px;
  color: var(--text-muted);
  font-size: 13px;
}

.request-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

td .compact-link + .compact-link,
td .compact-link + .danger-button,
td .danger-button + .compact-link {
  margin-left: 8px;
}

.checklist-preview {
  display: grid;
  gap: 4px;
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 13px;
  line-height: 18px;
}

.checklist-preview:empty {
  display: none;
}

.defect-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.defect-photos:empty {
  display: none;
}

.defect-photos figure {
  min-width: 0;
  margin: 0;
  border: 1px solid rgba(144, 144, 151, 0.2);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(16, 32, 52, 0.72);
}

.defect-photos img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: rgba(0, 15, 33, 0.6);
}

.defect-photos figcaption {
  padding: 7px 8px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 15px;
  overflow-wrap: anywhere;
}

.compact-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 220px;
}

.compact-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.compact-checks input {
  width: 15px;
  min-height: 15px;
  padding: 0;
  accent-color: var(--primary-strong);
}

.empty-state {
  padding: 18px;
  color: var(--text-muted);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(460px, calc(100vw - 48px));
  border: 1px solid rgba(123, 208, 255, 0.38);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(16, 32, 52, 0.98);
  color: var(--text);
  box-shadow: var(--shadow);
}

.toast.error {
  border-color: rgba(255, 180, 171, 0.58);
  background: rgba(48, 14, 18, 0.98);
  color: var(--danger);
}

.danger-text {
  color: var(--danger);
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(0, 15, 33, 0.86);
  backdrop-filter: blur(10px);
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  border: 1px solid rgba(144, 144, 151, 0.24);
  border-radius: 8px;
  background: var(--surface-panel);
  box-shadow: var(--shadow);
  padding: 26px;
}

.login-head {
  margin-bottom: 20px;
}

.login-card h1 {
  font-size: 26px;
  line-height: 34px;
}

@media (max-width: 1120px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(144, 144, 151, 0.18);
  }

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

  .sidebar-bottom {
    margin-top: 0;
  }

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

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

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .content-shell {
    padding: 24px 16px 42px;
  }

  .page-head h2 {
    font-size: 24px;
    line-height: 32px;
  }

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

  .inline-grid,
  .check-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

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

  .request-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .compact-checks {
    grid-template-columns: 1fr;
  }

  .toolbar-inline {
    justify-content: stretch;
    min-width: 0;
  }

  .toolbar-inline .compact-select {
    width: 100%;
  }
}
