/* Interglobe Alliance — slate theme, teal & sky accents */
@import url("fonts/fonts-local.css");

:root {
  --primary: #f1f5f9;
  --secondary: #1e293b;
  --body-text: #94a3b8;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-2: #38bdf8;
  --accent-violet: #a78bfa;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --gold: var(--accent);
  --gold-light: rgba(186, 230, 253, 0.1);
  --bg: #0a0f18;
  --panel: #121b2d;
  --text: #e2e8f0;
  --muted: var(--body-text);
  --danger: #f87171;
  --border: rgba(148, 163, 184, 0.14);
  --field-border: rgba(148, 163, 184, 0.28);
  --field-bg: #151f30;
  --field-divider: rgba(148, 163, 184, 0.12);
  --filter-cell-border: rgba(45, 212, 191, 0.22);
  --filter-cell-bg: #141c2e;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  font-family: "Roboto", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 75% 50% at 50% -15%, rgba(45, 212, 191, 0.08), transparent 52%),
    radial-gradient(ellipse 45% 35% at 100% 100%, rgba(167, 139, 250, 0.07), transparent 48%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  color-scheme: dark;
}

.global-earth-bg-layer {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 70% at 50% -10%, rgba(34, 78, 150, 0.28), transparent 62%),
    radial-gradient(ellipse 60% 48% at 10% 20%, rgba(124, 86, 182, 0.14), transparent 66%),
    linear-gradient(180deg, #040916 0%, #030713 52%, #030510 100%);
}

.global-earth-bg-layer::before {
  content: "";
  position: absolute;
  inset: -10% -8%;
  background-image: url("assets/space/dark-s_pz.jpg");
  background-size: cover;
  background-position: center center;
  opacity: 0.55;
  filter: blur(4px) saturate(1.05);
  transform: scale(1.06);
}

.global-earth-bg-layer::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -46vh;
  width: min(180vw, 2200px);
  aspect-ratio: 1 / 1;
  transform: translateX(-50%);
  border-radius: 50%;
  background-image: url("assets/space/earth-day-4096.jpg");
  background-size: cover;
  background-position: 50% 50%;
  opacity: 0.72;
  filter: blur(16px) saturate(1.06) brightness(0.95);
  box-shadow:
    0 -22px 90px rgba(73, 146, 255, 0.45),
    inset 0 40px 120px rgba(255, 255, 255, 0.08);
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.92);
  box-shadow: var(--shadow-sm);
}

.top h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

nav {
  display: flex;
  gap: 0.75rem;
}

nav a {
  color: var(--accent);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-weight: 500;
}

nav a:hover {
  background: rgba(45, 212, 191, 0.1);
  color: var(--accent-hover);
}

nav a[aria-current="page"] {
  background: rgba(45, 212, 191, 0.18);
  color: var(--text);
}

main {
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

main.narrow {
  max-width: 520px;
}

.hint {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1rem;
}

.hint code {
  font-size: 0.85em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.filters {
  margin-bottom: 1rem;
}

.filters-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "toggle . bulk"
    ". . count";
  align-items: center;
  gap: 0.75rem 1rem;
}

.filters-toggle {
  grid-area: toggle;
}

.filters-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--field-divider);
}

.filters-hint {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.filters-count {
  font-size: 0.9rem;
  color: var(--muted);
  grid-area: count;
  justify-self: end;
  text-align: right;
}

.filters-bar #bulk-print-qr {
  grid-area: bulk;
  justify-self: end;
}

.inventory-summary {
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.inventory-summary-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.inventory-summary-kpis {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
}

.inventory-summary-kpis strong {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.inventory-summary-kpis-hint {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.88em;
}

.inventory-summary-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.inventory-summary-breakdowns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem 1.25rem;
  margin-top: 0.25rem;
}

.inventory-summary-col {
  min-width: 0;
}

.inventory-summary-col h3 {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.inventory-summary-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--field-divider);
  border-radius: 8px;
  background: rgba(10, 15, 24, 0.45);
  max-height: 11rem;
  overflow-y: auto;
}

.inventory-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.65rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
}

.inventory-summary-row:last-child {
  border-bottom: none;
}

.inventory-summary-row .inv-sum-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inventory-summary-row .inv-sum-count {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent-2);
}

.inventory-summary-row.inv-sum-more {
  color: var(--muted);
  font-style: italic;
  font-size: 0.78rem;
}

.link-btn {
  font: inherit;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  font-weight: 500;
}

.link-btn:hover {
  color: var(--accent-hover);
}

.status {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  background: rgba(239, 83, 80, 0.15);
  color: #ffccbc;
  border: 1px solid rgba(239, 83, 80, 0.35);
}

