/* ============================================================
   SEOBOLT — App components (pure CSS, PHP-ready)
   Depends on colors_and_type.css (tokens in :root).
   Include ONCE, after colors_and_type.css.
   Cockpit aviateur · warm ink/paper/amber.
   ============================================================ */

/* ---- Layout ---- */
.app-main { padding: 28px 36px 64px; max-width: 1280px; }
.stack    { display: flex; flex-direction: column; }
.row      { display: flex; align-items: center; }
.grid     { display: grid; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 24px; }
.mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; } .mt-6 { margin-top: 32px; }

/* ---- Panel ---- */
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  padding: 22px;
}
.panel--flush  { padding: 0; }
.panel--dark   { background: var(--ink); border-color: var(--ink-2); color: var(--paper); }
.panel--sunken { background: var(--cream); box-shadow: none; }
.panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.panel--dark .panel__head { border-color: var(--ink-2); }
.panel__body { padding: 20px; }

/* ---- Buttons ---- */
.btn {
  font-family: var(--font-sans); font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  padding: 11px 20px; border-radius: var(--r-sm); border: 1.5px solid transparent;
  cursor: pointer; transition: all var(--dur) var(--ease-instrument); text-decoration: none;
}
.btn svg { width: 17px; height: 17px; }
.btn--accent    { background: var(--signal); color: #fff; border-color: var(--signal); }
.btn--accent:hover    { background: var(--signal-deep); border-color: var(--signal-deep); }
.btn--secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--secondary:hover { background: var(--ink); color: var(--paper); }
.btn--ghost     { background: transparent; color: var(--fg-2); border-color: var(--line-2); }
.btn--ghost:hover     { color: var(--ink); border-color: var(--ink); }
.btn--ghost-amber { background: transparent; color: var(--signal-deep); border-color: transparent; padding-inline: 8px; }
.btn--ghost-amber:hover { color: var(--signal); background: var(--signal-wash); }
.btn--lg { padding: 13px 24px; font-size: 15.5px; }
.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .4; cursor: default; }

/* ---- Chips / annunciators ---- */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 11px; border-radius: var(--r-pill); border: 1px solid;
}
.chip__dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.chip--go      { background: var(--go-wash);      border-color: var(--go);      color: var(--go); }
.chip--signal  { background: var(--signal-wash);  border-color: var(--signal);  color: var(--signal-deep); }
.chip--caution { background: var(--caution-wash); border-color: var(--caution); color: var(--caution); }
.chip--alert   { background: var(--alert-wash);   border-color: var(--alert);   color: var(--alert); }
.chip--quiet   { background: transparent;         border-color: var(--line-2);  color: var(--fg-2); }
.chip--ink     { background: var(--ink);          border-color: var(--ink);     color: var(--paper); }

/* ---- Readout (KPI instrument) ---- */
.readout-card { display: flex; flex-direction: column; gap: 10px; min-height: 116px; }
.readout-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.readout-card__icon {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  background: var(--cream); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; flex: none; color: var(--fg-3);
}
.readout-card__icon svg { width: 17px; height: 17px; }
.readout-val { display: flex; align-items: baseline; gap: 6px; margin-top: auto; }
.readout-val .num {
  font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums;
  font-size: 34px; line-height: 1; color: var(--ink); letter-spacing: -0.01em;
}
.readout-val .unit { font-family: var(--font-mono); font-size: 13px; color: var(--fg-3); }
.readout-card__sub { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--fg-2); }
.readout-card__sub.is-go     { color: var(--go); }
.readout-card__sub.is-signal { color: var(--signal); }
.readout-card__sub.is-alert  { color: var(--alert); }

/* ---- Gauge (rendered by seobolt-app.js into [data-gauge]) ---- */
.gauge { display: inline-flex; align-items: center; gap: 18px; }
.gauge__svg .needle, .gauge__svg .val {
  transition: all 900ms var(--ease-needle);
}
.gauge__meta .label { margin-bottom: 4px; }
.gauge__score {
  font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums;
  font-size: 44px; line-height: .9; letter-spacing: -0.02em;
}
.gauge__score .max { font-size: 18px; color: var(--fg-3); }

