/**
 * TMSAPM — Black & gold UI (template-inspired)
 * Loaded after style.css
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&display=swap');

:root {
  --bg: #0a0a0a;
  --bg-deep: #050505;
  --panel: #141414;
  --panel2: #1c1c1c;
  --text: #f5f5f5;
  --muted: #a8a8a8;
  --primary: #f5c518;
  --primary-dark: #d4a106;
  --primary-text: #0a0a0a;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;
  --border: rgba(255, 255, 255, 0.1);
  --input-border: rgba(255, 255, 255, 0.22);
  --input-border-focus: rgba(245, 197, 24, 0.85);
  --accent-soft: rgba(245, 197, 24, 0.14);
  --accent-mid: rgba(245, 197, 24, 0.24);
  --accent-border: rgba(245, 197, 24, 0.45);
  --accent-strong: rgba(245, 197, 24, 0.65);
  --radius: 14px;
  --radius-lg: 22px;
  --font: 'DM Sans', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

/* ----- Top bar (portal) ----- */
.topbar {
  background: rgba(10, 10, 10, 0.92);
  border-bottom: 1px solid var(--border);
}

.brand a {
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.04em;
}

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

.nav-link.active,
.nav-home.active {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  color: var(--primary);
}

.nav-home {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.nav-group .nav-direct-link.active {
  background: var(--accent-soft);
  color: var(--primary);
}

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

.btn-primary {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: var(--primary-text);
  font-weight: 700;
}

.btn-primary:hover {
  background: #ffe566;
  border-color: var(--primary);
  color: var(--primary-text);
}

.btn-ghost-dark {
  background: transparent;
  border: 2px solid #0a0a0a;
  color: #0a0a0a;
  font-weight: 700;
}

.btn-ghost-dark:hover {
  background: #0a0a0a;
  color: #fff;
}

.table th {
  background: rgba(245, 197, 24, 0.08);
  color: var(--primary);
}

[data-theme-toggle] {
  background: var(--panel2);
  border-color: var(--border);
  color: var(--text);
}

[data-theme-toggle]:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

/* ----- Marketing shell (landing + auth) ----- */
body.page-marketing .topbar,
body.auth-hero-page .topbar {
  display: none;
}

body.page-marketing .layout,
body.auth-hero-page .layout {
  min-height: 100vh;
  flex-direction: column;
}

body.page-marketing .content {
  flex: 1;
  padding: 0;
  max-width: none;
}

.marketing-section--dark .btn:not(.btn-primary) {
  border: 2px solid rgba(255, 255, 255, 0.35);
  color: #f5f5f5;
  background: transparent;
}

.marketing-section--dark .btn:not(.btn-primary):hover {
  border-color: var(--primary);
  color: var(--primary);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px clamp(20px, 4vw, 48px);
  background: #ffffff;
  border-bottom: 1px solid #e5e5e5;
  color: #0a0a0a;
}

.site-header__brand {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: #0a0a0a;
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
  flex-wrap: wrap;
}

.site-header__nav a {
  text-decoration: none;
  color: #333;
  font-weight: 600;
  font-size: 14px;
}

.site-header__nav a:hover {
  color: #0a0a0a;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ----- Wavy hero ----- */
.marketing-hero {
  position: relative;
  overflow: hidden;
  min-height: min(88vh, 720px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}

.marketing-hero__panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(32px, 6vw, 64px);
}

.marketing-hero__panel--dark {
  background: #0a0a0a;
  color: #fff;
}

.marketing-hero__panel--gold {
  background: var(--primary);
  color: var(--primary-text);
  clip-path: polygon(12% 0, 100% 0, 100% 100%, 0 100%);
  margin-left: -8%;
}

.marketing-hero__visual {
  width: min(280px, 70%);
  aspect-ratio: 4/3;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.08);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.marketing-hero__content {
  max-width: 420px;
}

.marketing-hero__site {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.75;
  margin: 0 0 8px;
}

.marketing-hero__title {
  margin: 0 0 16px;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.15;
}

.marketing-hero__lead {
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.6;
  opacity: 0.9;
}

.marketing-search {
  background: #0a0a0a;
  padding: clamp(20px, 4vw, 36px) clamp(20px, 4vw, 48px);
}

.marketing-search__inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  gap: 0;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid #333;
}

.marketing-search__inner input {
  flex: 1;
  border: none;
  border-radius: 0;
  padding: 16px 22px;
  font-size: 15px;
  background: #fff;
  color: #0a0a0a;
}

.marketing-search__inner button {
  border: none;
  border-radius: 0;
  padding: 16px 28px;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 800;
  cursor: pointer;
}

.marketing-section {
  padding: clamp(40px, 6vw, 72px) clamp(20px, 4vw, 48px);
  background: #f4f4f5;
  color: #0a0a0a;
}

.marketing-section--dark {
  background: #0a0a0a;
  color: #f5f5f5;
}

.marketing-section__grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.marketing-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid #e5e5e5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.marketing-section--dark .marketing-card {
  background: #141414;
  border-color: #2a2a2a;
  color: #f5f5f5;
}

