/* ==========================================================================
   Adluminious Media Manifest Control — design tokens
   Warm white surfaces, Adluminious orange as the primary accent and the
   logo's magenta as a secondary highlight (both sampled from the logo),
   with three status accents
   (teal / amber / red) for crawl results, distinct from the brand blue so
   "this is selected" and "this needs attention" never look the same.
   Status is rendered as a small rotated "ink stamp" — reads naturally as
   an actual paper stamp now that the surface is white.
   ========================================================================== */

:root {
  /* Surfaces */
  --page-bg:   #FBF8F6;
  --panel-bg:  #FFFFFF;
  --panel-alt: #F7F1ED;
  --line:      #EBE2DC;
  --line-soft: #F3EDE9;

  /* Text */
  --ink-900: #221A20;
  --ink-700: #5A4E55;
  --ink-400: #9A8D93;

  /* Brand orange — primary accent (selection, actions, links).
     Token names kept as --blue* so the rest of the stylesheet is unchanged
     from the Xool build; only the values differ. */
  --blue:     #C94616;
  --blue-hov: #A9380F;
  --blue-dim: #FDEDE5;

  /* Brand magenta — secondary highlight (brand bar, seller IDs) */
  --magenta:     #C4124F;
  --magenta-dim: #FBE6EE;

  /* Status: verified — green from the logo's leaf, darkened for legibility */
  --teal:     #3B8A1F;
  --teal-dim: #EAF5E1;

  /* Status: discrepancy / needs attention */
  /* Mustard rather than amber, so it never reads as the brand orange */
  --amber:     #947300;
  --amber-dim: #FBF4D5;

  /* Status: unreachable / danger */
  --red:     #B8202F;
  --red-dim: #FBE5E7;

  /* Dedicated dark surface, used only for the toast so it pops against
     the light UI rather than blending in */
  --pop-bg:   #221A20;
  --pop-text: #FFF8F4;

  --radius-sm: 4px;
  --radius-md: 7px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Consolas, monospace;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--ink-900);
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------- Top bar ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 20px;
  height: 60px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-bg);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  height: 32px;
  width: auto;
  display: block;
}

.brand-sub { font-size: 11px; color: var(--ink-400); font-family: var(--font-mono); letter-spacing: 0.04em; padding-left: 10px; border-left: 1px solid var(--line); }

.ticker {
  display: flex;
  gap: 26px;
  flex: 1;
  overflow-x: auto;
  padding: 4px 0;
}

.ticker-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 68px;
}

.ticker-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-900);
  font-weight: 600;
}

.ticker-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink-900);
}

.ticker-value--ok { color: var(--teal); }
.ticker-value--warn { color: var(--amber); }
.ticker-value--bad { color: var(--red); }

.sellers-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-700);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.sellers-link:hover { border-color: var(--blue); color: var(--blue); }
.arrow { display: inline-block; }

/* ---------------- Body grid ---------------- */

.body-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  flex: 1;
  min-height: 0;
}

.sidenav {
  border-right: 1px solid var(--line);
  background: var(--panel-bg);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-900);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
}

.nav-index {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-400);
}

.nav-item:hover { background: var(--page-bg); color: var(--ink-900); }

.nav-item.is-active {
  background: var(--blue-dim);
  color: var(--blue);
  box-shadow: inset 2px 0 0 var(--blue);
}
.nav-item.is-active .nav-index { color: var(--blue); }

.nav-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-footnote {
  font-size: 11px;
  color: var(--ink-400);
  line-height: 1.5;
  margin: 0;
}

/* ---------------- Content / panels ---------------- */

.content {
  padding: 26px 30px 40px;
  min-width: 0;
  overflow-x: auto;
}

.panel { display: none; }
.panel.is-active { display: block; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.panel-head h1 {
  font-size: 20px;
  margin: 0 0 4px;
  font-weight: 700;
}

.panel-sub {
  margin: 0;
  color: var(--ink-400);
  font-size: 12.5px;
  max-width: 56ch;
}

/* ---------------- Buttons ---------------- */

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn--primary { background: var(--blue); color: #ffffff; }
.btn--primary:hover { background: var(--blue-hov); }

.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink-700); }
.btn--ghost:hover { border-color: var(--ink-700); color: var(--ink-900); }

