/* ============================================================
   Something From Nothing — "Editorial Carbon" design system
   ------------------------------------------------------------
   IBM Plex Serif display type over a sharp, 1px-ruled Carbon-
   style surface system. Paper-grain light theme, ink dark theme.
   Accent: IBM blue #0f62fe (light) / Carbon blue-40 #78a9ff (dark).
   Theme switching: <html data-theme="light|dark"> set pre-paint.
   The class API is stable — pages style themselves with these.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
    /* Type families. Display was IBM Plex Serif originally; switched to the
       sans stack for a friendlier, social-feed feel (bold sans titles). */
    --font-ui: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    --font-display: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Consolas', monospace;

    /* Brand constants (theme-independent) */
    --avatar-yellow: #F2C94C;
    --modal-scrim: rgba(13, 13, 18, 0.62);

    /* Spacing scale (4px baseline) */
    --space-xs: 4px;
    --space-s: 8px;
    --space-m: 12px;
    --space-l: 16px;
    --space-xl: 20px;
    --space-xxl: 24px;
    --space-xxxl: 32px;

    /* Radius scale — deliberately tight: sharp, editorial */
    --radius-s: 2px;
    --radius-m: 4px;
    --radius-l: 6px;
    --radius-xl: 8px;
    --radius-pill: 999px;

    /* Surface border thickness — themeable so brutalist palettes can go chunky. */
    --surface-border-width: 1px;

    /* Type scale */
    --font-display-size: 32px;
    --font-title: 21px;
    --font-heading: 17px;
    --font-body: 14px;
    --font-caption: 12px;
    --font-small: 11px;

    /* Motion */
    --ease-out: cubic-bezier(0.2, 0, 0, 1);
    --dur-fast: 110ms;
    --dur-med: 220ms;

    /* Mobile tab bar height (incl. top border) — single source of truth for
       everything that docks against it (like bars, sticky footers). */
    --tab-bar-height: 61px;

    /* Desktop sidebar rail width — fixed bottom bars offset past it. */
    --sidebar-width: 232px;

    /* Desktop content-column geometry — one source of truth shared by
       .app-content, the narrow reading column, and the fixed docked action
       bars, so the Like/Nope bar always lines up under the reading column. */
    --content-max: 1080px;
    --content-gutter: 40px;
    --reading-max: 720px;

    /* Height of a fixed top navigation bar (layouts.css sets this for the
       Top Bar layout). Sticky page headers offset below it. */
    --topnav-height: 0px;
}

:root, [data-theme="light"] {
    --accent: #0f62fe;
    --accent-hover: #0043ce;
    --accent-text: #ffffff;
    --accent-soft: #edf5ff;          /* Carbon blue-10: tints, hovers, selected */
    --accent-soft-border: #d0e2ff;
    --accent-secondary: #dfd8f7;     /* heritage lavender — idea hero avatars */

    --page-bg: #f6f6f3;              /* warm paper */
    --page-dots: rgba(22, 22, 26, 0.05);
    --text: #16161a;
    --text-secondary: #5d5d66;
    --text-disabled: #a8a8b0;

    --card-bg: #ffffff;
    --card-stroke: #e2e2dc;
    --card-stroke-hover: #0f62fe;
    --surface-alt: #eeeee9;          /* inset panels, wells */
    --divider: #e7e7e1;

    --nav-bg: #fbfbf9;
    --nav-border: #e2e2dc;
    --nav-selected: #0f62fe;
    --nav-unselected: #5d5d66;

    --pill-bg: #eeeee9;
    --pill-text: #3c3c44;

    --dislike-red: #da1e28;
    --dislike-red-soft: #fff1f1;
    --interested-green: #198038;
    --interested-green-soft: #defbe6;

    --entry-bg: #ffffff;
    --entry-border: #c9c9c2;
    --entry-placeholder: #a0a0a8;
    --input-focus-ring: rgba(15, 98, 254, 0.18);

    --chat-bubble-theirs: #eeeee9;
    --chat-bubble-mine: #0f62fe;
    --chat-bubble-mine-text: #ffffff;
    --chat-input-bg: #fbfbf9;
    --chat-input-border: #c9c9c2;

    --button-disabled-bg: #e2e2dc;
    --button-disabled-text: #a8a8b0;

    --segment-bg: #eeeee9;
    --segment-stroke: #d8d8d1;

    --overlay-bg: #ffffff;
    --panel-header-bg: #f6f6f3;
    --panel-stroke: #e2e2dc;

    --skeleton-block: #e9e9e3;
    --empty-icon-bg: #eeeee9;
    --spinner: #0f62fe;
    --back-button-text: #5d5d66;

    --shadow-raise: 0 2px 6px rgba(22, 22, 26, 0.05), 0 12px 28px rgba(22, 22, 26, 0.07);
    --shadow-overlay: 0 8px 24px rgba(22, 22, 26, 0.16), 0 24px 64px rgba(22, 22, 26, 0.18);
}

