@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  background: #ececec;
  color: #333;
  --surface: #f5f5f5;
  --page-background: #ececec;
  --surface-soft: #f4f4f4;
  --line: #d6d6d6;
  --muted: #526c66;
  --accent: #145248;
  --accent-soft: #ceefdb;
  --danger: #9a2437;
  --primary: #208374;
  --primary-hover: #175f53;
  --primary-text: #f5f5f5;
  --sidebar: #175f53;
  --sidebar-text: #f5f5f5;
  --sidebar-muted: #c5e5de;
  --sidebar-active-text: #145248;
  --symbol-background: #d7e8e1;
  --symbol-text: #145248;
  --theme-toggle-background: #292929;
  --theme-toggle-text: #f5f5f5;
  --theme-toggle-border: #f5f5f5;
  --theme-toggle-hover: #3a3a3a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    background: #282828;
    color: #f5f5f5;
    --surface: #323232;
    --page-background: #282828;
    --surface-soft: #3a3a3a;
    --line: #5d5d5d;
    --muted: #b9cbc6;
    --accent: #89c8bd;
    --accent-soft: #145248;
    --danger: #ff9aa8;
    --primary: #89c8bd;
    --primary-hover: #a9d9d1;
    --primary-text: #0f201d;
    --sidebar: #292929;
    --sidebar-text: #f5f5f5;
    --sidebar-muted: #a5c9c2;
    --sidebar-active-text: #f5f5f5;
    --symbol-background: #3d5c55;
    --symbol-text: #d1e9e1;
    --theme-toggle-background: #17675a;
    --theme-toggle-text: #f5f5f5;
    --theme-toggle-border: #89c8bd;
    --theme-toggle-hover: #208374;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  background: #282828;
  color: #f5f5f5;
  --surface: #323232;
  --page-background: #282828;
  --surface-soft: #3a3a3a;
  --line: #5d5d5d;
  --muted: #b9cbc6;
  --accent: #89c8bd;
  --accent-soft: #145248;
  --danger: #ff9aa8;
  --primary: #89c8bd;
  --primary-hover: #a9d9d1;
  --primary-text: #0f201d;
  --sidebar: #292929;
  --sidebar-text: #f5f5f5;
  --sidebar-muted: #a5c9c2;
  --sidebar-active-text: #f5f5f5;
  --symbol-background: #3d5c55;
  --symbol-text: #d1e9e1;
  --theme-toggle-background: #17675a;
  --theme-toggle-text: #f5f5f5;
  --theme-toggle-border: #89c8bd;
  --theme-toggle-hover: #208374;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
