/* ============================================================
   SEATS BOARD — departure-board / aviation terminal aesthetic
   ============================================================ */
:root {
  --bg:        #0a0d16;
  --bg-2:      #0e1320;
  --panel:     #121829;
  --panel-2:   #161d31;
  --border:    #242c44;
  --border-2:  #303a59;
  --text:      #e8ebf6;
  --muted:     #8b93b0;
  --faint:     #5b647f;

  --amber:     #f6b44a;   /* split-flap accent  */
  --amber-dim: #b9863a;
  --econ:      #46d6c5;   /* economy   */
  --prem:      #7aa2ff;   /* premium   */
  --biz:       #f6b44a;   /* business  */
  --first:     #f06fa6;   /* first     */
  --good:      #57d9a3;
  --warn:      #f0a04b;

  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --body: "Hanken Grotesk", system-ui, sans-serif;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --shadow: 0 16px 50px -12px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(246,180,74,.06), transparent 60%),
    radial-gradient(900px 500px at -5% 10%, rgba(70,214,197,.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 14px 26px;
  background: linear-gradient(180deg, rgba(10,13,22,.96), rgba(10,13,22,.86));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  font-size: 26px; color: var(--amber);
  text-shadow: 0 0 18px rgba(246,180,74,.55);
  animation: spin 14s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.brand h1 {
  font-family: var(--display); font-weight: 800; font-size: 22px;
  letter-spacing: .14em; margin: 0; line-height: 1;
}
.brand h1 span { color: var(--amber); }
.tagline { margin: 3px 0 0; font-size: 11px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }

.status-strip { display: flex; align-items: center; gap: 22px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 56px; }
.stat label { font-size: 9.5px; letter-spacing: .16em; color: var(--faint); }
.stat span { font-family: var(--mono); font-size: 14px; color: var(--text); font-weight: 500; }

.refresh-btn {
  font-family: var(--body); font-weight: 700; font-size: 13px;
  color: #1a1206; background: linear-gradient(180deg, #ffd27a, var(--amber));
  border: none; border-radius: 9px; padding: 10px 16px; cursor: pointer;
  box-shadow: 0 6px 20px -6px rgba(246,180,74,.6);
  transition: transform .12s ease, box-shadow .12s ease;
}
.refresh-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 26px -6px rgba(246,180,74,.75); }
.refresh-btn:active { transform: translateY(0); }

/* ---------------- scrape panel ---------------- */
.scrape-panel {
  position: sticky; top: 71px; z-index: 25;
  background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 14px 26px;
}
.scrape-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.scrape-row label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.scrape-row .hint { color: var(--faint); }
.scrape-row input, .scrape-row select { width: 130px; }
.scrape-row .chk { flex-direction: row; align-items: center; gap: 7px; color: var(--text); }
.scrape-row .chk input { width: auto; }
.scrape-note { margin: 12px 0 0; font-size: 11.5px; color: var(--faint); max-width: 880px; line-height: 1.5; }
.scrape-note strong { color: var(--amber); }
.scrape-progress { margin-top: 14px; }
.bar { height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--econ), var(--amber));
  background-size: 200% 100%; animation: shimmer 1.6s linear infinite;
  transition: width .4s ease;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.scrape-msg { margin-top: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------------- layout ---------------- */
.layout {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 270px 1fr; gap: 22px;
  padding: 22px 26px; align-items: start;
}

/* ---------------- filters ---------------- */
.filters {
  position: sticky; top: 95px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; display: flex; flex-direction: column; gap: 13px;
  box-shadow: var(--shadow);
}
.filters-head { display: flex; align-items: baseline; justify-content: space-between; }
.filters-head h2 { font-family: var(--display); font-size: 15px; letter-spacing: .12em; text-transform: uppercase; margin: 0; }
.link-btn { background: none; border: none; color: var(--econ); cursor: pointer; font-size: 12px; font-family: var(--body); }
.link-btn:hover { text-decoration: underline; }

.f { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 11px; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.f-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 11px; }
.f-hint { margin: -5px 0 2px; font-size: 10.5px; color: var(--faint); text-transform: none; letter-spacing: .02em; line-height: 1.4; }
.f-hint b { color: var(--amber); font-weight: 600; }

input, select {
  width: 100%; min-width: 0;  /* let inputs shrink inside grid/flex cells (no overflow) */
  font-family: var(--body); font-size: 13px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-2); border-radius: 8px;
  padding: 8px 10px; outline: none; transition: border-color .15s, box-shadow .15s;
  text-transform: none;
}
input:focus, select:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(246,180,74,.14); }
input::placeholder { color: var(--faint); }
select { cursor: pointer; }

.csv-btn {
  margin-top: 4px; text-align: center; text-decoration: none;
  color: var(--econ); border: 1px dashed var(--border-2); border-radius: 8px;
  padding: 9px; font-size: 12px; letter-spacing: .04em; transition: background .15s, border-color .15s;
}
.csv-btn:hover { background: rgba(70,214,197,.07); border-color: var(--econ); }