[data-theme="dark"] {
    --accent: #78a9ff;               /* Carbon blue-40 — cohesive with brand blue */
    --accent-hover: #a6c8ff;
    --accent-text: #101014;
    --accent-soft: #1a2540;
    --accent-soft-border: #2c3d66;
    --accent-secondary: #3b3557;

    --page-bg: #101014;              /* deep ink */
    --page-dots: rgba(242, 242, 239, 0.045);
    --text: #f2f2ef;
    --text-secondary: #9d9da8;
    --text-disabled: #55555e;

    --card-bg: #191920;
    --card-stroke: #2b2b34;
    --card-stroke-hover: #78a9ff;
    --surface-alt: #20202a;
    --divider: #26262f;

    --nav-bg: #14141a;
    --nav-border: #26262f;
    --nav-selected: #78a9ff;
    --nav-unselected: #9d9da8;

    --pill-bg: #23232c;
    --pill-text: #c9c9d2;

    --dislike-red: #fa4d56;
    --dislike-red-soft: #35191c;
    --interested-green: #42be65;
    --interested-green-soft: #16281c;

    --entry-bg: #14141a;
    --entry-border: #3a3a45;
    --entry-placeholder: #6c6c78;
    --input-focus-ring: rgba(120, 169, 255, 0.22);

    --chat-bubble-theirs: #23232c;
    --chat-bubble-mine: #0f62fe;
    --chat-bubble-mine-text: #ffffff;
    --chat-input-bg: #14141a;
    --chat-input-border: #3a3a45;

    --button-disabled-bg: #26262f;
    --button-disabled-text: #6c6c78;

    --segment-bg: #14141a;
    --segment-stroke: #33333e;

    --overlay-bg: #1c1c24;
    --panel-header-bg: #14141a;
    --panel-stroke: #33333e;

    --skeleton-block: #23232c;
    --empty-icon-bg: #23232c;
    --spinner: #78a9ff;
    --back-button-text: #9d9da8;

    --shadow-raise: 0 2px 6px rgba(0, 0, 0, 0.35), 0 12px 28px rgba(0, 0, 0, 0.4);
    --shadow-overlay: 0 8px 24px rgba(0, 0, 0, 0.5), 0 24px 64px rgba(0, 0, 0, 0.55);
}

/* ---------- Base ---------- */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font-ui);
    font-size: var(--font-body);
    line-height: 1.55;
    color: var(--text);
    background-color: var(--page-bg);
    /* faint editorial dot grid — atmosphere without noise */
    background-image: radial-gradient(var(--page-dots) 1px, transparent 1px);
    background-size: 26px 26px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 600;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

img {
    max-width: 100%;
}

h1:focus {
    outline: none;
}

::selection {
    background: var(--accent);
    color: var(--accent-text);
}

/* Carbon-style focus ring on keyboard nav */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Typography ---------- */
.page-title {
    font-family: var(--font-display);
    /* Fluid: shrinks on narrow phones so titles fit beside header actions
       instead of ellipsizing; caps at the display size from ~530px up. */
    font-size: clamp(21px, 6vw, var(--font-display-size));
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

/* The signature mark: a short blue rule under page titles */
.page-title.ruled::after {
    content: "";
    display: block;
    width: 34px;
    height: 4px;
    margin-top: 10px;
    background: var(--accent);
}

.card-title {
    font-family: var(--font-display);
    font-size: var(--font-title);
    font-weight: 600;
    line-height: 1.25;
}

.section-header {
    font-size: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.005em;
}

.caption {
    font-size: var(--font-caption);
    color: var(--text-secondary);
}

/* Mono meta label — timestamps, sectors, hrs/week, wizard steps */
.meta-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* Intro screens (login / registration) */
.intro-title {
    font-family: var(--font-display);
    font-size: clamp(34px, 5vw, 44px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.015em;
    color: var(--text);
}

.intro-title .accent, .intro-title.accent {
    color: var(--accent);
}

.intro-subtitle {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: var(--font-body);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-s);        /* near-square: the Carbon heritage */
    padding: 10px 18px;
    min-height: 44px;
    min-width: 44px;
    transition: background-color var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out),
                box-shadow var(--dur-fast) var(--ease-out);
}