.marketing-card h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  font-weight: 800;
}

.marketing-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #525252;
}

.marketing-section--dark .marketing-card p {
  color: #a3a3a3;
}

.marketing-portals {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.site-footer {
  background: #0a0a0a;
  color: #a3a3a3;
  padding: 48px clamp(20px, 4vw, 48px) 24px;
}

.site-footer__grid {
  max-width: 1100px;
  margin: 0 auto 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 28px;
}

.site-footer h4 {
  margin: 0 0 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.site-footer a {
  color: var(--primary);
  text-decoration: none;
}

.site-footer__copy {
  text-align: center;
  font-size: 12px;
  border-top: 1px solid #222;
  padding-top: 20px;
  max-width: 1100px;
  margin: 0 auto;
}

/* Auth pages — gold wave aesthetic */
body.auth-hero-page {
  background: #0a0a0a;
}

html[data-theme="light"] body.auth-hero-page {
  background: #f4f4f5;
}

.auth-hero-page .auth-hero-overlay {
  background: linear-gradient(
    115deg,
    rgba(10, 10, 10, 0.92) 0%,
    rgba(10, 10, 10, 0.7) 45%,
    rgba(245, 197, 24, 0.25) 100%
  );
}

body.auth-hero-page .auth-card--hero {
  background: rgba(20, 20, 20, 0.9);
  border: 1px solid rgba(245, 197, 24, 0.35);
  border-radius: var(--radius-lg);
}

body.auth-hero-page .auth-card--hero h2 {
  color: #fff;
}

body.auth-hero-page .auth-card--hero label {
  color: var(--primary);
}

body.auth-hero-page .auth-card--hero input {
  border-radius: var(--radius);
  border-color: rgba(255, 255, 255, 0.2);
  background: #0a0a0a;
}

body.auth-hero-page .auth-card--hero input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

body.auth-hero-page .auth-card--hero .btn-primary {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: var(--primary-text);
  border-radius: var(--radius);
  font-weight: 800;
}

body.auth-hero-page .auth-card--hero .btn:not(.btn-primary) {
  border-radius: var(--radius);
  border: 2px solid rgba(255, 255, 255, 0.25);
  color: #f5f5f5;
}

/* Light theme — white panels, gold accent */
html[data-theme="light"] {
  --bg: #f4f4f5;
  --bg-deep: #e5e5e5;
  --panel: #ffffff;
  --panel2: #fafafa;
  --text: #0a0a0a;
  --muted: #525252;
  --primary: #f5c518;
  --border: rgba(0, 0, 0, 0.1);
  --input-border: rgba(0, 0, 0, 0.2);
  --input-border-focus: #d4a106;
  --accent-soft: rgba(245, 197, 24, 0.18);
  --accent-mid: rgba(245, 197, 24, 0.28);
  --accent-border: rgba(212, 161, 6, 0.45);
  --accent-strong: rgba(180, 130, 0, 0.55);
}

html[data-theme="light"] body {
  background: linear-gradient(180deg, #fafafa, #f4f4f5);
}

html[data-theme="light"] .topbar {
  background: #ffffff;
  border-bottom-color: #e5e5e5;
}

html[data-theme="light"] .sidebar {
  background: #ffffff;
  border-right-color: #e5e5e5;
}

html[data-theme="light"] .nav-home,
html[data-theme="light"] .nav-link.active {
  color: #0a0a0a;
}

html[data-theme="light"] .btn-primary {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: var(--primary-text);
}

html[data-theme="light"] .card h3,
html[data-theme="light"] .stat {
  color: #0a0a0a;
}

html[data-theme="light"] body.page-landing .index-hero-card,
html[data-theme="light"] body.page-landing .index-hero-features,
html[data-theme="light"] body.auth-hero-page .auth-card--hero {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  color: #0a0a0a;
}

html[data-theme="light"] body.auth-hero-page .auth-card--hero h2,
html[data-theme="light"] body.auth-hero-page .auth-card--hero label {
  color: #0a0a0a;
}

html[data-theme="light"] [data-theme-toggle] {
  background: #0a0a0a;
  color: #fff;
  border-color: #0a0a0a;
}

@media (max-width: 900px) {
  .marketing-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .marketing-hero__panel--gold {
    clip-path: none;
    margin-left: 0;
  }

  .marketing-hero__panel {
    min-height: 320px;
  }
}

/* ----- Operator booking dispatch ----- */
.dispatch-cell {
  min-width: 320px;
  vertical-align: top;
}

.dispatch-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.dispatch-truck-wrap {
  position: relative;
  width: 100%;
}

.dispatch-truck-tip {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.dispatch-truck-tip__title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}

.dispatch-truck-tip__badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-text);
  font-size: 10px;
  font-weight: 800;
  vertical-align: middle;
}

.dispatch-truck-tip__match {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.18);
  color: var(--success);
  font-size: 10px;
  font-weight: 700;
}

