/* ==========================================================================
   BriefBrew Unified Briefs Stylesheet (Feeds, Discover, Reader, Drafts, Schedules, Timeline)
   Built strictly on --app-* constraints from theme.css.
   ========================================================================== */

/* ==========================================================================
   Briefs feed (/briefs): X-style timeline built on the --app-* theme tokens
   (assets/css/theme.css), so light and dark mode both work without overrides.
   ========================================================================== */

.bf {
    --bf-line: var(--app-border);
    --bf-hover: color-mix(in srgb, var(--app-text) 3.5%, transparent);
    --bf-radius: 16px;
    color: var(--app-text);
}

.bf-grid {
    display: flex;
    justify-content: center;
    gap: 32px;
    max-width: var(--app-max-w);
    margin: 0 auto;
    padding: 0 16px;
}

.bf-main {
    flex: 0 1 620px;
    min-width: 0;
    min-height: 100vh;
    border-left: 1px solid var(--bf-line);
    border-right: 1px solid var(--bf-line);
    background: var(--app-surface);
}

/* ── Header + tabs ─────────────────────────────────────────────────────── */
.bf-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--app-surface) 82%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--bf-line);
}
.bf-header__top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px 4px;
}
.bf-header__title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--app-text);
}
.bf-iconbtn {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: var(--app-text);
}
/* The legacy theme squares every button ([dir] button { border-radius: 0 }) */
[dir] .bf-iconbtn { border-radius: 50%; }
.bf-iconbtn .material-icons { line-height: 1; }
.bf-iconbtn:hover { background: var(--bf-hover); color: var(--app-text); text-decoration: none; }

.bf-tabs { display: flex; }

/* Horizontally scrollable tab strip (Notifications filters) — no clumping on small screens */
.bf-tabs--scroll {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    gap: 4px;
    padding: 0 4px;
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 24px), transparent 100%);
}
.bf-tabs--scroll::-webkit-scrollbar { display: none; }
.bf-tabs--scroll .bf-tab {
    flex: 0 0 auto;
    padding: 0 14px;
    white-space: nowrap;
    scroll-snap-align: start;
}
.bf-tabs--scroll .bf-tab:last-child { margin-right: 20px; }
.bf-tab {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--app-muted);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .15s;
}
.bf-tab:hover { background: var(--bf-hover); color: var(--app-text); text-decoration: none; }
.bf-tab > span {
    position: relative;
    padding: 14px 0;
}
.bf-tab.is-active { color: var(--app-text); font-weight: 700; }
.bf-tab.is-active > span::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: calc(100% + 8px);
    min-width: 56px;
    height: 4px;
    border-radius: 4px;
    background: var(--app-accent);
}

/* ── New briefs pill (X.com-style sticky floating counter + stacked avatars) ── */
.bf-newpill-wrap {
    position: sticky;
    top: 112px;
    z-index: 25;
    height: 0;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}
button.bf-newpill,
[dir] button.bf-newpill {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    height: 40px;
    margin-top: 12px;
    padding: 0 18px 0 12px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 9999px;
    background: var(--app-accent, #0B5FFF);
    color: #fff;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    letter-spacing: -.01em;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(11, 95, 255, .34), 0 2px 6px rgba(15, 23, 42, .14);
    cursor: pointer;
    box-sizing: border-box;
    transition: transform .18s cubic-bezier(.22, 1, .36, 1), box-shadow .18s ease, background-color .15s ease, opacity .16s ease;
    animation: bf-drop .28s cubic-bezier(.22, 1, .36, 1);
}
button.bf-newpill[x-cloak] { display: none !important; }
button.bf-newpill:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow: 0 10px 28px rgba(11, 95, 255, .42), 0 3px 8px rgba(15, 23, 42, .16);
}
button.bf-newpill:active:not(:disabled) { transform: translateY(0) scale(.98); }
button.bf-newpill:disabled { opacity: .88; cursor: progress; }
.bf-newpill__arrow {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 18px;
    flex-shrink: 0;
}
.bf-newpill__avatars {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.bf-newpill__avatar {
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    box-sizing: border-box;
    border: 2px solid var(--app-accent, #0B5FFF);
    background: #fff;
    margin-left: -8px;
    flex-shrink: 0;
}
.bf-newpill__avatar:first-child { margin-left: 0; }
.bf-newpill__text {
    display: inline-block;
    line-height: 1;
}
.bf-newpill__spin {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    animation: bf-spin .65s linear infinite;
    flex-shrink: 0;
}
/* Realtime Letterbox unread dot when activated via WebSocket */
.bf-tab.is-live-unread .bf-tab__label:not(:has(.bf-tab__flag))::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--app-accent);
    margin-right: 6px;
    vertical-align: middle;
}
@keyframes bf-drop { from { opacity: 0; transform: translateY(-10px) scale(.96); } }
@keyframes bf-spin { to { transform: rotate(360deg); } }

/* ── Composer ─────────────────────────────────────────────────────────── */
.bf-composer {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--bf-line);
    color: inherit;
}
.bf-composer:hover { text-decoration: none; color: inherit; }
.bf-composer__body { flex: 1; min-width: 0; }
.bf-composer__prompt {
    padding: 8px 0 14px;
    font-size: 19px;
    color: var(--app-muted);
}
.bf-composer:hover .bf-composer__prompt { color: var(--app-text-2); }
.bf-composer__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--bf-line);
}
.bf-composer__hints { display: flex; gap: 4px; }
.bf-composer__hints span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: var(--app-accent);
}
.bf-composer__hints .material-icons { font-size: 20px; }
.bf-composer:hover .bf-composer__hints span:hover { background: var(--app-accent-soft); }

/* ── Buttons, links, chips ────────────────────────────────────────────── */
.bf .bf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: filter .15s, background-color .15s;
}
.bf .bf-btn:hover { text-decoration: none; filter: brightness(.94); }
.bf .bf-btn--accent { background: var(--app-accent); color: #fff; }
.bf .bf-btn--accent:hover { color: #fff; }
.bf .bf-btn--inverse { background: var(--app-text); color: var(--app-surface); }
.bf .bf-btn--inverse:hover { color: var(--app-surface); }
.bf .bf-btn--ghost { background: transparent; border-color: var(--app-border-2); color: var(--app-text); }
.bf .bf-btn--ghost:hover { background: var(--bf-hover); color: var(--app-text); filter: none; }
.bf .bf-btn--sm { padding: 6px 14px; font-size: 14px; }
.bf .bf-btn--block { display: flex; width: 100%; margin-top: 10px; }

.bf-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--app-accent);
    font-weight: 600;
    cursor: pointer;
}
.bf-link:hover { text-decoration: underline; }
.bf-accent { color: var(--app-accent); }

.bf-avatar {
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 50%;
    object-fit: cover;
    background: var(--app-surface-3);
}
.bf-avatar--sm { width: 40px; height: 40px; }

/* ── Search ───────────────────────────────────────────────────────────── */
.bf-search {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0 16px;
    height: 44px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--app-surface-2);
    color: var(--app-muted);
    cursor: text;
}
.bf-search:focus-within {
    border-color: var(--app-accent);
    background: var(--app-surface);
    color: var(--app-accent);
}
.bf-search .material-icons { font-size: 20px; }
.bf-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--app-text);
    font-size: 15px;
}
.bf-search input::placeholder { color: var(--app-muted); }

.bf-mobile-tools {
    display: none;
    padding: 12px 16px;
    border-bottom: 1px solid var(--bf-line);
}
.bf-chips {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}
.bf-chips::-webkit-scrollbar { display: none; }
.bf-chip {
    flex: none;
    padding: 6px 12px;
    border: 1px solid var(--app-border-2);
    border-radius: 999px;
    background: transparent;
    color: var(--app-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.bf-chip.is-active { background: var(--app-accent); border-color: var(--app-accent); color: #fff; }

.bf-filterbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--bf-line);
    background: var(--app-accent-soft);
    color: var(--app-text-2);
    font-size: 14px;
}

/* ── Posts ────────────────────────────────────────────────────────────── */
.bf-feed { position: relative; transition: opacity .15s; }
.bf-feed.is-loading > .bf-post,
.bf-feed.is-loading > .bf-empty { display: none; }

.bf-post {
    display: flex;
    gap: 12px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--bf-line);
    cursor: pointer;
    transition: background-color .15s;
}
.bf-post:hover { background: var(--bf-hover); }
.bf-post:focus-within { outline: none; }
.bf-post__avatar { flex: none; }
.bf-post__body { flex: 1; min-width: 0; }