/* ---------------- board / table ---------------- */
.board { min-width: 0; }
.board-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
#result-count { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.cabin-legend { display: flex; gap: 14px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }
.lg { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.lg::before { content: ""; width: 9px; height: 9px; border-radius: 2px; }
.lg.econ::before  { background: var(--econ); }
.lg.prem::before  { background: var(--prem); }
.lg.biz::before   { background: var(--biz); }
.lg.first::before { background: var(--first); }

.table-wrap {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border); border-radius: 14px; overflow-x: auto;
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; min-width: 860px; }
thead th {
  position: sticky; top: 0; z-index: 5;
  background: var(--panel-2);
  font-family: var(--display); font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; text-align: left;
  color: var(--muted); padding: 13px 14px; border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
}
thead th.cabin-h.econ  { color: var(--econ); }
thead th.cabin-h.prem  { color: var(--prem); }
thead th.cabin-h.biz   { color: var(--biz); }
thead th.cabin-h.first { color: var(--first); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th .arrow { opacity: .9; margin-left: 4px; }

tbody tr {
  border-bottom: 1px solid rgba(36,44,68,.55);
  animation: rowin .35s ease both;
}
tbody tr:hover { background: rgba(122,162,255,.05); }
@keyframes rowin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
tbody td { padding: 11px 14px; vertical-align: middle; }

.cell-date { font-family: var(--mono); font-size: 13px; color: var(--text); white-space: nowrap; }
.cell-date .dow { display: block; font-size: 10px; color: var(--faint); letter-spacing: .08em; }

.route { display: flex; align-items: center; gap: 9px; }
.route .code { font-family: var(--mono); font-weight: 600; font-size: 15px; letter-spacing: .04em; }
.route .arr { color: var(--amber); font-size: 13px; }
.route .city { display: block; font-size: 10.5px; color: var(--faint); }
.route .endpoint { line-height: 1.15; }

/* cabin cells */
.cab { min-width: 116px; }
.cab.empty { color: var(--faint); font-family: var(--mono); }
.cab .miles { font-family: var(--mono); font-weight: 600; font-size: 15px; }
.cab .sub { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 11px; color: var(--muted); }
.cab .fees { font-family: var(--mono); }
.cab.econ  .miles { color: var(--econ); }
.cab.prem  .miles { color: var(--prem); }
.cab.biz   .miles { color: var(--biz); }
.cab.first .miles { color: var(--first); }

.stops {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 5px; cursor: help; white-space: nowrap;
}
.stops.nonstop { color: var(--good); background: rgba(87,217,163,.12); }
.stops.conn    { color: var(--warn); background: rgba(240,160,75,.12); }
.stops .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.seats { font-family: var(--mono); font-size: 11px; color: var(--faint); }

.cell-seen { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.cell-seen.fresh { color: var(--good); }

.details-btn {
  font-family: var(--body); font-size: 12px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 7px;
  padding: 6px 11px; cursor: pointer; transition: background .14s, border-color .14s;
  white-space: nowrap;
}
.details-btn:hover { background: var(--bg); border-color: var(--amber); color: var(--amber); }

.empty { padding: 60px; text-align: center; color: var(--muted); font-family: var(--mono); }

/* ---------------- pager ---------------- */
.pager { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px; }
.page-size, .page-nav { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.page-size select { width: 76px; padding: 6px 8px; }
#page-info { font-family: var(--mono); font-size: 12px; min-width: 130px; text-align: center; }

.ghost-btn {
  font-family: var(--body); font-size: 13px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border-2); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; transition: border-color .14s, color .14s;
}
.ghost-btn:hover:not(:disabled) { border-color: var(--amber); color: var(--amber); }
.ghost-btn:disabled { opacity: .4; cursor: not-allowed; }

.go-btn {
  font-family: var(--body); font-weight: 700; font-size: 13px; color: #1a1206;
  background: linear-gradient(180deg, #ffd27a, var(--amber)); border: none;
  border-radius: 8px; padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-block;
}
.go-btn:hover { filter: brightness(1.06); }

/* ---------------- modal ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(5,7,12,.72); backdrop-filter: blur(4px);
}
.modal-card {
  width: min(900px, 94vw); height: min(82vh, 760px);
  background: var(--panel); border: 1px solid var(--border-2); border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow);
  animation: pop .22s ease both;
}
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-family: var(--display); font-size: 17px; margin: 0; letter-spacing: .04em; }
.modal-actions { display: flex; gap: 10px; align-items: center; }
#modal-frame { flex: 1; border: none; width: 100%; background: #fff; }

.hidden { display: none !important; }

/* ---------------- login ---------------- */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  position: relative; z-index: 1; width: min(400px, 92vw);
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border); border-radius: 18px; padding: 38px 34px;
  box-shadow: var(--shadow); text-align: center;
}
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; }
.login-brand .logo { font-size: 24px; }
.login-brand h1 { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: .14em; margin: 0; }
.login-brand h1 span { color: var(--amber); }
.login-tag { color: var(--muted); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin: 8px 0 26px; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 11px;
  background: #fff; color: #1f2330; font-weight: 600; font-size: 14px;
  text-decoration: none; border-radius: 10px; padding: 12px 16px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.google-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 26px -10px rgba(255,255,255,.4); }
.login-error {
  background: rgba(240,111,166,.12); border: 1px solid rgba(240,111,166,.4);
  color: #f7a9c9; border-radius: 9px; padding: 10px 13px; font-size: 13px; margin-bottom: 18px;
}
.login-note { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.login-note code { color: var(--amber); font-family: var(--mono); font-size: 11.5px; }
.dev-btn { display: inline-block; margin-top: 16px; color: var(--econ); font-size: 12px; text-decoration: none; border-bottom: 1px dashed currentColor; }
.dev-btn:hover { color: var(--amber); }
.login-foot { margin: 26px 0 0; color: var(--faint); font-size: 11px; letter-spacing: .05em; }

/* ---------------- user chip ---------------- */
.user-chip { display: flex; align-items: center; gap: 9px; padding-left: 6px; }
.user-chip img { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border-2); }
.user-chip .uemail { font-size: 11px; color: var(--muted); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signout { font-size: 11px; color: var(--faint); text-decoration: none; border: 1px solid var(--border-2); border-radius: 7px; padding: 6px 9px; transition: color .14s, border-color .14s; }
.signout:hover { color: var(--amber); border-color: var(--amber); }

@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .status-strip { gap: 12px; flex-wrap: wrap; }
}