.status.status--ok {
  background: rgba(76, 175, 80, 0.16);
  color: #a5d6a7;
  border: 1px solid rgba(129, 199, 132, 0.45);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.04);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr.charger-row-out {
  background: rgba(239, 83, 80, 0.12);
  box-shadow: inset 4px 0 0 0 var(--danger);
}

tbody tr.charger-row-out td {
  border-bottom-color: rgba(239, 83, 80, 0.25);
}

tbody tr.charger-row-out .status-select {
  border: 2px solid rgba(239, 83, 80, 0.65);
}

.inv-log-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.inv-log-section-head .inventory-summary-title {
  margin: 0;
}

.inv-log-reset-btn {
  flex-shrink: 0;
}

.inv-log-day-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.inv-log-day-heading {
  margin: 1.25rem 0 0;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--text);
}

.inv-log-day-block:first-child .inv-log-day-heading {
  margin-top: 0;
}

.inv-log-hint {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.checkout-log-note {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 22rem;
}

.inv-log-not-returned {
  color: var(--muted);
  font-style: italic;
}

.inv-log-sold {
  color: #a5d6a7;
  font-weight: 600;
}

table.inv-log-table {
  font-size: 0.88rem;
}

button,
.button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  background: linear-gradient(135deg, #2dd4bf 0%, #38bdf8 100%);
  color: #042f2e;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  box-shadow: 0 2px 14px rgba(45, 212, 191, 0.32);
  transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.12s ease;
}

button:hover,
.button:hover {
  filter: brightness(1.07);
  box-shadow:
    0 4px 20px rgba(45, 212, 191, 0.38),
    0 0 22px rgba(56, 189, 248, 0.12);
}

.button.ghost {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--border);
  box-shadow: none;
}

.button.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(45, 212, 191, 0.1);
  filter: none;
  box-shadow: none;
}

button.small {
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(198, 40, 40, 0.45);
  box-shadow: none;
}

button.small:hover {
  background: rgba(239, 83, 80, 0.15);
  filter: none;
  box-shadow: none;
}

button.small.row-edit {
  color: #fef08a;
  border-color: rgba(254, 240, 138, 0.62);
  background: rgba(254, 240, 138, 0.08);
}

button.small.row-edit:hover {
  background: rgba(254, 240, 138, 0.18);
  color: #fff9c4;
}

button.small.row-sold {
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.62);
  background: rgba(134, 239, 172, 0.08);
}

button.small.row-sold:hover {
  background: rgba(134, 239, 172, 0.18);
  color: #bbf7d0;
}

button.small.row-remove {
  color: #ffffff;
  border-color: #dc2626;
  background: #dc2626;
}

button.small.row-remove:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--field-divider);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

/* Clear separation between stacked form fields */
.card > label,
.card .panel > label {
  padding-bottom: 0.9rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--field-divider);
}

.card > label:last-of-type,
.card .panel > label:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.card > .actions {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--field-divider);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem 1rem;
}

.filters-grid label {
  padding: 0.75rem 0.85rem;
  margin: 0;
  background: var(--filter-cell-bg);
  border: 2px solid var(--filter-cell-border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.filters-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--field-divider);
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #c8c8c8;
}

.req {
  color: var(--danger);
  font-weight: 600;
}