.dispatch-truck-tip__meta {
  color: var(--muted);
  margin-bottom: 6px;
}

.dispatch-truck-tip__reasons {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 11px;
}

.dispatch-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.dispatch-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 0;
}

.dispatch-form__label {
  font-size: 11px;
  color: var(--muted);
}

.dispatch-form .dispatch-truck {
  width: 100%;
}

.dispatch-accept,
.dispatch-reject-btn {
  width: 100%;
}

.dispatch-reject {
  margin: 0;
}

.dispatch-no-truck {
  font-size: 12px;
  margin: 0;
  padding: 8px 10px;
}

.dispatch-no-truck details {
  margin-top: 6px;
}

.dispatch-no-truck summary {
  cursor: pointer;
}

.dispatch-no-truck ul {
  margin: 6px 0 0 18px;
  line-height: 1.45;
}

html[data-theme="light"] .dispatch-truck-tip {
  background: rgba(245, 197, 24, 0.12);
  border-color: rgba(212, 161, 6, 0.45);
}

.table tr.row-highlight td {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.collection-modal-card input[readonly] {
  opacity: 0.85;
}

.receipt-page__toolbar {
  margin-bottom: 16px;
}

.receipt-page__copies {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.receipt-page__copies--single {
  grid-template-columns: minmax(280px, 420px);
}

.receipt-doc {
  background: #fff;
  color: #0a0a0a;
  border: 1px solid #ddd;
  border-radius: var(--radius-lg);
  padding: 20px;
}

.receipt-doc__header {
  text-align: center;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.receipt-doc__brand {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.receipt-doc__title {
  margin: 6px 0 4px;
  font-size: 1.35rem;
}

.receipt-doc__copy {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #525252;
}

.receipt-doc__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-bottom: 14px;
  font-size: 13px;
}

.receipt-doc__label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #737373;
}

.receipt-doc__section h2 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.receipt-doc__section p {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.45;
}

.receipt-doc__amounts {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #ccc;
}

.receipt-doc__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 14px;
}

.receipt-doc__row--change strong {
  color: #15803d;
}

.receipt-doc__footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #eee;
  text-align: center;
  font-size: 12px;
}

@media print {
  .sidebar,
  .topbar,
  .receipt-page__toolbar,
  .site-header {
    display: none !important;
  }

  .layout,
  .content,
  .container {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .receipt-page__copies {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .receipt-doc {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