.btn:active:not(:disabled) {
    transform: scale(0.985);
}

.btn:disabled {
    cursor: default;
}

.btn-blue {
    background: var(--accent);
    color: var(--accent-text);
}

.btn-blue:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-blue:disabled {
    background: var(--button-disabled-bg);
    color: var(--button-disabled-text);
}

.btn-white {
    background: var(--card-bg);
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-white:hover:not(:disabled) {
    background: var(--accent-soft);
}

.btn-white:disabled {
    background: var(--button-disabled-bg);
    color: var(--button-disabled-text);
    border-color: transparent;
}

/* Quiet tertiary button */
.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--entry-border);
}

.btn-ghost:hover:not(:disabled) {
    border-color: var(--text);
}

.btn-ghost:disabled {
    color: var(--text-disabled);
    border-color: var(--divider);
}

/* Outlined action buttons (browse cards, like bar) */
.btn-action {
    height: 42px;
    border-radius: var(--radius-s);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: 1px solid currentColor;
    background: transparent;
    padding: 0 12px;
    transition: background-color var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
}

.btn-action:active:not(:disabled) {
    transform: scale(0.985);
}

.btn-action:disabled {
    opacity: 0.45;
    cursor: default;
}

.btn-action-primary {
    color: var(--text);
}

.btn-action-primary:hover:not(:disabled) {
    background: var(--surface-alt);
}

.btn-action-interested {
    color: var(--interested-green);
}

.btn-action-interested:hover:not(:disabled) {
    background: var(--interested-green-soft);
}

.btn-action-interested.is-active {
    background: var(--interested-green);
    color: #ffffff;
    border-color: var(--interested-green);
}

.btn-action-dislike {
    color: var(--dislike-red);
}

.btn-action-dislike:hover:not(:disabled) {
    background: var(--dislike-red-soft);
}

.btn-danger {
    background: var(--dislike-red);
    color: #ffffff;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-s);
    padding: 10px 18px;
    min-height: 44px;
    transition: filter var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.btn-danger:hover:not(:disabled) {
    filter: brightness(1.08);
}

.btn-danger:active:not(:disabled) {
    transform: scale(0.985);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text);
    padding: 8px 0;
    font-size: var(--font-body);
    font-weight: 500;
    text-align: left;
    transition: color var(--dur-fast) var(--ease-out);
}

.btn-text:hover {
    color: var(--accent);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    color: var(--back-button-text);
    font-size: 14px;
    padding: 8px 0;
    transition: color var(--dur-fast) var(--ease-out);
}

.btn-back:hover {
    color: var(--text);
}

/* Icon-only buttons (bell, settings, back arrow, dismiss X) */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-s);
    padding: 8px;
    margin: -8px;                   /* keep >=44px hit area without visual bulk */
    color: var(--text);
    transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.icon-btn:hover:not(:disabled) {
    color: var(--accent);
}

.icon-btn:active:not(:disabled) {
    opacity: 0.7;
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ---------- Icons ---------- */
.icon {
    display: inline-flex;
    flex-shrink: 0;
    line-height: 0;
}

.icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.icon-accent {
    color: var(--accent);
}

/* ---------- Cards & surfaces ---------- */
/* Flat token card — quiet section surface */
.section-card {
    background: var(--card-bg);
    border: var(--surface-border-width) solid var(--card-stroke);
    border-radius: var(--radius-l);
    padding: var(--space-xl);
}

/* Interactive list card (browse feeds): 1px rule, hover raises + accent edge */
.list-card {
    background: var(--card-bg);
    border: var(--surface-border-width) solid var(--card-stroke);
    border-radius: var(--radius-l);
    padding: var(--space-xl);
    transition: border-color var(--dur-med) var(--ease-out),
                box-shadow var(--dur-med) var(--ease-out),
                transform var(--dur-med) var(--ease-out);
}

.list-card:hover {
    border-color: var(--accent-soft-border);
    box-shadow: var(--shadow-raise);
    transform: translateY(-2px);
}

/* Home dashboard tile */
.tile-card {
    background: var(--card-bg);
    border: var(--surface-border-width) solid var(--card-stroke);
    border-radius: var(--radius-l);
    padding: var(--space-xl);
    min-height: 140px;
    text-align: left;
    transition: border-color var(--dur-med) var(--ease-out),
                box-shadow var(--dur-med) var(--ease-out),
                transform var(--dur-med) var(--ease-out);
}

.tile-card:hover {
    border-color: var(--card-stroke-hover);
    box-shadow: var(--shadow-raise);
    transform: translateY(-2px);
}

.divider {
    height: 1px;
    background: var(--divider);
    border: none;
    margin: 0;
}

/* Pressable feedback for tappable non-button surfaces */
.pressable {
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}

.pressable:active {
    transform: scale(0.985);
    opacity: 0.92;
}

/* Staggered entrance for card lists: parent gets .stagger */
@keyframes rise-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 'backwards' (not 'both') so the retained end-keyframe doesn't pin
   transform and suppress hover translateY on cards after entry. */
.stagger > * {
    animation: rise-in 420ms var(--ease-out) backwards;
}

.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 45ms; }
.stagger > *:nth-child(3) { animation-delay: 90ms; }
.stagger > *:nth-child(4) { animation-delay: 135ms; }
.stagger > *:nth-child(5) { animation-delay: 180ms; }
.stagger > *:nth-child(6) { animation-delay: 225ms; }
.stagger > *:nth-child(n+7) { animation-delay: 260ms; }

