/* app.<domain>: the signed-in web app (mockup). Shares tokens and buttons with the marketing site. */
:root { --data-1: #7488e6; --side-w: 232px; }
body.webapp { background: var(--bg); min-height: 100vh; display: block; height: auto; }
body.webapp .reveal { opacity: 1; transform: none; }

/* ---------- login ---------- */
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-art { position: relative; overflow: hidden; border-right: 1px solid var(--line); background: #000; display: flex; flex-direction: column; justify-content: space-between; padding: 40px; }
.auth-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.45; }
.auth-art > *:not(img) { position: relative; }
.auth-art blockquote { margin: 0; max-width: 420px; font-size: 22px; line-height: 1.35; letter-spacing: -0.015em; }
.auth-art blockquote .dim { color: var(--text-3); }
.auth-art .coord { position: static; display: block; margin-top: 18px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 28px; letter-spacing: -0.025em; margin-top: 28px; }
.auth-card .sub { color: var(--text-2); margin: 8px 0 0; font-size: 15px; }
.invite-banner { margin-top: 22px; padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(163, 180, 255, 0.35); background: var(--accent-dim); font-size: 14px; display: flex; gap: 10px; align-items: center; }
.invite-banner .ws-badge { flex: none; }
.sso { display: grid; gap: 8px; margin-top: 26px; }
.sso .btn { justify-content: center; width: 100%; height: 42px; }
.sso .btn svg { width: 16px; height: 16px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; font: 400 12px var(--f-mono); color: var(--text-3); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--text-2); display: flex; justify-content: space-between; }
.field label a { color: var(--accent); }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font: 14px var(--f-sans); outline: none; transition: border-color 0.2s; }
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.form-error { color: var(--bad); font-size: 13px; margin: -4px 0 12px; min-height: 18px; }
.auth-card .btn-light { width: 100%; justify-content: center; margin-top: 6px; }
.auth-switch { margin-top: 22px; font-size: 14px; color: var(--text-2); text-align: center; }
.auth-switch button { color: var(--accent); }
.auth-note { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); font: 400 12px/1.6 var(--f-mono); color: var(--text-3); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(10, 10, 11, 0.25); border-top-color: #0a0a0b; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; background: var(--bg); }
.org-switch { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 9px; text-align: left; margin-bottom: 10px; border: 1px solid var(--line); }
.org-switch:hover { background: var(--bg-2); }
.org-switch .nm { font-size: 14px; font-weight: 500; }
.org-switch small { display: block; font: 400 11.5px var(--f-mono); color: var(--text-3); }
.org-switch svg { margin-left: auto; width: 14px; height: 14px; color: var(--text-3); }
.side a.nav-i { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 14px; color: var(--text-2); }
.side a.nav-i:hover { background: var(--bg-2); color: var(--text); }
.side a.nav-i.on { background: var(--panel-2); color: var(--text); }
.side a.nav-i svg { width: 16px; height: 16px; flex: none; }
.side a.nav-i .cnt { margin-left: auto; font: 400 11px var(--f-mono); color: var(--text-3); }
.side h6 { margin: 16px 10px 6px; font: 500 11px/1 var(--f-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.side .grow { flex: 1; }
.side .dl { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.side .dl b { display: block; color: var(--text); font-weight: 500; }
.side .dl svg { width: 18px; height: 18px; flex: none; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; width: 100%; text-align: left; position: relative; }
.me:hover { background: var(--bg-2); }
.me small { display: block; font: 400 11.5px var(--f-mono); color: var(--text-3); }
.me-menu { position: absolute; bottom: 52px; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 4px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); z-index: 20; }
.me-menu a, .me-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; color: var(--text-2); }
.me-menu a:hover, .me-menu button:hover { background: var(--panel-2); color: var(--text); }
.av-p { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font: 600 11px/1 var(--f-sans); color: #0a0a0b; flex: none; }
.av-p.sm { width: 22px; height: 22px; font-size: 9.5px; }
.av-stack { display: inline-flex; }
.av-stack .av-p { border: 2px solid var(--bg); margin-left: -6px; }
.av-stack .av-p:first-child { margin-left: 0; }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 32px; border-bottom: 1px solid var(--line); background: rgba(10, 10, 11, 0.85); backdrop-filter: blur(12px); }
.crumbs { font-size: 14px; color: var(--text-3); display: flex; gap: 8px; align-items: center; }
.crumbs b { color: var(--text); font-weight: 500; }
.topbar .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.topbar .menu-btn { display: none; }
.content { padding: 32px 32px 80px; max-width: 1160px; }
.page-h { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-h h1 { font-size: 28px; letter-spacing: -0.025em; margin: 0; }
.page-h p { margin: 6px 0 0; color: var(--text-2); font-size: 15px; }
.page-h .acts { display: flex; gap: 8px; }

/* ---------- blocks ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile-s { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: var(--bg-2); }
.tile-s small { font: 500 11px/1 var(--f-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.tile-s b { display: block; font-size: 28px; font-weight: 500; letter-spacing: -0.025em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.tile-s span { display: block; font-size: 13px; color: var(--text-3); margin-top: 4px; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.panel + .panel, .grid2 + .panel, .panel + .grid2, .tiles + .grid2, .tiles + .panel { margin-top: 16px; }
.panel-h { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-h h2 { font-size: 15px; margin: 0; letter-spacing: -0.01em; }
.panel-h .r { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-3); }
.panel-b { padding: 16px 18px; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.rows > div { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 14px; }
.rows > div:last-child { border-bottom: 0; }
.rows .t2 { color: var(--text-3); font-size: 13px; }
.rows time { margin-left: auto; font: 400 12px var(--f-mono); color: var(--text-3); white-space: nowrap; }
.check-i { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-3); flex: none; display: grid; place-items: center; }
.check-i.done { background: var(--ok); border-color: var(--ok); color: #0a0a0b; }
.check-i svg { width: 11px; height: 11px; }
.prog { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; width: 120px; }
.prog b { display: block; height: 100%; background: var(--ok); border-radius: 4px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font: 500 11px/1 var(--f-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 12px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .person { display: flex; align-items: center; gap: 10px; }
.tbl .person small { display: block; color: var(--text-3); font-size: 12.5px; }
.tbl .mono { font: 400 12.5px var(--f-mono); color: var(--text-2); }
.tbl-wrap { overflow-x: auto; }
.pill-s { display: inline-flex; align-items: center; gap: 6px; font: 400 11.5px/1 var(--f-mono); padding: 5px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2); white-space: nowrap; }
.pill-s.ok { color: var(--ok); border-color: rgba(111, 216, 168, 0.35); }
.pill-s.warn { color: var(--warn); border-color: rgba(233, 196, 106, 0.35); }
.pill-s.acc { color: var(--accent); border-color: rgba(163, 180, 255, 0.4); }
.pill-s svg { width: 11px; height: 11px; }
.btn-xs { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.icon-b { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--text-3); border: 1px solid transparent; }
.icon-b:hover { color: var(--text); border-color: var(--line-2); }
.icon-b svg { width: 14px; height: 14px; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); color: var(--text-3); }
.search .input { padding-left: 32px; height: 34px; width: 240px; }
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; }
.seg button { padding: 5px 11px; border-radius: 6px; font-size: 12.5px; color: var(--text-3); }
.seg button.on { background: var(--panel-2); color: var(--text); }

/* library */
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.agent-c { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--bg-2); display: flex; flex-direction: column; gap: 12px; text-align: left; transition: border-color 0.2s; }
.agent-c:hover { border-color: var(--line-3); }
.agent-c .top { display: flex; gap: 12px; align-items: center; }
.agent-c .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #0a0a0b; font-weight: 600; flex: none; }
.agent-c h3 { font-size: 15px; margin: 0; }
.agent-c p { margin: 0; color: var(--text-2); font-size: 13.5px; }
.agent-c .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.agent-c .foot { display: flex; align-items: center; gap: 8px; margin-top: auto; font-size: 12.5px; color: var(--text-3); }
.agent-c .foot .select { width: auto; height: 30px; margin-left: auto; font-size: 13px; }

/* rules */
.rule-row { display: grid; grid-template-columns: 1fr 320px; gap: 24px; padding: 18px; border-bottom: 1px solid var(--line); align-items: start; }
.rule-row:last-child { border-bottom: 0; }
.rule-row h3 { font-size: 14.5px; margin: 0; }
.rule-row p { margin: 4px 0 0; color: var(--text-3); font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip-x { display: inline-flex; gap: 6px; align-items: center; font: 400 12px/1 var(--f-mono); padding: 6px 6px 6px 9px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--bg); }
.chip-x button { color: var(--text-3); display: grid; place-items: center; }
.chip-x button svg { width: 10px; height: 10px; }
.chip-x button:hover { color: var(--bad); }
.add-row { display: flex; gap: 6px; }
.add-row .input { height: 32px; font: 12.5px var(--f-mono); }
.checks label { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--text-2); padding: 4px 0; }
.checks input { accent-color: var(--text); }
.switch { width: 34px; height: 20px; border-radius: 20px; background: var(--panel-2); border: 1px solid var(--line-2); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-3); transition: transform 0.25s var(--ease), background 0.25s; }
.switch[aria-checked="true"] { background: var(--text); border-color: var(--text); }
.switch[aria-checked="true"]::after { transform: translateX(14px); background: #0a0a0b; }
.savebar { position: sticky; bottom: 16px; margin-top: 16px; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); font-size: 14px; }
.savebar .r { margin-left: auto; display: flex; gap: 8px; }

