/* =========================================================================
   Auto Import GH — admin console stylesheet
   Brand: navy #0f2744, orange #f2a10b. No external fonts or assets.
   ========================================================================= */

:root {
  --navy: #0f2744;
  --navy-700: #1c4066;
  --accent: #f2a10b;
  --accent-600: #cf8704;
  --cream: #f6f7f9;
  --paper: #ffffff;
  --ink: #16202a;
  --muted: #61707f;
  --line: #e1e5ea;
  --ok: #1e7a4b;
  --warn: #92590a;
  --danger: #a52121;
  --radius: 12px;
  /* Density, 31 October 2026 — the console keeps its 15 px body text; only
     the chrome around it gets tighter, so more rows fit without anyone having
     to squint at a form. */
  --panel-pad: 14px;
  --row-pad: 7px 9px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
body.admin { margin: 0; font-family: var(--sans); background: var(--cream); color: var(--ink); font-size: 15px; line-height: 1.55; }
a { color: var(--navy-700); }
h1, h2, h3 { line-height: 1.2; color: var(--navy); margin: 0 0 0.5em; }
h1 { font-size: 1.34rem; }
h2 { font-size: 1.04rem; }
h3 { font-size: 0.92rem; }
code { font-family: var(--mono); font-size: 0.82em; background: #f0f2f5; padding: 1px 5px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 8px; top: 8px; background: var(--accent); padding: 8px 12px; z-index: 100; border-radius: 6px; }
.fine { font-size: 0.8rem; color: var(--muted); }
.warn-text { color: var(--warn); font-size: 0.78rem; }

/* ------------------------------------------------------------------ header */
.admin-header { background: var(--navy); color: #e9eef3; position: sticky; top: 0; z-index: 40; }
.admin-header-inner { max-width: 1360px; margin: 0 auto; padding: 8px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.admin-brand { color: #fff; text-decoration: none; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.admin-brand img { width: 46px; height: 26px; object-fit: contain; }
.admin-brand span { color: var(--accent); font-weight: 500; text-transform: lowercase; }
.admin-nav { width: 100%; display: none; }
.admin-nav.is-open { display: block; }
.admin-nav ul { list-style: none; margin: 0; padding: 6px 0 10px; display: flex; flex-wrap: wrap; gap: 4px; }
.admin-nav a { display: block; padding: 7px 10px; border-radius: 8px; color: #cdd8e3; text-decoration: none; font-size: 0.85rem; }
.admin-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-nav a.is-active { background: var(--accent); color: #221c05; font-weight: 650; }
.admin-user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 0.82rem; color: #c3cfda; }
.admin-user a { color: var(--accent); text-decoration: none; }
.nav-toggle { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); border-radius: 8px; width: 38px; height: 34px; display: inline-grid; place-items: center; cursor: pointer; }
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after { display: block; width: 16px; height: 2px; background: #fff; content: ""; position: relative; }
.nav-toggle-bar::before { position: absolute; top: -5px; }
.nav-toggle-bar::after { position: absolute; top: 5px; }
@media (min-width: 1080px) {
  .admin-nav { display: block !important; width: auto; }
  .nav-toggle { display: none; }
  .admin-nav ul { padding: 0; }
}

/* ------------------------------------------------------------------ layout */
.admin-main { max-width: 1360px; margin: 0 auto; padding: 16px 18px 48px; }
.admin-page-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.admin-page-head h1 { margin: 0; }
.admin-cols { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 16px; }
@media (min-width: 900px) { .admin-cols { grid-template-columns: 1fr 1fr; } }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--panel-pad); margin-bottom: 12px; }
.panel > :last-child { margin-bottom: 0; }

.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 18px; }
@media (min-width: 780px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat strong { display: block; font-size: 1.6rem; line-height: 1.15; margin: 4px 0 2px; color: var(--navy); }

/* ------------------------------------------------------------------ tables */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.admin-table th, .admin-table td { text-align: left; padding: var(--row-pad); border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table thead th { background: #f2f4f7; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.admin-table tbody tr:hover { background: #fbfbfc; }
.admin-table td select, .admin-table td textarea, .admin-table td input { width: 100%; font-family: var(--sans); font-size: 0.84rem; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.admin-table tbody th { background: #fafbfc; font-weight: 650; width: 34%; }
/* a wide log table scrolls inside its panel instead of pushing the page */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.table-scroll .admin-table { min-width: 0; font-size: 0.78rem; }
.table-scroll .admin-table th, .table-scroll .admin-table td { padding: 8px 7px; }

/* filter row under a page title */
.table-tools {
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end;
  width: 100%; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
}
.table-tools .field { flex: 0 0 auto; }
.table-tools label { display: block; font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.table-tools input {
  display: block; margin-top: 4px; min-width: 150px; padding: 7px 9px; font-family: var(--sans);
  font-size: 0.85rem; border: 1px solid var(--line); border-radius: 7px; background: #fff;
}
.table-tools input[type="search"] { min-width: 190px; }

/* ----------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border-radius: 9px; border: 1px solid transparent; font-family: var(--sans); font-size: 0.88rem; font-weight: 650; text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-outline { background: #fff; border-color: var(--navy); color: var(--navy); }
.btn-quiet { background: #fff; border-color: var(--line); color: var(--navy); }
.btn-quiet:hover { border-color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------------------------------------------------------- notices */
.notice { border-radius: 9px; padding: 11px 13px; font-size: 0.86rem; margin: 0 0 14px; border: 1px solid transparent; }
.notice-info { background: #eef4fb; border-color: #cfe0f3; color: #17405f; }
.notice-ok { background: #edf9f1; border-color: #bfe6ce; color: #14603a; }
.notice-warn { background: #fff7e6; border-color: #f0dcae; color: #7a5306; }
.notice-error { background: #fdf0f0; border-color: #f0c9c9; color: #8e1f1f; }

.pill { display: inline-block; font-size: 0.66rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: #eef1f5; color: #3a4753; }
.pill-available { background: #e6f5ec; color: #14603a; }
.pill-reserved { background: #fdf0d9; color: #8a5a07; }
.pill-sold { background: #fbe7e7; color: #922020; }
.pill-draft { background: #eceff3; color: #4c5966; }
.pill-new { background: #e7f0fb; color: #12446f; }

.pill-warn { background: #fdf0d9; color: #8a5a07; }

/* ------------------------------------------------------------------ forms */
.form { display: grid; gap: 6px; }
.form label { font-size: 0.72rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: #46535f; margin-top: 5px; }
.form input, .form select, .form textarea { font-family: var(--sans); font-size: 0.9rem; padding: 9px 11px; border: 1px solid #d7dbe0; border-radius: 8px; background: #fff; width: 100%; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 3px solid rgba(242,161,11,.45); border-color: var(--accent-600); }
.form-grid { display: grid; gap: 10px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 8px; }
@media (min-width: 860px) { .form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.form-inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-inline > div { display: grid; gap: 4px; min-width: 140px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.check input { width: auto; }
.image-admin-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 12px; }
.image-admin-item { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.image-admin-item img { width: 100%; height: 110px; object-fit: cover; display: block; }
.image-admin-item figcaption { padding: 6px 8px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }

/* ------------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; background: linear-gradient(160deg, #0f2744 0%, #143354 60%, #0d2036 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 26px 24px 28px; width: min(100%, 440px); box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.login-logo { width: 190px; height: auto; margin: 0 auto 14px; }
.login-card h1 { text-align: center; margin-bottom: 16px; }




/* -------------------------------------------------------------------- misc */
.admin-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-filters input, .admin-filters select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.activity { display: grid; gap: 8px; }
.kv { display: grid; gap: 8px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.kv dt { color: var(--muted); font-size: 0.84rem; }
.kv dd { margin: 0; font-weight: 600; text-align: right; }

/* ------------------------------------------------- connection check (login) */
.setup-check { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 18px; background: #fafbfc; }
.setup-check h2 { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.setup-check ul { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.setup-row { display: flex; gap: 10px; align-items: flex-start; font-size: 0.85rem; line-height: 1.4; }
.setup-row strong { display: block; font-size: 0.86rem; }
.setup-detail { color: var(--muted); }
.setup-mark { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; margin-top: 2px; position: relative; }
.setup-row.is-ok .setup-mark { background: #d8f0dd; border: 1px solid #4b9c5c; }
.setup-row.is-ok .setup-mark::after { content: ''; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px; border: solid #2e7d43; border-width: 0 2px 2px 0; transform: rotate(42deg); }
.setup-row.is-bad .setup-mark { background: #fde4e1; border: 1px solid #c0453a; }
.setup-row.is-bad .setup-mark::after { content: '\00d7'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #a3332a; font-size: 13px; line-height: 1; font-weight: 700; }
.setup-row.is-wait .setup-mark { background: #eef1f5; border: 1px solid #b9c4d0; }
.setup-row.is-bad .setup-detail { color: #8c3a32; }

/* ---------------------------------------------------- rate source controls */
.radio-row { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 4px 0 14px; }
.radio-row label { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.radio-row input[type="radio"] { margin: 0; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 18px 0 14px; }
.form input:disabled { background: #f3f5f8; color: var(--muted); }

/* ------------------------------------------------------- photographs, admin
   The grids that show photographs in the console. Deliberately plain: the
   picture is the content, so the frame stays out of its way. */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
}

.photo-card,
.photo-tile {
  position: relative;
  margin: 0;
  border: 1px solid var(--line, #d8dee8);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.photo-card img,
.photo-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.photo-card figcaption {
  display: block;
  padding: 0.4rem 0.5rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #445;
}

.photo-card-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.photo-card-tools .btn {
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
}

.photo-card.is-cover,
.photo-tile.is-cover {
  border-color: var(--orange, #f07818);
  box-shadow: 0 0 0 2px rgba(240, 120, 24, 0.35);
}

.photo-tile-pick {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.photo-tile-cover {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--orange, #f07818);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.photo-tile-remove {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  width: 1.6rem;
  height: 1.6rem;
  border: 0;
  border-radius: 50%;
  background: rgba(10, 37, 64, 0.82);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.photo-tile-remove:hover,
.photo-tile-remove:focus-visible {
  background: #b3261e;
}

.photo-tile-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background: #eef2f7;
  color: #667;
  font-size: 0.8rem;
}

.photo-tile-note {
  margin: 0;
  padding: 0.35rem 0.5rem 0.5rem;
  color: #b3261e;
  font-size: 0.75rem;
}

.photo-tile.is-working .photo-tile-pick { opacity: 0.7; }

/* the drop zone */
.dropzone {
  position: relative;
  border: 2px dashed var(--line, #c2ccdb);
  border-radius: 12px;
  background: #f7f9fc;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone.is-over {
  border-color: var(--orange, #f07818);
  background: #fff5ec;
}

.dropzone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.dropzone-label {
  display: block;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  color: #35405a;
}

.dropzone-label strong { display: block; font-size: 1rem; color: var(--navy, #0a2540); }
.dropzone-label span { display: block; margin-top: 0.3rem; font-size: 0.82rem; color: #5a6478; }

.dropzone-input:focus-visible + .dropzone-label {
  outline: 3px solid var(--orange, #f07818);
  outline-offset: -3px;
  border-radius: 12px;
}

/* --------------------------------------------------- round 2 (30 Oct 2026) */
/* .grid-2 is display:grid, which beats the browser's own rule for [hidden] —
   without this the clearane fields show for an imported car. */
[data-cleared-only][hidden], .grid-2[hidden], .rate-approve[hidden] { display: none !important; }

/* One blanket rule for the rest: a class that sets display must never make a
   hidden panel visible again. Add [hidden] and the element is gone. */
[hidden] { display: none !important; }

.rate-approve { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-sm);
  padding: 12px 14px; margin: 10px 0 14px; background: #fffaf3; display: grid; gap: 8px; }
.rate-approve p { margin: 0; }
.rate-approve input { max-width: 420px; }

.lead-delete { margin-top: 8px; }
.lead-delete > summary { cursor: pointer; color: #a3241f; font-weight: 600; font-size: 0.86rem; }
.lead-delete .lead-update { border-color: #e6c9c6; background: #fff8f7; }

.idle-warning { position: fixed; right: 16px; bottom: 16px; z-index: 60; max-width: 340px;
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(10,37,64,0.18); padding: 12px 14px;
  display: grid; gap: 8px; font-size: 0.86rem; }
.idle-warning p { margin: 0; }
.idle-warning .btn { justify-self: start; }