body.resizing-panes { cursor: col-resize; user-select: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.sign-in { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.sign-in-card { position: relative; width: min(100%, 390px); padding: 34px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 24px 60px #11182012; }
.sign-in-card > .theme-toggle { position: absolute; top: 28px; right: 28px; }
.theme-toggle { display: grid; place-items: center; flex: none; width: 34px; height: 34px; padding: 0; border: 1px solid var(--theme-toggle-border); border-radius: 9px; background: var(--theme-toggle-background); color: var(--theme-toggle-text); }
.theme-toggle:hover { background: var(--theme-toggle-hover); }
.ui-icon { display: inline-block; flex: none; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; -webkit-mask-mode: alpha; mask-mode: alpha; }
.icon-lucide-sun { --icon: url("/icons/lucide-sun.svg?v=3"); }
.icon-lucide-moon { --icon: url("/icons/lucide-moon.svg?v=4"); }
.icon-manage-sources { --icon: url("/icons/manage-sources.svg"); }
.icon-sign-out { --icon: url("/icons/sign-out.svg"); }
.icon-search { --icon: url("/icons/search.svg"); }
.icon-close { --icon: url("/icons/close.svg"); }
.icon-checklist { --icon: url("/icons/checklist.svg"); }
.icon-chevron-down { --icon: url("/icons/chevron-down.svg"); }
.icon-tabler-refresh { --icon: url("/icons/tabler-refresh.svg"); }
.icon-tabler-inbox { --icon: url("/icons/tabler-inbox.svg"); }
.icon-tabler-arrow-left { --icon: url("/icons/tabler-arrow-left.svg"); }
.icon-tabler-external-link { --icon: url("/icons/tabler-external-link.svg"); }
.icon-tabler-circle { --icon: url("/icons/tabler-circle.svg"); }
.icon-tabler-circle-check { --icon: url("/icons/tabler-circle-check.svg"); }
.brand-mark { display: block; flex: none; width: 54px; height: 54px; border-radius: 12px; }
.brand-mark.small { width: 36px; height: 36px; border-radius: 9px; }
.sign-in h1 { margin: 20px 0 6px; font-size: 28px; letter-spacing: -.03em; }
.sign-in p { color: var(--muted); margin: 0 0 24px; }
.sign-in form { display: grid; gap: 10px; }
.sign-in-card > .primary { width: 100%; }
.sign-in label { font-size: 13px; font-weight: 600; }
.sign-in input, #search { width: 100%; border: 1px solid var(--line); background: var(--surface-soft); color: inherit; border-radius: 10px; padding: 11px 12px; }
.sign-in .hint { font-size: 12px; line-height: 1.5; margin: 17px 0 0; }
.sign-in .error { color: var(--danger); font-size: 13px; margin: 14px 0 0; }
.primary { border: 0; color: var(--primary-text); background: var(--primary); border-radius: 10px; padding: 11px 15px; font-weight: 600; }
.primary:hover { background: var(--primary-hover); }

.app { display: grid; grid-template-columns: 246px 6px 390px 6px minmax(240px, 1fr); grid-template-rows: minmax(0, 1fr); height: 100dvh; min-height: 540px; background: var(--surface); }
.sidebar { display: flex; flex-direction: column; background: var(--sidebar); color: var(--sidebar-text); min-width: 0; min-height: 0; padding: 18px 12px 12px; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 0 9px 18px; }
.sidebar-heading .theme-toggle { width: 30px; height: 30px; }
.sidebar-heading .theme-toggle .ui-icon { width: 20px; height: 20px; }
.brand-row { display: flex; align-items: center; gap: 10px; min-width: 0; letter-spacing: -.02em; }
.brand-row strong { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar nav { overflow-y: auto; min-height: 0; flex: 1; }
.sidebar-footer { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.pane-resizer { position: relative; background: var(--surface); border-left: 1px solid var(--line); cursor: col-resize; touch-action: none; }
.pane-resizer::after { content: ""; position: absolute; top: calc(50% - 18px); left: 2px; width: 2px; height: 36px; border-radius: 2px; background: var(--muted); opacity: .25; }
.pane-resizer:hover::after, .pane-resizer:focus-visible::after, .pane-resizer.dragging::after { background: var(--accent); opacity: .8; }
.pane-resizer:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.nav-label, .eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 700; }
.nav-label { padding: 16px 12px 5px; color: var(--sidebar-muted); }
.source-item { width: 100%; border: 0; background: transparent; color: inherit; padding: 6px 10px; text-align: left; display: flex; align-items: center; gap: 8px; border-radius: 10px; font-weight: 500; }
.mobile-source-picker { display: none; }
.source-item:hover, .manage-link:hover, #sign-out:hover, .quiet:hover, .icon-button:hover { background: var(--accent-soft); }
.sidebar .source-item:hover { color: var(--sidebar-active-text); }
.source-item.active { background: var(--accent-soft); color: var(--sidebar-active-text); font-weight: 650; }
.source-symbol, .source-icon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 7px; background: var(--symbol-background); color: var(--symbol-text); object-fit: cover; overflow: hidden; font-size: 17px; }
.source-symbol.all .ui-icon { width: 20px; height: 20px; }
.source-icon.large, .source-symbol.large { width: 44px; height: 44px; border-radius: 11px; font-size: 27px; }
.count { margin-left: auto; font-size: 12px; color: var(--muted); }
.sidebar .count { color: var(--sidebar-muted); }
.sidebar .source-item.active .count { color: var(--sidebar-active-text); }
.sidebar .source-item:hover .count { color: var(--sidebar-active-text); }
.manage-link, #sign-out { display: inline-flex; align-items: center; gap: 8px; width: max-content; min-height: 34px; border: 1px solid transparent; background: transparent; color: var(--sidebar-text); text-align: left; font-weight: 600; padding: 5px 9px; border-radius: 9px; }
.sidebar .manage-link:hover, .sidebar #sign-out:hover { background: color-mix(in srgb, var(--sidebar-text) 12%, transparent); }

.inbox-pane { position: relative; display: flex; flex-direction: column; min-width: 0; }
.pane-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 10px; }
.header-actions { display: flex; align-items: center; gap: 4px; }
.icon-button.mobile-header-button, .icon-button.mobile-search-close { display: none; }
.eyebrow { margin: 0 0 5px; }
.pane-header h1 { font-size: 32px; letter-spacing: -.04em; margin: 0; }
.settings-heading h2 { font-size: 26px; letter-spacing: -.04em; margin: 0; }
.icon-button { display: inline-flex; align-items: center; border: 0; background: transparent; color: var(--accent); border-radius: 9px; padding: 4px 10px; }
.inbox-controls { display: flex; gap: 7px; align-items: center; padding: 0 13px 8px 18px; }
#search { padding: 8px 11px; }
.quiet, .destructive { border: 0; background: transparent; color: var(--accent); padding: 7px 8px; border-radius: 8px; white-space: nowrap; }
.destructive { color: var(--danger); }
.selection-bar { display: flex; align-items: center; justify-content: space-between; padding: 2px 14px 8px; }
.message-list { overflow-y: auto; flex: 1; border-top: 1px solid var(--line); }
.message-row { width: 100%; display: flex; gap: 8px; align-items: flex-start; background: transparent; color: inherit; border: 0; border-bottom: 1px solid var(--line); text-align: left; padding: 8px 10px; }
.message-row:hover { background: var(--surface-soft); }
.message-row.active { background: var(--accent-soft); }
.message-row .source-icon, .message-row .source-symbol { width: 34px; height: 34px; border-radius: 9px; }
.message-content { min-width: 0; flex: 1; }
.message-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.message-title { min-width: 0; flex: 1; font-size: 15px; line-height: 1.25; font-weight: 500; overflow-wrap: anywhere; }
.message-row.unread .message-title { font-weight: 700; }
.message-time { color: var(--muted); flex: none; font-size: 11px; white-space: nowrap; }
.message-summary { display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; margin-top: 3px; color: var(--muted); font-size: 14px; line-height: 1.3; }
.unread-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: middle; }
.select-indicator { margin-top: 7px; color: var(--accent); }
.empty-list { text-align: center; color: var(--muted); padding: 80px 24px; line-height: 1.5; }
.pane-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 46px; padding: 4px 12px 4px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.danger-button { border: 1px solid color-mix(in srgb, var(--danger) 38%, var(--surface)); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); font-weight: 600; padding: 7px 10px; border-radius: 9px; }
.danger-button:hover { background: color-mix(in srgb, var(--danger) 18%, var(--surface)); }