.bf-post__meta {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    font-size: 15px;
    line-height: 20px;
    white-space: nowrap;
}
.bf-post__name {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--app-text);
    font-weight: 700;
}
.bf-post__name:hover { color: var(--app-text); text-decoration: underline; }
.bf-badge { font-size: 15px; color: var(--app-accent); }
.bf-post__handle {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--app-muted);
}
.bf-dot, .bf-post__time { flex: none; color: var(--app-muted); }

.bf .bf-post__subject {
    margin: 4px 0 2px;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -.01em;
}
.bf .bf-post__link { color: var(--app-text); }
.bf .bf-post__link:hover { color: var(--app-text); text-decoration: none; }

.bf .bf-post__excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 4px 0 0;
    color: var(--app-text-2);
    font-size: 15px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.bf-post__tags { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; }
.bf-tag {
    padding: 0;
    border: 0;
    background: none;
    color: var(--app-accent);
    font-size: 14px;
    cursor: pointer;
}
.bf-tag:hover { text-decoration: underline; }

.bf-post__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 8px -8px 0;
    color: var(--app-muted);
}
.bf-action {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--app-muted);
    font-size: 13px;
    line-height: 1;
}
.bf-action .material-icons { font-size: 18px; }
.bf-action--share { cursor: pointer; margin-left: 8px; }
.bf-action--share:hover { background: var(--app-accent-soft); color: var(--app-accent); }
.bf-action--read {
    margin-left: auto;
    color: var(--app-accent);
    font-weight: 600;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .15s, transform .15s;
}
.bf-action--read .material-icons { font-size: 16px; }
.bf-post:hover .bf-action--read,
.bf-action--read:focus { opacity: 1; transform: none; text-decoration: none; color: var(--app-accent); }

/* ── Empty states ─────────────────────────────────────────────────────── */
.bf-empty {
    max-width: 420px;
    margin: 0 auto;
    padding: 56px 24px;
    text-align: center;
}
.bf-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: var(--app-accent-soft);
    color: var(--app-accent);
}
.bf-empty__icon .material-icons { font-size: 30px; }
.bf .bf-empty h3 {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--app-text);
}
.bf-empty p { margin: 0; color: var(--app-muted); font-size: 15px; line-height: 1.5; }
.bf-empty__cta { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 24px 0 8px; }
.bf .bf-empty__cta .bf-btn { padding: 12px 24px; }
.bf .bf-empty__tips {
    margin: 32px 0 0;
    padding: 0;
    list-style: none;
    text-align: left;
    border: 1px solid var(--bf-line);
    border-radius: var(--bf-radius);
}
.bf-empty__tips li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--app-text-2);
    font-size: 14px;
}
.bf-empty__tips li + li { border-top: 1px solid var(--bf-line); }
.bf-empty__tips .material-icons { font-size: 20px; color: var(--app-accent); }

/* ── Skeletons / load more ────────────────────────────────────────────── */
.bf-skeletons { flex-direction: column; }
.bf-skel {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--bf-line);
}
.bf-skel__a, .bf-skel__lines i {
    background: linear-gradient(90deg, var(--app-surface-2) 25%, var(--app-surface-3) 50%, var(--app-surface-2) 75%);
    background-size: 200% 100%;
    animation: bf-shimmer 1.2s infinite linear;
}
.bf-skel__a { width: 40px; height: 40px; flex: none; border-radius: 50%; }
.bf-skel__lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.bf-skel__lines i { display: block; height: 12px; border-radius: 6px; }
.bf-skel__lines i:nth-child(1) { width: 40%; }
.bf-skel__lines i:nth-child(2) { width: 85%; height: 16px; }
.bf-skel__lines i:nth-child(3) { width: 70%; }
@keyframes bf-shimmer { to { background-position: -200% 0; } }

.bf-more { text-align: center; }
.bf-more > .bf-link { padding: 18px; display: block; width: 100%; }
.bf-more > .bf-link:hover { background: var(--bf-hover); text-decoration: none; }
.bf-end {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 28px 16px 80px;
    color: var(--app-muted);
    font-size: 14px;
}
.bf-end .material-icons { font-size: 18px; color: var(--app-success); }

/* ── Right rail ───────────────────────────────────────────────────────── */
.bf-rail { flex: 0 0 340px; }
.bf-rail__inner {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 12px 0 32px;
}
.bf-rail__inner > .bf-search {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 0 0 6px var(--app-bg);
}

.bf-card {
    overflow: hidden;
    border: 1px solid var(--bf-line);
    border-radius: var(--bf-radius);
    background: var(--app-surface);
}
.bf .bf-card__title {
    margin: 0;
    padding: 12px 16px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--app-text);
}
.bf-card__note { margin: 0; padding: 0 16px 12px; color: var(--app-muted); font-size: 14px; }
.bf-card--cta { padding-bottom: 16px; }
.bf .bf-card--cta .bf-btn { margin-left: 16px; margin-right: 16px; width: calc(100% - 32px); }
.bf-card__more {
    display: block;
    padding: 16px;
    color: var(--app-accent);
    font-size: 15px;
}
.bf-card__more:hover { background: var(--bf-hover); text-decoration: none; color: var(--app-accent); }

.bf-trend {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 10px 16px;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
    transition: background-color .15s;
}
.bf-trend:hover { background: var(--bf-hover); }
.bf-trend.is-active { box-shadow: inset 3px 0 0 var(--app-accent); }
.bf-trend__rank, .bf-trend__count { color: var(--app-muted); font-size: 13px; }
.bf-trend__tag { color: var(--app-text); font-size: 15px; font-weight: 700; margin: 2px 0; }

.bf-who {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    transition: background-color .15s;
}
.bf-who:hover { background: var(--bf-hover); }
.bf-who__link { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; }
.bf-who__link:hover { text-decoration: none; color: inherit; }
.bf-who__text { display: flex; flex-direction: column; min-width: 0; }
.bf-who__name { color: var(--app-text); font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bf-who__link:hover .bf-who__name { text-decoration: underline; }
.bf-who__handle { color: var(--app-muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bf-rail__foot { padding: 0 16px; color: var(--app-muted); font-size: 13px; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1199.98px) {
    .bf-rail { display: none; }
    .bf-mobile-tools { display: block; }
    .bf-main { flex-basis: 640px; }
}
@media (max-width: 767.98px) {
    .bf-grid { padding: 0; }
    .bf-main { border-left: 0; border-right: 0; }
    .bf-composer__prompt { font-size: 17px; }
    .bf-action--read { opacity: 1; transform: none; }
    .bf-empty h3 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    .bf *, .bf *::before, .bf *::after { animation: none !important; transition: none !important; }
}

/* ── Letterbox "new briefs" flag ──────────────────────────────────────── */
.bf-tab__flag {
    position: absolute;
    top: 12px;
    right: -11px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--app-accent);
    box-shadow: 0 0 0 2px var(--app-surface);
    animation: bf-flag-in .3s ease-out;
}
@keyframes bf-flag-in { from { transform: scale(0); } }

/* ── Focus: no ring after a mouse click, a clear accent ring for keyboard users ── */
.bf button:focus,
.bf a:focus,
.bf [role="tab"]:focus { outline: none; box-shadow: none; }
.bf button:focus-visible,
.bf a:focus-visible,
.bf input:focus-visible { outline: 1.5px solid color-mix(in srgb, var(--app-accent) 45%, transparent); outline-offset: 2px; }
.bf .bf-tab:focus-visible { outline-offset: -4px; border-radius: 8px; }
.bf .bf-search input:focus-visible { outline: none; }   /* the pill already highlights */

/* ── All briefs (the author's own list) ───────────────────────────────── */
.bf-vis {
    display: inline-flex; align-items: center; gap: 3px;
    margin-left: 6px; padding: 1px 8px; border-radius: 999px;
    font-size: 12px; font-weight: 600; line-height: 18px;
}
.bf-vis .material-icons { font-size: 13px; line-height: 1; }
.bf-vis--public  { background: color-mix(in srgb, var(--app-success) 14%, transparent); color: var(--app-success); }
.bf-vis--private { background: color-mix(in srgb, var(--app-warning) 16%, transparent); color: var(--app-warning); }
a.bf-action, button.bf-action { cursor: pointer; color: inherit; }
a.bf-action:hover, button.bf-action:hover { background: var(--bf-hover); color: var(--app-text); text-decoration: none; }
.mb-count { margin-left: 4px; color: var(--app-muted); font-size: 12px; font-weight: 500; }
.mb-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 4px 16px 14px; text-align: center; }
.mb-stats b { display: block; font-size: 20px; font-weight: 800; color: var(--app-text); }
.mb-stats span { font-size: 13px; color: var(--app-muted); }
.mb-link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--app-text); font-size: 15px; font-weight: 500; transition: background-color .15s; }
.mb-link:hover { background: var(--bf-hover); color: var(--app-text); text-decoration: none; }
.mb-link .material-icons { width: 22px; font-size: 20px; color: var(--app-muted); text-align: center; }
.mb-link__count { margin-left: auto; color: var(--app-muted); font-size: 13px; font-weight: 400; }
.mb-link:last-child { padding-bottom: 16px; }