.btn--full { width: 100%; }

.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--danger-text { background: none; border: none; color: var(--red); cursor: pointer; font-size: 12px; padding: 5px 8px; }
.btn--danger-text:hover { text-decoration: underline; }

/* ---------------- Tables ---------------- */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--panel-bg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.data-table th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-900);
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-alt);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(34, 26, 32, 0.035); }

.mono { font-family: var(--font-mono); }
.col-actions { text-align: right; }

.empty-row {
  text-align: center;
  color: var(--ink-400);
  padding: 30px 14px !important;
  font-size: 13px;
}

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------------- Stamp (signature status element) ---------------- */

.stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--ink-400);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  color: var(--ink-400);
  transform: rotate(-8deg);
}

.stamp--valid { border-color: var(--teal); color: var(--teal); }
.stamp--missing { border-color: var(--amber); color: var(--amber); }
.stamp--unreachable { border-color: var(--red); color: var(--red); }
.stamp--none { border-style: dashed; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.badge--on { background: var(--teal-dim); color: var(--teal); }
.badge--off { background: #E7EBF2; color: var(--ink-400); }
.badge--confidential { background: var(--amber-dim); color: var(--amber); }

/* ---------------- Ledger layout ---------------- */

.ledger-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  min-height: 400px;
}

.ledger-pub-list {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-bg);
  overflow-y: auto;
  max-height: 560px;
}

.ledger-pub-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.ledger-pub-item:hover { background: rgba(34, 26, 32, 0.035); }
.ledger-pub-item.is-active { background: var(--blue-dim); box-shadow: inset 2px 0 0 var(--blue); }

.ledger-pub-item .name {
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ledger-pub-item .sid {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-400);
}

.ledger-detail {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-bg);
  padding: 20px;
}

.log-entry {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.log-entry:last-child { border-bottom: none; }

.log-entry .when {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-400);
  min-width: 150px;
}

.log-entry .msg { font-size: 12.5px; color: var(--ink-700); }
.log-entry .msg strong { color: var(--ink-900); }

/* ---------------- Modals ---------------- */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 28, 48, 0.45);
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-overlay.is-open { display: flex; }

.modal {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 420px;
  padding: 22px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(34, 26, 32, 0.16);
}
.modal--wide { max-width: 640px; }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-head h2 { font-size: 16px; margin: 0; }
.modal-head #snippet-seller-id { font-family: var(--font-mono); color: var(--magenta); }

.modal-close {
  background: none;
  border: none;
  color: var(--ink-400);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--ink-900); }

#publisher-form, #seat-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-700);
  font-weight: 500;
}

.optional { color: var(--ink-400); font-weight: 400; font-size: 11px; }

input[type="text"], input[type="password"], select {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  color: var(--ink-900);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
input[type="text"]:focus, input[type="password"]:focus, select:focus { border-color: var(--blue); background: var(--panel-bg); }

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-900);
}
.checkbox-row input { width: 15px; height: 15px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.snippet-box {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-900);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--pop-bg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--pop-text);
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  box-shadow: 0 12px 30px rgba(34, 26, 32, 0.25);
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.is-error { border-color: var(--red); }
.toast.is-success { border-color: var(--teal); }

/* ---------------- Responsive ---------------- */

@media (max-width: 860px) {
  .body-grid { grid-template-columns: 1fr; }
  .sidenav {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
  }
  .nav-footer { display: none; }
  .ledger-layout { grid-template-columns: 1fr; }
  .content { padding: 18px; }
}


/* ---------------- Adluminious brand bar ----------------
   Thin orange-to-magenta strip across the top of the header, echoing the
   gradient in the logo mark. */
.topbar { position: relative; }
.topbar::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: linear-gradient(90deg, #F08A2C 0%, #E0501C 45%, #C4124F 100%);
}
.login-card { border-top: 3px solid var(--blue); }