@media (prefers-reduced-motion: reduce) {
    .stagger > * { animation: none; }
    .list-card, .tile-card, .btn, .pressable { transition: none; }
    .stepper-seg.active::after { animation: none; transition: none; }
    .modal-card, .action-sheet, .notif-panel { animation: none; }
}

/* ---------- Pills ---------- */
.pill {
    display: inline-block;
    background: var(--pill-bg);
    color: var(--pill-text);
    border-radius: var(--radius-s);
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 500;
    margin: 0 6px 6px 0;
}

/* Mono variant for hrs/week, remote, sector meta */
.pill-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
}

/* ---------- Inputs ---------- */
/* NB: no `select.entry` here — an element-qualified selector (0,1,1) would
   out-specify `.entry-filled` (0,1,0) and strip the border off boxed
   <select>s. A select carrying `.entry` matches `.entry` regardless. */
.entry, .editor {
    font-family: inherit;
    font-size: var(--font-body);
    color: var(--text);
    border: none;
    outline: none;
    width: 100%;
}

/* Underline-style input (login / wizard screens) */
.entry-underline {
    background: transparent;
    border-bottom: 1px solid var(--entry-border);
    padding: 10px 2px;
    border-radius: 0;
    transition: border-color var(--dur-fast) var(--ease-out);
}

.entry-underline:focus {
    border-bottom: 2px solid var(--accent);
    padding-bottom: 9px;
}

.entry-underline::placeholder {
    color: var(--entry-placeholder);
}

/* Boxed input (forms, filters) */
.entry-filled {
    background: var(--entry-bg);
    border: 1px solid var(--entry-border);
    border-radius: var(--radius-s);
    padding: 10px 12px;
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.entry-filled:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.entry-filled::placeholder {
    color: var(--entry-placeholder);
}

.editor {
    background: transparent;
    resize: vertical;
    min-height: 60px;
}

.editor::placeholder {
    color: var(--entry-placeholder);
}

select.entry-filled {
    appearance: auto;
    min-height: 40px;
}

input[type="checkbox"].checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

input[type="date"].entry {
    background: transparent;
    border-bottom: 1px solid var(--entry-border);
    padding: 10px 2px;
    color: var(--text);
    color-scheme: light;
}

[data-theme="dark"] input[type="date"].entry {
    color-scheme: dark;
}

input[type="date"].entry:focus {
    border-bottom: 2px solid var(--accent);
    padding-bottom: 9px;
}

.inline-error {
    font-size: var(--font-caption);
    color: var(--dislike-red);
    margin-top: 4px;
}

/* Form field group with a mono label above the control */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field > .meta-label {
    margin-bottom: 0;
}

/* ---------- Wizard stepper (registration) ---------- */
.stepper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stepper-seg {
    flex: 1;
    height: 3px;
    background: var(--segment-stroke);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.stepper-seg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--dur-med) var(--ease-out);
}

.stepper-seg.done::after,
.stepper-seg.active::after {
    transform: scaleX(1);
}