/* ── Notifications ─────────────────────────────────────────────────────── */
.nt-sub { color: var(--app-muted); font-size: 13px; }
.bf .bf-tabs a.bf-tab:hover { text-decoration: none; }
.bf .nt-group {
    margin: 0; padding: 14px 16px 6px;
    font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: var(--app-muted);
}
.nt-item {
    display: flex; gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--bf-line);
    transition: background-color .15s;
}
.nt-item[data-href] { cursor: pointer; }
.nt-item:hover { background: var(--bf-hover); }
.nt-item.is-new { background: color-mix(in srgb, var(--app-accent) 6%, transparent); box-shadow: inset 3px 0 0 var(--app-accent); }
.nt-icon {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 40px; height: 40px; border-radius: 50%;
}
.nt-icon .material-icons { font-size: 20px; }
.nt-icon--accent  { background: var(--app-accent-soft); color: var(--app-accent); }
.nt-icon--success { background: color-mix(in srgb, var(--app-success) 15%, transparent); color: var(--app-success); }
.nt-icon--info    { background: color-mix(in srgb, var(--app-info) 15%, transparent); color: var(--app-info); }
.nt-icon--muted   { background: var(--app-surface-3); color: var(--app-muted); }
.nt-icon--danger  { background: color-mix(in srgb, var(--app-danger) 13%, transparent); color: var(--app-danger); }
.nt-body { flex: 1; min-width: 0; }
.nt-kind { display: flex; align-items: center; gap: 4px; color: var(--app-muted); font-size: 13px; }
.nt-new {
    margin-left: 6px; padding: 0 7px; border-radius: 999px;
    background: var(--app-accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px;
}
.bf .nt-text { margin: 2px 0 0; color: var(--app-text); font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.nt-text a { color: var(--app-text); }
.nt-text a:hover { color: var(--app-accent); }
.nt-strong { font-weight: 700; }
.bf .nt-meta { margin: 2px 0 0; color: var(--app-muted); font-size: 13px; }
.nt-pager { display: flex; justify-content: space-between; padding: 16px; }
.bf .nt-note { margin: 0; padding: 0 16px; color: var(--app-muted); font-size: 14px; line-height: 1.5; }

/* ==========================================================================
   Discover (/i/discover) and writer pages (/{username}/briefs).
   Builds on feeds.css (.bf-*) and the --app-* theme tokens.
   ========================================================================== */

/* ── Discover ─────────────────────────────────────────────────────────── */
.dc-search { padding: 4px 16px 12px; }
.dc-intro {
    padding: 14px 16px;
    border-bottom: 1px solid var(--bf-line);
    color: var(--app-muted);
    font-size: 14px;
}
.dc-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
    transition: opacity .15s;
}
.dc-grid.is-loading { opacity: .45; pointer-events: none; }
.dc-empty { grid-column: 1 / -1; }

.dc-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--bf-line);
    border-radius: 16px;
    background: var(--app-surface);
    transition: border-color .15s, box-shadow .15s;
}
.dc-card:hover { border-color: var(--app-border-2); box-shadow: 0 4px 16px rgba(0, 0, 0, .05); }
.dc-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dc-card__who { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; }
.dc-card__who:hover { text-decoration: none; color: inherit; }
.dc-card__avatar { width: 48px; height: 48px; }
.dc-card__names { display: flex; flex-direction: column; min-width: 0; }
.dc-card__name {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--app-text);
    font-weight: 800;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dc-card__who:hover .dc-card__name { text-decoration: underline; }
.dc-card__handle { color: var(--app-muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bf .dc-card__btn { margin-top: 2px; }
.dc-card__btn .material-icons, .pp-actions .material-icons { font-size: 17px; line-height: 1; }

.dc-card__bio {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    color: var(--app-text-2);
    font-size: 14px;
    line-height: 1.45;
}
.dc-card__stats { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--app-muted); font-size: 13px; }
.dc-card__stats b { color: var(--app-text); font-weight: 700; }

.dc-card__latest {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: auto;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--app-surface-2);
    color: inherit;
    transition: background-color .15s;
}
a.dc-card__latest:hover { background: var(--app-surface-3); text-decoration: none; color: inherit; }
.dc-card__latest-label { color: var(--app-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.dc-card__latest-subject { color: var(--app-text); font-weight: 700; font-size: 14px; line-height: 1.35; }
.dc-card__latest--empty { color: var(--app-muted); font-size: 13px; }

.dc-read {
    display: flex;
    gap: 12px;
    padding: 10px 16px;
    color: inherit;
    transition: background-color .15s;
}
.dc-read:hover { background: var(--bf-hover); text-decoration: none; color: inherit; }
.dc-read__rank { flex: none; width: 18px; color: var(--app-muted); font-weight: 800; font-size: 16px; }
.dc-read__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dc-read__subject { color: var(--app-text); font-weight: 700; font-size: 14px; line-height: 1.35; }
.dc-read__meta { display: flex; align-items: center; gap: 6px; color: var(--app-muted); font-size: 13px; }
.dc-read__avatar { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }

/* ── Writer page ──────────────────────────────────────────────────────── */
.pp-top { padding-bottom: 8px; }
.pp-top .bf-header__title { font-size: 19px; }
.pp-top__count { color: var(--app-muted); font-size: 13px; }

.pp-banner {
    height: 180px;
    background:
        radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--app-accent) 55%, transparent), transparent 60%),
        radial-gradient(120% 140% at 100% 100%, color-mix(in srgb, #8b5cf6 45%, transparent), transparent 60%),
        var(--app-surface-3);
    background-size: cover;
    background-position: center;
}
.pp-hero__body { padding: 0 16px 16px; border-bottom: 1px solid var(--bf-line); }
.pp-hero__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.pp-avatar {
    width: 128px;
    height: 128px;
    margin-top: -64px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--app-surface-3);
    border: 4px solid var(--app-surface);
}
.pp-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding-top: 12px; }
.bf .pp-actions__icon { width: 38px; height: 38px; border: 1px solid var(--app-border-2); }
.pp-actions__icon .material-icons { font-size: 19px; }

