/* Operator console styling.
 *
 * The brand tokens below mirror frontend/css/parametrix.css. They are restated
 * rather than imported because this service deploys on its own (docs/ADR-005
 * §5) and must render correctly with nothing from the app's image available.
 * Keep the two in step if the palette changes.
 *
 * The console is deliberately plainer than the studio: it is an internal tool
 * used a handful of times a month, and the thing that matters on the screen is
 * an invitation link an operator is about to paste into an email.
 */

@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@400;600;800&family=Roboto+Slab:wght@600;700&display=swap');

:root {
  --pmx-font-headline: 'Roboto Slab', Georgia, serif;
  --pmx-font-body: 'Assistant', 'Segoe UI', sans-serif;
  --pmx-red: #EE3D24;
  --pmx-charcoal: #333333;
  --pmx-green: #3FB549;
  --pmx-blue: #0073BB;
  --pmx-yellow: #FCC214;
  --ink: #333333;
  --ink-2: #676768;
  --ink-3: #8a8a8c;
  --line: #E5E5E5;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(51, 51, 51, .12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--surface-2); color: var(--ink);
  font: 14.5px/1.45 var(--pmx-font-body);
}
h1, h2, h3, h4 { font-family: var(--pmx-font-headline); font-weight: 700; margin: 0; }
code { font-family: var(--mono); font-size: .92em; }
a { color: var(--pmx-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--pmx-red); color: #fff; }

/* ------------------------------------------------------------------- bar */
.bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--pmx-charcoal); color: #fff;
  height: 46px; padding: 0 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.wordmark { font: 800 16px var(--pmx-font-body); letter-spacing: .01em; }
.app {
  font: 700 15px var(--pmx-font-headline);
  padding-left: 10px; border-left: 1px solid #55555a;
}
/* The console is not the app. Say so in the chrome, in red, permanently. */
.role-tag {
  font: 600 11px var(--pmx-font-body); text-transform: uppercase; letter-spacing: .06em;
  background: var(--pmx-red); color: #fff; padding: 3px 8px; border-radius: 3px;
}
.spacer { flex: 1; }
.who { font-size: 13px; color: #d8d8da; display: flex; align-items: center; gap: 10px; }
.who button {
  font: 600 12px var(--pmx-font-body); color: #d8d8da;
  background: none; border: 1px solid #55555a; border-radius: 4px;
  padding: 3px 9px; cursor: pointer;
}
.who button:hover { color: #fff; border-color: #8a8a8c; }

/* ------------------------------------------------------------------ gate */
.gate {
  position: fixed; inset: 46px 0 0; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 40;
}
.gate-card {
  background: var(--surface); border: 1px solid var(--line);
  border-top: 3px solid var(--pmx-red); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px 28px; max-width: 430px; text-align: center;
}
.gate-card h1 { font-size: 20px; margin-bottom: 8px; }
.gate-btn { display: flex; justify-content: center; min-height: 44px; margin: 18px 0 4px; }

/* ---------------------------------------------------------------- layout */
main { max-width: 1180px; margin: 0 auto; padding: 20px 24px 60px; }
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; margin-bottom: 16px;
}
.panel-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 16px; }
.panel-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.hint { color: var(--ink-2); font-size: 13px; margin: 0 0 10px; }
.fine { color: var(--ink-3); font-size: 11.5px; display: block; margin-top: 3px; }
.err { color: var(--pmx-red); font-size: 13px; font-weight: 600; margin: 10px 0 0; }
.ok-msg { color: #2E8540; font-size: 13px; font-weight: 600; margin: 10px 0 0; }
.opt { color: var(--ink-3); font-weight: 400; font-size: 11.5px; }

/* --------------------------------------------------------------- controls */
input, select, button { font-family: inherit; font-size: 13px; }
input[type="text"], input[type="email"], input[type="search"], select {
  border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px;
  background: #fff; color: var(--ink); min-width: 0;
}
input:focus, select:focus { outline: 2px solid rgba(0, 115, 187, .35); outline-offset: -1px; }
.btn {
  font-weight: 600; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 5px; padding: 5px 11px; cursor: pointer;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--pmx-red); border-color: var(--pmx-red); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--pmx-red); }
.btn.danger:hover { background: var(--pmx-red); border-color: var(--pmx-red); color: #fff; }
.btn.sm { font-size: 11.5px; padding: 2px 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }

.form-grid {
  display: grid; gap: 12px 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 12.5px; }
.form-actions {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font: 600 11px var(--pmx-font-body); text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-3);
  padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--surface-2); }
tr.clickable { cursor: pointer; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 4px; }
.slug { font-family: var(--mono); font-weight: 600; color: var(--pmx-charcoal); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.dim { color: var(--ink-3); }
.wrap-table { overflow-x: auto; }

/* --------------------------------------------------------------- badges */
.badge {
  display: inline-block; font: 600 11px var(--pmx-font-body);
  padding: 2px 7px; border-radius: 10px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
}
.badge.pending { background: #FFF6DA; border-color: #F4E39C; color: #7a5c00; }
.badge.accepted { background: #E9F7EA; border-color: #BFE6C3; color: #1f6b28; }
.badge.expired, .badge.revoked { background: #F2F2F2; border-color: var(--line); color: var(--ink-3); }
.badge.none { background: #FDEDEA; border-color: #F8C9C0; color: #a52a17; }
.badge.role { background: #EAF4FB; border-color: #B2D3DB; color: #0a5a8f; }

/* ---------------------------------------------------------- invite links */
/* The payoff of the whole console. An operator has just created an account and
   needs to get this string into an email without losing a character of it, so
   it is shown whole, in monospace, with the copy affordance next to it. */
.invite {
  margin-top: 12px; padding: 12px 14px;
  background: #FFFDF5; border: 1px solid #F4E39C; border-left: 3px solid var(--pmx-yellow);
  border-radius: var(--radius);
}
.invite h4 { font-size: 13.5px; margin-bottom: 4px; }
.invite .link {
  display: block; width: 100%; margin: 8px 0;
  font-family: var(--mono); font-size: 12px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 5px; padding: 7px 9px;
}
.invite .row { margin-top: 6px; }
.invite .expiry { font-size: 12px; color: var(--ink-2); }

.sub-line { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.kv { display: flex; gap: 6px; align-items: baseline; }
.kv .k { font: 600 11px var(--pmx-font-body); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.stack { display: flex; flex-direction: column; gap: 2px; }
.stack .sub { font-size: 11.5px; color: var(--ink-3); }
.back { font-size: 12.5px; font-weight: 600; }
.section-h { font-size: 14px; margin: 18px 0 6px; }
.empty { color: var(--ink-3); font-size: 13px; padding: 14px 0; text-align: center; }
