/* AgentFort console (app.agentfort.net). Light theme on the same tokens as shared/site/site.css.
   The shell classes product modules may use are listed in CONTRACT section 6 and marked
   "contract" below; keep their names stable. No inline styles anywhere (the CSP forbids them). */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --brand: #1f5eff;
  --brand-deep: #1a4fd9;
  --brand-ink: #ffffff;
  --brand-soft: #eaf0ff;
  --good: #0f7b45;
  --good-soft: #e8f6ee;
  --warn: #a15c00;
  --warn-soft: #fff4e0;
  --bad: #b42318;
  --bad-soft: #fdeceb;
  --neutral-soft: #f1f3f6;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 2px 8px rgba(17, 24, 39, 0.04);
  --shadow-lg: 0 12px 40px rgba(17, 24, 39, 0.18);
  --focus: 0 0 0 3px rgba(31, 94, 255, 0.35);
  --header-h: 60px;
  --sidebar-w: 232px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; background: var(--bg); color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; margin: 0; }
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); transform: translateY(-200%); }
.skip-link:focus { transform: none; box-shadow: var(--shadow-lg), var(--focus); }
.icon { flex: none; }
.boot { padding: 48px; }
.noscript { padding: 24px; }
.fatal { max-width: 640px; margin: 64px auto; padding: 0 20px; }