.bf .pp-name {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 12px 0 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.015em;
    color: var(--app-text);
}
.pp-handle { color: var(--app-muted); font-size: 15px; }
.pp-heading { margin: 12px 0 0; color: var(--app-text); font-weight: 700; font-size: 15px; }
.pp-bio { margin: 6px 0 0; color: var(--app-text-2); font-size: 15px; line-height: 1.5; white-space: pre-line; }
.pp-bio .bb-bio-link,
.pp-bio .bb-bio-mention,
.br-author__bio .bb-bio-link,
.br-author__bio .bb-bio-mention {
    color: var(--app-accent, #2563eb);
    text-decoration: none;
    font-weight: 500;
}
.pp-bio .bb-bio-link:hover,
.pp-bio .bb-bio-mention:hover,
.br-author__bio .bb-bio-link:hover,
.br-author__bio .bb-bio-mention:hover {
    text-decoration: underline;
}
.pp-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; color: var(--app-muted); font-size: 14px; }
.pp-meta span { display: inline-flex; align-items: center; gap: 4px; }
.pp-meta .material-icons { font-size: 16px; line-height: 1; }
.pp-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; color: var(--app-muted); font-size: 14px; }
.pp-stats b { color: var(--app-text); font-weight: 700; }
.pp-tabs { border-bottom: 1px solid var(--bf-line); }
.pp-stats a { color: var(--app-muted); text-decoration: none; }
.pp-stats a:hover { color: var(--app-text); }
.pp-meta a { color: inherit; }
.pp-meta .badge { margin-left: 4px; }
.pp-bio--empty { color: var(--app-muted); }
.pp-private { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--app-surface-3); font-size: 11px; }
.pp-owner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.pp-owner .bf-btn .material-icons { font-size: 17px; }

/* Links tab: reuses the link cards of the Livewire `profile.links` component */
.pp-links { padding: 12px 16px 24px; }
.pp-links > .row { margin: 0; }
.pp-links > .row > div { flex: 1 1 100%; max-width: 100%; min-width: 0; }   /* full-width list, not shrink-to-fit */
.pp-links .link-card { background: var(--app-surface); border-color: var(--app-border-2); }
.pp-links .link-title { color: var(--app-text); }
.pp-links .social-icon-wrapper { background: var(--app-surface-3); }

@media (max-width: 767.98px) {
    .dc-grid { grid-template-columns: 1fr; padding: 12px; }
    .pp-banner { height: 130px; }
    .pp-avatar { width: 88px; height: 88px; margin-top: -44px; }
    .pp-actions .bf-btn { padding: 7px 14px; font-size: 14px; }
}

/* ==========================================================================
   Brief read page (/{username}/brief/{reference}). Builds on feeds.css (.bf-*)
   and the --app-* theme tokens, so light and dark mode both work.
   ========================================================================== */

.br-header { padding-bottom: 12px; }

/* ── Author-only stats strip ──────────────────────────────────────────── */
.br-owner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--bf-line);
    background: var(--app-surface-2);
    font-size: 14px;
    color: var(--app-muted);
}
.br-owner__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--app-danger) 14%, transparent);
    color: var(--app-danger);
    font-weight: 600;
    font-size: 13px;
}
.br-owner__badge.is-public {
    background: color-mix(in srgb, var(--app-success) 14%, transparent);
    color: var(--app-success);
}
.br-owner__badge .material-icons { font-size: 15px; }
.br-stat b { color: var(--app-text); font-weight: 700; }
.br-owner__link {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    color: var(--app-accent);
    font-weight: 600;
}
.br-owner__link .material-icons { font-size: 16px; }
.br-owner__link:hover { color: var(--app-accent); }

/* ── Article ──────────────────────────────────────────────────────────── */
.br-article { padding: 24px 32px 8px; }
.br-article--themed {
    margin: 16px 20px 12px;
    padding: 28px 32px 16px;
    background: var(--br-card);
    color: var(--br-text);
    border: 1px solid var(--br-border);
    border-radius: var(--br-radius, 12px);
    font-family: var(--br-font, inherit);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .03);
    border-top: var(--br-top-bar, none) solid;
    border-top-width: 4px;
    border-top-color: var(--br-top-bar, var(--br-border));
}
.br-article--themed .br-byline__link { color: var(--br-heading) !important; }
.br-article--themed .br-byline__meta,
.br-article--themed .br-actions .bf-action { color: var(--br-muted); }
.br-article--themed .br-title {
    color: var(--br-heading) !important;
    font-family: var(--br-heading-font, inherit);
}
.br-article--themed .br-body {
    color: var(--br-text);
    font-family: var(--br-font, inherit);
}
.br-article--themed .br-body h1,
.br-article--themed .br-body h2,
.br-article--themed .br-body h3,
.br-article--themed .br-body h4 {
    color: var(--br-heading);
    font-family: var(--br-heading-font, inherit);
}
.br-article--themed .br-body > h4:first-child {
    margin-top: 0;
    margin-bottom: .5em;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--br-accent);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.br-article--themed .br-body a { color: var(--br-link); }
.br-article--themed .br-body strong { color: var(--br-heading); }
.br-article--themed .br-body blockquote {
    border-left-color: var(--br-accent);
    color: var(--br-muted);
}
.br-article--themed .br-body hr { border-top-color: var(--br-border); }
.br-article--themed .br-actions { border-top-color: var(--br-border); }
@media (max-width: 767.98px) {
    .br-article--themed { margin: 12px 12px 8px; padding: 20px 18px 10px; }
}

.br-byline { display: flex; align-items: center; gap: 12px; }
.br-byline__avatar { width: 48px; height: 48px; }
.br-byline__text { min-width: 0; }
.br-byline__name { display: flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 700; }
.bf .br-byline__link { color: var(--app-text); }
.bf .br-byline__link:hover { color: var(--app-text); text-decoration: underline; }
.br-byline__meta { display: flex; flex-wrap: wrap; gap: 4px; color: var(--app-muted); font-size: 14px; }

.bf .br-title {
    margin: 20px 0 8px;
    font-size: clamp(22px, 2.4vw, 28px);
    font-weight: 750;
    line-height: 1.24;
    letter-spacing: -.022em;
    color: var(--app-text);
    overflow-wrap: anywhere;
}

/* Reading typography */
.br-body {
    margin-top: 20px;
    color: var(--app-text);
    font-size: 18px;
    line-height: 1.75;
    overflow-wrap: anywhere;
}
.br-body > :first-child { margin-top: 0; }
.br-body p { margin: 0 0 1.25em; }
.br-body h1, .br-body h2, .br-body h3, .br-body h4 {
    margin: 1.8em 0 .6em;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -.015em;
    color: var(--app-text);
}
.br-body h1 { font-size: 1.6em; }
.br-body h2 { font-size: 1.4em; }
.br-body h3 { font-size: 1.2em; }
.br-body h4 { font-size: 1.05em; }
.br-body a { color: var(--app-accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.br-body strong { font-weight: 700; color: var(--app-text); }
.br-body ul, .br-body ol { margin: 0 0 1.25em; padding-left: 1.4em; list-style: revert; }
.br-body li { margin: .35em 0; }
.br-body blockquote {
    margin: 1.6em 0;
    padding: .2em 0 .2em 1.1em;
    border-left: 3px solid var(--app-accent);
    color: var(--app-text-2);
    font-size: 1.05em;
    font-style: italic;
}
.br-body img, .br-body video {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.6em auto;
    border-radius: 14px;
    border: 1px solid var(--bf-line);
}
.br-body figure { margin: 1.6em auto; max-width: 100%; }
.br-body figure.image { text-align: center; }
.br-body figure.image img { width: 100%; height: auto; margin: 0 auto; }
.br-body figure.image.image_resized { max-width: 100%; display: block; box-sizing: border-box; }
.br-body figure.image.image_resized img { width: 100%; height: auto; }
.br-body figure.image-style-block-align-left:not([style*="margin-left"]) { margin-left: 0; margin-right: auto; }
.br-body figure.image-style-block-align-right { margin-left: auto; margin-right: 0; }
.br-body figure.image-style-align-center { margin-left: auto; margin-right: auto; }
.br-body figure.image-style-align-left { float: left; margin: 0.4em 1.4em 1em 0; max-width: 65%; }
.br-body figure.image-style-align-right,
.br-body figure.image-style-side { float: right; margin: 0.4em 0 1em 1.4em; max-width: 65%; }
.br-body::after { content: ""; display: table; clear: both; }
@media (max-width: 600px) {
    .br-body figure.image-style-align-left,
    .br-body figure.image-style-align-right,
    .br-body figure.image-style-side {
        float: none;
        margin: 1.4em auto;
        max-width: 100%;
    }
}
.br-body figcaption { margin-top: 0.55em; text-align: center; color: var(--app-muted); font-size: 14px; }
.br-body hr { margin: 2.4em auto; width: 80px; border: 0; border-top: 2px solid var(--bf-line); }
.br-body :not(pre) > code {
    padding: .15em .4em;
    border-radius: 6px;
    background: var(--app-surface-2);
    font-size: .88em;
}
.br-body pre {
    margin: 1.6em 0;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid var(--bf-line);
    background: var(--app-surface-2);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: auto;
}
.br-body pre code.hljs { padding: 0; background: transparent; }
.br-body table {
    display: block;
    width: 100%;
    margin: 1.6em 0;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 15px;
}
.br-body th, .br-body td { padding: 10px 14px; border: 1px solid var(--bf-line); text-align: left; }
.br-body th { background: var(--app-surface-2); font-weight: 700; }

/* Attachments */
.br-files { display: grid; gap: 10px; margin: 8px 0 20px; }
.br-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--bf-line);
    border-radius: 14px;
    color: var(--app-text);
    transition: background-color .15s;
}
.br-file:hover { background: var(--bf-hover); color: var(--app-text); text-decoration: none; }
.br-file__icon { color: var(--app-accent); }
.br-file__text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.br-file__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-file__meta { color: var(--app-muted); font-size: 13px; }

