:root {
  --bg: #0c1218;
  --surface: #131b24;
  --surface-2: #182331;
  --line: #263445;
  --text: #eaf1f7;
  --muted: #a8b9c9;
  --soft: #7e92a7;
  --primary: #7cc8ff;
  --primary-soft: #16324a;
  --success: #66d19a;
  --warning: #e1a24b;
  --danger: #ff7c72;
  --danger-soft: #412228;
  --gold: #ffd45a;
  --mint: #59e1b8;
  --rose: #ff849f;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(124, 200, 255, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 212, 90, 0.12), transparent 25%),
    linear-gradient(180deg, #0d141b 0%, #091017 100%);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Trebuchet MS", sans-serif;
}

body {
  overflow: hidden;
}

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

a {
  color: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
  min-height: 0;
}

.shell-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  background: rgba(8, 14, 20, 0.92);
  border-right: 1px solid var(--line);
  min-height: 0;
  overflow-y: auto;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(124, 200, 255, 0.28), rgba(89, 225, 184, 0.16));
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.sidebar-brand strong {
  display: block;
  font-size: 1.1rem;
}

.sidebar-brand small {
  color: var(--soft);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 14px 16px;
  transition: 0.2s ease;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(124, 200, 255, 0.1);
  border-color: rgba(124, 200, 255, 0.18);
  color: var(--text);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scope-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  flex-wrap: nowrap;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 18, 24, 0.78);
  backdrop-filter: blur(14px);
}

.topbar h1,
.section-header h2,
.panel-header h3,
.hero-card h3,
.detail-hero h2 {
  margin: 0;
  font-family: "Bahnschrift", "Segoe UI Variable Display", sans-serif;
  font-weight: 700;
}

.topbar-main,
.topbar-actions,
.section-actions,
.inline-actions,
.panel-header,
.panel-header-split,
.panel-section-head,
.list-card-top,
.meta-row,
.form-actions,
.search-tabs,
.hero-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-header-split {
  justify-content: space-between;
  flex-wrap: wrap;
}

.topbar-main {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-main p,
.section-header p,
.hero-card p,
.detail-note p,
.list-card p,
.empty-state p,
.login-hero p {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-actions {
  flex: 0 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.content-scroll {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 24px 28px 40px;
}

.panel,
.hero-card,
.detail-hero,
.login-card,
.metric-card,
.mini-card,
.list-card,
.confirm-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(19, 27, 36, 0.98), rgba(14, 22, 30, 0.98));
  box-shadow: var(--shadow);
}

.hero-card,
.detail-hero,
.login-card {
  padding: 24px;
}

.panel {
  padding: 20px;
}

.panel-loading,
.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 36px 24px;
}

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

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.list-card,
.list-panel {
  width: 100%;
}

.list-card {
  border: 1px solid var(--line);
  padding: 18px;
  background: rgba(24, 35, 49, 0.55);
  text-align: left;
  color: var(--text);
}

.interactive:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 200, 255, 0.26);
}

.meta-row {
  flex-wrap: wrap;
  color: var(--soft);
  font-size: 0.92rem;
}

.metrics-grid,
.detail-grid,
.filters-grid,
.info-grid,
.photo-grid,
.access-grid {
  display: grid;
  gap: 16px;
}

.metrics-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin: 20px 0;
}

.metric-card {
  padding: 18px;
}

.metric-card span {
  display: block;
  color: var(--muted);
}

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

.accent-primary { border-color: rgba(124, 200, 255, 0.2); }
.accent-mint { border-color: rgba(89, 225, 184, 0.2); }
.accent-gold { border-color: rgba(255, 212, 90, 0.2); }
.accent-rose { border-color: rgba(255, 132, 159, 0.2); }
.accent-danger { border-color: rgba(255, 124, 114, 0.2); }

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

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

.detail-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  margin-top: 16px;
}

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

.info-grid span,
.form-field span,
.scope-select span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.info-grid strong {
  display: block;
}

.form-field input,
.form-field select,
.form-field textarea,
.scope-select select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(24, 35, 49, 0.55);
  color: var(--text);
}

.scope-select {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 230px;
  min-width: 230px;
}

