/*
 * The docs, dashboard and sign-in pages (and the base of the AI agent pages). Built on base.css,
 * which holds the tokens, fonts and buttons; see DESIGN.md.
 */
.lead { font-size: 18px; line-height: 1.55; color: var(--ink-2); max-width: 640px; }
.muted { color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Inputs */
.input { width: 100%; height: 48px; padding: 0 15px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: #fff; font: 16px var(--font); color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease; }
.input::placeholder { color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(20, 18, 15, .08); }
label.field { display: grid; gap: 7px; font-size: 14px; font-weight: 600; color: var(--ink-2); }

/* Reading pages (docs, legal): a sidebar on the paper and the text on a white sheet, the pair centred. */
.docs { display: grid; grid-template-columns: 220px minmax(0, 940px); justify-content: center; gap: 40px; padding: 32px 0 120px; }
.toc { position: sticky; top: 96px; align-self: start; display: grid; gap: 2px; font-size: 14.5px; padding-top: 12px; }
.toc p { font: 500 12px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px 12px; }
.toc p ~ p { margin-top: 22px; }
.toc a { text-decoration: none; color: var(--ink-2); padding: 7px 12px; border-radius: 999px; transition: background .15s ease, color .15s ease; }
.toc a:hover { background: var(--card); color: var(--ink); }
.doc { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 56px 64px 64px; }
.doc > .kicker { margin-bottom: 18px; font-size: 12px; }
.doc h1 { font-size: clamp(30px, 3.1vw, 42px); line-height: 1.08; letter-spacing: -.035em; font-weight: 600; margin: 0 0 16px; max-width: 720px; text-wrap: balance; }
.doc .lead { font-size: 18px; line-height: 1.55; }
.doc section { padding-top: 40px; margin-top: 40px; border-top: 1px solid var(--line); scroll-margin-top: 88px; }
.doc section:first-of-type { margin-top: 44px; }
.doc h2 { font-size: 25px; font-weight: 600; letter-spacing: -.025em; line-height: 1.15; margin-bottom: 12px; }
.doc h3 { font-size: 17.5px; font-weight: 600; letter-spacing: -.01em; margin: 28px 0 8px; }
.doc p, .doc li { color: var(--ink-2); font-size: 16px; line-height: 1.6; max-width: 720px; }
.doc p + p { margin-top: 12px; }
.doc ul, .doc ol { padding-left: 22px; margin: 14px 0; display: grid; gap: 8px; }
.doc li::marker { color: var(--ink-3); }
.doc a { color: var(--red-ink); text-decoration: none; background-image: linear-gradient(currentColor, currentColor); background-size: 100% 1px; background-position: 0 100%; background-repeat: no-repeat; }
.doc a:hover { color: var(--ink); }
.doc strong { color: var(--ink); font-weight: 600; }
.doc p code, .doc li code, .doc td code { overflow-wrap: anywhere; }

/* Code blocks: near-black with a light mono face. */
pre { position: relative; margin: 18px 0; background: var(--code-bg); color: #e3dfd7; border-radius: 18px; padding: 22px 24px; overflow-x: auto; font: 14px/1.7 var(--mono); }
pre .copy { position: absolute; top: 12px; right: 12px; font: 500 12px var(--mono); letter-spacing: .04em; color: #d9d6cf; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); border-radius: 999px; padding: 6px 11px; cursor: pointer; }
pre .copy:hover { background: rgba(255, 255, 255, .16); }
pre:has(.copy) { padding-right: 84px; }
.tok-k { color: #ffb4a8; } .tok-s { color: #b9e3b0; } .tok-c { color: #847e73; }

/* Reference tables */
table.ref { width: 100%; border-collapse: separate; border-spacing: 0; margin: 18px 0; font-size: 14.5px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
table.ref th, table.ref td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.ref tr:last-child td { border-bottom: 0; }
table.ref th { font: 500 11.5px/1.3 var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; background: var(--paper); }
table.ref td { color: var(--ink-2); }
table.ref td:first-child { white-space: nowrap; }
.table-scroll { overflow-x: auto; }

.callout { margin: 20px 0; padding: 18px 20px 18px 22px; border-radius: var(--r-md); background: var(--paper); border-left: 3px solid var(--red); font-size: 15.5px; color: var(--ink-2); max-width: 760px; }
.callout strong { color: var(--ink); }
.steps-list { counter-reset: s; list-style: none; padding: 0 !important; }
.steps-list li { counter-increment: s; position: relative; padding-left: 44px; min-height: 28px; }
.steps-list li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: 0; width: 30px; height: 28px; border-radius: 8px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-2); font: 500 12px/26px var(--mono); text-align: center; }

/* Sign in (dashboard and connect) */
.auth { position: relative; overflow: hidden; min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 56px 20px 96px; isolation: isolate; }
.auth::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: calc(100% / 7) 100%; opacity: .6; -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent); mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent); }
.auth::after { content: ""; position: absolute; z-index: -1; width: 640px; height: 640px; left: 50%; top: 50%; transform: translate(-50%, -30%); border-radius: 50%; background: radial-gradient(circle, rgba(255, 45, 58, .12), transparent 62%); }
.auth-card { min-width: 0; width: min(460px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: 40px; box-shadow: var(--shadow); display: grid; gap: 18px; }
.auth-card::before { content: ""; width: 44px; height: 44px; border-radius: 12px; background: var(--red-ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg transform='rotate(9 12 12)' fill='white'%3E%3Cpath d='M9.9 7a2.1 2.1 0 0 1 4.2 0L13.4 15.6a1.4 1.4 0 0 1-2.8 0Z'/%3E%3Ccircle cx='12' cy='19.6' r='2.1'/%3E%3C/g%3E%3C/svg%3E") center / 34px no-repeat; box-shadow: 0 6px 14px -6px rgba(225, 29, 42, .6); }
.auth-card.consent::before { display: none; }
.auth-card h1 { font-size: 28px; font-weight: 600; letter-spacing: -.03em; line-height: 1.12; }
.auth-card .sub { color: var(--ink-2); font-size: 15.5px; line-height: 1.5; margin-top: -8px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font: 500 11.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.social { display: grid; gap: 12px; }
.apple-btn { height: 48px; border-radius: 999px; background: #000; color: #fff; border: 0; font: 600 16px var(--font); display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.apple-btn:hover { background: var(--dark-2); }
.apple-btn svg { width: 18px; height: 18px; }
#google-button { min-height: 44px; min-width: 0; overflow: hidden; display: flex; justify-content: center; }
.switch-mode { font-size: 14.5px; color: var(--ink-3); text-align: center; }
.switch-mode button { background: none; border: 0; color: var(--ink); font: 600 14.5px var(--font); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.switch-mode button:hover { text-decoration-color: var(--ink); }
.error { color: var(--red-ink); font-size: 14px; background: var(--red-soft); border-radius: var(--r-sm); padding: 11px 14px; }

/* Dashboard: a side menu and one page per thing (overview, alerts, API keys, channels, plan and usage). */
.dash { width: min(1200px, 100% - 64px); margin-inline: auto; padding: 44px 0 120px; display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 44px; align-items: start; }
.dash-nav { position: sticky; top: 88px; display: grid; gap: 2px; }
.dash-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px; color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 500; white-space: nowrap; }
.dash-nav a:hover { color: var(--ink); background: rgba(255, 255, 255, .6); }
.dash-nav a[aria-current="page"] { color: var(--ink); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.dash-nav svg { width: 18px; height: 18px; flex: none; }
.dash-nav .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--red-ink); color: #fff; font: 600 11.5px/20px var(--font); text-align: center; }
.dash-main { min-width: 0; }
.dash-page { display: grid; gap: 18px; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; }
.dash-head h1 { font-size: clamp(28px, 2.8vw, 36px); font-weight: 600; letter-spacing: -.035em; line-height: 1.1; }
.dash-head p { color: var(--ink-2); font-size: 15.5px; margin-top: 8px; max-width: 620px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-head .btn { height: 44px; font-size: 15px; }

/* Overview: four numbers, each a way into its page. */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { display: grid; gap: 6px; padding: 18px 20px; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); text-decoration: none; min-width: 0; transition: border-color .15s ease; }
.stat:hover { border-color: var(--ink-3); }
.stat-label { color: var(--ink-3); font-size: 13.5px; }
.stat strong { font-size: 28px; font-weight: 600; letter-spacing: -.035em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-more { color: var(--ink-2); font-size: 13.5px; }
.stat-more::after { content: " →"; color: var(--ink-3); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px; min-width: 0; }
.card h2 { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card .muted { font-size: 14px; }
.card .note { margin-top: 14px; }
.card-actions { margin-top: 14px; }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.card-actions:not(:has(> :not([hidden]))) { display: none; }
.card pre { margin: 6px 0 0; }
.more { color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.more::after { content: " →"; color: var(--ink-3); }
.more:hover { text-decoration: underline; text-underline-offset: 3px; }
.center { text-align: center; }

.list { display: grid; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; }
.row > :first-child { min-width: 0; }
.row.link { text-decoration: none; }
.row.link:hover .name { text-decoration: underline; text-underline-offset: 3px; }
.row .name { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.row .meta { color: var(--ink-3); font-size: 13.5px; overflow-wrap: anywhere; }
.row code { font-size: 12.5px; }
.row-actions { display: flex; align-items: center; gap: 10px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.with-icon { display: flex; align-items: center; gap: 12px; }

/* A channel's icon: photo, emoji, or its first letter. */
.ch-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; overflow: hidden; background: var(--paper); font-size: 19px; line-height: 1; }
.ch-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ch-icon.letter { background: var(--red-soft); color: var(--red-ink); font-size: 16px; font-weight: 600; }

.new-key { display: grid; gap: 12px; padding: 16px; border-radius: var(--r-md); background: var(--green-soft); border: 1px solid #bfe3c9; margin-bottom: 14px; }
.new-key code { display: block; word-break: break-all; background: #fff; padding: 11px 13px; font-size: 13.5px; }
.inline-form { display: flex; gap: 8px; }
.inline-form .input { height: 44px; font-size: 15px; }
.inline-form .btn { height: 44px; font-size: 15px; }

/* The test alert form (API keys) */
.app-note { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--line); margin-bottom: 18px; }
.app-note.nudge { background: var(--red-soft); border-color: var(--red-line); }
.app-note svg { width: 26px; height: 26px; flex: none; color: var(--ink-2); }
.app-note > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.app-note strong { font-size: 15px; font-weight: 600; }
.app-note span { font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.app-note b { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.app-note .btn { flex: none; }
.test-form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 160px; gap: 12px; }
.test-form .input { height: 44px; font-size: 15px; }
.test-form textarea.input { height: auto; min-height: 84px; padding: 11px 15px; line-height: 1.45; resize: vertical; }
.test-form select.input { appearance: none; -webkit-appearance: none; padding-right: 36px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23847e73' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 12px center / 16px no-repeat; cursor: pointer; }
.field-icon .input { text-align: center; font-size: 19px; padding: 0 8px; }
.test-form .hint { margin: -4px 0 0; font-size: 13.5px; }
.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.form-actions .btn { height: 44px; font-size: 15px; }

/* Alerts */
.filters { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font: 500 14px var(--font); cursor: pointer; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.on { background: var(--dark); border-color: var(--dark); color: #fff; }
.chip .ch-icon { width: 20px; height: 20px; border-radius: 6px; font-size: 12px; background: transparent; margin-left: -4px; }
.chip .ch-icon.letter { background: var(--red-soft); font-size: 11px; }
.feed { display: grid; }
.event { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 14px; padding: 15px 0; border-top: 1px solid var(--line); cursor: pointer; }
.event:first-child { border-top: 0; padding-top: 6px; }
.event:last-child { padding-bottom: 4px; }
.event:hover .event-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.event-main { min-width: 0; display: grid; gap: 3px; }
.event-title { font-weight: 500; font-size: 15.5px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.event-title span:last-child { overflow-wrap: anywhere; }
.event-title.unread { font-weight: 600; }
.event-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex: none; }
.event-preview { color: var(--ink-2); font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-sub { color: var(--ink-3); font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 3px; }
.event time { color: var(--ink-3); font-size: 13px; white-space: nowrap; padding-top: 2px; }
.pill { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 6px; font: 500 11px/1.3 var(--mono); letter-spacing: .04em; text-transform: uppercase; background: var(--paper); color: var(--ink-2); }
.lv-info { background: var(--blue-soft); color: var(--blue); }
.lv-success { background: var(--green-soft); color: var(--green); }
.lv-warning { background: var(--amber-soft); color: var(--amber); }
.lv-critical { background: var(--red-soft); color: var(--red-ink); }
.detail { margin-top: 10px; padding: 16px; border-radius: var(--r-md); background: var(--paper); display: grid; gap: 12px; font-size: 14.5px; cursor: default; grid-column: 2 / -1; min-width: 0; }
.detail .body { color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.table-scroll { overflow-x: auto; }
.detail table { border-collapse: collapse; width: 100%; font-size: 13.5px; background: #fff; border-radius: var(--r-sm); overflow: hidden; }
.detail th, .detail td { padding: 8px 11px; border-bottom: 1px solid var(--line); text-align: left; }
.detail th { color: var(--ink-3); font-weight: 600; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 120px; height: 90px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.detail-foot .muted { font-size: 13.5px; color: var(--ink-3); }
.empty { text-align: center; padding: 30px 12px; color: var(--ink-3); font-size: 15px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--dark); }

/* Plan and usage */
.meters { display: grid; gap: 16px; }
.meter-line { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.meter-line .muted { color: var(--ink-3); font-size: 14.5px; }
.meter-line .full { color: var(--red-ink); font-weight: 600; font-size: 14.5px; }
.meter { height: 8px; border-radius: 99px; background: var(--paper); overflow: hidden; margin-top: 9px; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--dark); }
.meter.full i { background: var(--red-ink); }
#plan-status:empty { display: none; }
#plan-summary { color: var(--ink-2); font-size: 15.5px; margin-bottom: 6px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 13px 20px; border-radius: 999px; font-size: 14.5px; box-shadow: var(--shadow); z-index: 60; max-width: calc(100% - 40px); }

@media (max-width: 1020px) {
    .docs { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 20px; }
    .dash { width: min(1200px, 100% - 40px); grid-template-columns: minmax(0, 1fr); gap: 22px; padding-top: 22px; }
    .dash-nav { position: static; display: flex; gap: 6px; overflow-x: auto; margin-inline: -20px; padding: 2px 20px; scrollbar-width: none; }
    .dash-nav::-webkit-scrollbar { display: none; }
    .dash-nav a { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14.5px; }
    .dash-nav a[aria-current="page"] { background: var(--dark); border-color: var(--dark); color: #fff; box-shadow: none; }
    .dash-nav svg { display: none; }
    .dash-nav .count { margin-left: 2px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .toc { position: static; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; }
    .toc p { width: 100%; margin: 6px 0 2px; }
    .toc p ~ p { margin-top: 10px; }
    .toc a { background: var(--card); border: 1px solid var(--line); font-size: 14px; padding: 6px 12px; }
    .doc { padding: 48px 40px 56px; }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .doc { padding: 32px 20px 40px; border-radius: var(--r-lg); }
    .doc h2 { font-size: 22px; }
    .doc .lead { font-size: 16.5px; }
    .doc section { padding-top: 36px; margin-top: 36px; }
    .doc p, .doc li { font-size: 15.5px; }
    pre { margin-inline: -8px; border-radius: 14px; padding: 18px; font-size: 13px; }
    pre:has(.copy) { padding: 50px 18px 18px; }
    table.ref { display: block; overflow-x: auto; font-size: 14px; }
    table.ref td:first-child { white-space: normal; }
    .auth { padding: 28px 16px 64px; place-items: start center; }
    .auth-card { padding: 28px 22px; border-radius: var(--r-lg); }
    .card { padding: 18px 16px; }
    .stat { padding: 15px 16px; }
    .stat strong { font-size: 24px; }
    .event { grid-template-columns: 38px minmax(0, 1fr); gap: 12px; }
    .event time { grid-column: 2; padding: 0; }
    .detail { grid-column: 1 / -1; }
    .inline-form { flex-direction: column; }
    .app-note { flex-wrap: wrap; }
    .app-note .btn { width: 100%; }
    .form-row { grid-template-columns: 84px minmax(0, 1fr); }
    .form-row > :last-child { grid-column: 1 / -1; }
    .row { flex-wrap: wrap; }
    .row-actions { justify-content: flex-start; }
    .dash-head .btn { flex: 1; }
    .head-actions { width: 100%; }
}