.br-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.br-tags .bf-chip:hover { border-color: var(--app-accent); color: var(--app-accent); text-decoration: none; }

.br-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 -8px;
    padding: 10px 0;
    border-top: 1px solid var(--bf-line);
}
.br-actions__spacer { flex: 1; }
.br-actions .bf-action { font-size: 14px; }

/* ── Subscribe call to action ─────────────────────────────────────────── */
.br-cta {
    margin: 8px 32px 28px;
    padding: 28px 24px;
    border: 1px solid var(--bf-line);
    border-radius: 20px;
    background:
        radial-gradient(120% 140% at 0% 0%, var(--app-accent-soft), transparent 60%),
        var(--app-surface);
    text-align: center;
}
.br-cta__avatar { width: 56px; height: 56px; margin-bottom: 12px; }
.bf .br-cta__title {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--app-text);
}
.br-cta__text { margin: 0 auto 18px; max-width: 400px; color: var(--app-muted); font-size: 15px; }
.bf .br-cta__link { color: var(--app-accent); }
.bf .br-cta__btn { padding: 12px 32px; }
.br-cta__done .material-icons, .br-author .material-icons { font-size: 18px; }

/* ── More from the author ─────────────────────────────────────────────── */
.br-more-card {
    padding: 14px 12px 10px;
}
.br-more-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 6px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--bf-line);
}
.bf .br-more-card__title {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -.01em;
    color: var(--app-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.br-more-card__author {
    font-weight: 700;
    color: var(--app-text);
}
.bf .br-more-card__all {
    font-size: 12px;
    font-weight: 600;
    color: var(--app-accent);
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    transition: opacity .15s ease;
}
.bf .br-more-card__all:hover {
    opacity: .8;
    text-decoration: underline;
}
.br-more__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.br-more__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 8px;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
    transition: background-color .16s ease, transform .16s ease;
    position: relative;
}
.br-more__item + .br-more__item::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 8px;
    right: 8px;
    height: 1px;
    background: var(--bf-line);
    opacity: .65;
    transition: opacity .15s ease;
}
.br-more__item:hover {
    background: var(--bf-hover);
    color: inherit;
    text-decoration: none;
}
.br-more__item:hover::before,
.br-more__item:hover + .br-more__item::before {
    opacity: 0;
}
.br-more__subject {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--app-text);
    font-weight: 650;
    font-size: 14px;
    line-height: 1.38;
    letter-spacing: -.01em;
    transition: color .15s ease;
}
.br-more__item:hover .br-more__subject {
    color: var(--app-accent);
}
.br-more__excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--app-text-2);
    font-size: 12.5px;
    line-height: 1.48;
    opacity: .9;
}
.br-more__meta {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    color: var(--app-muted);
    font-size: 11.5px;
    margin-top: 2px;
}
.br-more__dot {
    opacity: .6;
}

.br-more--inline { display: none; border-top: 1px solid var(--bf-line); padding: 14px 12px 36px; }
.bf .br-more__title { margin: 0 0 8px; padding: 0 8px; font-size: 14px; font-weight: 500; letter-spacing: -.01em; color: var(--app-muted); }

/* ── Author card ──────────────────────────────────────────────────────── */
.br-author { padding: 16px; }
.br-author__head { display: flex; align-items: center; gap: 12px; color: inherit; }
.br-author__head:hover { text-decoration: none; color: inherit; }
.br-author__avatar { width: 56px; height: 56px; }
.br-author__name { display: flex; align-items: center; gap: 4px; color: var(--app-text); font-weight: 800; font-size: 17px; }
.br-author__head:hover .br-author__name { text-decoration: underline; }
.br-author__handle { display: block; color: var(--app-muted); font-size: 14px; }
.br-author__bio { margin: 12px 0 0; color: var(--app-text-2); font-size: 14px; line-height: 1.5; }
.bf .br-author .bf-btn--block { margin: 14px 0 0; width: 100%; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1199.98px) {
    .br-more--inline { display: block; }
}
@media (max-width: 767.98px) {
    .br-article { padding: 18px 16px 4px; }
    .br-body { font-size: 17px; }
    .br-cta { margin: 8px 16px 24px; }
    .br-owner { padding: 10px 16px; }
    .br-owner__link { margin-left: 0; }
}

/* highlight.js light theme on a dark page */
html[data-theme="dark"] .br-body .hljs { color: var(--app-text); }

/* ==========================================================================
   Drafts (/brief/drafts) & Scheduled (/brief/schedules) list pages
   Built on --app-* theme tokens (assets/css/theme.css) for light & dark mode.
   ========================================================================== */

.bl-page {
    min-height: 100%;
    color: var(--app-text);
    background: var(--app-bg);
    overflow-x: hidden;
}

/* ── Sticky header + workspace tabs ──────────────────────────────────── */
.bl-header {
    position: sticky;
    top: 0;
    z-index: 25;
    background: color-mix(in srgb, var(--app-surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--app-border);
}

.bl-header__inner {
    max-width: var(--app-max-w);
    margin: 0 auto;
    padding: 16px 24px 0;
}

.bl-header__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.bl-header__lead {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    flex: 1 1 220px;
}

[dir] .bl-iconbtn {
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--app-text-2);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .15s, color .15s;
}

[dir] .bl-iconbtn:hover {
    background: var(--app-surface-2);
    color: var(--app-text);
    text-decoration: none;
}

.bl-iconbtn .material-icons {
    font-size: 20px;
    line-height: 1;
}

.bl-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bl-header__title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.015em;
    line-height: 1.2;
    color: var(--app-text);
}

.bl-count-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    color: var(--app-text-2);
}

.bl-header__sub {
    margin: 4px 0 0;
    font-size: 13.5px;
    color: var(--app-muted);
    line-height: 1.4;
}

[dir] .bl-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 0;
    background: var(--app-accent);
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--app-accent) 26%, transparent);
    transition: background-color .15s, transform .12s;
}

[dir] .bl-cta:hover,
[dir] .bl-cta:focus-visible {
    background: var(--app-accent-hover);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.bl-cta .material-icons {
    font-size: 18px;
}

.bl-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}
.bl-tabs::-webkit-scrollbar { display: none; }