/* ---------- Spinner ---------- */
.spinner {
    width: 26px;
    height: 26px;
    border: 2.5px solid transparent;
    border-top-color: var(--spinner);
    border-right-color: var(--spinner);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-lg {
    width: 52px;
    height: 52px;
    border-width: 3px;
}

.spinner-white {
    border-top-color: #ffffff;
    border-right-color: #ffffff;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Full-screen busy overlay (login, wizard submit) */
.busy-overlay {
    position: fixed;
    inset: 0;
    background: var(--modal-scrim);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(2px);
}

/* ---------- Avatars ---------- */
.avatar {
    border-radius: 50%;
    background: var(--avatar-yellow);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(22, 22, 26, 0.08);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-hero-idea {
    background: var(--accent-secondary);
}

/* ---------- App shell: sidebar (desktop) + tab bar (mobile) ---------- */
.app-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding-bottom: var(--tab-bar-height);   /* clear the fixed tab bar on mobile */
}

.app-content.no-tabs {
    padding-bottom: 0;
}

/* Sidebar (hidden on mobile) */
.app-sidebar {
    display: none;
}

.brand-mark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 19px;
    line-height: 1.15;
    letter-spacing: -0.01em;
    padding: 26px 20px 22px;
    display: block;
}

.brand-mark .accent {
    color: var(--accent);
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 10px;
}

.side-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: var(--radius-m);
    border-left: 3px solid transparent;
    color: var(--nav-unselected);
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.side-item:hover {
    color: var(--text);
    background: var(--surface-alt);
}

.side-item.active {
    color: var(--nav-selected);
    background: var(--accent-soft);
    border-left-color: var(--accent);
}

.side-item .icon {
    width: 20px;
    height: 20px;
}

.side-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--dislike-red);
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.side-foot {
    margin-top: auto;
    padding: 14px 20px 18px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-disabled);
}

/* Concept affordances in the nav — mock ideas for the layout system, not
   functional. Hidden unless the active layout (layouts.css) reveals one. */
.concept-btn {
    display: none;
}

.concept-btn:disabled {
    cursor: default;
    opacity: 0.85;
}

.concept-glyph {
    width: 20px;
    font-size: 18px;
    line-height: 1;
    text-align: center;
    flex-shrink: 0;
}

/* Bottom tab bar (mobile only) */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-bar-height);
    background: var(--nav-bg);
    border-top: 1px solid var(--nav-border);
    display: flex;
    justify-content: center;
    z-index: 50;
    backdrop-filter: blur(8px);
}

.tab-bar-inner {
    display: flex;
    width: 100%;
    max-width: 680px;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--nav-unselected);
    font-size: var(--font-small);
    font-weight: 500;
    position: relative;
    border-top: 2px solid transparent;
    transition: color var(--dur-fast) var(--ease-out);
}

.tab-item.active {
    color: var(--nav-selected);
    border-top-color: var(--accent);
}

.tab-item .icon {
    width: 22px;
    height: 22px;
}

.tab-badge {
    position: absolute;
    top: 4px;
    left: calc(50% + 6px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--dislike-red);
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Desktop: sidebar replaces the tab bar; content widens */
@media (min-width: 900px) {
    .app-shell {
        flex-direction: row;
    }

    .app-sidebar {
        display: flex;
        flex-direction: column;
        width: var(--sidebar-width);
        flex-shrink: 0;
        position: sticky;
        top: 0;
        height: 100dvh;
        background: var(--nav-bg);
        border-right: 1px solid var(--nav-border);
    }

    .tab-bar {
        display: none;
    }

    .app-content,
    .app-content.no-tabs {
        max-width: var(--content-max);
        padding: 0 var(--content-gutter) 48px;
        /* Centre within whatever region the active layout's nav leaves —
           the same rule for every layout (sidebar, rail, top bar, dock). */
        margin: 0 auto;
    }
}

/* Content width helpers for pages */
.page {
    padding: 0 var(--space-xl) var(--space-xl);
}

@media (min-width: 900px) {
    .page {
        padding: 0 0 var(--space-xl);
    }
}

/* Narrow reading column (detail pages, settings) — centred in the content
   box so detail pages sit in the middle of the available region. */
.page-narrow {
    max-width: var(--reading-max);
    margin-left: auto;
    margin-right: auto;
}

/* --- Docked action bar (Like/Nope on idea & profile detail pages) ----------
   position:fixed in both layouts so no scroll position or pixel rounding can
   shift it. Mobile: welded above the tab bar, full width. Desktop: pinned to
   the screen bottom right of the sidebar, with the background spanning the
   whole region — but the inner wrappers mirror .app-content + .page-narrow so
   the buttons sit centred UNDER the reading column, not the whole region. */
.docked-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--tab-bar-height) - 1px);   /* 1px overlap onto the tab bar: no seam */
    z-index: 40;
    background: var(--nav-bg);
    border-top: 1px solid var(--nav-border);
}