.detail-pane { position: relative; overflow-y: auto; min-width: 0; background: var(--page-background); }
.empty-detail { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--muted); text-align: center; }
.empty-symbol { width: 58px; height: 58px; border-radius: 13px; }
.empty-detail h2 { color: inherit; font-size: 19px; margin: 20px 0 4px; }
.empty-detail p { margin: 0; font-size: 13px; }
.message-detail { max-width: 820px; margin: 14px; padding: 30px clamp(20px, 3vw, 36px); background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 10px; box-shadow: 0 12px 35px #14524814; }
.detail-source { display: flex; align-items: center; gap: 9px; font-size: 26px; font-weight: 600; }
.message-detail h2 { font-size: clamp(25px, 3vw, 38px); letter-spacing: -.04em; line-height: 1.16; margin: 20px 0 10px; }
.detail-time { color: var(--muted); font-size: 13px; }
.detail-body { font-size: 16px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; margin: 20px 0; }
.detail-actions { display: flex; gap: 8px; margin-top: 24px; }
.detail-actions a { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); text-decoration: none; padding: 7px 8px; }
.source-settings { max-width: 820px; margin: 14px; padding: 28px clamp(16px, 2vw, 32px); background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 10px; box-shadow: 0 12px 35px #14524814; }
.settings-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; letter-spacing: -.02em; }
.settings-brand strong { font-size: 20px; }
.settings-heading p:last-child { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 8px 0 20px; }
.settings-row { display: flex; flex-wrap: wrap; align-items: center; gap: 11px; padding: 10px 0; border-top: 1px solid var(--line); }
.settings-row strong { flex: 1; min-width: 90px; font-size: 14px; overflow-wrap: anywhere; }
.settings-row input[type=file] { display: none; }
.settings-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 100%; margin-left: auto; }
.settings-row .quiet { font-size: 13px; padding-inline: 5px; }
.notification-settings { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.notification-settings h3 { margin: 0 0 5px; font-size: 20px; }
.notification-settings p { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.notification-modes { display: flex; flex-wrap: wrap; gap: 7px; }
.notification-mode { border: 1px solid var(--line); background: var(--surface); color: inherit; border-radius: 9px; padding: 7px 10px; font-size: 13px; }
.notification-mode:hover, .notification-mode[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
#notification-status { min-height: 20px; margin: 12px 0 0; }
.settings-footer { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.4; text-align: center; }
.back-button { display: none; border: 0; background: transparent; color: var(--accent); padding: 10px 16px 0; }

@media (max-width: 1040px) {
  .app { grid-template-columns: 205px 6px 360px 6px minmax(240px, 1fr); }
  .sidebar { padding-left: 7px; padding-right: 7px; }
}
@media (max-width: 760px) {
  .app { display: flex; flex-direction: column; min-height: 0; height: 100dvh; }
  .pane-resizer { display: none; }
  .sidebar { position: relative; z-index: 2; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 4px; height: auto; padding: 8px 10px 6px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-heading { grid-column: 1 / -1; padding: 0 2px 6px; }
  .brand-row strong { font-size: 24px; }
  .sidebar nav { grid-column: 1; overflow: visible; min-width: 0; }
  .mobile-source-picker { position: relative; display: block; }
  #mobile-source { display: flex; align-items: center; gap: 8px; width: 100%; height: 36px; min-height: 36px; color: var(--accent); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 0 9px; text-align: left; font-size: 13px; font-weight: 600; }
  #mobile-source-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #mobile-source .source-icon, #mobile-source .source-symbol { width: 22px; height: 22px; border-radius: 6px; }
  #mobile-source .source-symbol.all .ui-icon { width: 16px; height: 16px; }
  #mobile-source .icon-chevron-down { width: 15px; height: 15px; transition: transform .15s ease; }
  #mobile-source[aria-expanded="true"] .icon-chevron-down { transform: rotate(180deg); }
  .mobile-source-menu { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; width: min(300px, calc(100vw - 20px)); max-height: min(58dvh, 420px); overflow-y: auto; padding: 5px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--accent); box-shadow: 0 15px 34px #081c1940; }
  .source-menu-item { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 40px; border: 0; border-radius: 8px; padding: 5px 8px; background: transparent; color: inherit; text-align: left; font-size: 14px; }
  .source-menu-item:hover, .source-menu-item[aria-checked="true"] { background: var(--accent-soft); }
  .source-menu-item .source-icon, .source-menu-item .source-symbol { width: 27px; height: 27px; }
  .source-menu-item .count { color: var(--accent); }
  #all-source, #source-list { display: none; }
  .sidebar .nav-label { display: none; }
  .sidebar-footer { flex-direction: row; align-items: center; grid-column: 2; gap: 2px; }
  .sidebar .manage-link, .sidebar #sign-out { min-height: 36px; font-size: 12px; white-space: nowrap; padding: 0 6px; }
  .sidebar .manage-link .ui-icon { width: 16px; height: 16px; }
  .sidebar #sign-out { justify-content: center; width: 36px; padding: 0; }
  .sidebar #sign-out .ui-icon { width: 18px; height: 18px; }
  .sidebar #sign-out .action-label { display: none; }
  .sidebar-heading .theme-toggle { width: 32px; height: 32px; }
  .sidebar-heading .theme-toggle .ui-icon { width: 21px; height: 21px; }
  .inbox-pane { flex: 1; min-height: 0; border-right: 0; }
  .pane-header { min-height: 56px; padding: 9px 12px 7px 16px; }
  .icon-button.mobile-header-button { display: inline-flex; }
  .header-actions .icon-button { min-width: 34px; min-height: 34px; justify-content: center; padding: 5px; }
  .mobile-header-button[aria-pressed="true"] { background: var(--accent-soft); }
  .inbox-controls { position: absolute; z-index: 1; top: 0; left: 0; right: 0; height: 56px; display: none; padding: 7px 12px 7px 16px; background: var(--surface); }
  .inbox-pane.search-open .inbox-controls { display: flex; }
  .icon-button.mobile-search-close { display: inline-flex; justify-content: center; min-width: 36px; min-height: 36px; padding: 5px; }
  #select-toggle { display: none; }
  #search { padding: 7px 10px; }
  .selection-bar { padding: 0 12px 6px; }
  .message-row { padding: 7px 10px; }
  .message-title { font-size: 16px; }
  .message-time { margin-top: 2px; }
  .message-summary { font-size: 15px; }
  .detail-pane { display: none; flex: 1; min-height: 0; }
  .app.detail-open .inbox-pane { display: none; }
  .app.detail-open .detail-pane { display: block; }
  .back-button { display: flex; align-items: center; gap: 5px; }
  .message-detail, .source-settings { padding-top: 24px; }
  .message-detail { margin: 10px; }
  .source-settings { margin: 10px; }
  .detail-source { font-size: 22px; }
}
@media (max-width: 380px) {
  .sidebar nav, .sidebar-footer { grid-column: 1 / -1; }
  .sidebar-footer { justify-content: space-between; }
}
