:root {
  color-scheme: dark;
  --bg: #050a12;
  --surface: #0a1422;
  --surface-2: #0e1b2d;
  --line: #213047;
  --text: #f4f7fb;
  --muted: #91a2b9;
  --accent: #ff4d3d;
  --accent-2: #ff6a5d;
  --green: #42d392;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% -10%, rgba(35, 79, 132, 0.28), transparent 34rem),
    linear-gradient(180deg, #07101d 0, var(--bg) 38rem);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

button, input, textarea, select { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.menu-button {
  position: fixed;
  z-index: 45;
  top: max(14px, calc(env(safe-area-inset-top) + 8px));
  left: max(14px, env(safe-area-inset-left));
  display: grid;
  width: 46px;
  height: 46px;
  place-content: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(10, 20, 34, 0.94);
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}
.menu-button span { display: block; width: 20px; height: 2px; border-radius: 2px; background: currentColor; }
.drawer-scrim { position: fixed; z-index: 50; inset: 0; background: rgba(0, 0, 0, 0.58); backdrop-filter: blur(2px); }
.app-drawer {
  position: fixed;
  z-index: 55;
  inset: 0 auto 0 0;
  width: min(86vw, 340px);
  padding: max(22px, calc(env(safe-area-inset-top) + 14px)) 18px max(22px, env(safe-area-inset-bottom));
  border-right: 1px solid var(--line);
  background: #081321;
  box-shadow: 24px 0 70px rgba(0, 0, 0, 0.48);
  transform: translateX(-105%);
  transition: transform 180ms ease;
}
.drawer-open { overflow: hidden; }
.drawer-open .app-drawer { transform: translateX(0); }
.drawer-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.drawer-close { width: 42px; height: 42px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 30px; line-height: 1; }
.drawer-links { display: grid; gap: 8px; padding-top: 18px; }
.drawer-links a { padding: 13px 14px; border-radius: 12px; color: #cbd6e4; font-weight: 750; text-decoration: none; }
.drawer-links a:hover, .drawer-links a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.drawer-links a[aria-current="page"] { box-shadow: inset 3px 0 var(--accent); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: max(14px, env(safe-area-inset-top)) max(22px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 10, 18, 0.82);
  backdrop-filter: blur(18px);
}
.bottom-bar {
  position: static;
  top: auto;
  padding-top: 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 0;
}
.footer-actions { display: flex; align-items: center; gap: 9px; }
.footer-actions form { margin: 0; }
.footer-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -0.02em; }
.brand small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.11em; }

.brand-mark {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  border-radius: 18px;
  background: var(--text);
  color: #07101d;
  font-size: 31px;
  font-weight: 900;
  letter-spacing: -0.08em;
  box-shadow: inset -8px -8px 0 rgba(255, 77, 61, 0.18);
}
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; font-size: 22px; }

.dashboard { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: calc(72px + env(safe-area-inset-top)) 0 96px; }
.pull-refresh { position: fixed; z-index: 20; top: calc(env(safe-area-inset-top) + 8px); left: 50%; display: flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transform: translate(-50%, -12px); transition: opacity 150ms ease, transform 150ms ease; }
.pull-refresh.visible { opacity: 1; transform: translate(-50%, 0); }
.pull-refresh.ready { color: #8be8b9; border-color: rgba(66, 211, 146, 0.35); }

.status-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow, .card-kicker {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2.25rem, 6vw, 4rem); line-height: 0.98; letter-spacing: -0.055em; }
h2 { margin-bottom: 0; font-size: 1.35rem; letter-spacing: -0.025em; }
h3 { font-size: 1rem; line-height: 1.35; }
.muted { color: var(--muted); }

.live-indicator {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid rgba(66, 211, 146, 0.25);
  border-radius: 999px;
  background: rgba(66, 211, 146, 0.08);
  color: #8be8b9;
  font-size: 14px;
  font-weight: 700;
}
.live-indicator span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 6px rgba(66, 211, 146, 0.1); }

.notification-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid rgba(255, 77, 61, 0.35);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 77, 61, 0.13), rgba(14, 27, 45, 0.9) 55%);
  box-shadow: var(--shadow);
}
.notification-card.connected { border-color: rgba(66, 211, 146, 0.35); background: linear-gradient(135deg, rgba(66, 211, 146, 0.1), rgba(14, 27, 45, 0.9) 55%); }
.notification-card p:last-child { margin-bottom: 0; color: var(--muted); }
.button-row, .rule-actions { display: flex; align-items: center; gap: 9px; }

.primary-button, .secondary-button, .quiet-button, .danger-button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 750;
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}
.primary-button { border: 1px solid var(--accent); background: var(--accent); color: white; }
.secondary-button { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.quiet-button, .danger-button { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); background: transparent; color: var(--muted); }
.danger-button { color: #ff8c82; }
button:hover { transform: translateY(-1px); }
button:disabled { cursor: default; opacity: 0.58; transform: none; }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 14px; margin-bottom: 18px; }
.metric, .panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(10, 20, 34, 0.86);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
}
.metric { padding: 19px 21px; }
.metric span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 13px; }
.metric strong { font-size: 1.7rem; line-height: 1.15; }
.metric .time-value { font-size: 1rem; font-weight: 650; }