@media (min-width: 900px) {
    .docked-bar {
        left: var(--sidebar-width);   /* clear the sidebar rail */
        bottom: 0;                    /* bottom of the screen; no tab bar here */
    }

    /* Mirrors .app-content's box (max-width + gutter, centred). */
    .docked-bar-content {
        max-width: var(--content-max);
        margin: 0 auto;
        padding: 0 var(--content-gutter);
    }

    /* Mirrors the centred .page-narrow reading column. */
    .docked-bar-column {
        max-width: var(--reading-max);
        width: 100%;
        margin: 0 auto;
    }
}

/* Responsive card grid (browse feeds) */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 700px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    }
}

/* Mobile: feed items run edge-to-edge (social-feed style) — bleed past the
   page gutter, drop side borders/radius, separate rows with a hairline. */
@media (max-width: 699px) {
    .card-grid {
        margin-left: calc(-1 * var(--space-xl));
        margin-right: calc(-1 * var(--space-xl));
        gap: 0;
    }

    .card-grid > .list-card {
        border-left: none;
        border-right: none;
        border-bottom: none;
        border-top: 1px solid var(--card-stroke);
        border-radius: 0;
    }

    .card-grid > .list-card:first-child {
        border-top: none;
    }

    .card-grid > .list-card:hover {
        transform: none;
        box-shadow: none;
        border-color: var(--card-stroke);
    }
}

/* ---------- Page scaffolding ---------- */
.page-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: var(--space-m);
    padding: var(--space-xl) 0 var(--space-s);
}

.page-header .page-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Empty state ---------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 48px 24px;
    gap: var(--space-m);
}

.empty-state-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--empty-icon-bg);
    border: 1px solid var(--card-stroke);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon .icon {
    width: 30px;
    height: 30px;
    color: var(--text-secondary);
}

.empty-state .section-header {
    font-family: var(--font-display);
}

.empty-state .caption {
    max-width: 340px;
}

/* ---------- Skeleton ---------- */
@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.skeleton-block {
    background: var(--skeleton-block);
    border-radius: var(--radius-s);
    animation: skeleton-pulse 1.6s ease-in-out infinite;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--skeleton-block);
    flex-shrink: 0;
    animation: skeleton-pulse 1.6s ease-in-out infinite;
}

/* ---------- Chat ---------- */
.chat-bubble {
    max-width: min(420px, 78%);
    border-radius: var(--radius-xl);
    padding: 9px 13px;
    font-size: 14.5px;
    line-height: 1.5;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.chat-bubble-mine {
    background: var(--chat-bubble-mine);
    color: var(--chat-bubble-mine-text);
    border-bottom-right-radius: var(--radius-s);
    margin-left: auto;
}

.chat-bubble-theirs {
    background: var(--chat-bubble-theirs);
    color: var(--text);
    border-bottom-left-radius: var(--radius-s);
    margin-right: auto;
}

.chat-system {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    text-align: center;
}

.chat-input-row {
    background: var(--chat-input-bg);
    border-top: 1px solid var(--divider);
    padding: 10px 14px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.chat-input-border {
    flex: 1;
    border: 1px solid var(--chat-input-border);
    border-radius: var(--radius-m);
    padding: 8px 12px;
    background: var(--entry-bg);
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.chat-input-border:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.chat-input-border textarea {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 14.5px;
    resize: none;
    max-height: 120px;
}

/* ---------- Modal / dialog ---------- */
@keyframes modal-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--modal-scrim);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
    backdrop-filter: blur(2px);
}

.modal-card {
    background: var(--overlay-bg);
    border: 1px solid var(--panel-stroke);
    border-radius: var(--radius-xl);
    padding: var(--space-xxl);
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-overlay);
    animation: modal-in 200ms var(--ease-out);
}

.modal-title {
    font-family: var(--font-display);
    font-size: var(--font-heading);
    font-weight: 700;
    margin-bottom: var(--space-s);
}

.modal-message {
    font-size: var(--font-body);
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    white-space: pre-wrap;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-m);
}

.modal-actions .btn {
    min-height: 40px;
}

.btn-modal-cancel {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--entry-border);
}