.bl-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 14px 13px;
    font-size: 14px;
    font-weight: 600;
    color: var(--app-muted);
    text-decoration: none;
    white-space: nowrap;
    border-radius: 8px 8px 0 0;
    transition: color .15s, background-color .15s;
}

.bl-tab:hover {
    color: var(--app-text);
    background: color-mix(in srgb, var(--app-text) 4%, transparent);
    text-decoration: none;
}

.bl-tab.is-active {
    color: var(--app-text);
    font-weight: 700;
}

.bl-tab.is-active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--app-accent);
}

.bl-tab__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: var(--app-surface-2);
    color: var(--app-text-2);
}

.bl-tab.is-active .bl-tab__badge {
    background: var(--app-accent-soft);
    color: var(--app-accent);
}

/* ── Main content wrap & grid ────────────────────────────────────────── */
.bl-wrap {
    max-width: var(--app-max-w);
    margin: 0 auto;
    padding: 24px 24px 72px;
}

.bl-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}

/* ── Brief card ──────────────────────────────────────────────────────── */
.bl-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    padding: 18px 20px 15px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 16px;
    box-shadow: var(--app-shadow);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.bl-card:hover {
    border-color: var(--app-border-2);
    box-shadow: var(--app-shadow-md);
}

.bl-card--error {
    border-color: color-mix(in srgb, var(--app-danger) 42%, var(--app-border));
}

.bl-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.bl-card__who {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.bl-avatar-link {
    flex-shrink: 0;
    display: inline-flex;
    border-radius: 50%;
}

.bl-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
}

.bl-who-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bl-who-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--app-text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bl-who-name:hover {
    color: var(--app-accent);
    text-decoration: underline;
}

.bl-who-handle {
    font-size: 12px;
    color: var(--app-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bl-card__controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.bl-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

.bl-badge .material-icons {
    font-size: 13px;
    line-height: 1;
}

.bl-badge--draft {
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    color: var(--app-text-2);
}

.bl-badge--scheduled {
    background: var(--app-accent-soft);
    color: var(--app-accent);
}

.bl-badge--warning {
    background: color-mix(in srgb, var(--app-warning) 16%, transparent);
    color: var(--app-warning);
}

.bl-badge--danger {
    background: color-mix(in srgb, var(--app-danger) 14%, transparent);
    color: var(--app-danger);
}

.bl-badge--public {
    background: color-mix(in srgb, var(--app-success) 14%, transparent);
    color: var(--app-success);
}

/* Overflow dropdown menu */
[dir] .bl-menu {
    min-width: 196px;
    padding: 6px;
    border-radius: 12px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    box-shadow: 0 10px 28px rgba(15, 18, 22, .14), var(--app-shadow);
}

[dir] .bl-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--app-text);
    background: transparent;
}

[dir] .bl-menu .dropdown-item:hover,
[dir] .bl-menu .dropdown-item:focus {
    background: var(--app-surface-2);
    color: var(--app-text);
}

[dir] .bl-menu .dropdown-item .material-icons {
    font-size: 17px;
    color: var(--app-muted);
}

[dir] .bl-menu .dropdown-item.is-danger {
    color: var(--app-danger);
}
[dir] .bl-menu .dropdown-item.is-danger .material-icons {
    color: var(--app-danger);
}

[dir] .bl-menu .dropdown-divider {
    margin: 5px 4px;
    border-top-color: var(--app-border);
}

/* Body: title + excerpt */
.bl-card__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.bl-card__subject {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.01em;
    line-height: 1.32;
    color: var(--app-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bl-card__subject a {
    color: inherit;
    text-decoration: none;
}

.bl-card__subject a:hover {
    color: var(--app-accent);
}

.bl-card__subject.is-untitled a {
    color: var(--app-muted);
    font-style: italic;
}

.bl-card__excerpt {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--app-text-2);
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bl-card__excerpt--empty {
    color: var(--app-muted);
    font-style: italic;
}

/* Publish error callout */
.bl-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--app-danger) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--app-danger) 24%, transparent);
    color: var(--app-danger);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
}

.bl-alert .material-icons {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Schedule time highlight bar */
.bl-sendbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 9px 12px;
    border-radius: 10px;
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    font-size: 12.5px;
}

.bl-sendbar__when {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 700;
    color: var(--app-text);
}

.bl-sendbar__when .material-icons {
    font-size: 16px;
    color: var(--app-accent);
}

.bl-sendbar__rel {
    font-weight: 600;
    color: var(--app-muted);
    white-space: nowrap;
}

/* Chips row */
.bl-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.bl-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--app-text-2);
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    max-width: 100%;
}

.bl-chip .material-icons {
    font-size: 14px;
    color: var(--app-muted);
}

.bl-chip--muted {
    color: var(--app-muted);
    font-weight: 500;
}

.bl-chip--public {
    color: var(--app-success);
    background: color-mix(in srgb, var(--app-success) 12%, transparent);
    border-color: color-mix(in srgb, var(--app-success) 24%, transparent);
}
.bl-chip--public .material-icons {
    color: var(--app-success);
}

/* Card footer */
.bl-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 12px;
    margin-top: auto;
    border-top: 1px solid var(--app-border);
}

.bl-card__time {
    font-size: 12.5px;
    color: var(--app-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bl-card__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

[dir] .bl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .15s, border-color .15s, color .15s;
}

[dir] .bl-btn .material-icons {
    font-size: 15px;
}

[dir] .bl-btn--ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--app-text-2);
}

[dir] .bl-btn--ghost:hover {
    background: var(--app-surface-2);
    color: var(--app-text);
    text-decoration: none;
}

[dir] .bl-btn--soft {
    background: var(--app-accent-soft);
    border: 1px solid color-mix(in srgb, var(--app-accent) 20%, transparent);
    color: var(--app-accent);
}

[dir] .bl-btn--soft:hover {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
    text-decoration: none;
}

/* Pagination & empty state */
.bl-pager {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

.bl-empty-wrap {
    padding: 20px 0;
}

/* ── Focus accessibility ─────────────────────────────────────────────── */
.bl-page a:focus-visible,
.bl-page button:focus-visible {
    outline: 1.5px solid color-mix(in srgb, var(--app-accent) 45%, transparent);
    outline-offset: 2px;
}

/* ── Responsive breakpoints ──────────────────────────────────────────── */
@media (max-width: 899.98px) {
    .bl-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 767.98px) {
    .bl-header__inner {
        padding: 14px 16px 0;
    }
    .bl-wrap {
        padding: 16px 14px 84px;
    }
    .bl-header__title {
        font-size: 20px;
    }
    .bl-card {
        padding: 16px;
        border-radius: 14px;
    }
}

@media (max-width: 479.98px) {
    .bl-header__sub {
        font-size: 12.5px;
    }
    [dir] .bl-cta {
        padding: 7px 12px;
        font-size: 12.5px;
    }
}

/* ── Draft preview page (/brief/draft/{reference}) ───────────────────── */
.dp-topbar {
    justify-content: space-between;
    gap: 12px;
    padding-right: 16px;
}
.dp-topbar__left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.dp-topbar__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
[dir] .dp-delbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--app-danger) 28%, var(--app-border));
    background: transparent;
    color: var(--app-danger);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
[dir] .dp-delbtn:hover {
    background: color-mix(in srgb, var(--app-danger) 10%, transparent);
    border-color: var(--app-danger);
}
[dir] .dp-delbtn .material-icons { font-size: 16px; }

.dp-empty-body {
    padding: 28px 20px;
    text-align: center;
    border: 1px dashed var(--app-border-2);
    border-radius: 12px;
    background: var(--app-surface-2);
    color: var(--app-muted);
    font-size: 14px;
}
.dp-empty-body p { margin: 0 0 12px; }