/* ---- Progress bars ---- */
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar__top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.bar__label { font-size: 14px; color: var(--fg-1); font-weight: 500; }
.bar__val { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-3); }
.bar__track { height: 7px; border-radius: var(--r-pill); background: var(--cream-2); overflow: hidden; }
.bar__fill  { height: 100%; border-radius: var(--r-pill); background: var(--signal); transition: width var(--dur-slow) var(--ease-instrument); }
.bar__fill.is-go     { background: var(--go); }
.bar__fill.is-alert  { background: var(--alert); }
.bar__fill.is-caution{ background: var(--caution); }

/* ---- Fields ---- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field__label {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--fg-3); font-weight: 500;
}
.input, .select, .textarea {
  width: 100%; box-sizing: border-box; font-family: var(--font-sans); font-size: 15px;
  color: var(--ink); background: var(--white); border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm); padding: 11px 14px; outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.textarea { font-family: var(--font-sans); line-height: 1.5; resize: vertical; min-height: 96px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-wash); }
.input::placeholder, .textarea::placeholder { color: var(--fg-3); }
.field__hint { font-size: 12.5px; color: var(--fg-3); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238A8170' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }

/* ---- Tables ---- */
.seo-table { width: 100%; border-collapse: collapse; }
.seo-table th {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 500; color: var(--fg-3); text-align: left; padding: 11px 16px;
  background: var(--cream); border-bottom: 1px solid var(--line);
}
.seo-table th.num, .seo-table td.num { text-align: right; }
.seo-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--fg-1); vertical-align: middle; }
.seo-table tr:last-child td { border-bottom: none; }
.seo-table tbody tr { transition: background var(--dur); }
.seo-table tbody tr:hover { background: var(--cream); }
.seo-table .kw { font-family: var(--font-mono); font-size: 13.5px; color: var(--ink); }
.seo-table .pos { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 18px; color: var(--ink); }

/* ---- Segmented control / tabs ---- */
.seg { display: inline-flex; background: var(--cream); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg__btn {
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 500; color: var(--fg-2);
  background: transparent; border: none; border-radius: 2px; padding: 6px 14px; cursor: pointer;
  transition: all var(--dur);
}
.seg__btn.is-active { background: var(--white); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }

/* ---- Toggle / switch ---- */
.switch { width: 38px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; border: none; transition: background var(--dur); flex: none; }
.switch.is-on { background: var(--go); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 999px; background: #fff; transition: left var(--dur) var(--ease-instrument); }
.switch.is-on::after { left: 20px; }

/* ---- Section label ---- */
.eyebrow { font-family: var(--font-mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--fg-3); font-weight: 500; }

/* ---- Banner (alert/info strip) ---- */
.banner { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-radius: var(--r-md); }
.banner--dark { background: var(--ink); color: var(--paper); }
.banner__icon { width: 40px; height: 40px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; flex: none; }

/* ---- Empty state ---- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 56px 32px; }
.empty__instrument {
  width: 60px; height: 60px; border-radius: 999px; background: var(--cream);
  border: 1.5px solid var(--line-2); display: flex; align-items: center; justify-content: center; color: var(--signal);
}
.empty__instrument svg { width: 26px; height: 26px; }
.empty h2 { font-family: var(--font-display); font-size: 26px; font-weight: 500; margin: 0; color: var(--ink); }
.empty p { font-size: 15px; color: var(--fg-2); margin: 0; max-width: 420px; line-height: 1.55; }

/* ---- Calendar (warm) ---- */
.cal { width: 100%; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal__dow { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--fg-3); text-align: center; padding-bottom: 4px; }
.cal__cell { aspect-ratio: 1 / 0.82; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 8px; background: var(--white); position: relative; }
.cal__cell.is-muted { background: var(--paper); color: var(--fg-3); }
.cal__cell.is-today { border-color: var(--signal); box-shadow: inset 0 0 0 1px var(--signal); }
.cal__cell.has-events { background: var(--cream); }
.cal__num { font-family: var(--font-mono); font-size: 12px; color: var(--fg-2); }
.cal__dots { position: absolute; bottom: 7px; left: 8px; display: flex; gap: 3px; }
.cal__dot { width: 6px; height: 6px; border-radius: 999px; }

/* ---- Sparkline holder ---- */
.spark { display: inline-block; line-height: 0; }

/* ---- Misc helpers ---- */
.divider-v { width: 1px; align-self: stretch; background: var(--line); }
.title-serif { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.02em; color: var(--ink); }
.muted { color: var(--fg-3); }
