/* =========================================================================
   Housecarl operator console — overrides over /static/housecarl-chrome/*.css.
   Only console-specific surface adjustments live here. All tokens, chrome,
   and primitives come from the design pack (loaded in base.html).
   ========================================================================= */

/* The console keeps its main container in the .wrap from chrome.css (1280px).
   Operator pages are denser, so we pull padding in slightly. */
body[data-mode="console"] main,
body[data-mode="console"] > .wrap {
  padding-top: var(--s-4);
  padding-bottom: var(--s-7);
}

/* Page-level wrap: every console template content is wrapped in <main class="wrap"> */
main.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-4) var(--s-5) var(--s-7);
}
@media (max-width: 720px) {
  main.wrap { padding-left: var(--s-3); padding-right: var(--s-3); }
}

/* --- Console masthead — wordmark layout ------------------------------- */
.masthead--console .wordmark {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.masthead--console .wordmark-text { display: flex; flex-direction: column; gap: 2px; }
.masthead--console .wordmark .eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .22em;
  color: var(--copper-orange);
  font-weight: 700;
  text-transform: uppercase;
}
.masthead--console .wordmark .m2 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 12px;
  color: var(--fg2);
}

.masthead--console .meta { font-family: inherit; }
.masthead--console .meta .statline { font-size: 10.5px; }
.masthead--console .meta .statline kbd {
  font-family: var(--font-mono);
  font-size: 9.5px;
  background: var(--paper-tint);
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  padding: 0 4px 1px;
  border-radius: 2px;
  color: var(--ink);
  margin-left: 2px;
}

/* --- Operator slug (used at top of every operator page) --------------- */
.operator-slug {
  display: grid;
  grid-template-columns: 110px 1fr 280px;
  gap: var(--s-5);
  align-items: flex-start;
  padding: var(--s-4) 0 var(--s-3);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--s-4);
}
.operator-slug__num {
  border-top: 2px solid var(--ink);
  padding-top: 8px;
}
.operator-slug__num .roman {
  font-family: var(--font-serif);
  font-weight: 700;
  font-style: italic;
  font-size: 32px;
  line-height: 1;
  color: var(--ink);
}
.operator-slug__num .label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fg2);
  margin-top: 6px;
}
.operator-slug__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: var(--size-xl);
  line-height: var(--lh-tight);
  letter-spacing: -.005em;
  color: var(--ink);
  margin: 0 0 var(--s-1);
  max-width: 36ch;
}
.operator-slug__sub {
  font-family: var(--font-serif);
  font-size: var(--size-sm);
  font-style: italic;
  color: var(--fg2);
  margin: 0;
  line-height: var(--lh-snug);
}
.operator-slug__aside {
  border-left: 1px solid var(--iron-900);
  padding-left: var(--s-4);
  font-family: var(--font-serif);
  font-size: var(--size-xs);
  line-height: var(--lh-loose);
  color: var(--fg2);
}
.operator-slug__aside .eyebrow { display: block; margin-bottom: 4px; }
@media (max-width: 880px) {
  .operator-slug { grid-template-columns: 1fr; }
  .operator-slug__aside { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: var(--s-3); }
}

/* --- Nav cards on dashboard ------------------------------------------- */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-3);
  margin-top: var(--s-4);
}
.nav-card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-left: var(--bw-heavy) solid var(--copper-orange);
  padding: var(--s-4) var(--s-4) var(--s-3);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  transition: background var(--dur-fast) var(--ease-standard);
}
.nav-card:hover { background: var(--paper-tint); }
.nav-card .eyebrow { color: var(--copper-orange); }
.nav-card h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: var(--size-md);
  letter-spacing: -.005em;
  color: var(--ink);
  margin: 0;
}
.nav-card p {
  font-family: var(--font-serif);
  font-size: var(--size-sm);
  color: var(--fg2);
  margin: var(--s-1) 0 var(--s-3);
  line-height: var(--lh-loose);
}
.nav-card__action {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--copper-orange);
  font-weight: 700;
  margin-top: auto;
}
.nav-card.is-disabled {
  background: var(--paper-tint);
  border-left-color: var(--iron-300);
  color: var(--fg3);
  pointer-events: none;
  cursor: not-allowed;
}
.nav-card.is-disabled .eyebrow,
.nav-card.is-disabled h3 { color: var(--fg3); }
.nav-card.is-disabled .nav-card__action { color: var(--fg3); }
.nav-card.is-disabled .nav-card__action::after { content: " · permission required"; font-style: italic; text-transform: none; letter-spacing: 0; }

/* --- Pre-formatted pre/code defaults inside the console --------------- */
pre.code, pre {
  white-space: pre;
  word-break: normal;
}
code.inline {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--iron-50);
  padding: 1px 5px;
  border: 1px solid var(--rule);
  border-radius: var(--r-xs);
}

/* --- Form helpers used across operator pages -------------------------- */
form.inline-form { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }

/* --- Auth surfaces (login/signup) ------------------------------------- */
.auth-shell {
  max-width: 480px;
  margin: var(--s-7) auto;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-top: var(--bw-heavy) solid var(--copper-orange);
  box-shadow: var(--shadow-card-lg);
}
.auth-shell__head {
  padding: var(--s-4) var(--s-5);
  background: var(--bg-paper);
  border-bottom: 1px solid var(--rule);
}
.auth-shell__head .eyebrow { display: block; }
.auth-shell__head h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--size-2xl);
  letter-spacing: -.005em;
  color: var(--ink);
  margin: 4px 0 0;
}
.auth-shell__head p {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--size-sm);
  color: var(--fg2);
  margin: 4px 0 0;
}
.auth-shell__body { padding: var(--s-5); }
.auth-shell__divider {
  margin: var(--s-4) 0;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--fg3);
}
.auth-shell__divider::before,
.auth-shell__divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule);
}
.auth-shell__sso {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.auth-shell__sso .btn {
  justify-content: center;
  padding: 10px 14px;
}
.auth-shell__foot {
  padding: var(--s-3) var(--s-5);
  background: var(--bg-paper);
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--font-serif);
  font-size: var(--size-sm);
}

/* --- Status pills used in tables -------------------------------------- */
.status-cell { display: inline-flex; align-items: center; gap: var(--s-1); }

/* --- Token meter integration with rate-limit data -------------------- */
.rate-limits-section {
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--rule);
}
.rate-limits-section h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: var(--size-md);
  margin: 0 0 var(--s-3);
}

/* --- Inline alert patterns for HTMX swap targets --------------------- */
.htmx-swap-target { transition: opacity var(--dur-base) var(--ease-standard); }
.htmx-request .htmx-swap-target { opacity: .5; }

/* --- Print-friendly tweaks for audit log printing -------------------- */
@media print {
  .topnav, .toolbar, .toast-stack, form button[type="submit"] { display: none !important; }
}
