/* Cool Move Logistics — static admin portal styles.
   Ported from the Flask admin.css to match it 1:1, with a few additions for the
   client-side build: password-gate overlay, processing spinner, toast, and the
   SPA section show/hide. White/#F6F8FA surfaces, ink text, brand blue for
   primary actions and active nav. Mono feel for tours, filenames and stats.
   System font stack, no webfont dependency. */

:root {
  --ink: #0b1220;
  --slate: #51606f;
  --surface: #ffffff;
  --canvas: #f6f8fa;
  --blue: #0e63c4;
  --blue-dark: #0b51a3;
  --blue-tint: #e8f1fc;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  --green: #0f8b5f;
  --green-bg: #e7f6ef;
  --red: #c23a3a;
  --red-bg: #fbecec;
  --grey: #64748b;
  --grey-bg: #eef2f6;

  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-w: 232px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono",
    Menlo, Consolas, "Liberation Mono", monospace;

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04),
    0 1px 3px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--canvas);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue);
  text-decoration: none;
  cursor: pointer;
}
a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.01em;
}

.mono {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------- layout */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px;
  color: var(--ink);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
}
.brand:hover {
  text-decoration: none;
}
.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--blue);
  flex: 0 0 auto;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius);
  color: var(--slate);
  font-weight: 500;
  font-size: 14.5px;
}
.nav-link:hover {
  background: var(--canvas);
  color: var(--ink);
  text-decoration: none;
}
.nav-link.active {
  background: var(--blue-tint);
  color: var(--blue-dark);
}
.nav-ico {
  font-size: 15px;
  width: 18px;
  text-align: center;
  opacity: 0.85;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px 10px 2px;
}
.sidebar-note {
  margin: 0;
  font-size: 12px;
  color: var(--grey);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
}
.su-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px var(--green-bg);
}
.su-email {
  font-size: 12px;
  color: var(--slate);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-email {
  font-size: 13px;
  color: var(--slate);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .topbar-email {
    display: none;
  }
}
.page-title {
  font-size: 17px;
}
.nav-burger {
  display: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--slate);
  user-select: none;
}

.content {
  padding: 28px 24px 48px;
  max-width: 1140px;
  width: 100%;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}
.btn:hover {
  text-decoration: none;
  border-color: var(--slate);
}
.btn:active {
  transform: translateY(0.5px);
}
.btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 13.5px;
}
.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.btn-primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}
.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--slate);
}
.btn-ghost:hover {
  background: var(--canvas);
  border-color: var(--line);
  color: var(--ink);
}
.btn-danger {
  color: var(--red);
  border-color: var(--line-strong);
}
.btn-danger:hover {
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red);
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card-pad {
  padding: 20px 22px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-head h2 {
  font-size: 16px;
}
.muted {
  color: var(--slate);
}
.subtle {
  color: var(--grey);
  font-size: 13px;
}

/* ---------------------------------------------------------------- stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}
.stat-label {
  font-size: 12.5px;
  color: var(--slate);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 6px;
  letter-spacing: -0.02em;
}
.stat-sub {
  font-size: 12.5px;
  color: var(--grey);
  margin-top: 2px;
}
.stat.accent .stat-value {
  color: var(--blue);
}
.stat.good .stat-value {
  color: var(--green);
}
.stat.bad .stat-value {
  color: var(--red);
}

/* ---------------------------------------------------------------- tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th,
table.data td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate);
  font-weight: 600;
  background: var(--canvas);
  white-space: nowrap;
}
table.data tbody tr:last-child td {
  border-bottom: none;
}
table.data tbody tr:hover {
  background: #fafcfe;
}
td.fname,
td.tour,
td.rname {
  font-family: var(--font-mono);
  font-size: 13px;
}
td.fname {
  color: var(--slate);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
td.rname {
  color: var(--ink);
}
td.tour {
  color: var(--blue-dark);
  font-weight: 500;
}
td.right {
  text-align: right;
  white-space: nowrap;
}
.dash {
  color: var(--line-strong);
}

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-renamed {
  color: var(--green);
  background: var(--green-bg);
}
.badge-skipped {
  color: var(--grey);
  background: var(--grey-bg);
}
.badge-error {
  color: var(--red);
  background: var(--red-bg);
}

/* ---------------------------------------------------------------- flash */
.flash {
  border-radius: var(--radius);
  padding: 11px 15px;
  margin-bottom: 18px;
  font-size: 14px;
  border: 1px solid var(--line);
}
.flash-warn {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}
.flash-error {
  background: var(--red-bg);
  border-color: #f3c0c0;
  color: var(--red);
}

/* ---------------------------------------------------------------- tool */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  display: block;
}
.dropzone:hover,
.dropzone:focus-within {
  border-color: var(--blue);
  background: #fbfdff;
}
.dropzone.dragover {
  border-color: var(--blue);
  background: var(--blue-tint);
}
.dropzone-ico {
  font-size: 30px;
  color: var(--blue);
  line-height: 1;
}
.dropzone-title {
  font-size: 16px;
  font-weight: 600;
  margin: 12px 0 4px;
}
.dropzone-hint {
  color: var(--slate);
  font-size: 13.5px;
  margin: 0;
}
.dropzone-browse {
  color: var(--blue);
  font-weight: 500;
  text-decoration: underline;
}
#file-count {
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--slate);
  min-height: 20px;
}
#file-count strong {
  color: var(--ink);
  font-family: var(--font-mono);
}
.file-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--slate);
  max-height: 132px;
  overflow-y: auto;
  text-align: left;
}
.file-list li {
  padding: 2px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate);
}
.field-hint {
  font-size: 12px;
  color: var(--grey);
}
input[type="date"],
input[type="text"],
input[type="password"],
input[type="search"] {
  font-family: inherit;
  font-size: 14.5px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  min-height: 40px;
}
input:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: var(--blue);
}
.tool-controls .spacer {
  flex: 1 1 auto;
}