/* usage charts */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: rgba(255, 255, 255, 0.07); stroke-width: 1; }
.chart .axis text { fill: var(--text-3); font: 400 11px var(--f-mono); }
.chart .lbl { fill: var(--text-2); font: 400 12.5px var(--f-sans); }
.chart .val { fill: var(--text); font: 400 12px var(--f-mono); }
.chart .hit { fill: transparent; cursor: default; }
.chart .bar { fill: var(--data-1); }
.chart .row:hover .bar, .chart .row.hover .bar { fill: #8a9ef5; }
.chart .line { fill: none; stroke: var(--data-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--data-1); opacity: 0.1; }
.chart .cross { stroke: var(--line-3); stroke-width: 1; }
.chart .dot { fill: var(--data-1); stroke: var(--bg-2); stroke-width: 2; }
.tip { position: absolute; pointer-events: none; z-index: 5; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 12.5px; white-space: nowrap; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.tip b { display: block; font-weight: 500; }
.tip span { color: var(--text-2); font-family: var(--f-mono); font-size: 12px; }
.hero-num { display: flex; align-items: baseline; gap: 12px; }
.hero-num b { font-size: 36px; font-weight: 500; letter-spacing: -0.03em; }
.hero-num span { color: var(--text-3); font-size: 14px; }

/* billing */
.plan-c { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.plan-c h3 { font-size: 20px; margin: 0; display: flex; gap: 10px; align-items: center; }
.plan-c p { margin: 6px 0 0; color: var(--text-2); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.stepper button { width: 34px; height: 34px; color: var(--text-2); font-size: 16px; }
.stepper button:hover { background: var(--panel-2); color: var(--text); }
.stepper b { min-width: 44px; text-align: center; font-weight: 500; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 24px; font-size: 14px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; }
.note-s { color: var(--text-3); font-size: 13px; margin: 12px 0 0; }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.6); display: grid; place-items: center; padding: 16px; animation: fadeIn 0.2s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: 100%; max-width: 480px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel); box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7); animation: up 0.3s var(--ease); }
.modal-h { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-h h2 { font-size: 16px; margin: 0; }
.modal-h .icon-b { margin-left: auto; }
.modal-b { padding: 18px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.code-box { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 9px; border: 1px dashed var(--line-3); font: 500 15px var(--f-mono); letter-spacing: 0.08em; }
.code-box .btn { margin-left: auto; }
.toast-a { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 70; padding: 10px 14px; border-radius: 10px; background: var(--text); color: #0a0a0b; font-size: 14px; font-weight: 500; animation: up 0.3s var(--ease); display: flex; gap: 8px; align-items: center; }
.toast-a svg { width: 14px; height: 14px; }
.empty-s { padding: 40px 18px; text-align: center; color: var(--text-3); font-size: 14px; }

@media (max-width: 1080px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .rule-row { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform 0.3s var(--ease); }
  .shell.nav-open .side { transform: none; box-shadow: 0 0 80px rgba(0, 0, 0, 0.8); }
  .topbar { padding: 0 16px; }
  .topbar .menu-btn { display: grid; }
  .content { padding: 24px 16px 64px; }
  .search .input { width: 100%; }
  .page-h .acts { width: 100%; }
  .tbl th, .tbl td { padding: 10px 12px; }
  .hide-sm { display: none; }
}
.org-switch > span:not(.ws-badge) { min-width: 0; }
.org-switch small, .me small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me > span:not(.av-p) { min-width: 0; }
.side > *:not(.grow) { flex-shrink: 0; }
.side { overflow-y: auto; }
