/* Self-hosted webfonts (Phase M — vendored from Google Fonts, zero external
   CDN calls). Instrument Sans 400/500/600/700 + JetBrains Mono 400/500,
   all subsets Google serves, font-display:swap. Files live in ./fonts/.
   To refresh: re-run the fetch in scripts/verify_m_prod.py's docstring. */
/* latin-ext */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url(./fonts/instrument-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url(./fonts/instrument-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: swap;
  src: url(./fonts/instrument-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: swap;
  src: url(./fonts/instrument-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url(./fonts/instrument-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url(./fonts/instrument-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url(./fonts/instrument-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url(./fonts/instrument-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/jetbrains-mono-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/jetbrains-mono-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/jetbrains-mono-greek.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/jetbrains-mono-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/jetbrains-mono-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/jetbrains-mono-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(./fonts/jetbrains-mono-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(./fonts/jetbrains-mono-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(./fonts/jetbrains-mono-greek.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(./fonts/jetbrains-mono-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(./fonts/jetbrains-mono-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(./fonts/jetbrains-mono-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Channelmind design tokens + component classes (dark theme). */
:root {
  --bg: #0a0a0e; --panel: #12121a; --panel-2: #101016; --panel-3: #0d0d13;
  --border: #1e1e28; --border-2: #26262f; --border-3: #2c2c3a; --border-4: #3a3a4c; --border-soft: #191922;
  --hover: #16161f; --raised: #1a1a24; --raised-2: #22222e; --track: #22222c; --bubble-user: #1c1c2a;
  --header-bg: rgba(10,10,14,.85); --overlay: rgba(5,5,8,.7);
  --text: #e5e5ea; --text-bright: #f4f4f7; --text-mid: #b8b8c6; --text-dim: #8a8a99; --text-faint: #5a5a6a; --text-ghost: #71717f;
  --accent-from: #f43f5e; --accent-to: #6366f1; --accent-grad: linear-gradient(135deg, #f43f5e, #6366f1);
  --indigo: #6366f1; --link: #a5b4fc; --link-hover: #c7d2fe;
  --green: #34d399; --amber: #fbbf24; --blue: #60a5fa; --red: #f87171;
  --mono: 'JetBrains Mono', monospace;
}
[data-theme="light"] {
  --bg: #f5f5f8; --panel: #ffffff; --panel-2: #f6f6f9; --panel-3: #efeff4;
  --border: #e5e5ec; --border-2: #dadae3; --border-3: #c9c9d6; --border-4: #b3b3c2; --border-soft: #e9e9f0;
  --hover: #ededf2; --raised: #e6e6ed; --raised-2: #dcdce6; --track: #e3e3ea; --bubble-user: #e8e8f6;
  --header-bg: rgba(247,247,250,.85); --overlay: rgba(25,25,35,.35);
  --text: #1c1c28; --text-bright: #0a0a0e; --text-mid: #42424f; --text-dim: #6d6d7c; --text-faint: #9494a2; --text-ghost: #84848f;
  --indigo: #4f46e5; --link: #4f46e5; --link-hover: #4338ca;
  --green: #059669; --amber: #b45309; --blue: #2563eb; --red: #dc2626;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Instrument Sans', system-ui, sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; transition: background .2s ease, color .2s ease; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes shimmer { 0% { opacity: .5; } 50% { opacity: .9; } 100% { opacity: .5; } }

/* layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.page { max-width: 1200px; margin: 0 auto; padding: 32px 32px 80px; }

/* header */
.app-header { border-bottom: 1px solid var(--border); background: var(--header-bg); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 40; }
.app-header .bar { height: 64px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); }
.logo:hover { color: var(--text); }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-grad); display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(99,102,241,.35); }
.logo-name { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-dim); }
.nav a:hover { color: var(--text); background: var(--hover); }
.nav a.active { font-weight: 600; color: var(--text); background: var(--raised); }

/* user menu */
.user-btn { display: flex; align-items: center; gap: 9px; border: none; background: none; cursor: pointer; font-family: inherit; color: var(--text); padding: 4px 6px; border-radius: 8px; }
.user-btn:hover { background: var(--hover); }
.user-btn span { white-space: nowrap; }
.bot-card:hover { border-color: var(--border-3); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.avatar { width: 28px; height: 28px; border-radius: 9999px; background: var(--accent-grad); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; }
.menu { position: absolute; right: 0; top: 44px; min-width: 160px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--panel); box-shadow: 0 12px 32px rgba(0,0,0,.5); padding: 6px; display: flex; flex-direction: column; z-index: 50; }
.menu a { padding: 8px 10px; border-radius: 6px; font-size: 13px; color: var(--text-dim); }
.menu a:hover { color: var(--text); background: var(--hover); }

/* cards */
.card { border-radius: 12px; border: 1px solid var(--border); background: var(--panel); }
.stat-box { border-radius: 8px; border: 1px solid var(--border-soft); background: var(--panel-2); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.mono { font-family: var(--mono); }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > .label { font-size: 12px; font-weight: 600; color: var(--text-mid); }
.input, .select, .textarea { padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-3); background: var(--panel-2); color: var(--text); font-family: inherit; font-size: 13px; outline: none; }
.input, .select { height: 40px; }
.select { appearance: none; cursor: pointer; padding-right: 32px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%238a8a99' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; }
.textarea { padding: 9px 12px; resize: none; line-height: 1.5; }
.input:focus, .textarea:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.select:focus { border-color: var(--indigo); }
.input.invalid, .select.invalid { border-color: rgba(248,113,113,.5); box-shadow: 0 0 0 3px rgba(248,113,113,.12); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: .5; }

/* buttons */
.btn { height: 40px; padding: 0 18px; border-radius: 8px; border: none; cursor: pointer; font-family: inherit; font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { color: #fff; background: var(--accent-grad); box-shadow: 0 4px 20px rgba(99,102,241,.3); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); }
.btn-secondary { border: 1px solid var(--border-3); background: var(--raised); color: var(--text); font-size: 13px; }
.btn-secondary:hover:not(:disabled) { background: var(--raised-2); border-color: var(--border-4); }
.btn-ghost { border: 1px solid var(--border-3); background: none; color: var(--text-dim); font-weight: 500; font-size: 13px; }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.btn-danger-ghost { border: 1px solid transparent; background: none; color: var(--text-ghost); font-weight: 500; font-size: 13px; }
.btn-danger-ghost:hover:not(:disabled) { color: var(--red); background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.2); }
.btn-danger { border: 1px solid rgba(248,113,113,.3); background: rgba(248,113,113,.12); color: var(--red); font-weight: 700; font-size: 13px; }
.btn-danger:hover:not(:disabled) { background: rgba(248,113,113,.2); }
.btn-sm { height: 36px; padding: 0 14px; }
.icon-btn { border: none; background: none; cursor: pointer; color: var(--text-faint); padding: 4px; border-radius: 7px; }
.icon-btn:hover { color: var(--text); background: var(--border); }
.link-btn { display: inline-flex; align-items: center; gap: 5px; border: none; background: none; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 500; color: var(--link); padding: 0; }
.link-btn:hover { color: var(--link-hover); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 9999px; border: 1px solid; white-space: nowrap; }
.badge-dot { width: 6px; height: 6px; border-radius: 9999px; background: currentColor; }
.badge-pending  { color: var(--amber); background: rgba(251,191,36,.1);  border-color: rgba(251,191,36,.25); }
.badge-building { color: var(--blue);  background: rgba(96,165,250,.1);  border-color: rgba(96,165,250,.25); }
.badge-building .badge-dot { animation: pulse 1.4s ease-in-out infinite; }
.badge-ready    { color: var(--green); background: rgba(52,211,153,.1);  border-color: rgba(52,211,153,.25); }
.badge-error    { color: var(--red);   background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.25); }
.badge-plan { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 9999px; background: rgba(99,102,241,.15); color: var(--link); border: 1px solid rgba(99,102,241,.3); }

/* modal */
.overlay { position: fixed; inset: 0; z-index: 50; background: var(--overlay); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { width: 100%; border-radius: 12px; border: 1px solid var(--border-2); background: var(--panel); box-shadow: 0 24px 64px rgba(0,0,0,.6); overflow: hidden; }
.modal-accent { height: 2px; background: linear-gradient(90deg, #f43f5e, #6366f1); }

/* toast */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 8px; background: var(--panel-2); box-shadow: 0 12px 32px rgba(0,0,0,.5); font-size: 13px; color: var(--text); max-width: 340px; border: 1px solid rgba(52,211,153,.3); }
.toast.err { border-color: rgba(248,113,113,.3); }
.toast .dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 9999px; background: var(--green); }
.toast.err .dot { background: var(--red); }

/* misc */
.title-input { height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text); font-family: inherit; font-size: 20px; font-weight: 700; letter-spacing: -.01em; outline: none; width: 320px; }
.title-input:hover { border-color: var(--border-3); background: var(--panel-2); }
.title-input:focus { border-color: var(--indigo); background: var(--panel-2); }
.collapse-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: none; background: none; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text); border-radius: 8px; }
.collapse-btn:hover { background: var(--hover); }
.file-drop { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px dashed var(--border-3); background: var(--bg); color: var(--text-dim); font-size: 12.5px; cursor: pointer; }
.file-drop:hover { border-color: var(--indigo); color: var(--text); }
.sync-select { height: 28px; padding: 0 26px 0 10px; border-radius: 7px; background: var(--bg); font-size: 12px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238a8a99' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 9px center; }
.google-btn { margin-top: 16px; width: 100%; height: 40px; display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: 8px; border: none; background: #fff; color: #1a1a24; font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.google-btn:hover { background: #ececf2; }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--panel-2); gap: 2px; }
.seg button { height: 28px; padding: 0 12px; border: none; border-radius: 7px; background: none; color: var(--text-dim); font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--raised-2); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
/* custom select */
.sf { position: relative; display: inline-flex; flex-shrink: 0; min-width: 90px; }
.sf-btn { height: 40px; padding: 0 32px 0 12px; border-radius: 8px; border: 1px solid var(--border-3); background: var(--panel-2); color: var(--text); font-family: inherit; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; width: 100%; text-align: left; white-space: nowrap; position: relative; }
.sf-btn:hover { border-color: var(--border-4); }
.sf-btn:focus-visible { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.sf-btn::after { content: ''; position: absolute; right: 12px; width: 9px; height: 9px; border-right: 2px solid var(--text-dim); border-bottom: 2px solid var(--text-dim); transform: rotate(45deg) translateY(-3px); pointer-events: none; }
.sf.open .sf-btn { border-color: var(--indigo); }
.sf-sm .sf-btn { height: 28px; padding: 0 26px 0 10px; border-radius: 7px; font-size: 12px; background: var(--bg); }
.sf-sm .sf-btn::after { right: 10px; width: 7px; height: 7px; }
.sf-menu { position: absolute; top: calc(100% + 4px); left: 0; min-width: 100%; border-radius: 8px; border: 1px solid var(--border-2); background: var(--panel); box-shadow: 0 12px 32px rgba(0,0,0,.45); padding: 5px; display: flex; flex-direction: column; gap: 1px; z-index: 55; max-height: 260px; overflow-y: auto; }
.sf-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 10px; border: none; border-radius: 6px; background: none; color: var(--text-mid); font-family: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; text-align: left; white-space: nowrap; }
.sf-opt:hover, .sf-opt.hi { background: var(--hover); color: var(--text); }
.sf-opt.sel { color: var(--text); font-weight: 600; }
.sf-opt .tick { color: var(--indigo); }
.progress { height: 4px; border-radius: 9999px; background: var(--track); overflow: hidden; }
/* mobile */
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr !important; }
  .hide-sm { display: none !important; }
  .row-wrap { flex-wrap: wrap; }
  .row-wrap > .btn, .row-wrap > .sf { flex: 1 1 100% !important; width: 100%; }
  .src-row { flex-wrap: wrap; position: relative; }
  .src-row > .src-id { flex: 1 1 100% !important; }
  .src-row .src-id > div:last-child { padding-right: 78px; }
  /* badge rides the title line (top-right); buttons become one tidy full-width row */
  .src-actions { display: flex; align-items: center; gap: 8px; flex: 1 1 100%; margin-left: 0; }
  .src-actions .badge { position: absolute; top: 0; right: 0; }
  .src-actions .btn { flex: 1 1 0; }
  /* a lone button (Delete on doc/building cards) shouldn't stretch full width —
     it right-aligns compactly, killing the dead space next to it */
  .src-actions .btn:only-of-type { flex: 0 0 auto; margin-left: auto; padding: 0 18px; }
  /* single-action cards (doc Ready, channel Building — just Delete): one compact
     row, no dead button line */
  .src-row:has(.src-actions .btn:only-of-type) { flex-wrap: nowrap; }
  .src-row:has(.src-actions .btn:only-of-type) > .src-id { flex: 1 1 auto !important; min-width: 0; }
  .src-row:has(.src-actions .btn:only-of-type) .src-id > div:last-child { padding-right: 0; }
  .src-row:has(.src-actions .btn:only-of-type) .src-actions { flex: 0 0 auto; }
  .src-row:has(.src-actions .btn:only-of-type) .src-actions .badge { position: static; }
  .src-row:has(.src-actions .btn:only-of-type) .src-actions .btn:only-of-type { margin-left: 0; padding: 0 12px; }
  .sync-row { flex-wrap: wrap; }
  /* avatars/rings: TOP edge flush with the top of the channel name (line-height
     slack above the text ≈ 3px is compensated) */
  .src-row { align-items: flex-start !important; }
  .src-row .src-id { align-items: flex-start !important; }
  .src-row .src-id > div:first-child { margin-top: 3px; }
  .q-row { align-items: flex-start !important; }
  .q-row > svg { margin-top: 1px; } /* ring stroke is inset ~2px inside its 38px box */
  .sync-row .sf { margin-left: auto; }
  /* sync status carries real states (Syncing… / failed · Retry / up to date) —
     wrap to its own line on mobile instead of hiding it */
  /* sync row: one clean line — "Weekly" already implies the next run, so on
     mobile the status shows just "Last synced 2h ago" */
  .sync-status { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: right; }
  .sync-status .sync-next { display: none; }
  /* ingestion-queue rows: let badge + actions wrap under the ring/label */
  .q-row { flex-wrap: wrap; row-gap: 10px; position: relative; }
  /* reserve the status-chip corner for the text block */
  .q-row .q-info { flex: 1 1 calc(100% - 52px); padding-right: 118px; }
  .q-row .q-actions { flex: 1 1 100%; margin-left: 0; }
  .q-row .q-actions .badge { position: absolute; top: 12px; right: 14px; }
  .q-row .q-actions .btn { flex: 1 1 0; }
  /* badge-only rows (Ready ✓): collapse the empty button line + its row-gap */
  .q-row .q-actions:not(:has(.btn)) { height: 0; margin-top: -10px; }
  .page { padding-left: 16px; padding-right: 16px; }
  .btn-block-sm { width: 100%; }
  .src-card { padding: 14px !important; }
  .src-list { gap: 12px !important; }
  .logo-name { display: none; }
  .nav a { white-space: nowrap; padding: 6px 10px; font-size: 13px; }
  .title-row { flex-wrap: wrap; flex: 1 1 100%; }
  .title-row .title-input { flex: 1 1 100%; width: auto; font-size: 18px; }
  .card-head-title { flex: 1 1 100%; min-width: 0; }
}
.progress > div { height: 100%; border-radius: 9999px; background: linear-gradient(90deg, #f43f5e, #6366f1); }

/* Ingestion / auto-sync progress states (docs/design-brief-ingestion-ux.md) */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; transform-origin: center; }
/* neutral "waiting / cancelled" chip — muted, no pulse */
.badge-queued { color: var(--text-dim); background: rgba(138,138,153,.08); border-color: rgba(138,138,153,.2); }
/* origin tag for jobs enqueued by auto-sync (job.origin === 'auto') */
.badge-autosync { color: var(--link); background: rgba(99,102,241,.12); border-color: rgba(99,102,241,.3); }
/* header global-activity pill (AppHeader) */
a.hdr-activity { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px; border-radius: 9999px; border: 1px solid rgba(96,165,250,.25); background: rgba(96,165,250,.08); color: var(--blue); font-size: 12px; font-weight: 600; white-space: nowrap; }
a.hdr-activity:hover { background: rgba(96,165,250,.14); border-color: rgba(96,165,250,.4); color: var(--blue); }
.hdr-activity .badge-dot { width: 6px; height: 6px; animation: pulse 1.4s ease-in-out infinite; }
/* Redeploy reconnect indicator (deploy-UX). Rendered globally by app.js while the
   backend is briefly unreachable. position:fixed + centered so it overlays the top
   of the page and NEVER reflows the header/content. Reuses the amber badge tokens
   and the pulsing .badge-dot already used elsewhere. */
.reconnect-pill { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 60; display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 15px; border-radius: 9999px; border: 1px solid rgba(251,191,36,.3); background: rgba(251,191,36,.12); color: var(--amber); font-size: 12.5px; font-weight: 600; white-space: nowrap; box-shadow: 0 6px 22px rgba(0,0,0,.4); backdrop-filter: blur(8px); }
.reconnect-pill .badge-dot { width: 6px; height: 6px; animation: pulse 1.4s ease-in-out infinite; }
.fade-enter-active, .fade-leave-active { transition: opacity .25s ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; }
.sf-btn:disabled { opacity: .5; cursor: default; }
/* Add-source kind toggle (Channel | Playlist) + source-row kind tag */
.kind-btn { height: 26px; padding: 0 14px; border-radius: 6px; border: none; background: none; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--text-dim); }
.kind-btn:hover { color: var(--text); }
.kind-btn.on { background: var(--raised-2); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.src-tag { flex-shrink: 0; font-family: var(--mono); font-size: 9.5px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--text-ghost); border: 1px solid var(--border-2); border-radius: 5px; padding: 1px 6px; background: var(--panel-3); }
/* Source name/meta: ellipsis on desktop, fully wrapped on mobile (no collapse UI) */
.src-label, .src-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 640px) {
  /* wrap by WORDS only — 'anywhere' collapses flex min-content to one char and
     squeezes names into a needle column to fit the chip on the same line */
  .src-label { white-space: normal; overflow: visible; overflow-wrap: break-word; line-height: 1.45; }
  .src-meta { white-space: normal; overflow: visible; overflow-wrap: break-word; line-height: 1.5; }
  /* the kind chip flows INLINE right after the last word of the name — it can
     never wrap to a lonely left-edge line or float between lines */
  .src-title { display: inline !important; }
  .src-label { display: inline; }
  .src-title .src-tag { display: inline-flex; margin-left: 0; vertical-align: 1px; margin-top: 0; }
  /* queue rows expand too — nothing stays truncated on mobile */
  .q-label { white-space: normal !important; overflow: visible !important; overflow-wrap: break-word; line-height: 1.45; }
}
/* Persona interview: animated ellipsis in the status text + message entrance */
.think-ellip span { animation: thinkdot 1.2s ease-in-out infinite; }
.think-ellip span:nth-child(2) { animation-delay: .15s; }
.think-ellip span:nth-child(3) { animation-delay: .3s; }
@keyframes thinkdot { 0%, 100% { opacity: .2; } 40% { opacity: 1; } }
.msg-in { animation: msgIn .28s ease both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.hdr-activity-count { display: none; }
@media (max-width: 640px) { .hdr-activity-lbl { display: none; } .hdr-activity-count { display: inline; font-family: var(--mono); } a.hdr-activity { padding: 0 10px; } }
.skeleton { animation: shimmer 1.6s ease-in-out infinite; }
.skel-line { border-radius: 6px; background: var(--border); }
.divider-v { width: 1px; height: 26px; background: var(--border); }