.dp-other {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    border-top: 1px solid var(--app-border);
    text-decoration: none;
    color: inherit;
    transition: background-color .15s;
}
.dp-other:hover {
    background: color-mix(in srgb, var(--app-text) 3.5%, transparent);
    text-decoration: none;
    color: inherit;
}
.dp-other__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--app-text);
    line-height: 1.35;
}
.dp-other__excerpt {
    font-size: 13px;
    color: var(--app-muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dp-other__meta {
    font-size: 12px;
    color: var(--app-muted);
}
.dp-footer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 20px 28px;
    border-top: 1px solid var(--app-border);
}
@media (max-width: 767.98px) {
    .dp-delbtn span { display: none; }
    [dir] .dp-delbtn { padding: 7px 9px; }
}

/* ── Timeline (/brief/timeline) ──────────────────────────────────────── */
.tl-wrap {
    max-width: var(--app-max-w-wide);
    margin: 0 auto;
    padding: 20px 24px 72px;
}

.tl-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.tl-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tl-seg {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
}

[dir] .tl-seg__btn {
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--app-muted);
    padding: 5px 11px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .14s, color .14s;
}

[dir] .tl-seg__btn:hover {
    color: var(--app-text);
    background: var(--app-surface-2);
}

[dir] .tl-seg__btn.is-active {
    background: var(--app-accent-soft);
    color: var(--app-accent);
    font-weight: 700;
}

.tl-select {
    height: 34px;
    padding: 0 28px 0 11px;
    border-radius: 10px;
    border: 1px solid var(--app-border);
    background-color: var(--app-surface);
    color: var(--app-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238899a6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.tl-select:focus {
    outline: none;
    border-color: var(--app-accent);
}

.tl-search-wrap {
    position: relative;
    flex: 1 1 220px;
    max-width: 300px;
    min-width: 180px;
}

.tl-search-wrap .material-icons {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--app-muted);
    pointer-events: none;
}

.tl-search {
    width: 100%;
    height: 36px;
    padding: 0 32px 0 34px;
    border-radius: 999px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 13.5px;
    transition: border-color .15s, box-shadow .15s;
}

.tl-search::placeholder {
    color: var(--app-muted);
}

.tl-search:focus {
    outline: none;
    border-color: var(--app-accent);
    box-shadow: 0 0 0 3px var(--app-accent-soft);
}

[dir] .tl-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--app-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

[dir] .tl-search-clear:hover {
    background: var(--app-surface-2);
    color: var(--app-text);
}
.tl-search-clear .material-icons {
    position: static;
    transform: none;
    font-size: 16px;
    pointer-events: auto;
}

.tl-surface {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 16px;
    box-shadow: var(--app-shadow);
    overflow: hidden;
}

.tl-table-wrap {
    overflow-x: auto;
    transition: opacity .15s;
}

.tl-loading {
    opacity: .55;
    pointer-events: none;
}

.tl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.tl-table thead th {
    padding: 11px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--app-muted);
    background: var(--app-surface-2);
    border-bottom: 1px solid var(--app-border);
    white-space: nowrap;
    text-align: left;
}
.tl-table thead th:first-child,
.tl-table tbody td:first-child {
    padding-left: 18px;
}
.tl-table thead th:last-child,
.tl-table tbody td:last-child {
    padding-right: 16px;
}

.tl-table thead th.is-num,
.tl-table tbody td.is-num {
    text-align: right;
}

.tl-table thead th.is-center,
.tl-table tbody td.is-center {
    text-align: center;
}

.tl-sort {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: inherit;
    text-decoration: none;
}

.tl-sort:hover {
    color: var(--app-text);
    text-decoration: none;
}

.tl-sort .material-icons {
    font-size: 15px;
    opacity: .65;
}

.tl-table tbody tr {
    border-bottom: 1px solid var(--app-border);
    transition: background-color .12s;
}

.tl-table tbody tr:last-child {
    border-bottom: 0;
}

.tl-table tbody tr:hover {
    background: color-mix(in srgb, var(--app-text) 2.5%, transparent);
}

.tl-table tbody td {
    padding: 12px 10px;
    vertical-align: middle;
    color: var(--app-text);
}

.tl-title-cell {
    min-width: 190px;
    max-width: 310px;
}

.tl-subject-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.tl-subject {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--app-text);
    text-decoration: none;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tl-subject:hover {
    color: var(--app-accent);
    text-decoration: none;
}

.tl-subline {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
    font-size: 12px;
    color: var(--app-muted);
}

.tl-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.tl-dot--public { background: var(--app-success); }
.tl-dot--private { background: var(--app-warning); }

.tl-inline-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    color: var(--app-muted);
    text-decoration: none;
    flex-shrink: 0;
}
.tl-inline-link:hover {
    background: var(--app-surface-2);
    color: var(--app-accent);
    text-decoration: none;
}
.tl-inline-link .material-icons { font-size: 15px; }

.tl-num {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--app-text);
}

.tl-num--muted {
    font-weight: 500;
    color: var(--app-muted);
}

.tl-num-sub {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--app-muted);
}

.tl-seg-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    color: var(--app-text-2);
    white-space: nowrap;
}
.tl-seg-tag--muted {
    color: var(--app-muted);
    font-weight: 500;
}

.tl-status-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tl-status-note {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11.5px;
    color: var(--app-muted);
    white-space: nowrap;
}
.tl-status-note .material-icons { font-size: 12px; }
.tl-status-note--warn { color: var(--app-warning); font-weight: 600; }
.tl-status-note--err {
    color: var(--app-danger);
    max-width: 170px;
    white-space: normal;
    line-height: 1.3;
}

@media (max-width: 899.98px) {
    .tl-wrap {
        padding: 16px 14px 84px;
    }
    .tl-search-wrap {
        max-width: none;
    }
    .tl-surface {
        background: transparent;
        border: 0;
        box-shadow: none;
        overflow: visible;
    }
    .tl-table,
    .tl-table tbody {
        display: block;
    }
    .tl-table thead {
        display: none;
    }
    .tl-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .tl-table tbody tr {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px 8px;
        padding: 15px 16px;
        background: var(--app-surface);
        border: 1px solid var(--app-border);
        border-radius: 14px;
        box-shadow: var(--app-shadow);
    }
    .tl-table tbody td {
        padding: 0;
        border: 0;
    }
    .tl-table tbody td.tl-title-cell {
        grid-column: 1 / -1;
        min-width: 0;
        max-width: none;
        padding-right: 36px;
    }
    .tl-subject {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    .tl-table tbody td.is-num {
        text-align: left;
    }
    .tl-table tbody td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 10.5px;
        font-weight: 700;
        letter-spacing: .04em;
        text-transform: uppercase;
        color: var(--app-muted);
        margin-bottom: 2px;
    }
    .tl-table tbody td.tl-seg-col {
        text-align: left;
    }
    .tl-table tbody td.tl-status-col {
        grid-column: 1 / -1;
        text-align: left;
        padding-top: 8px;
        border-top: 1px solid var(--app-border);
    }
    .tl-status-cell {
        align-items: flex-start;
    }
    .tl-table tbody tr {
        position: relative;
    }
    .tl-table tbody td.tl-actions-col {
        position: absolute;
        top: 12px;
        right: 10px;
    }
}

/* ==========================================================================
   Brief Analytics (/{username}/brief/{reference}/analytics)
   Unified with --app-* tokens, radii, shadows, and .bl-* button/card system.
   ========================================================================== */
.ba-page {
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    color: var(--app-text);
}