.scope-select span {
  margin-bottom: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

.scope-select select {
  flex: 1 1 auto;
  min-width: 0;
}

.checkbox-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.checkbox-field input {
  width: 22px;
  height: 22px;
}

.button {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 16px;
  background: rgba(24, 35, 49, 0.55);
  color: var(--text);
}

a.button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.button:hover {
  border-color: rgba(124, 200, 255, 0.24);
}

.button.primary {
  background: linear-gradient(135deg, rgba(124, 200, 255, 0.24), rgba(124, 200, 255, 0.08));
  border-color: rgba(124, 200, 255, 0.24);
}

.button.ghost {
  background: rgba(24, 35, 49, 0.4);
}

.button.danger {
  background: rgba(255, 124, 114, 0.12);
  border-color: rgba(255, 124, 114, 0.26);
  color: #ffd4d0;
}

.button.full {
  width: 100%;
}

.button.tiny {
  padding: 6px 10px;
  font-size: 0.84rem;
}

.wrap-actions {
  flex-wrap: wrap;
}

.status-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  white-space: nowrap;
  font-size: 0.88rem;
}

.tone-primary { color: var(--primary); border-color: rgba(124, 200, 255, 0.24); }
.tone-success { color: var(--success); border-color: rgba(102, 209, 154, 0.24); }
.tone-warning { color: var(--warning); border-color: rgba(225, 162, 75, 0.24); }
.tone-danger { color: var(--danger); border-color: rgba(255, 124, 114, 0.24); }
.tone-neutral { color: var(--muted); }

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

.qr-card {
  display: grid;
  gap: 18px;
  justify-items: center;
  text-align: center;
}

.qr-link {
  display: inline-flex;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.qr-image {
  display: block;
  width: min(100%, 240px);
  aspect-ratio: 1;
  object-fit: contain;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.list-card h4,
.timeline-body h4,
.mini-card strong,
.detail-note strong {
  margin: 0;
}

.photo-card {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(24, 35, 49, 0.46);
}

.photo-card img {
  display: block;
  width: 100%;
  height: 170px;
  object-fit: cover;
}

.photo-card figcaption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(124, 200, 255, 0.12);
}

.timeline-body {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: rgba(24, 35, 49, 0.4);
}

.detail-note {
  margin-top: 16px;
}

.supply-receipt-history {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.supply-receipt-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(24, 35, 49, 0.45);
  padding: 14px 16px;
}

.supply-receipt-card p {
  margin: 6px 0 0;
}

.supply-receipt-card .meta-row {
  margin-top: 10px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 14px;
  background: rgba(24, 35, 49, 0.42);
  min-width: 0;
  max-width: min(100%, 320px);
}

.user-pill strong,
.user-pill small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill small,
.subtle,
.subtle-text {
  color: var(--soft);
}

.paging-row {
  text-align: center;
  padding: 16px;
  color: var(--muted);
}

.search-tabs {
  margin-bottom: 18px;
}

.tab-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 10px 16px;
}

.tab-button.is-active {
  color: var(--text);
  background: rgba(124, 200, 255, 0.12);
  border-color: rgba(124, 200, 255, 0.22);
}

.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 460px);
  gap: 26px;
  align-items: center;
  padding: 40px;
  overflow-y: auto;
}

.login-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hamburger {
  display: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  padding: 10px 14px;
}

.modal-backdrop,
.screen-loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 9, 13, 0.72);
  backdrop-filter: blur(8px);
  z-index: 40;
}

.modal-card {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(19, 27, 36, 1), rgba(13, 20, 28, 1));
  box-shadow: var(--shadow);
}

.modal-form {
  padding: 24px;
}

.modal-form-wide {
  padding: 26px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(19, 27, 36, 0.98);
  box-shadow: var(--shadow);
  z-index: 50;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(124, 200, 255, 0.16);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.is-hidden {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    z-index: 30;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .hamburger {
    display: inline-flex;
  }

  .login-shell,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .content-scroll {
    padding-inline: 18px;
  }

  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    overflow-x: visible;
    padding-bottom: 0;
  }

  .scope-select {
    display: flex;
    align-items: center;
    flex: 1 1 220px;
    min-width: min(100%, 220px);
  }

  .user-pill {
    max-width: 100%;
  }

  .content-scroll {
    padding-bottom: 88px;
  }
}
