@font-face {
  font-family: "Inter Variable";
  src: url("/assets/fonts/InterVariable.woff2") format("woff2-variations");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #1d1c23;
  --ink-soft: #62616b;
  --muted: #96949e;
  --faint: #c4c1c9;
  --line: #e9e6e8;
  --line-strong: #ddd9de;
  --paper: #fbfaf8;
  --paper-raised: #fffefd;
  --violet: #7869e8;
  --violet-soft: #efedff;
  --mint: #63af91;
  --mint-soft: #e9f6f0;
  --amber: #d49c37;
  --amber-soft: #fff5dd;
  --rose: #d65f78;
  --rose-soft: #fff0f3;
  --blue: #5e91d8;
  --blue-soft: #edf4ff;
  --shadow: 0 32px 80px rgba(41, 33, 57, 0.16), 0 8px 24px rgba(41, 33, 57, 0.08);
  --radius-lg: 30px;
  --radius-md: 18px;
  --radius-sm: 12px;
  font-family: "Inter Variable", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; background: #3155ce; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  background:
    radial-gradient(circle at 90% 88%, rgba(246, 212, 109, .95), transparent 28%),
    radial-gradient(circle at 8% 80%, rgba(242, 162, 170, .9), transparent 31%),
    radial-gradient(circle at 82% 12%, rgba(78, 173, 204, .95), transparent 32%),
    linear-gradient(145deg, #2f50d2 0%, #6279e5 34%, #da6cc3 68%, #f4ca78 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

body.drawer-open { overflow: hidden; }

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
a { color: inherit; }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  backdrop-filter: blur(42px) saturate(112%);
}

.app-shell {
  position: relative;
  width: min(1460px, calc(100% - 40px));
  min-height: calc(100vh - 40px);
  margin: 20px auto;
  padding: 0 48px;
  overflow: hidden;
  background: rgba(251, 250, 248, .985);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.app-header {
  height: 76px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.brand {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.03em;
  text-decoration: none;
}

.brand img { width: 32px; height: 32px; border-radius: 10px; box-shadow: 0 4px 11px rgba(90, 74, 193, .16); }

.main-nav { display: flex; align-self: stretch; gap: 28px; }

.nav-item {
  position: relative;
  appearance: none;
  padding: 2px 0 0;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.nav-item::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--violet);
  opacity: 0;
  transform: scaleX(.5);
  transition: .2s ease;
}

.nav-item:hover, .nav-item.is-active { color: var(--ink); }
.nav-item.is-active::after { opacity: 1; transform: scaleX(1); }

.header-actions { justify-self: end; display: flex; align-items: center; gap: 10px; }

.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}

.connection.is-live { color: #4c997b; }
.connection.is-live .connection-dot { background: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
.connection.is-offline .connection-dot { background: var(--rose); box-shadow: 0 0 0 3px var(--rose-soft); }

.button, .icon-button, .text-button, .load-more, .copy-button {
  appearance: none;
  border: 0;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 550;
}

.button svg, .icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.button-primary { color: white; background: var(--violet); box-shadow: 0 7px 16px rgba(94, 78, 205, .18); }
.button-primary:hover { background: #6c5ed9; transform: translateY(-1px); }
.button-secondary { color: var(--ink); background: white; border: 1px solid var(--line-strong); }
.button-secondary:hover { border-color: #c8c3cc; }
.button-ghost { color: var(--ink-soft); background: transparent; }
.button-ghost:hover { background: #f1efef; }

.icon-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border-radius: 11px;
}
.icon-button:hover { background: #f0eeee; color: var(--ink); }

main { min-height: calc(100vh - 180px); }
.view { display: none; padding: 34px 0 48px; }
.view.is-active { display: block; animation: view-in .25s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h1 { margin: 0; font-size: 30px; line-height: 1.08; letter-spacing: -.035em; font-weight: 600; }
.eyebrow { margin: 0 0 7px; color: var(--violet); font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.title-line { display: flex; align-items: center; gap: 10px; }
.count-badge { min-width: 24px; height: 24px; display: inline-grid; place-items: center; padding: 0 7px; border-radius: 999px; color: var(--violet); background: var(--violet-soft); font-size: 11px; font-weight: 600; }
.text-button { padding: 7px 0; color: var(--muted); background: none; font-size: 12px; font-weight: 500; }
.text-button:hover { color: var(--violet); }

.toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) auto auto auto auto; gap: 9px; margin-bottom: 18px; }
.search-field, .select-field { min-height: 42px; display: flex; align-items: center; background: var(--paper-raised); border: 1px solid var(--line-strong); border-radius: 11px; }
.search-field { gap: 9px; padding: 0 14px; }
.search-field svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }
.search-field input, .select-field select { width: 100%; height: 40px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; font-weight: 400; }
.search-field input::placeholder { color: var(--faint); }
.select-field { min-width: 142px; padding: 0 9px 0 13px; }
.select-field select { min-width: 108px; }
.refresh-button { width: 42px; height: 42px; background: var(--paper-raised); border: 1px solid var(--line-strong); }

.inbox-panel { min-height: 320px; overflow: hidden; background: rgba(255, 255, 255, .52); border: 1px solid var(--line); border-radius: var(--radius-md); }
.day-group { padding: 20px 0 6px; }
.day-label { margin: 0; padding: 0 24px 8px; color: var(--faint); font-size: 10.5px; font-weight: 500; letter-spacing: .025em; }

.notification-row {
  position: relative;
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(130px, .75fr) minmax(300px, 2.4fr) minmax(130px, 1fr) 105px 72px;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  text-align: left;
  background: transparent;
  border: 0;
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease;
}
.notification-row:hover { z-index: 1; background: rgba(255, 255, 255, .92); border-color: var(--line); }
.notification-row.is-unread::before { content: ""; position: absolute; left: 10px; width: 5px; height: 5px; border-radius: 50%; background: var(--violet); }
.source-cell { min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 12px; font-weight: 450; }
.source-glyph { width: 10px; height: 10px; flex: none; border-radius: 3px; transform: rotate(45deg); }
.tone-violet { background: #7667e8; }
.tone-mint { background: #2f9d78; }
.tone-amber { background: #d29a32; }
.tone-rose { background: #d8647a; }
.tone-blue { background: #4f8fd8; }
.tone-plum { background: #9b64c7; }
.tone-coral { background: #cc7651; }
.tone-teal { background: #5c988e; }
.tone-neutral { background: #aaa6ae; }
.source-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-cell { min-width: 0; }
.notification-title { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--ink); font-size: 14px; line-height: 1.35; font-weight: 500; }
.is-unread .notification-title { font-weight: 600; }
.pin-icon { width: 13px; height: 13px; flex: none; color: var(--violet); fill: currentColor; }
.notification-body { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.category-cell { min-width: 0; display: flex; gap: 5px; overflow: hidden; }
.category-tag { max-width: 112px; overflow: hidden; padding: 4px 8px; border-radius: 7px; color: var(--ink-soft); background: #f2f0f1; font-size: 10px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.ai-thinking { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 500; }
.ai-thinking::before { content: ""; width: 8px; height: 8px; border: 1.5px solid #c8c3ef; border-top-color: var(--violet); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.level-cell { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 500; text-transform: capitalize; }
.level-dot { width: 8px; height: 8px; border-radius: 50%; }
.level-info { color: #7884bc; }.level-info .level-dot { background: #9ca7da; }
.level-success { color: #4e9b7c; }.level-success .level-dot { background: #6db99a; }
.level-warning { color: #b57b19; }.level-warning .level-dot { background: #d6a342; }
.level-error { color: #c6536b; }.level-error .level-dot { background: #dc7187; }
.level-critical { color: #a43d58; }.level-critical .level-dot { background: #b83959; box-shadow: 0 0 0 3px #fde8ed; }
.level-debug { color: #84808a; }.level-debug .level-dot { background: #aaa6ae; }
.time-cell { color: var(--muted); font-size: 10px; text-align: right; white-space: nowrap; }

.loading-state { min-height: 120px; display: flex; align-items: center; justify-content: center; gap: 7px; }
.loading-state span { width: 6px; height: 6px; border-radius: 50%; background: #b9b3e9; animation: pulse 1s ease-in-out infinite; }
.loading-state span:nth-child(2) { animation-delay: .14s; }.loading-state span:nth-child(3) { animation-delay: .28s; }
@keyframes pulse { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

.empty-state { min-height: 360px; padding: 60px 24px; text-align: center; }
.empty-state.standalone { background: rgba(255,255,255,.45); border: 1px solid var(--line); border-radius: var(--radius-md); }
.empty-mark { width: 60px; height: 60px; display: grid; place-items: center; margin: 0 auto 18px; color: var(--violet); background: var(--violet-soft); border-radius: 20px; }
.empty-mark svg { width: 34px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h2 { margin: 0 0 8px; font-size: 18px; font-weight: 600; letter-spacing: -.025em; }
.empty-state p { max-width: 360px; margin: 0 auto; color: var(--muted); font-size: 13px; line-height: 1.6; }
.load-more { width: 100%; padding: 17px; color: var(--violet); background: transparent; border-top: 1px solid var(--line); font-size: 11px; font-weight: 550; }
.load-more:hover { background: white; }

.source-groups { display: grid; gap: 32px; }
.source-group { min-width: 0; }
.source-group-header { min-height: 28px; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 2px 10px; }
.source-group-title { display: flex; align-items: center; gap: 9px; }
.source-group-title h2 { margin: 0; color: var(--ink-soft); font-size: 12px; font-weight: 600; letter-spacing: -.01em; }
.source-group-mark { width: 9px; height: 9px; border-radius: 3px; }
.source-group-count { color: var(--muted); font-size: 10px; }
.source-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.source-card { min-height: 148px; padding: 23px; background: rgba(255,255,255,.62); border: 1px solid var(--line); border-radius: 16px; outline: none; cursor: pointer; transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.source-card:hover { transform: translateY(-2px); border-color: var(--line-strong); background: white; }
.source-card:focus-visible { border-color: #a79ceb; box-shadow: 0 0 0 3px var(--violet-soft); }
.source-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.source-identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.source-identity > div { min-width: 0; }
.source-icon-large { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; color: white; font-size: 14px; font-weight: 600; }
.source-card h3 { overflow: hidden; margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.source-card .slug { margin-top: 3px; color: var(--muted); font-family: ui-monospace, monospace; font-size: 10px; }
.source-settings-button { width: 34px; height: 34px; flex: none; display: grid; place-items: center; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 10px; transition: color .15s ease, background .15s ease; }
.source-settings-button:hover, .source-settings-button:focus-visible { color: var(--ink); background: #f0eeee; outline: none; }
.source-settings-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.source-metrics { display: flex; gap: 26px; margin-top: 24px; }
.metric strong { display: block; font-size: 18px; letter-spacing: -.03em; }.metric span { color: var(--muted); font-size: 10px; }

.source-dialog { width: min(470px, calc(100% - 32px)); padding: 0; overflow: hidden; color: var(--ink); background: var(--paper); border: 1px solid rgba(255,255,255,.85); border-radius: 22px; box-shadow: 0 30px 90px rgba(31,26,42,.28); }
.source-dialog::backdrop { background: rgba(25,22,31,.3); backdrop-filter: blur(4px); }
.source-dialog form { margin: 0; }
.source-dialog-header { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 26px; border-bottom: 1px solid var(--line); }
.source-dialog-header .eyebrow { margin-bottom: 4px; }
.source-dialog-header h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.03em; }
.source-form-fields { padding: 25px 26px 18px; }
.source-form-fields label { display: block; margin-bottom: 17px; }
.source-form-fields label > span { display: block; margin-bottom: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 500; }
.source-form-fields input { width: 100%; height: 43px; padding: 0 12px; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 10px; outline: none; font-size: 13px; }
.source-form-fields input:focus { border-color: #9c90ec; box-shadow: 0 0 0 3px var(--violet-soft); }
.source-form-fields .field-help { margin: -4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.source-form-fields .form-error { margin-bottom: 0; }
.source-dialog-actions { min-height: 74px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 26px; color: inherit; border-top: 1px solid var(--line); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.settings-card { min-height: 240px; padding: 28px; background: rgba(255,255,255,.62); border: 1px solid var(--line); border-radius: 17px; }
.settings-card.compact { min-height: auto; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.card-icon { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 24px; border-radius: 13px; }
.card-icon.violet { color: var(--violet); background: var(--violet-soft); }.card-icon.mint { color: var(--mint); background: var(--mint-soft); }
.card-icon svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.settings-card-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.settings-card h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.025em; }
.settings-card p { color: var(--ink-soft); font-size: 12px; line-height: 1.65; }
.settings-card p.muted { color: var(--muted); }
.status-pill { padding: 5px 8px; color: #3f9171; background: var(--mint-soft); border-radius: 999px; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.status-pill.is-off { color: #ad7630; background: var(--amber-soft); }.status-pill.is-neutral { color: var(--violet); background: var(--violet-soft); }
code { padding: 2px 5px; color: #5c50b2; background: var(--violet-soft); border-radius: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.code-wrap { position: relative; margin-top: 15px; }
pre { margin: 0; padding: 16px 58px 16px 16px; overflow: auto; color: #e6e3f2; background: #292730; border-radius: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; line-height: 1.6; white-space: pre-wrap; }
.copy-button { position: absolute; top: 8px; right: 8px; padding: 6px 8px; color: #c9c5d5; background: #3c3945; border-radius: 6px; font-size: 9px; font-weight: 650; }
.copy-button:hover { color: white; }
.label { margin: 0 0 3px; color: var(--muted) !important; font-size: 9px !important; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.setting-value { margin: 0; color: var(--ink) !important; font-size: 13px !important; font-weight: 550; }

footer { min-height: 84px; display: flex; align-items: center; gap: 8px; color: var(--faint); border-top: 1px solid var(--line); font-size: 10px; }
footer a { color: #8a7be6; text-decoration: none; } footer a:hover { text-decoration: underline; }

.drawer-scrim { position: fixed; z-index: 20; inset: 0; background: rgba(25, 22, 31, .24); backdrop-filter: blur(3px); }
.detail-drawer { position: fixed; z-index: 21; top: 16px; right: 16px; bottom: 16px; width: min(510px, calc(100% - 32px)); display: flex; flex-direction: column; overflow: hidden; background: var(--paper); border: 1px solid rgba(255,255,255,.7); border-radius: 24px; box-shadow: -16px 20px 60px rgba(28, 23, 38, .2); opacity: 0; transform: translateX(calc(100% + 32px)); transition: opacity .22s ease, transform .3s cubic-bezier(.22,.8,.26,1); }
.detail-drawer.is-open { opacity: 1; transform: translateX(0); }
.drawer-header { min-height: 84px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line); }
.drawer-header .eyebrow { margin: 0; }
.drawer-content { padding: 32px 28px 44px; overflow: auto; }
.detail-source { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 12px; font-weight: 500; }
.detail-title { margin: 22px 0 10px; font-size: 27px; line-height: 1.18; font-weight: 600; letter-spacing: -.04em; }
.detail-body { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 30px 0; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-meta .label { display: block; margin-bottom: 5px; }.detail-meta strong { font-size: 12px; font-weight: 550; }
.drawer-section { margin-top: 28px; }
.drawer-section h3 { margin: 0 0 12px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.drawer-fields { display: grid; grid-template-columns: 1fr 1.7fr; gap: 10px; }
.drawer-fields label span { display: block; margin: 0 0 6px; color: var(--muted); font-size: 10px; font-weight: 650; }
.drawer-fields select, .drawer-fields input { width: 100%; height: 40px; padding: 0 11px; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 9px; outline: 0; font-size: 12px; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ai-note { padding: 15px; color: var(--ink-soft); background: var(--violet-soft); border-radius: 11px; font-size: 11px; line-height: 1.55; }
.ai-note strong { color: var(--violet); }.ai-note p { margin: 5px 0 0; }
.raw-json { max-height: 260px; font-size: 10px; }

.login-card label > span { display: block; margin-bottom: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 500; }
.login-card input { width: 100%; padding: 11px 12px; outline: none; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 10px; font-size: 13px; transition: border-color .15s ease, box-shadow .15s ease; }
.login-card input:focus { border-color: #9c90ec; box-shadow: 0 0 0 3px var(--violet-soft); }
.form-error { min-height: 17px; margin: 10px 0 0; color: var(--rose); font-size: 11px; }

.login-screen { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(248,247,244,.78); backdrop-filter: blur(34px); }
.login-screen[hidden] { display: none; }
.login-card { width: min(410px, 100%); padding: 48px; text-align: center; background: rgba(255,255,255,.86); border: 1px solid rgba(255,255,255,.9); border-radius: 28px; box-shadow: var(--shadow); }
.login-card > img { border-radius: 17px; box-shadow: 0 10px 24px rgba(86,70,190,.22); }
.login-card .eyebrow { margin-top: 23px; }.login-card h1 { margin: 0; font-size: 36px; font-weight: 600; letter-spacing: -.045em; }.login-card > p:not(.eyebrow) { margin: 12px auto 28px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.login-card form { display: grid; gap: 14px; text-align: left; }.login-card .button { width: 100%; min-height: 44px; }
.login-card .form-error { margin: -4px 0; }

.toast-region { position: fixed; z-index: 60; right: 24px; bottom: 24px; display: grid; gap: 8px; }
.toast { min-width: 240px; padding: 13px 16px; color: white; background: #292730; border-radius: 11px; box-shadow: 0 14px 40px rgba(22,19,29,.24); font-size: 11px; font-weight: 600; animation: toast-in .22s ease both; }
.toast.is-error { background: #a8425a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.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; }


/* --- settings: alerts, retention, spend, sessions ------------------------ */

.settings-card.wide { grid-column: 1 / -1; min-height: auto; }
.card-icon.rose { color: var(--rose); background: var(--rose-soft); }
.card-icon.amber { color: var(--amber); background: var(--amber-soft); }

.token-row { margin-top: 18px; }
.token-field { display: flex; align-items: center; gap: 12px; padding: 10px 13px; background: white; border: 1px solid var(--line-strong); border-radius: 10px; }
.token-field code { flex: 1; overflow: hidden; color: var(--ink); font-family: ui-monospace, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.token-field .text-button { padding: 0; white-space: nowrap; }

.push-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0 4px; }
.switch-row { display: flex; align-items: center; gap: 10px; margin-left: auto; color: var(--ink-soft); font-size: 12px; }

.switch { display: inline-flex; cursor: pointer; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track { position: relative; width: 34px; height: 20px; background: #ddd9de; border-radius: 999px; transition: background .16s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: white; border-radius: 50%; box-shadow: 0 1px 3px rgba(30, 25, 40, .22); transition: transform .16s ease; }
.switch input:checked + .switch-track { background: var(--violet); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--violet); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; }
.switch-row input { accent-color: var(--violet); width: 15px; height: 15px; }

.rules-table { width: 100%; margin-top: 18px; border-collapse: collapse; }
.rules-table th, .rules-table td { padding: 9px 0; text-align: left; border-bottom: 1px solid var(--line); }
.rules-table thead th { color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.rules-table tbody th { font-weight: 500; }
.rules-table th:not(:first-child), .rules-table td:not(:first-child) { width: 130px; }
.rules-table tbody tr:last-child th, .rules-table tbody tr:last-child td { border-bottom: 0; }

.field-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-top: 18px; }
.field-row label span:first-child { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 650; }
.input-suffix { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.input-suffix input { width: 96px; height: 40px; padding: 0 11px; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 9px; outline: 0; font-size: 12px; }
.input-suffix input:focus { border-color: #9c90ec; box-shadow: 0 0 0 3px var(--violet-soft); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0 6px; }
.stat-tile { padding: 15px 16px; background: rgba(255,255,255,.7); border: 1px solid var(--line); border-radius: 13px; }
.stat-value { margin: 3px 0 2px; color: var(--ink); font-size: 22px; font-weight: 600; letter-spacing: -.035em; }
.stat-note { margin: 0; color: var(--muted); font-size: 10px; }

.chart-figure { position: relative; margin: 12px 0 0; }
.chart-figure figcaption { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 18px; margin: 12px 0 6px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 11px; }
.legend-swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-value { color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-canvas svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-canvas .grid-line { stroke: var(--line); stroke-width: 1; }
.chart-canvas .axis-line { stroke: var(--line-strong); stroke-width: 1; }
.chart-canvas .axis-text { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart-canvas .chart-hit:hover { fill: rgba(120, 105, 232, .06); }

.chart-tooltip { position: absolute; z-index: 5; top: 44px; min-width: 168px; padding: 11px 13px; background: #2b2833; border-radius: 10px; box-shadow: 0 12px 32px rgba(22, 19, 29, .26); color: #f2f0f7; pointer-events: none; }
.tooltip-title { margin: 0 0 7px; font-size: 10px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: #b8b3c6; }
.tooltip-row { display: flex; align-items: center; gap: 7px; margin: 3px 0; font-size: 11px; }
.tooltip-value { margin-left: auto; font-variant-numeric: tabular-nums; }
.tooltip-total { margin: 8px 0 0; padding-top: 7px; border-top: 1px solid rgba(255,255,255,.14); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }

.data-table { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: 11px; }
.data-table th, .data-table td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.data-table th { color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.data-table th .legend-swatch { margin-right: 6px; vertical-align: middle; display: inline-block; }
.data-table .numeric { text-align: right; font-variant-numeric: tabular-nums; }

.pricing-details { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.pricing-details summary { color: var(--ink-soft); font-size: 12px; font-weight: 550; cursor: pointer; }
.pricing-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 12px; }
.pricing-row code { min-width: 150px; padding-bottom: 10px; color: var(--ink); font-family: ui-monospace, monospace; font-size: 11px; }
.price-field span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 650; }
.price-field input { width: 110px; height: 36px; padding: 0 10px; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 9px; outline: 0; font-size: 12px; }
.price-field input:focus { border-color: #9c90ec; box-shadow: 0 0 0 3px var(--violet-soft); }

.session-list { margin: 18px 0 0; padding: 0; list-style: none; }
.session-item { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.session-item:last-child { border-bottom: 0; }
.session-item .button { margin-left: auto; }
.session-name { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 550; }
.session-badge { padding: 3px 7px; color: var(--violet); background: var(--violet-soft); border-radius: 999px; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.session-meta { margin: 3px 0 0; color: var(--muted); font-size: 11px; }


/* --- quiet hours, budget meter, repeats, per-source rules ---------------- */

.subsection { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.subsection-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.subsection-head h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: -.02em; }
.subsection .field-row label span:first-child { display: block; }
.field-row select { height: 40px; padding: 0 11px; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 9px; outline: 0; font-size: 12px; }
.field-row select:focus, .field-row input:focus { border-color: #9c90ec; box-shadow: 0 0 0 3px var(--violet-soft); }
.field-row select:disabled, .field-row input:disabled, .input-suffix .text-button:disabled { opacity: .5; cursor: not-allowed; }
.input-suffix input[type="text"] { width: 190px; }
.input-suffix .currency { color: var(--muted); }

.budget-block { margin-top: 20px; }
.budget-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.budget-head label span:first-child { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 650; }
.budget-head .input-suffix input { width: 100px; }
.budget-status { margin: 0 0 4px; color: var(--ink-soft) !important; font-size: 12px !important; font-variant-numeric: tabular-nums; }
.budget-status.is-close { color: #ad7630 !important; }
.budget-status.is-reached { color: #b83959 !important; font-weight: 600; }

/* Track is a lighter step of the fill's own ramp, so the state reads across the bar. */
.meter { height: 8px; margin-top: 12px; overflow: hidden; background: var(--violet-soft); border-radius: 999px; }
.meter-fill { display: block; height: 100%; background: var(--violet); border-radius: 999px; transition: width .3s ease, background .2s ease; }
.meter.is-close { background: var(--amber-soft); }
.meter.is-close .meter-fill { background: var(--amber); }
.meter.is-reached { background: var(--rose-soft); }
.meter.is-reached .meter-fill { background: #b83959; }

.repeat-badge { padding: 1px 6px; margin-left: 2px; color: var(--violet); background: var(--violet-soft); border-radius: 999px; font-size: 9.5px; font-weight: 650; font-variant-numeric: tabular-nums; }

.source-rules { display: flex; gap: 10px; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); }
.source-rule { flex: 1; min-width: 0; }
.source-rule span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.source-rule select { width: 100%; height: 32px; padding: 0 8px; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 8px; outline: 0; font-size: 11px; }
.source-rule select:focus { border-color: #9c90ec; box-shadow: 0 0 0 3px var(--violet-soft); }


/* --- assistive features: search, suggestions, links ---------------------- */

.ask-button { height: 44px; white-space: nowrap; }
.interpretation { display: flex; align-items: center; gap: 12px; margin: -6px 0 14px; padding: 11px 15px; background: var(--violet-soft); border-radius: 11px; }
.interpretation p { flex: 1; margin: 0; color: #574bb4; font-size: 12px; }
.interpretation .text-button { padding: 0; color: #574bb4; }
.interpretation .text-button:hover { color: var(--ink); }

.assist-list { margin: 14px 0 12px; padding: 0; list-style: none; }
.assist-item { display: flex; align-items: center; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.assist-item > div:first-child { flex: 1; min-width: 0; }
.assist-item:last-child { border-bottom: 0; }
.assist-item .switch { flex: none; }
.assist-title { margin: 0 !important; color: var(--ink) !important; font-size: 12.5px !important; font-weight: 550; }
.assist-note { margin: 2px 0 0 !important; color: var(--muted) !important; font-size: 11px !important; }

.proposal-list { margin: 18px 0 0; padding: 0; list-style: none; }
.proposal { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.proposal:last-child { border-bottom: 0; }
.proposal-rule { margin: 0 !important; color: var(--ink) !important; font-size: 13px !important; font-weight: 550; }
.proposal-reason { margin: 3px 0 0 !important; color: var(--muted) !important; font-size: 11.5px !important; }
.proposal-actions { display: flex; flex: none; gap: 8px; margin-left: auto; }

.provenance { margin: 14px 0 0; padding: 11px 13px; color: var(--ink-soft); background: var(--amber-soft); border-radius: 10px; font-size: 11px; line-height: 1.55; }

.related-list { display: grid; gap: 8px; }
.related-item { display: grid; gap: 3px; width: 100%; padding: 12px 13px; text-align: left; background: white; border: 1px solid var(--line-strong); border-radius: 11px; transition: border-color .15s ease; }
.related-item:hover { border-color: #c8c3cc; }
.related-title { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 550; }
.related-title > span:first-child { display: inline-flex; flex: none; }
.related-meta { color: var(--muted); font-size: 10.5px; }
.related-reason { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; font-style: italic; }

@media (max-width: 1050px) {
  .app-shell { width: calc(100% - 32px); margin: 16px auto; min-height: calc(100vh - 32px); padding: 0 34px; }
  .notification-row { grid-template-columns: 120px minmax(260px, 2fr) 96px 68px; }
  .category-cell { display: none; }
  .source-grid { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }.settings-card.compact { grid-column: auto; }
  .stat-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  body { background: var(--paper); }
  .ambient { display: none; }
  /* env() keeps an installed Home Screen app clear of the notch and the home indicator. */
  .app-shell { width: 100%; min-height: 100vh; margin: 0; padding: env(safe-area-inset-top) 18px calc(84px + env(safe-area-inset-bottom)); border: 0; border-radius: 0; box-shadow: none; }
  .app-header { height: 76px; grid-template-columns: 1fr auto; }
  .brand { font-size: 20px; }.brand img { width: 32px; height: 32px; }
  .main-nav { position: fixed; z-index: 15; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); height: 62px; justify-content: space-around; gap: 0; padding: 0 12px; background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 40px rgba(34,29,42,.15); backdrop-filter: blur(16px); }
  .nav-item { flex: 1; font-size: 11px; }.nav-item::after { left: 35%; right: 35%; bottom: 7px; }
  .connection-label, #sign-out { display: none; }.connection { margin-right: 0; }.header-actions { gap: 3px; }
  .view { padding: 28px 0 40px; }.page-heading { margin-bottom: 20px; }.page-heading h1 { font-size: 28px; }
  .toolbar { grid-template-columns: 1fr 44px; }
  .search-field { grid-column: 1 / -1; }.select-field { min-width: 0; }.select-field:nth-of-type(3), .select-field:nth-of-type(4) { display: none; }
  .inbox-panel { overflow: visible; background: transparent; border: 0; }
  .day-group { padding: 12px 0 4px; }.day-label { padding: 0 2px 9px; }
  .notification-row { min-height: 104px; grid-template-columns: 1fr auto; gap: 8px 14px; margin-bottom: 8px; padding: 17px; background: rgba(255,255,255,.78); border: 1px solid var(--line); border-radius: 14px; }
  .notification-row:hover { border-color: var(--line); }.notification-row.is-unread::before { left: 7px; top: 21px; }
  .source-cell { grid-column: 1; grid-row: 1; padding-left: 4px; font-size: 10px; }.content-cell { grid-column: 1 / -1; grid-row: 2; padding-left: 4px; }.level-cell { grid-column: 2; grid-row: 1; }.time-cell { display: none; }
  .notification-title { font-size: 13px; }.notification-body { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .source-grid { grid-template-columns: 1fr; }.settings-card.compact { grid-template-columns: 1fr; }
  .settings-card { padding: 22px; }
  .stat-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .switch-row { margin-left: 0; width: 100%; }
  .rules-table th:not(:first-child), .rules-table td:not(:first-child) { width: 74px; }
  .rules-table thead th:not(:first-child) { font-size: 8px; }
  .pricing-row code { min-width: 0; width: 100%; }
  .input-suffix input[type="text"] { width: 100%; }
  .budget-head { align-items: flex-start; }
  .source-rules { flex-direction: column; gap: 8px; }
  .assist-item, .proposal { flex-wrap: wrap; }
  .proposal-actions { margin-left: 0; }
  .ask-button { grid-column: 1 / -1; }
  .session-item { flex-wrap: wrap; }
  footer { display: none; }
  .detail-drawer { inset: auto 0 0; width: 100%; height: min(88vh, 760px); border-radius: 22px 22px 0 0; transform: translateY(105%); }.detail-drawer.is-open { transform: translateY(0); }
  .drawer-content { padding: 26px 22px 40px; }.drawer-header { min-height: 68px; padding: 0 22px; }.drawer-fields { grid-template-columns: 1fr; }
  .login-card { padding: 36px 25px; }.toast-region { left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); }.toast { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