.btn-modal-cancel:hover {
    border-color: var(--text);
}

/* Action sheet */
.action-sheet {
    background: var(--overlay-bg);
    border: 1px solid var(--panel-stroke);
    border-radius: var(--radius-xl);
    max-width: 420px;
    width: 100%;
    overflow: hidden;
    box-shadow: var(--shadow-overlay);
    animation: modal-in 200ms var(--ease-out);
}

.action-sheet-title {
    padding: var(--space-l) var(--space-xl);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    text-align: center;
    border-bottom: 1px solid var(--divider);
}

.action-sheet-item {
    display: block;
    width: 100%;
    padding: 14px var(--space-xl);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--divider);
    font-size: 15px;
    color: var(--accent);
    text-align: center;
    transition: background-color var(--dur-fast) var(--ease-out);
}

.action-sheet-item:hover {
    background: var(--surface-alt);
}

.action-sheet-item.destructive {
    color: var(--dislike-red);
}

.action-sheet-item.cancel {
    font-weight: 600;
    border-bottom: none;
    color: var(--text);
}

/* ---------- Notifications panel ---------- */
.notif-panel {
    position: absolute;
    top: 58px;
    right: 15px;
    width: min(380px, calc(100vw - 30px));
    max-height: 440px;
    background: var(--overlay-bg);
    border: 1px solid var(--panel-stroke);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-overlay);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 60;
    animation: modal-in 180ms var(--ease-out);
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--panel-header-bg);
    border-bottom: 1px solid var(--divider);
}

.notif-header > :first-child {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 500;
}

.notif-list {
    overflow-y: auto;
}

.notif-row {
    display: grid;
    grid-template-columns: 8px 36px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 11px 14px;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease-out);
}

.notif-row:hover {
    background: var(--surface-alt);
}

.unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background: var(--accent);
}

.bell-dot {
    position: absolute;
    top: 0;
    right: 2px;
    width: 9px;
    height: 9px;
    border-radius: 5px;
    background: var(--dislike-red);
    border: 2px solid var(--page-bg);
    pointer-events: none;
}

/* ---------- Segmented control ---------- */
.segmented {
    display: flex;
    background: var(--segment-bg);
    border: 1px solid var(--segment-stroke);
    border-radius: var(--radius-m);
    padding: 3px;
    gap: 3px;
}

.segmented button {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-s);
    padding: 7px 8px;
    font-size: 13px;
    font-weight: 500;
    transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.segmented button:hover:not(.active) {
    color: var(--text);
}

.segmented button.active {
    background: var(--accent);
    color: var(--accent-text);
}

/* ---------- Misc ---------- */
.validation-message {
    color: var(--dislike-red);
    font-size: var(--font-caption);
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: var(--radius-m);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* Hidden until the Blazor runtime flags an unhandled circuit error. */
#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: lightyellow;
    color: #000000;
    padding: 0.6rem 1.25rem 0.7rem;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Intro screens (login / registration) */
.intro-stack {
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding: 50px 30px 34px;
    max-width: 460px;
    margin: 0 auto;
    min-height: 100dvh;
    justify-content: center;
}

/* Split auth shell: brand panel + form panel on desktop */
.auth-split {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
}

.auth-brand-panel {
    display: none;
}

@media (min-width: 900px) {
    .auth-split {
        grid-template-columns: minmax(380px, 44%) 1fr;
    }

    .auth-brand-panel {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 48px 52px;
        background:
            radial-gradient(1200px 700px at -10% -10%, var(--accent-soft), transparent 60%),
            var(--nav-bg);
        border-right: 1px solid var(--nav-border);
        position: relative;
        overflow: hidden;
    }

    .auth-brand-panel::after {
        content: "";
        position: absolute;
        inset: 0;
        background-image: radial-gradient(var(--page-dots) 1px, transparent 1px);
        background-size: 22px 22px;
        pointer-events: none;
    }

    .auth-form-panel {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 48px 40px;
    }

    .auth-form-panel .intro-stack {
        min-height: 0;
        padding: 0;
        width: 100%;
    }
}

/* Utility */
.text-center { text-align: center; }
.flex-row { display: flex; align-items: center; }
.flex-1 { flex: 1; }
.mt-auto { margin-top: auto; }
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ============================================================
   Feed-list & browse-page chrome — shared classes
   ------------------------------------------------------------
   Extracted from per-page scoped CSS (BrowseIdeas/BrowseUsers
   feeds and LikedIdeas/Bookmarks list rows were near-identical).
   These class names are used ONLY on those pages, so promoting
   them to global is safe and removes the duplication. Each page
   keeps only its genuinely unique rules in its .razor.css.
   ============================================================ */

/* --- Non-blocking busy overlay (content stays interactive) --- */
.busy-float {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

/* --- Browse feeds: sticky header (title left, refresh + Filters right) --- */
.browse-header {
    display: flex;
    align-items: center;
    gap: var(--space-m);
    padding: var(--space-xl) 0 var(--space-s);
    position: sticky;
    top: var(--topnav-height);
    z-index: 40;
    background: var(--page-bg);
    border-bottom: 1px solid var(--divider);
}

@media (max-width: 899px) {
    .browse-header {
        margin-left: calc(-1 * var(--space-xl));
        margin-right: calc(-1 * var(--space-xl));
        padding-left: var(--space-xl);
        padding-right: var(--space-xl);
    }
}

.browse-header .page-header {
    padding: 0;
    flex: 1;
    min-width: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 14px;
}

.refresh-spinner {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

.refresh-icon {
    width: 18px;
    height: 18px;
}

/* Compact ghost button with the mono meta-label voice. */
.filters-toggle {
    min-height: 36px;
    min-width: 0;
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* --- Collapsible filter toolbar (a .section-card of .field groups) --- */
.filter-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-l);
    margin: 10px 0 var(--space-l);
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-l);
}

@media (min-width: 700px) {
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1000px) {
    .filter-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.filter-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: var(--font-body);
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-m);
}