/* spinner inside the process / sign-in button while busy */
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
/* dark-on-light spinner for loading states inside cards */
.spinner-ink {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--line);
  border-top-color: var(--blue);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------------- filters */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
}
.filter-bar form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.filter-bar .spacer {
  flex: 1 1 auto;
}

/* ---------------------------------------------------------------- empty */
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--slate);
}
.empty-ico {
  font-size: 30px;
  color: var(--line-strong);
}
.empty h3 {
  margin: 12px 0 4px;
  font-size: 16px;
  color: var(--ink);
}
.empty p {
  margin: 0;
  font-size: 14px;
}

/* ---------------------------------------------------------------- results */
.results-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.results-summary .pill {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}
.results-summary .pill strong {
  font-family: var(--font-mono);
  color: var(--ink);
}

.page-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- login */
.login-wrap {
  position: fixed;
  inset: 0;
  z-index: 100;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--canvas);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 30px 28px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.login-sub {
  color: var(--slate);
  font-size: 13.5px;
  margin: 0 0 22px;
}
.login-card .field {
  margin-bottom: 16px;
}
.login-card input {
  width: 100%;
}
.login-card .btn {
  width: 100%;
}
.login-error {
  background: var(--red-bg);
  border: 1px solid #f3c0c0;
  color: var(--red);
  font-size: 13.5px;
  padding: 9px 12px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.login-foot {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--grey);
  line-height: 1.5;
}

/* ---------------------------------------------------------------- company */
.placeholder {
  text-align: center;
  padding: 60px 24px;
}
.placeholder-ico {
  font-size: 34px;
  color: var(--line-strong);
}
.placeholder h2 {
  margin: 14px 0 6px;
}
.placeholder p {
  color: var(--slate);
  margin: 0;
  font-size: 14.5px;
}

/* ---------------------------------------------------------------- boot splash */
.boot {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  background: var(--canvas);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.boot .brand-dot {
  width: 12px;
  height: 12px;
  animation: bootpulse 1.3s ease-in-out infinite;
}
.boot-word {
  opacity: 0.9;
}
@keyframes bootpulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---------------------------------------------------------------- tool note */
.tool-note {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--grey);
}

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(11, 18, 32, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .sidebar {
    position: fixed;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(11, 18, 32, 0.18);
  }
  .nav-burger {
    display: inline-block;
  }
  .content {
    padding: 20px 16px 40px;
  }
}

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

/* ===================================================================== inbox */
.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.seg {
  display: inline-flex;
  background: var(--grey-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--slate);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}
.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-card);
}

.lead-list {
  display: grid;
  gap: 12px;
}
.lead-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
}
.lead-card.is-new {
  border-left: 3px solid var(--blue);
}
.lead-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.lead-id {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.lead-sub {
  color: var(--slate);
  font-size: 13.5px;
  margin-top: 2px;
}
.lead-type {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 20px;
}
.lead-type.quote {
  background: var(--blue-tint);
  color: var(--blue-dark);
}
.lead-type.driver {
  background: var(--green-bg);
  color: var(--green);
}
.lead-spacer {
  flex: 1;
}
.lead-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  font-size: 14px;
}
.lead-contact a {
  color: var(--blue);
  text-decoration: none;
}
.lead-contact a:hover {
  text-decoration: underline;
}
.lead-msg {
  margin-top: 12px;
  padding: 11px 13px;
  background: var(--canvas);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink);
  white-space: pre-wrap;
}
.lead-details {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 16px;
}
.lead-detail {
  font-size: 13px;
}
.lead-detail b {
  color: var(--slate);
  font-weight: 600;
}
.lead-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.lead-date {
  color: var(--grey);
  font-size: 12.5px;
}
.lead-status {
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.lead-del {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--grey);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.lead-del:hover {
  color: var(--red);
}