input,
textarea,
select {
  font: inherit;
  padding: 0.6rem 0.75rem;
  min-height: 2.65rem;
  border-radius: 8px;
  border: 2px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

textarea {
  min-height: 5rem;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(45, 212, 191, 0.55);
  outline-offset: 1px;
  border-color: var(--accent);
  background: #182335;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(45, 212, 191, 0.28);
}

.filters-grid select {
  cursor: pointer;
  min-width: 0;
}

.td-cell-status {
  vertical-align: middle;
  white-space: nowrap;
}

.td-row-actions {
  vertical-align: middle;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.td-row-actions .link-btn {
  font-size: 0.8rem;
}

select.status-select {
  min-width: 8.5rem;
  cursor: pointer;
  min-height: 2.5rem;
  background-color: var(--field-bg);
  background-image: linear-gradient(45deg, transparent 50%, #c0c0c0 50%),
    linear-gradient(135deg, #c0c0c0 50%, transparent 50%);
  background-position: calc(100% - 0.85rem) 1rem, calc(100% - 0.55rem) 1rem;
  background-size: 0.3rem 0.3rem;
  background-repeat: no-repeat;
  padding-right: 1.75rem;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid var(--field-border);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.25rem;
}

.msg {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.msg.ok {
  background: rgba(76, 175, 80, 0.16);
  color: #a5d6a7;
  border: 1px solid rgba(129, 199, 132, 0.45);
}

.msg.err {
  background: rgba(239, 83, 80, 0.14);
  color: #ffcdd2;
  border: 1px solid rgba(239, 83, 80, 0.4);
}

.empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  margin: 0;
}

.empty a {
  color: var(--accent);
  font-weight: 500;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-logo-link {
  flex-shrink: 0;
  line-height: 0;
  border-radius: 8px;
}

.brand-logo-img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.brand-titles {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.brand-company {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}

.brand-company:hover {
  color: var(--accent-hover);
}

.page-title {
  font-family: "Roboto Slab", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

/* Inventory — re-print checkout QR */
.qr-reprint-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.qr-reprint-modal[hidden] {
  display: none !important;
}

.qr-reprint-dialog {
  position: relative;
  max-width: 100%;
  width: 22rem;
  padding: 1.25rem 1.5rem 1.5rem;
  margin: 0;
}

.qr-reprint-close {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}

.qr-reprint-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.qr-reprint-title {
  margin: 0 1.5rem 0.35rem 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

.qr-reprint-model {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.qr-reprint-location {
  margin: 0 0 0.9rem;
  font-size: 0.9rem;
  color: var(--text);
  text-align: center;
  word-break: break-word;
}

#qr-reprint-host {
  display: flex;
  justify-content: center;
  margin-bottom: 0.85rem;
  min-height: 4rem;
}

#qr-reprint-host canvas,
#qr-reprint-host img {
  border-radius: 8px;
  max-width: 100%;
  height: auto;
}

.qr-reprint-url {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  word-break: break-all;
}

.qr-reprint-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

button.small.row-show-qr {
  color: var(--accent);
  border-color: rgba(45, 212, 191, 0.45);
}

button.small.row-show-qr:hover {
  background: rgba(45, 212, 191, 0.12);
  filter: none;
}

button.small.row-checkout-info {
  color: #7dd3fc;
  border-color: rgba(125, 211, 252, 0.5);
}

button.small.row-checkout-info:hover {
  background: rgba(125, 211, 252, 0.12);
  filter: none;
}

/* Tire inventory action buttons */
button.small.row-add-qty {
  color: #042f2e;
  border-color: rgba(45, 212, 191, 0.78);
  background: rgba(45, 212, 191, 0.92);
}

button.small.row-add-qty:hover {
  background: #5eead4;
  border-color: #5eead4;
  color: #042f2e;
  filter: none;
}

button.small.row-sold-qty {
  color: #422006;
  border-color: rgba(251, 191, 36, 0.82);
  background: rgba(251, 191, 36, 0.95);
}

button.small.row-sold-qty:hover {
  background: #fcd34d;
  border-color: #fcd34d;
  color: #422006;
  filter: none;
}

button.small.row-remove-qty {
  color: #e0f2fe;
  border-color: rgba(56, 189, 248, 0.78);
  background: rgba(2, 132, 199, 0.85);
}

button.small.row-remove-qty:hover {
  background: rgba(3, 105, 161, 0.95);
  border-color: rgba(56, 189, 248, 0.92);
  color: #e0f2fe;
  filter: none;
}

.checkout-info-label {
  margin: 0.85rem 0 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.checkout-info-label:first-of-type {
  margin-top: 0;
}

.checkout-info-body {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text);
}

.checkout-info-body.checkout-info-note {
  white-space: pre-wrap;
  word-break: break-word;
}

html,
body {
  overflow-x: hidden;
}

@media (max-width: 768px) {
  .top {
    padding: 0.75rem 0.9rem;
    gap: 0.6rem;
  }

  main {
    padding: 0.9rem;
  }

  .card {
    padding: 0.9rem;
    gap: 0.75rem;
  }

  .filters-bar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "toggle"
      "bulk"
      "count";
    align-items: stretch;
  }

  .filters-count,
  .filters-bar #bulk-print-qr {
    justify-self: start;
    text-align: left;
  }

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

  .table-wrap {
    border-radius: 8px;
  }

  table {
    min-width: 720px;
  }

  .td-row-actions {
    gap: 0.45rem;
  }

  .qr-reprint-dialog {
    width: min(22rem, calc(100vw - 1rem));
    padding: 1rem 0.9rem 1rem;
  }

  .qr-reprint-actions {
    justify-content: stretch;
  }

  .qr-reprint-actions .button,
  .qr-reprint-actions button {
    width: 100%;
  }

  /* Prevent iOS Safari auto-zoom on focused fields */
  input,
  textarea,
  select {
    font-size: 16px;
  }
}