/* 'Save search' sits opposite Clear/Apply in the actions row. */
.save-search-toggle {
    margin-right: auto;
}

/* --- Feed grid + initial-load skeleton + infinite-scroll spinner --- */
.browse-grid {
    padding-top: 8px;
}

/* Mobile: the first full-bleed card butts against the pinned header hairline. */
@media (max-width: 699px) {
    .browse-grid {
        padding-top: 0;
    }
}

.skeleton-wrap {
    position: relative;
}

.skeleton-host > div {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 16px !important;
}

@media (min-width: 700px) {
    .skeleton-host > div {
        grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    }
}

.skeleton-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.load-more {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}

.load-more-spinner {
    width: 30px;
    height: 30px;
}

/* --- List pages (Liked Ideas / Bookmarks): sticky header + feed rows --- */
.list-header {
    position: sticky;
    top: var(--topnav-height);
    z-index: 40;
    background: var(--page-bg);
    border-bottom: 1px solid var(--divider);
}

@media (max-width: 899px) {
    .list-header {
        margin-left: calc(-1 * var(--space-xl));
        margin-right: calc(-1 * var(--space-xl));
        padding-left: var(--space-xl);
        padding-right: var(--space-xl);
    }
}

.idea-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: var(--space-l);     /* + header's 8px = 24px rhythm to the first card */
    padding-bottom: var(--space-l);
}

/* Mobile: rows run edge-to-edge (social-feed style), first row butting
   straight against the pinned header's hairline. */
@media (max-width: 699px) {
    .idea-list {
        margin-left: calc(-1 * var(--space-xl));
        margin-right: calc(-1 * var(--space-xl));
        margin-top: 0;
        gap: 0;
    }

    .idea-list > .list-card {
        border-left: none;
        border-right: none;
        border-bottom: none;
        border-top: var(--surface-border-width) solid var(--card-stroke);
        border-radius: 0;
    }

    .idea-list > .list-card:first-child {
        border-top: none;
    }

    .idea-list > .list-card:hover {
        transform: none;
        box-shadow: none;
        border-color: var(--card-stroke);
    }
}

.idea-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 14px;
    align-items: center;
    padding: var(--space-l) var(--space-xl);
}

.idea-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.idea-title {
    font-size: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.idea-summary {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.idea-meta {
    margin-top: 3px;
}

.idea-meta .pill {
    margin-bottom: 0;
}

.idea-actions {
    grid-column: 1 / -1;            /* mobile: actions row under the copy */
    display: flex;
    gap: var(--space-s);
    justify-content: flex-end;
    margin-top: 6px;
}

.row-btn {
    height: 36px;
    min-height: 36px;
    padding: 6px 14px;
    font-size: 13px;
}

@media (min-width: 700px) {
    .idea-row {
        grid-template-columns: auto 1fr auto;
    }

    .idea-actions {
        grid-column: auto;          /* desktop: actions sit to the right */
        margin-top: 0;
    }
}