/* ---------- shell layout ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-rows: var(--header-h) auto 1fr; grid-template-areas: "header header" "banner banner" "nav main"; }
.shell.no-nav { grid-template-columns: minmax(0, 1fr); grid-template-areas: "header" "banner" "main"; }
/* Paint the navigation column down the whole page, however long the content is. */
.shell:not(.no-nav) { background: linear-gradient(to right, var(--surface) calc(var(--sidebar-w) - 1px), var(--line) calc(var(--sidebar-w) - 1px), var(--line) var(--sidebar-w), transparent var(--sidebar-w)); }
.topbar { grid-area: header; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .spacer { flex: 1; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); font-size: 16px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.logo-mark { width: 24px; height: 24px; border-radius: 7px; background: linear-gradient(135deg, var(--brand), #6b8cff); display: inline-block; flex: none; }
.ws-switch { min-width: 0; }
.ws-select { appearance: none; max-width: 300px; font: inherit; font-weight: 600; color: var(--ink); background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center / 10px 7px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 30px 7px 11px; cursor: pointer; text-overflow: ellipsis; }
.ws-select:hover { border-color: var(--line-strong); }
.user-menu { position: relative; }
.user-menu > summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px; border-radius: var(--radius-sm); }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { background: var(--neutral-soft); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-deep); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.who-name { font-weight: 500; font-size: 14px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px; display: grid; gap: 4px; z-index: 40; }
.menu-who { display: grid; gap: 2px; padding: 4px 6px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-who .badge { justify-self: start; margin-top: 4px; }
.menu-link { padding: 7px 6px; border-radius: var(--radius-sm); color: var(--ink-2); }
.menu-link:hover { background: var(--neutral-soft); text-decoration: none; }
.menu-panel .btn { margin-top: 6px; }

.banners { grid-area: banner; min-width: 0; }
.banner { grid-area: banner; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 9px 20px; font-size: 14px; border-bottom: 1px solid var(--line); }
.banner a { font-weight: 600; }
.banner.info { background: var(--brand-soft); color: var(--brand-deep); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.warn a, .banner.bad a { color: inherit; text-decoration: underline; }

.sidebar { grid-area: nav; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.nav-group { display: grid; gap: 2px; }
.nav-group-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 0 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 500; font-size: 14px; }
.nav-link:hover { background: var(--neutral-soft); text-decoration: none; color: var(--ink); }
.nav-link.active { background: var(--brand-soft); color: var(--brand-deep); }
.nav-link .icon { color: var(--muted); }
.nav-link.active .icon { color: var(--brand); }
.nav-lock { margin-left: auto; display: inline-flex; color: var(--muted); }
.nav-lock .icon { width: 14px; height: 14px; }

.main { grid-area: main; padding: 28px 32px 72px; min-width: 0; width: 100%; max-width: 1280px; }
.main:focus { box-shadow: none; }
.main > * + * { margin-top: 16px; }
.main > .page-head + * { margin-top: 0; }
.section-title { font-size: 17px; margin-top: 28px !important; }
.stack > * + *, .product-view > * + * { margin-top: 16px; }
.product-view > .page-head + * { margin-top: 0; }
.card > .hint, .card > form + *, .invite-result:not(:empty) { margin-top: 12px; }

/* ---------- page structure (contract) ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; }
.subtle { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.product-head { display: flex; align-items: center; gap: 12px; }
.product-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand-deep); }
.product-head .icon { width: 16px; height: 16px; color: var(--brand); }
.product-head + .tabs { margin-top: 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card-head .icon { color: var(--brand); }
.card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 500; }
.card h3 { font-size: 16px; margin-bottom: 6px; }

.grid-2, .grid-3 { display: grid; gap: 16px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 > .card + .card, .grid-3 > .card + .card { margin-top: 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.kpi { display: block; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--surface-2); color: inherit; }
a.kpi:hover { border-color: var(--brand); text-decoration: none; }
.kpi-value { font-size: 26px; font-weight: 700; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.kpi.good .kpi-value { color: var(--good); }
.kpi.warn .kpi-value { color: var(--warn); }
.kpi.bad .kpi-value { color: var(--bad); }

/* ---------- tables (contract) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.card .table-wrap { box-shadow: none; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.cell-main { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.nowrap { white-space: nowrap; }
.small { font-size: 13px; }

/* ---------- badges (contract) ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; background: var(--neutral-soft); color: var(--ink-2); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.neutral { background: var(--neutral-soft); color: var(--ink-2); }

/* ---------- buttons (contract) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 15px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background 0.12s, border-color 0.12s; }
.btn:hover { background: var(--neutral-soft); text-decoration: none; }
.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn-danger { background: var(--surface); border-color: #f1b8b2; color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-primary.btn-danger, .modal .btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.modal .btn-danger:hover { background: #962015; }
.btn-small { min-height: 30px; padding: 4px 11px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-row.right { justify-content: flex-end; }
.btn-row.center { justify-content: center; }

/* ---------- forms (contract) ---------- */
.form { display: grid; gap: 18px; max-width: 640px; }
.form-row { display: grid; gap: 6px; }
.label { font-weight: 600; font-size: 14px; color: var(--ink); }
.hint { color: var(--muted); font-size: 13px; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .input { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 11px; width: 100%; min-height: 38px; }
.form textarea { min-height: 96px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus, .input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.form input:disabled, .input:disabled { background: var(--neutral-soft); color: var(--muted); }
.input-small { min-height: 30px; padding: 3px 8px; width: auto; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.switch-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.switch-row input { margin-top: 2px; flex: none; }
.copy-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; color: var(--ink); }

/* ---------- states (contract) ---------- */
.empty { text-align: center; padding: 36px 20px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
.empty p { margin-bottom: 12px; }
.empty .btn { margin-top: 4px; }
.empty.compact { padding: 20px 16px; }
.callout { display: block; border: 1px solid #c9d6ff; border-left: 4px solid var(--brand); background: var(--brand-soft); color: var(--ink); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 14px; }
.callout .icon { vertical-align: -3px; }
.callout .btn-row, .callout .steps { margin-top: 12px; }
.callout.good { border-color: #b7e1c8; border-left-color: var(--good); background: var(--good-soft); }
.callout.warn { border-color: #f3d39f; border-left-color: var(--warn); background: var(--warn-soft); }
.callout.bad { border-color: #f1b8b2; border-left-color: var(--bad); background: var(--bad-soft); }

/* ---------- tabs (contract) ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 12px 0 20px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; color: var(--muted); font-weight: 500; font-size: 14px; border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer; white-space: nowrap; margin-bottom: -1px; font-family: inherit; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active, .tabs .active { color: var(--ink); border-bottom-color: var(--brand); }

/* ---------- text helpers (contract) ---------- */
.code { font-family: var(--mono); font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mono { font-family: var(--mono); font-size: 0.92em; overflow-wrap: anywhere; }

/* ---------- steps (contract) ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: step; position: relative; padding: 12px 14px 12px 52px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.steps li::before { content: counter(step); position: absolute; left: 14px; top: 11px; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }

/* ---------- console pages ---------- */
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.alert-list li { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.alert-list li:last-child { border-bottom: 0; }
.alert-list li > a, .alert-list li > span:not(.badge) { min-width: 0; overflow-wrap: anywhere; }
.alert-module { margin-left: auto; font-size: 12px; white-space: nowrap; }
.product-card .empty { margin: 0; }
.locked { text-align: center; padding: 40px 24px; max-width: 640px; }
.locked h2 { font-size: 20px; margin: 12px 0 8px; }
.locked-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--neutral-soft); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.locked .btn-row { margin-top: 16px; }
.plans { margin-top: 12px; }
.plan-card { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.plan-card p { color: var(--ink-2); font-size: 14px; margin: 0; }
.plan-card.featured { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }
.plan-card.current { background: var(--good-soft); border-color: #b7e1c8; }
.plan-price strong { font-size: 24px; }
.plan-action { margin-top: auto; padding-top: 8px; }
.plan-action .btn { width: 100%; white-space: normal; text-align: center; }
.danger-zone { border-color: #f1b8b2; }
.danger-zone h2 { color: var(--bad); }
.verify-status:empty { display: none; }

/* ---------- toasts and dialogs ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; width: min(480px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 14px; transition: opacity 0.3s; }
.toast.good { background: var(--good); }
.toast.warn { background: var(--warn); }
.toast.bad { background: var(--bad); }
.toast.leaving { opacity: 0; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(17, 24, 39, 0.45); display: grid; place-items: center; padding: 16px; z-index: 70; }
.modal { width: min(480px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 22px; display: grid; gap: 14px; }
.modal h2 { font-size: 18px; }
.modal-text { color: var(--ink-2); }

/* ---------- signed-out page ---------- */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.signin-panel { display: grid; align-content: center; gap: 16px; padding: clamp(28px, 7vw, 88px); max-width: 640px; }
.signin-panel h1 { font-size: clamp(26px, 3.4vw, 36px); margin-top: 18px; }
.signin-panel .lead { font-size: 17px; color: var(--ink-2); }
.signin-panel:focus { box-shadow: none; }
.idp-list { display: grid; gap: 10px; max-width: 360px; }
.idp-btn { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 46px; padding: 10px 18px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 15px; }
.idp-btn:hover { background: var(--neutral-soft); text-decoration: none; border-color: var(--muted); }
.signin-divider { height: 1px; background: var(--line); max-width: 360px; margin: 6px 0; }
.signin-aside { background: radial-gradient(70% 60% at 70% 20%, rgba(31, 94, 255, 0.12), transparent 70%), linear-gradient(180deg, var(--brand-soft), var(--bg)); border-left: 1px solid var(--line); padding: clamp(28px, 6vw, 72px); display: grid; align-content: center; gap: 12px; }
.signin-aside h2 { font-size: 18px; margin-bottom: 6px; }
.signin-aside .btn { justify-self: start; margin-top: 6px; }
.signin-product { display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); box-shadow: var(--shadow); }
.signin-product:hover { border-color: var(--brand); text-decoration: none; }
.signin-product span { color: var(--muted); font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "header" "banner" "nav" "main"; }
  .sidebar { position: static; height: auto; flex-direction: row; gap: 4px; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-group { display: flex; gap: 2px; }
  .nav-group-label { display: none; }
  .nav-link { white-space: nowrap; }
  .main { padding: 20px 16px 56px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .who-name { display: none; }
  .shell:not(.no-nav) { background: none; }
  .alert-list li { flex-wrap: wrap; gap: 6px 10px; }
  .alert-module { margin-left: 0; flex-basis: 100%; }
  .signin { grid-template-columns: minmax(0, 1fr); }
  .signin-aside { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 520px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand span:last-child { display: none; }
  .ws-select { max-width: 180px; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .facts dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