/* ── Hero summary card ──────────────────────────────────────────────── */
.ba-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 20px 22px;
    margin-bottom: 16px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow);
}
.ba-header-main {
    flex: 1;
    min-width: 240px;
}
.ba-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--app-accent);
    margin-bottom: 6px;
}
.ba-sep { color: var(--app-border-2); }
.ba-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.ba-title {
    margin: 0;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.015em;
    line-height: 1.25;
    color: var(--app-text);
}
.ba-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: var(--app-radius-pill);
    background: color-mix(in srgb, var(--app-success) 14%, transparent);
    color: var(--app-success);
    white-space: nowrap;
}
.ba-status-pill.is-scheduled {
    background: var(--app-accent-soft);
    color: var(--app-accent);
}
.ba-status-pill.is-draft {
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    color: var(--app-text-2);
}
.ba-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.ba-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--app-muted);
    margin-top: 6px;
}
.ba-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
[dir] .ba-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    border-radius: var(--app-radius-pill);
    font-size: 13px;
    font-weight: 700;
    border: 1px solid var(--app-border);
    background: var(--app-surface-2);
    color: var(--app-text);
    white-space: nowrap;
    text-decoration: none;
    transition: transform .15s ease, border-color .15s ease, background-color .15s ease;
}
[dir] .ba-btn:hover {
    text-decoration: none;
    color: var(--app-text);
    background: var(--app-surface-3);
    border-color: var(--app-border-2);
    transform: translateY(-1px);
}
.ba-btn .material-icons { font-size: 16px; }
[dir] .ba-btn--primary {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--app-accent) 26%, transparent);
}
[dir] .ba-btn--primary:hover {
    background: var(--app-accent-hover);
    border-color: var(--app-accent-hover);
    color: #fff;
}

/* ── Section label / card head ──────────────────────────────────────── */
.ba-section-label {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--app-muted);
    margin-bottom: 12px;
}
.ba-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.ba-panel-head h2 {
    margin: 0;
    font-size: 15.5px;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--app-text);
}

/* ── KPI grid ───────────────────────────────────────────────────────── */
.ba-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
@media (max-width: 991.98px) {
    .ba-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 479.98px) {
    .ba-kpi-grid { grid-template-columns: minmax(0, 1fr); }
}
.ba-kpi-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    padding: 18px 20px;
    box-shadow: var(--app-shadow);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ba-kpi-card:hover {
    border-color: var(--app-border-2);
    box-shadow: var(--app-shadow-md);
}
.ba-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--app-muted);
}
.ba-kpi-ic {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--app-accent-soft);
    color: var(--app-accent);
    flex-shrink: 0;
}
.ba-kpi-ic .material-icons { font-size: 18px; }
.ba-kpi-ic--green {
    background: color-mix(in srgb, var(--app-success) 14%, transparent);
    color: var(--app-success);
}
.ba-kpi-ic--muted {
    background: var(--app-surface-2);
    color: var(--app-muted);
}
.ba-kpi-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--app-text);
    line-height: 1.1;
    margin-top: 6px;
}
.ba-kpi-sub-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}
.ba-kpi-sub {
    font-size: 12.5px;
    color: var(--app-muted);
}
.ba-kpi-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--app-radius-pill);
}
.ba-kpi-badge.up {
    background: color-mix(in srgb, var(--app-success) 14%, transparent);
    color: var(--app-success);
}
.ba-kpi-badge.down {
    background: color-mix(in srgb, var(--app-danger) 14%, transparent);
    color: var(--app-danger);
}

/* ── Layout helpers & panels ────────────────────────────────────────── */
.ba-two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
@media (max-width: 899.98px) {
    .ba-two-col { grid-template-columns: minmax(0, 1fr); }
}
.ba-mb { margin-bottom: 16px; }
.ba-panel {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    padding: 20px;
    box-shadow: var(--app-shadow);
}

/* ── Chart ──────────────────────────────────────────────────────────── */
.ba-chart-wrap { position: relative; width: 100%; }
.ba-chart-legend {
    display: flex;
    gap: 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--app-muted);
}
.ba-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--app-radius-pill);
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
}

/* ── Engagement funnel ──────────────────────────────────────────────── */
.ba-funnel-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ba-funnel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
}
.ba-funnel-item-label {
    flex: 0 0 auto;
    min-width: 78px;
    font-weight: 600;
    color: var(--app-text-2);
}
.ba-funnel-bar-track {
    flex: 1;
    height: 7px;
    border-radius: var(--app-radius-pill);
    background: var(--app-surface-2);
    overflow: hidden;
}
.ba-funnel-bar-fill {
    height: 100%;
    border-radius: inherit;
    transition: width .25s ease;
}
.ba-funnel-item-val {
    font-weight: 700;
    color: var(--app-text);
    min-width: 2.5rem;
    text-align: right;
}
.ba-funnel-item-pct {
    font-size: 12px;
    font-weight: 700;
    color: var(--app-text-2);
    min-width: 3rem;
    text-align: right;
}
.ba-funnel-item-pct.is-zero {
    color: var(--app-muted);
    font-weight: 600;
}

/* ── Device & Location rows ─────────────────────────────────────────── */
.ba-device-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--app-border);
}
.ba-device-row:last-child { border-bottom: none; }
.ba-device-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--app-text);
    min-width: 100px;
}
.ba-muted-tag {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--app-muted);
    margin-left: 4px;
}
.ba-bar-track {
    flex: 1;
    height: 6px;
    border-radius: var(--app-radius-pill);
    background: var(--app-surface-2);
    overflow: hidden;
}
.ba-bar-fill {
    height: 100%;
    border-radius: var(--app-radius-pill);
    transition: width .6s cubic-bezier(.2,.7,.2,1);
}
.ba-device-pct {
    font-size: 12.5px;
    color: var(--app-muted);
    min-width: 38px;
    text-align: right;
}
.ba-device-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--app-text);
    min-width: 30px;
    text-align: right;
}

/* ── Divider & link table ───────────────────────────────────────────── */
.ba-divider {
    border: none;
    border-top: 1px solid var(--app-border);
    margin: 16px 0;
}
.ba-link-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ba-link-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--app-muted);
    padding: 0 0 8px;
    border-bottom: 1px solid var(--app-border);
}
.ba-link-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--app-border);
    color: var(--app-text);
    vertical-align: middle;
    font-weight: 600;
}
.ba-link-table tr:last-child td { border-bottom: none; }
.ba-link-url {
    color: var(--app-accent);
    font-size: 13px;
    font-weight: 500;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ba-bar-pill {
    display: inline-block;
    height: 6px;
    border-radius: var(--app-radius-pill);
    background: var(--app-accent);
    vertical-align: middle;
    margin-right: 6px;
}

/* ── Attachment rows, public stats & subscriber list ────────────────── */
.ba-attach-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 0;
    border-bottom: 1px solid var(--app-border);
}
.ba-attach-row:last-child { border-bottom: none; }
.ba-attach-name { font-size: 13.5px; font-weight: 600; color: var(--app-text); }
.ba-attach-count { font-size: 13px; font-weight: 700; color: var(--app-accent); }

.ba-public-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 8px;
}
.ba-public-stat {
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-md);
    padding: 12px;
    text-align: center;
}
.ba-public-value {
    font-size: 21px;
    font-weight: 800;
    color: var(--app-text);
    line-height: 1.1;
}
.ba-public-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--app-muted);
    margin-top: 4px;
}

.ba-subscriber-list { margin-top: 4px; }
.ba-sub-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--app-border);
    gap: 12px;
}
.ba-sub-row:last-child { border-bottom: none; }
.ba-sub-email {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--app-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ba-sub-tags { display: flex; gap: 6px; flex-shrink: 0; }
.ba-sub-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 3px 9px;
    border-radius: var(--app-radius-pill);
    white-space: nowrap;
}
.ba-sub-tag.opened {
    background: color-mix(in srgb, var(--app-success) 14%, transparent);
    color: var(--app-success);
}
.ba-sub-tag.clicked {
    background: var(--app-accent-soft);
    color: var(--app-accent);
}
.ba-sub-tag.downloaded {
    background: color-mix(in srgb, var(--app-info) 15%, transparent);
    color: var(--app-info);
}
.ba-sub-tag.unread {
    background: var(--app-surface-2);
    color: var(--app-muted);
}
.ba-sub-tag.unsubscribed {
    background: color-mix(in srgb, var(--app-danger) 14%, transparent);
    color: var(--app-danger);
}

.ba-empty {
    font-size: 13.5px;
    color: var(--app-muted);
    padding: 10px 0;
    margin: 0;
}
.ba-footnote {
    font-size: 12.5px;
    color: var(--app-muted);
    text-align: center;
    margin-top: 16px;
}