.content-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 18px; align-items: start; }
.featured-panel { margin-bottom: 18px; }
.panel { padding: 24px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.panel-heading-actions { display: flex; align-items: center; gap: 9px; }
.quiet-link { color: #cbd6e4; font-size: 13px; font-weight: 750; text-underline-offset: 3px; white-space: nowrap; }
.count-pill, .state-pill { border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700; }
.count-pill { padding: 5px 9px; }
.state-pill { padding: 3px 8px; color: #8be8b9; }

.rule-list { display: grid; gap: 11px; }
.rules-panel > summary { font-size: 1.1rem; }
.rules-panel[open] > summary { margin-bottom: 20px; }
.rule-card { padding: 17px; border: 1px solid var(--line); border-left: 4px solid var(--alert-color, var(--accent)); border-radius: 15px; background: rgba(14, 27, 45, 0.55); }
.rule-card.disabled { opacity: 0.58; }
.rule-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rule-card h3 { margin-bottom: 9px; }
.rule-card p { margin-bottom: 3px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.rule-card p strong { color: #c5d0df; font-weight: 650; }
.rule-actions { justify-content: flex-end; margin-top: 14px; }

.new-rule { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
summary { cursor: pointer; color: #cbd6e4; font-weight: 750; }
.stack-form { display: grid; gap: 15px; }
.stack-form.compact { margin-top: 18px; }
label { display: grid; gap: 7px; color: #cbd6e4; font-size: 14px; font-weight: 700; }
label small { color: var(--muted); font-size: 12px; font-weight: 500; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: #07101d;
  color: var(--text);
  padding: 12px 13px;
}
.color-label { grid-template-columns: 1fr auto; align-items: center; }
.color-label input[type="color"] { width: 54px; height: 42px; padding: 4px; cursor: pointer; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #91a2b9 50%), linear-gradient(135deg, #91a2b9 50%, transparent 50%); background-position: calc(100% - 18px) 53%, calc(100% - 13px) 53%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, textarea:focus, select:focus { border-color: #567397; box-shadow: 0 0 0 3px rgba(86, 115, 151, 0.17); }
textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.story-list { display: grid; gap: 0; }
.story { position: relative; display: block; margin-left: -10px; padding: 17px 0 17px 10px; border-top: 1px solid var(--line); text-decoration: none; }
.story.google-story { padding-right: 34px; }
.story:first-child { padding-top: 0; border-top: 0; }
.story-source-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.story-source { min-width: 0; color: var(--accent-2); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.story-source-alert { color: var(--alert-color, var(--accent-2)); }
.story-source > .level-pill { margin-right: 8px; vertical-align: middle; }
.story-publisher { color: var(--accent-2); }
.story h3 { margin: 6px 0; font-size: 1.05rem; }
.story-title-row { display: flex; align-items: baseline; justify-content: flex-start; gap: 9px; }
.story-title-row > span:first-child { min-width: 0; }
.story p { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.alert-rule-label { color: var(--muted); font-weight: 800; }
.story-time-row { display: flex; flex-wrap: wrap; align-items: center; column-gap: 22px; row-gap: 4px; }
.received-time { color: var(--muted); }
.published-time { color: var(--text); font-weight: 750; }
.google-news-mark { position: absolute; right: 8px; bottom: 15px; width: 18px; height: 18px; }
.update-label { color: #8be8b9; font-weight: 800; }
.similar-label, .app-only-label { color: var(--muted); font-weight: 800; }
.story:hover h3 { text-decoration: underline; text-underline-offset: 3px; }
.all-stories { margin-top: 5px; padding-top: 15px; border-top: 1px solid var(--line); }
.all-stories > summary { color: #cbd6e4; }
.all-stories .story-list { margin-top: 9px; }

.empty-state { padding: 54px 16px; text-align: center; color: var(--muted); }
.empty-state h3 { margin: 18px 0 7px; color: var(--text); }
.empty-state p { max-width: 34ch; margin: auto; }
.signal-icon { display: inline-flex; align-items: end; gap: 5px; height: 30px; }
.signal-icon i { display: block; width: 5px; border-radius: 3px; background: var(--accent); }
.signal-icon i:nth-child(1) { height: 10px; }.signal-icon i:nth-child(2) { height: 20px; }.signal-icon i:nth-child(3) { height: 30px; }

.source-panel { margin-top: 18px; }
.monitor-footer { margin-top: 42px; padding-top: 32px; border-top: 1px solid var(--line); }
.level-legend { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.level-legend > div { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(14, 27, 45, 0.5); }
.level-legend p { margin: 0; font-size: 13px; line-height: 1.3; }
.level-legend strong, .level-legend small { display: block; }
.level-legend small { margin-top: 3px; color: var(--muted); }
.level-pill { display: inline-block; flex: 0 0 auto; padding: 3px 7px; border-radius: 999px; font-size: 10px; font-weight: 850; letter-spacing: 0.05em; white-space: nowrap; }
.level-pill.level-1 { background: rgba(66, 211, 146, 0.13); color: #8be8b9; }
.level-pill.level-2 { background: rgba(245, 166, 35, 0.14); color: #ffc769; }
.level-pill.level-3 { background: rgba(255, 77, 61, 0.14); color: #ff9b92; }
.level-pill.level-iran { background: rgba(103, 92, 255, 0.18); color: #bbb4ff; }
.source-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 24px; margin-top: 18px; }
.source-list > div { display: flex; justify-content: space-between; gap: 18px; padding: 10px 0; border-top: 1px solid var(--line); }
.source-list small { display: flex; align-items: center; gap: 7px; color: var(--muted); text-align: right; }
.built-in-source-row > div { display: flex; flex: 1; justify-content: space-between; gap: 18px; align-items: center; }
.source-action { min-height: 32px; padding: 0 10px; }
.removed-sources { margin-top: 18px; }
.source-note { margin: 14px 0 0; font-size: 13px; }
.feed-status { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.feed-status-list { display: grid; gap: 0; margin-top: 12px; }
.feed-status-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 12px; }
.feed-status-row > div { display: grid; gap: 3px; }
.feed-status-row > div:last-child { justify-items: end; text-align: right; }
.feed-status-row small { color: var(--muted); }
.feed-status-row.healthy .feed-health-label { color: #8be8b9; font-weight: 750; }
.feed-status-row.issue .feed-health-label { color: #ff9b92; font-weight: 750; }
.feed-status-row.waiting .feed-health-label { color: #ffc769; font-weight: 750; }
.feed-status-row.disabled { opacity: 0.58; }
.feed-status-row.disabled span { color: var(--muted); font-weight: 750; }
.feed-status-action { margin: 0; }
.source-row-actions { display: flex !important; flex-direction: row; align-items: center; gap: 8px; }
.source-row-actions form { margin: 0; }
.source-row-actions .source-action { min-height: 28px; padding: 3px 8px; font-size: 11px; }
.source-details { font-size: 11px; overflow-wrap: anywhere; }
.source-details small { display: block !important; }
.source-details summary { color: var(--muted); }
.removed-source-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; }
.removed-source-row form { margin: 0; }
.unified-source-list { margin-top: 16px; }
.unified-source-list .feed-status-row > div:first-child small { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.custom-sources { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.custom-source-list { display: grid; gap: 11px; margin-top: 16px; }
.custom-source-card { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(14, 27, 45, 0.55); }
.custom-source-card.disabled { opacity: 0.58; }
.custom-source-card h3 { margin: 0 0 4px; }
.custom-source-card p { margin: 0 0 10px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.rule-level-form { display: flex; align-items: end; gap: 8px; margin-top: 13px; }
.rule-level-form label { flex: 1; }
.rule-level-form select { padding-top: 9px; padding-bottom: 9px; }
.edit-rule { margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); }
.checkbox-label { display: flex; align-items: flex-start; gap: 10px; }
.checkbox-label input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.checkbox-label span { flex: 1; }

.market-rule-card h3 { margin: 6px 0 8px; }
.asset-pill { display: inline-block; padding: 3px 7px; border-radius: 999px; background: rgba(86, 115, 151, 0.2); color: #b8c9df; font-size: 10px; font-weight: 850; letter-spacing: 0.09em; text-transform: uppercase; }
.asset-pill.crypto { background: rgba(245, 166, 35, 0.13); color: #ffc769; }
.asset-pill.oil { background: rgba(66, 211, 146, 0.12); color: #8be8b9; }
.current-quote { margin-top: 8px; }
.market-error { margin-top: 8px; color: #ff9b92 !important; }
.compact-empty { padding: 28px 12px; }
.market-disclaimer { color: var(--muted); font-size: 12px; line-height: 1.45; }
.market-history { margin-top: 17px; border-top: 1px solid var(--line); padding-top: 14px; }
.event-list { display: grid; margin-top: 12px; }
.price-event { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.price-event span { color: var(--muted); text-align: right; }

.flash { margin-bottom: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.flash.error { border-color: rgba(255, 77, 61, 0.45); color: #ffaba4; }
.flash.success { border-color: rgba(66, 211, 146, 0.4); color: #8be8b9; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-shell { width: min(430px, 100%); }
.login-card { padding: clamp(28px, 8vw, 44px); border: 1px solid var(--line); border-radius: 26px; background: rgba(10, 20, 34, 0.92); box-shadow: var(--shadow); }
.login-card .brand-mark { margin-bottom: 28px; }
.login-card h1 { font-size: 2.5rem; }
.login-copy, .privacy-note { color: var(--muted); }
.privacy-note { margin: 22px 0 0; text-align: center; font-size: 13px; }

.history-dashboard { min-height: calc(100vh - 90px); }
.history-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.history-header h1 { font-size: clamp(2.25rem, 6vw, 3.5rem); }
.history-filter { margin-bottom: 18px; }
.date-filter-form { display: flex; align-items: end; gap: 10px; }
.date-filter-form label { flex: 1; }
.history-day { margin-bottom: 18px; }
.history-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 24px 0; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .topbar { padding-left: 16px; padding-right: 16px; }
  .dashboard { width: min(100% - 24px, 1180px); padding-top: calc(52px + env(safe-area-inset-top)); }
  .status-panel, .notification-card { align-items: stretch; flex-direction: column; }
  .status-panel { gap: 14px; }
  .live-indicator { align-self: flex-start; }
  .button-row { display: grid; grid-template-columns: 1fr 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric.wide { grid-column: 1 / -1; }
  .content-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .source-list { grid-template-columns: 1fr; }
  .feed-status-row { grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; }
  .feed-status-row > div:first-child { grid-row: 1 / span 2; }
  .feed-status-row > div:nth-child(2) { grid-column: 2; grid-row: 1; }
  .source-row-actions { grid-column: 2; grid-row: 2; }
  .notification-card .button-row form { grid-column: 1 / -1; margin: 0; }
  .notification-card .button-row form button { width: 100%; }
  .level-legend { grid-template-columns: 1fr; }
  .rule-level-form { align-items: stretch; flex-direction: column; }
  .panel { padding: 19px; border-radius: 17px; }
  .panel-heading-actions { align-items: flex-end; flex-direction: column; }
  .history-header { align-items: stretch; flex-direction: column; }
  .history-header > .footer-link { align-self: flex-start; }
  .date-filter-form { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* v32 — calm, modern glass interface */
:root {
  --bg: #0a0b0f;
  --surface: rgba(28, 29, 35, 0.78);
  --surface-2: rgba(48, 49, 58, 0.72);
  --surface-solid: #1c1d23;
  --line: rgba(255, 255, 255, 0.095);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f5f5f7;
  --muted: #a1a1aa;
  --accent: #0a84ff;
  --accent-2: #7dbbff;
  --green: #30d158;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", sans-serif;
}

html { background: #0a0b0f; }

body {
  background:
    radial-gradient(circle at 18% -8%, rgba(10, 132, 255, 0.16), transparent 31rem),
    radial-gradient(circle at 92% 5%, rgba(191, 90, 242, 0.1), transparent 27rem),
    linear-gradient(180deg, #111218 0, #0a0b0f 34rem);
  font-size: 15px;
  letter-spacing: -0.006em;
}

::selection { background: rgba(10, 132, 255, 0.38); color: white; }

.menu-button {
  width: 48px;
  height: 48px;
  gap: 5px;
  border-color: var(--line-strong);
  border-radius: 16px;
  background: rgba(35, 36, 43, 0.76);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3), inset 0 1px rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
}
.menu-button span { width: 21px; height: 2px; }
.menu-button:hover { background: rgba(53, 54, 63, 0.86); }

.drawer-scrim {
  background: rgba(0, 0, 0, 0.44);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
}
.app-drawer {
  width: min(88vw, 360px);
  padding-left: 16px;
  padding-right: 16px;
  border-right-color: var(--line-strong);
  background: rgba(24, 25, 31, 0.9);
  box-shadow: 28px 0 80px rgba(0, 0, 0, 0.46);
  -webkit-backdrop-filter: blur(34px) saturate(155%);
  backdrop-filter: blur(34px) saturate(155%);
}
.drawer-heading { padding: 0 4px 20px; border-bottom-color: var(--line); }
.drawer-close {
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  font-size: 25px;
}
.drawer-links { gap: 6px; padding-top: 16px; }
.drawer-links a {
  padding: 13px 15px;
  border-radius: 14px;
  color: #d1d1d6;
  font-weight: 650;
}
.drawer-links a:hover { background: rgba(255, 255, 255, 0.055); }
.drawer-links a[aria-current="page"] {
  background: rgba(10, 132, 255, 0.16);
  color: #eef7ff;
  box-shadow: none;
}

.brand strong { font-weight: 700; letter-spacing: -0.025em; }
.brand small { color: #8e8e93; font-weight: 600; }
.brand-mark {
  background: linear-gradient(145deg, #238cff, #6e5cff);
  color: white;
  box-shadow: 0 9px 24px rgba(10, 132, 255, 0.24), inset 0 1px rgba(255, 255, 255, 0.28);
}

.dashboard { width: min(1220px, calc(100% - 40px)); padding-bottom: 82px; }
.status-panel { align-items: center; margin-bottom: 24px; }
.eyebrow, .card-kicker { color: #8dc4ff; font-weight: 750; letter-spacing: 0.13em; }
h1 { font-weight: 720; letter-spacing: -0.052em; }
h2 { font-weight: 700; letter-spacing: -0.032em; }
h3 { letter-spacing: -0.018em; }

.live-indicator {
  border-color: rgba(48, 209, 88, 0.2);
  background: rgba(48, 209, 88, 0.1);
  color: #7ee494;
  font-weight: 650;
}
.live-indicator span { background: #30d158; box-shadow: 0 0 0 5px rgba(48, 209, 88, 0.11); }

.metric, .panel, .notification-card, .login-card {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.21), inset 0 1px rgba(255, 255, 255, 0.045);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  backdrop-filter: blur(22px) saturate(130%);
}
.metric, .panel { border-radius: 24px; }
.metric { padding: 20px 22px; }
.metric span { margin-bottom: 7px; color: #98989f; font-weight: 540; }
.metric strong { font-weight: 700; letter-spacing: -0.035em; }
.panel { padding: 26px; }
.panel-heading { margin-bottom: 18px; }

.notification-card {
  border-color: rgba(10, 132, 255, 0.22);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(10, 132, 255, 0.14), transparent 52%),
    var(--surface);
}
.notification-card.connected {
  border-color: rgba(48, 209, 88, 0.2);
  background:
    linear-gradient(135deg, rgba(48, 209, 88, 0.1), transparent 52%),
    var(--surface);
}

.primary-button, .secondary-button, .quiet-button, .danger-button {
  border-radius: 12px;
  font-weight: 650;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.07);
}
.primary-button { border-color: #0a84ff; background: #0a84ff; }
.primary-button:hover { background: #2293ff; }
.secondary-button { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.075); }
.secondary-button:hover, .quiet-button:hover { background: rgba(255, 255, 255, 0.11); }
.quiet-button, .danger-button { border-color: var(--line); background: rgba(255, 255, 255, 0.035); }
.danger-button { color: #ff7a73; }

.count-pill, .state-pill {
  background: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05);
}
.state-pill { color: #75df8c; }
.quiet-link, summary, .all-stories > summary { color: #d1d1d6; }

.story-list { overflow: hidden; border-radius: 16px; }
.story {
  margin-left: 0;
  padding: 18px 12px;
  border-top-color: rgba(255, 255, 255, 0.075);
  border-radius: 13px;
  transition: background 150ms ease, transform 150ms ease;
}
.story.google-story { padding-right: 42px; }
.story:first-child { padding-top: 14px; }
.story:hover { background: rgba(255, 255, 255, 0.042); transform: translateY(-1px); }
.story:hover h3 { text-decoration: none; }
.story-source { font-weight: 760; letter-spacing: 0.075em; }
.story-publisher { color: #c4c4ca; }
.story h3 { margin: 8px 0; font-size: 1.07rem; font-weight: 680; line-height: 1.38; }
.story p { color: #9898a1; }
.story-time-row { column-gap: 30px; }
.published-time { color: #e5e5ea; }
.google-news-mark { right: 12px; bottom: 18px; }
.update-label { color: #60da7b; }
.similar-label, .app-only-label, .alert-rule-label { color: #98989f; }
.all-stories { border-top-color: var(--line); }

.rule-card, .custom-source-card, .level-legend > div {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}
.rule-card { border-left-width: 3px; }
.rule-card p strong { color: #d1d1d6; }

input, textarea, select {
  border-color: var(--line-strong);
  border-radius: 12px;
  background: rgba(8, 9, 13, 0.64);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(10, 132, 255, 0.85);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.17);
}
.checkbox-label input { accent-color: #0a84ff; }

.level-pill { font-weight: 800; box-shadow: inset 0 1px rgba(255, 255, 255, 0.06); }
.level-pill.level-1 { background: rgba(48, 209, 88, 0.14); color: #75df8c; }
.level-pill.level-2 { background: rgba(255, 159, 10, 0.16); color: #ffbd5c; }
.level-pill.level-3 { background: rgba(255, 69, 58, 0.16); color: #ff8a82; }
.level-pill.level-iran { background: rgba(191, 90, 242, 0.17); color: #d89aff; }
.asset-pill { background: rgba(10, 132, 255, 0.15); color: #8fc8ff; }

.source-list > div, .feed-status-row, .price-event, .monitor-footer, .new-rule,
.feed-status, .custom-sources, .market-history, .all-stories { border-color: var(--line); }
.feed-status-row { padding: 8px 4px; }
.feed-status-row.healthy .feed-health-label { color: #75df8c; }
.feed-status-row.issue .feed-health-label, .market-error { color: #ff8a82 !important; }
.feed-status-row.waiting .feed-health-label { color: #ffbd5c; }

.flash {
  border-color: var(--line-strong);
  border-radius: 14px;
  background: rgba(48, 49, 58, 0.82);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.flash.error { border-color: rgba(255, 69, 58, 0.38); color: #ff9b95; }
.flash.success { border-color: rgba(48, 209, 88, 0.32); color: #75df8c; }

.login-card { border-radius: 30px; }
.login-page { background: radial-gradient(circle at 50% 10%, rgba(10, 132, 255, 0.17), transparent 28rem); }
.bottom-bar { background: rgba(10, 11, 15, 0.65); }

@media (max-width: 760px) {
  body { font-size: 15px; }
  .menu-button { top: max(12px, calc(env(safe-area-inset-top) + 7px)); left: max(12px, env(safe-area-inset-left)); }
  .dashboard { width: calc(100% - 18px); padding-top: calc(70px + env(safe-area-inset-top)); padding-bottom: 64px; }
  .status-panel { padding: 0 7px; margin-bottom: 20px; }
  h1 { font-size: clamp(2.15rem, 12vw, 3.2rem); }
  .metric-grid { gap: 9px; }
  .metric { padding: 16px; border-radius: 19px; }
  .metric strong { font-size: 1.45rem; }
  .content-grid { gap: 12px; }
  .featured-panel, .notification-card { margin-bottom: 12px; }
  .panel, .notification-card { padding: 18px; border-radius: 22px; }
  .panel-heading { gap: 12px; margin-bottom: 14px; }
  .story { padding: 16px 8px; border-radius: 12px; }
  .story:first-child { padding-top: 10px; }
  .story.google-story { padding-right: 34px; }
  .story-source-row { align-items: flex-start; }
  .story h3 { font-size: 1.02rem; }
  .story-time-row { column-gap: 24px; }
  .google-news-mark { right: 7px; bottom: 17px; }
  .button-row { gap: 8px; }
  .primary-button, .secondary-button { min-height: 46px; }
  .source-row-actions { flex-wrap: wrap; justify-content: flex-end; }
  .feed-status-row { padding: 9px 2px; }
  .login-page { padding: 14px; }
  .login-card { padding: 28px 22px; border-radius: 26px; }
}

@media (min-width: 1100px) {
  .metric:hover, .panel:hover { border-color: rgba(255, 255, 255, 0.13); }
}

/* v33 — full interface overhaul */
:root {
  --sidebar-width: 248px;
  --canvas: #0b0d12;
  --card: #17191f;
  --card-raised: #1d2027;
  --hairline: rgba(255, 255, 255, 0.075);
}

body { background: var(--canvas); }
.app-shell { min-height: 100vh; }
.app-stage { min-width: 0; margin-left: var(--sidebar-width); }
.mobile-tabbar { display: none; }

.desktop-sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 16px 20px;
  border-right: 1px solid var(--hairline);
  background: rgba(14, 16, 21, 0.96);
  -webkit-backdrop-filter: blur(28px) saturate(135%);
  backdrop-filter: blur(28px) saturate(135%);
}
.sidebar-brand { padding: 2px 8px 28px; }
.sidebar-nav { display: grid; gap: 5px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  color: #a8a8b0;
  font-weight: 620;
  text-decoration: none;
  transition: color 140ms ease, background 140ms ease;
}
.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.045); color: #f5f5f7; }
.sidebar-nav a[aria-current="page"] { background: rgba(10, 132, 255, 0.14); color: #8fc9ff; }
.nav-icon {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 500;
}
.sidebar-label { margin: 22px 12px 7px; color: #686870; font-size: 10px; font-weight: 760; letter-spacing: 0.14em; text-transform: uppercase; }
.sidebar-footer { display: grid; gap: 12px; margin-top: auto; padding: 15px 8px 0; border-top: 1px solid var(--hairline); }
.sidebar-status { display: flex; align-items: center; gap: 10px; }
.sidebar-status > span { width: 8px; height: 8px; border-radius: 50%; background: #30d158; box-shadow: 0 0 0 5px rgba(48, 209, 88, 0.09); }
.sidebar-status div { display: grid; }
.sidebar-status strong { color: #d8d8dc; font-size: 12px; }
.sidebar-status small { color: #73737b; font-size: 10px; }
.sidebar-signout { padding: 0; border: 0; background: none; color: #85858d; cursor: pointer; font-size: 12px; text-align: left; }
.sidebar-signout:hover { color: #ff817a; transform: none; }
.app-drawer { display: none; }

.dashboard {
  width: min(1320px, calc(100% - 64px));
  margin: 0 auto;
  padding: 42px 0 72px;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
}
.page-header h1 { margin-bottom: 10px; font-size: clamp(2.35rem, 5vw, 4.25rem); }
.page-subtitle { max-width: 590px; margin: 0; color: #8f8f98; font-size: 1.02rem; }
.dashboard-header .live-indicator { margin-bottom: 6px; }

.dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.dashboard-metrics .metric { position: relative; overflow: hidden; min-height: 126px; padding: 20px 22px; border-radius: 20px; background: var(--card); box-shadow: none; }
.dashboard-metrics .metric::after { position: absolute; right: -18px; bottom: -32px; width: 95px; height: 95px; border-radius: 50%; background: rgba(10, 132, 255, 0.075); content: ""; }
.dashboard-metrics .metric span { margin-bottom: 9px; }
.dashboard-metrics .metric strong { display: block; font-size: 1.8rem; }
.dashboard-metrics .metric .time-value { font-size: 1.05rem; line-height: 1.35; }
.dashboard-metrics .metric small { display: block; margin-top: 8px; color: #696971; font-size: 11px; }

.dashboard-overview-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.72fr); gap: 16px; align-items: start; }
.dashboard-feed-column { min-width: 0; }
.featured-panel { margin: 0; }
.dashboard-rail { display: grid; gap: 16px; position: sticky; top: 18px; }
.dashboard-rail .notification-card {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 23px;
  background: linear-gradient(145deg, rgba(10, 132, 255, 0.13), rgba(29, 32, 39, 0.92) 58%);
  box-shadow: none;
}
.notification-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: rgba(10, 132, 255, 0.17); color: #8fc9ff; font-size: 20px; }
.notification-copy h2 { margin-bottom: 8px; }
.notification-copy p:last-child { margin: 0; color: #96969e; font-size: 13px; }
.dashboard-rail .button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dashboard-rail .button-row form { grid-column: 1 / -1; margin: 0; }
.dashboard-rail .button-row form button { width: 100%; }
.quick-panel { padding: 21px; box-shadow: none; }
.compact-heading { margin-bottom: 7px; }
.quick-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px; border-top: 1px solid var(--hairline); text-decoration: none; }
.quick-row span { display: flex; align-items: baseline; gap: 10px; }
.quick-row strong { min-width: 28px; font-size: 1.08rem; }
.quick-row small { color: #8d8d96; }
.quick-row b { color: #686870; font-size: 22px; font-weight: 400; }
.quick-row:hover b { color: #0a84ff; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 44px 2px 16px; scroll-margin-top: 20px; }
.section-heading h2 { font-size: 1.7rem; }
.section-heading p:last-child { margin: 0; color: #777780; font-size: 13px; }
.lower-grid { gap: 16px; }

.panel { border-radius: 22px; background: var(--card); box-shadow: none; }
.panel:hover { border-color: var(--line); }
.panel-heading { align-items: center; }
.panel-heading h2 { font-size: 1.4rem; }
#rules, #prices, #sources, #iphone-notifications { scroll-margin-top: 22px; }

.story-list { display: grid; gap: 9px; overflow: visible; border-radius: 0; }
.story {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 22px;
  align-items: start;
  gap: 13px;
  margin: 0;
  padding: 15px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.026);
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}
.story:first-child { padding: 15px; border: 1px solid var(--hairline); }
.story.google-story { padding-right: 15px; }
.story:hover { border-color: rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.045); transform: translateY(-1px); }
.story-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--alert-color) 30%, transparent);
  border-radius: 13px;
  background: color-mix(in srgb, var(--alert-color) 12%, rgba(255, 255, 255, 0.035));
  color: var(--alert-color);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
}
.story-body { display: block; min-width: 0; }
.story-source-row { display: flex; min-width: 0; }
.story-source { overflow: hidden; color: inherit; text-overflow: ellipsis; white-space: nowrap; }
.story-source-alert { color: var(--alert-color); }
.story-publisher { color: #8f8f98; }
.story h3 { margin: 7px 0 9px; color: #f2f2f4; font-size: 1.02rem; font-weight: 660; line-height: 1.36; }
.story-time-row { display: flex; flex-wrap: wrap; align-items: center; column-gap: 16px; row-gap: 6px; color: #7f7f88; font-size: 12px; }
.story-time-row strong { padding: 2px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.055); font-size: 10px; }
.story-time-row .update-label { background: rgba(48, 209, 88, 0.1); color: #68dc81; }
.story-open { align-self: center; color: #5f5f68; font-size: 17px; transition: color 150ms ease, transform 150ms ease; }
.story:hover .story-open { color: #8fc9ff; transform: translate(2px, -2px); }
.google-news-mark { right: 48px; bottom: 15px; width: 16px; height: 16px; opacity: 0.8; }
.all-stories { margin-top: 14px; padding: 0; border: 0; }
.all-stories > summary { display: flex; min-height: 44px; align-items: center; justify-content: center; border: 1px solid var(--hairline); border-radius: 13px; background: rgba(255, 255, 255, 0.025); font-size: 13px; }
.all-stories .story-list { margin-top: 9px; }

.rules-panel > summary, .source-panel > summary, .new-rule > summary, .market-history > summary, .custom-sources > summary, .removed-sources > summary {
  list-style: none;
}
.rules-panel > summary::-webkit-details-marker, .source-panel > summary::-webkit-details-marker, .new-rule > summary::-webkit-details-marker { display: none; }
.rules-panel > summary, .source-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  color: #f1f1f3;
  font-size: 1.22rem;
}
.rules-panel > summary::after, .source-panel > summary::after { color: #707079; content: "+"; font-size: 23px; font-weight: 400; }
.rules-panel[open] > summary::after, .source-panel[open] > summary::after { content: "−"; }
.rule-list { gap: 9px; }
.rule-card, .custom-source-card { border-radius: 16px; background: rgba(255, 255, 255, 0.025); }
.rule-card { position: relative; padding: 16px 16px 16px 35px; border-left-width: 1px; }
.rule-card::before { position: absolute; top: 22px; left: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--alert-color, #0a84ff); content: ""; }
.rule-title-row { margin-top: 0; padding-left: 0; }
.rule-actions { flex-wrap: wrap; }

.source-panel { margin-top: 16px; }
.feed-status-list { gap: 7px; }
.feed-status-row {
  padding: 11px 12px;
  border: 1px solid var(--hairline);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.022);
}
.feed-status-row:first-child { border-top: 1px solid var(--hairline); }
.source-row-actions .source-action { border-radius: 9px; }

.history-dashboard { min-height: 100vh; }
.history-header { align-items: end; }
.history-filter { padding: 18px; }
.history-day { margin-bottom: 14px; }
.history-day .story-list { gap: 8px; }

.login-page { display: block; min-height: 100vh; padding: 0; }
.guest-shell, .login-page .app-stage { min-height: 100vh; }
.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  align-items: center;
  gap: clamp(60px, 10vw, 150px);
  width: min(1120px, calc(100% - 64px));
  min-height: 100vh;
  margin: auto;
  padding: 60px 0;
}
.login-intro { max-width: 560px; }
.login-intro .brand-mark { margin-bottom: 36px; }
.login-intro h1 { margin-bottom: 22px; font-size: clamp(3rem, 6vw, 5.5rem); }
.login-intro > p:not(.eyebrow) { max-width: 470px; color: #96969e; font-size: 1.12rem; }
.login-features { display: flex; flex-wrap: wrap; gap: 17px; margin-top: 32px; color: #b3b3ba; font-size: 13px; }
.login-features span { display: flex; align-items: center; gap: 7px; }
.login-features i { width: 7px; height: 7px; border-radius: 50%; background: #30d158; }
.login-card { padding: 34px; border-radius: 28px; background: rgba(28, 30, 37, 0.88); }
.login-card .brand-mark { display: none; }
.login-card h1 { margin-bottom: 8px; font-size: 2.4rem; }
.login-card .primary-button { min-height: 48px; margin-top: 3px; }

@media (max-width: 1120px) {
  :root { --sidebar-width: 218px; }
  .dashboard { width: calc(100% - 36px); }
  .dashboard-overview-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .desktop-sidebar { display: none; }
  .app-stage { margin-left: 0; }
  .app-drawer { display: block; }
  .mobile-tabbar {
    position: fixed;
    z-index: 40;
    right: 10px;
    bottom: max(9px, env(safe-area-inset-bottom));
    left: 10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: 65px;
    padding: 7px 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 21px;
    background: rgba(27, 29, 35, 0.9);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.45), inset 0 1px rgba(255, 255, 255, 0.07);
    -webkit-backdrop-filter: blur(28px) saturate(150%);
    backdrop-filter: blur(28px) saturate(150%);
  }
  .mobile-tabbar a, .mobile-tabbar .menu-button {
    position: static;
    display: grid;
    width: auto;
    height: auto;
    min-height: 50px;
    place-content: center;
    gap: 1px;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: transparent;
    box-shadow: none;
    color: #85858e;
    font-size: 10px;
    font-weight: 650;
    text-align: center;
    text-decoration: none;
    transform: none;
  }
  .mobile-tabbar a[aria-current="page"] { background: rgba(10, 132, 255, 0.12); color: #69b5ff; }
  .mobile-tabbar .tab-icon { display: block; width: auto; height: 25px; background: none; font-size: 20px; line-height: 24px; }
  .mobile-tabbar .menu-button span { display: block; width: auto; height: auto; background: none; }
  .drawer-signout { position: absolute; right: 20px; bottom: max(24px, env(safe-area-inset-bottom)); left: 20px; }
  .drawer-signout button { width: 100%; }

  .dashboard { width: calc(100% - 22px); padding: calc(24px + env(safe-area-inset-top)) 0 calc(106px + env(safe-area-inset-bottom)); }
  .page-header { align-items: flex-start; flex-direction: column; gap: 15px; margin-bottom: 22px; padding: 0 5px; }
  .page-header h1 { font-size: clamp(2.3rem, 12vw, 3.4rem); }
  .page-subtitle { font-size: 0.95rem; }
  .dashboard-header .live-indicator { margin: 0; }
  .dashboard-metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .dashboard-metrics .metric { min-height: 110px; padding: 16px; }
  .dashboard-metrics .metric.wide { grid-column: 1 / -1; min-height: 96px; }
  .dashboard-overview-grid { grid-template-columns: 1fr; }
  .dashboard-rail { position: static; grid-row: auto; }
  .dashboard-feed-column { grid-row: 1; }
  .dashboard-rail { grid-row: 2; }
  .quick-panel { display: none; }
  .dashboard-rail .notification-card { padding: 19px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 5px; margin-top: 34px; padding: 0 5px; }
  .panel { padding: 17px; border-radius: 20px; }
  .panel-heading { margin-bottom: 14px; }
  .panel-heading h2 { font-size: 1.25rem; }
  .story-list { gap: 8px; }
  .story, .story:first-child {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 11px;
    padding: 13px;
    border: 1px solid var(--hairline);
    border-radius: 15px;
  }
  .story.google-story { padding-right: 13px; }
  .story-avatar { width: 38px; height: 38px; border-radius: 11px; font-size: 13px; }
  .story-open { display: none; }
  .story h3 { margin-top: 6px; font-size: 0.99rem; }
  .story-source { font-size: 10px; }
  .story-time-row { column-gap: 12px; font-size: 11px; }
  .google-news-mark { right: 13px; bottom: 12px; }
  .lower-grid { gap: 12px; }
  .source-panel { margin-top: 12px; }
  .feed-status-row { border-radius: 12px; }
  .history-filter { padding: 15px; }

  .login-shell { grid-template-columns: 1fr; gap: 30px; width: min(100% - 28px, 470px); padding: 44px 0; }
  .login-intro { text-align: center; }
  .login-intro .brand-mark { width: 54px; height: 54px; margin: 0 auto 24px; border-radius: 16px; font-size: 27px; }
  .login-intro h1 { font-size: clamp(2.5rem, 13vw, 4rem); }
  .login-intro > p:not(.eyebrow) { margin-right: auto; margin-left: auto; font-size: 1rem; }
  .login-features { display: none; }
  .login-card { padding: 25px 21px; border-radius: 24px; }
}

@media (max-width: 520px) {
  .dashboard-metrics .metric strong { font-size: 1.5rem; }
  .panel-heading-actions { align-items: flex-end; flex-direction: row; }
  .dashboard-rail .button-row { grid-template-columns: 1fr 1fr; }
  .rules-panel > summary, .source-panel > summary { font-size: 1.1rem; }
  .rule-actions { justify-content: flex-start; }
  .feed-status-row { grid-template-columns: 1fr auto; }
}
