/* =============================================================
   UNLICENSED NEWS - design system
   Modern minimal newsletter platform
   ============================================================= */

/* Fonts are served from the shared CDN at /var/www/cdn/fonts/.
   Same files live at https://cdn.unlicensedstudio.com/fonts/<family>/.
   `font-display: swap` keeps the UI readable while the .otf streams in,
   and `format('opentype')` lets browsers skip the download immediately
   if we ever ship a non-OTF variant they can't render. */

/* Quan family — full weight ladder, heaviest to lightest. */
@font-face { font-family: quan-black;       src: url(https://cdn.unlicensedstudio.com/fonts/Quan/Quan-Black.otf)       format('opentype'); font-display: swap; }
@font-face { font-family: quan-extrabold;   src: url(https://cdn.unlicensedstudio.com/fonts/Quan/Quan-Extrabold.otf)   format('opentype'); font-display: swap; }
@font-face { font-family: quan-bold;        src: url(https://cdn.unlicensedstudio.com/fonts/Quan/Quan-Bold.otf)        format('opentype'); font-display: swap; }
@font-face { font-family: quan;             src: url(https://cdn.unlicensedstudio.com/fonts/Quan/Quan.otf)             format('opentype'); font-display: swap; }
@font-face { font-family: quan-book;        src: url(https://cdn.unlicensedstudio.com/fonts/Quan/Quan-Book.otf)        format('opentype'); font-display: swap; }
@font-face { font-family: quan-light;       src: url(https://cdn.unlicensedstudio.com/fonts/Quan/Quan-Light.otf)       format('opentype'); font-display: swap; }
@font-face { font-family: quan-extralight;  src: url(https://cdn.unlicensedstudio.com/fonts/Quan/Quan-Extralight.otf)  format('opentype'); font-display: swap; }
@font-face { font-family: quan-hairline;    src: url(https://cdn.unlicensedstudio.com/fonts/Quan/Quan-Hairline.otf)    format('opentype'); font-display: swap; }

/* Nexa family — full weight ladder, heaviest to lightest. */
@font-face { font-family: nexa-black;       src: url(https://cdn.unlicensedstudio.com/fonts/Nexa/NexaBlack.otf)        format('opentype'); font-display: swap; }
@font-face { font-family: nexa-xbold;       src: url(https://cdn.unlicensedstudio.com/fonts/Nexa/NexaXBold.otf)        format('opentype'); font-display: swap; }
@font-face { font-family: nexa-heavy;       src: url(https://cdn.unlicensedstudio.com/fonts/Nexa/NexaHeavy.otf)        format('opentype'); font-display: swap; }
@font-face { font-family: nexa-bold;        src: url(https://cdn.unlicensedstudio.com/fonts/Nexa/NexaBold.otf)         format('opentype'); font-display: swap; }
@font-face { font-family: nexa;             src: url(https://cdn.unlicensedstudio.com/fonts/Nexa/NexaRegular.otf)      format('opentype'); font-display: swap; }
@font-face { font-family: nexa-book;        src: url(https://cdn.unlicensedstudio.com/fonts/Nexa/NexaBook.otf)         format('opentype'); font-display: swap; }
@font-face { font-family: nexa-light;       src: url(https://cdn.unlicensedstudio.com/fonts/Nexa/NexaLight.otf)        format('opentype'); font-display: swap; }
@font-face { font-family: nexa-thin;        src: url(https://cdn.unlicensedstudio.com/fonts/Nexa/NexaThin.otf)         format('opentype'); font-display: swap; }

/* ============================ THEMES ============================ */
:root,
[data-theme="light"] {
    --bg:                #ececec;
    --bg-app:            #ececec;
    --surface:           #ffffff;
    --surface-alt:       #f5f5f7;
    --surface-elev:      #ffffff;
    --hover:             #f0f0f3;
    --border:            #e3e3e7;
    --border-strong:     #d4d4d9;
    --text:              #111114;
    --text-dim:          #6e6e76;
    --text-mute:         #9a9aa3;
    --accent:            #111114;
    --accent-soft:       #11111414;
    --accent-contrast:   #ffffff;
    --danger:            #d6263a;
    --danger-soft:       #ffe9eb;
    --warn:              #d68f00;
    --ok:                #1f8a4f;
    --ok-soft:           #e7f6ee;
    --info:              #2563eb;

    --shadow-sm:         0 1px 2px rgba(17,17,20,.04), 0 1px 3px rgba(17,17,20,.04);
    --shadow-md:         0 6px 18px rgba(17,17,20,.06);
    --shadow-pop:        0 12px 32px rgba(17,17,20,.12);

    --radius-sm:         3px;
    --radius-md:         5px;
    --radius-lg:         7px;
    --radius-pill:       6px;

    --font-display:      'quan-bold', 'Helvetica Neue', Arial, sans-serif;
    --font-display-xl:   'quan-black', 'Helvetica Neue', Arial, sans-serif;
    --font-body:         'nexa', 'Helvetica Neue', Arial, sans-serif;
    --font-body-bold:    'nexa-bold', 'Helvetica Neue', Arial, sans-serif;
    --font-mono:         ui-monospace, 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}

[data-theme="dark"] {
    --bg:                #0c0c10;
    --bg-app:            #0c0c10;
    --surface:           #15151c;
    --surface-alt:       #11111a;
    --surface-elev:      #1b1b25;
    --hover:             #1f1f2a;
    --border:            #25252f;
    --border-strong:     #32323e;
    --text:              #ececf2;
    --text-dim:          #9b9ba6;
    --text-mute:         #6c6c78;
    --accent:            #ffffff;
    --accent-soft:       #ffffff14;
    --accent-contrast:   #0c0c10;
    --danger:            #ff5d72;
    --danger-soft:       #43151c;
    --warn:              #f4b740;
    --ok:                #4ade80;
    --ok-soft:           #173825;
    --info:              #60a5fa;
    --shadow-sm:         0 1px 2px rgba(0,0,0,.4);
    --shadow-md:         0 8px 24px rgba(0,0,0,.45);
    --shadow-pop:        0 18px 48px rgba(0,0,0,.6);
}

/* TERRA — earth tones with sage/olive green grounding (warm cream, clay,
   terracotta accent, deep forest text). Selector still matches old saved
   value "brand" for backwards compatibility. */
[data-theme="brand"],
[data-theme="terra"] {
    --bg:                #eef0e3;   /* soft sage-cream */
    --bg-app:            #eef0e3;
    --surface:           #f7f4e9;   /* warm parchment */
    --surface-alt:       #e1e2cd;   /* moss-tinted alt */
    --surface-elev:      #f7f4e9;
    --hover:             #d8dec0;   /* sage hover */
    --border:            #c8cda9;   /* olive border */
    --border-strong:     #a8b186;
    --text:              #2c3a25;   /* deep forest */
    --text-dim:          #586550;
    --text-mute:         #8a937a;
    --accent:            #6b8242;   /* olive green primary */
    --accent-soft:       #6b82421f;
    --accent-contrast:   #f7f4e9;
    --danger:            #a8462f;   /* terracotta */
    --danger-soft:       #f0d8c8;
    --warn:              #b88a2f;   /* amber */
    --ok:                #5e7a3a;   /* sage green */
    --ok-soft:           #d8e4c0;
    --info:              #5a7a82;   /* slate teal */
}

/* ============================ BASE ============================ */
* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0; height: 100%;
    background: var(--bg-app); color: var(--text);
    font-family: var(--font-body); font-size: 14px; line-height: 1.5;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg-app); }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

/* ============================ APP SHELL ============================ */
.app { display: grid; grid-template-columns: 240px 1fr; height: 100vh; overflow: hidden; }

.sidebar {
    background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 22px 14px; gap: 18px; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 6px; }
.brand-mark {
    width: 32px; height: 32px;
    border-radius: var(--radius-md);
    background: var(--text); color: var(--surface);
    display: grid; place-items: center;
    font-family: var(--font-display-xl); font-size: 14px; letter-spacing: -0.5px;
}
.brand-name { font-family: var(--font-display); font-size: 15px; letter-spacing: -.2px; }
.brand-name small {
    display: block; font-family: var(--font-body); color: var(--text-mute);
    font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px;
}
.nav-section-title {
    font-size: 10.5px; letter-spacing: 1.6px; text-transform: uppercase;
    color: var(--text-mute); padding: 0 12px; margin-top: 4px;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-md);
    color: var(--text-dim); cursor: pointer; font-size: 13.5px;
    transition: background .15s, color .15s; user-select: none;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.is-active { background: var(--text); color: var(--accent-contrast); }
.nav-item .ico { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.nav-item.is-active .ico { opacity: 1; }
.sidebar-scroll {
    /* Take the remaining vertical space inside .sidebar's flex column
       and own the y-overflow. min-height:0 is the well-known fix for
       letting a flex child shrink below its content size, which is what
       triggers the scrollbar instead of pushing the footer off-screen. */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 18px;
    /* Hide the visible scrollbar for a cleaner sidebar; scrolling
       still works via wheel / touch / keyboard. */
    scrollbar-width: none;       /* Firefox */
    -ms-overflow-style: none;    /* legacy IE / old Edge */
}
.sidebar-scroll::-webkit-scrollbar { /* Chromium, Safari */
    width: 0;
    height: 0;
    display: none;
}
.sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.main { display: flex; flex-direction: column; overflow: hidden; background: var(--bg-app); }
.topbar {
    display: flex; align-items: center; gap: 16px;
    padding: 18px 28px; background: var(--bg-app);
    border-bottom: 1px solid transparent;
}
.page-title {
    font-family: var(--font-display-xl); font-size: 26px; letter-spacing: -.6px;
    color: var(--text); margin: 0;
}
.page-sub { color: var(--text-dim); font-size: 13px; }
.topbar-spacer { flex: 1; }
.content { flex: 1; overflow-y: auto; padding: 8px 28px 32px; }

/* ============================ COMPONENTS ============================ */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 22px;
}
.card.flat { border: none; box-shadow: none; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-title { font-family: var(--font-display); font-size: 16px; letter-spacing: -.2px; margin: 0; }
.card-sub { color: var(--text-dim); font-size: 12.5px; }

.pill-toolbar {
    display: inline-flex; align-items: center;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-pill); padding: 4px; gap: 2px;
}
.pill-toolbar .pill {
    padding: 6px 14px; border-radius: var(--radius-sm);
    font-size: 13px; cursor: pointer; color: var(--text-dim);
    transition: background .15s, color .15s; font-family: var(--font-body-bold);
}
.pill-toolbar .pill.is-active { background: var(--text); color: var(--accent-contrast); }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text); font-family: var(--font-body-bold); font-size: 13px;
    cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
    text-align: left;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn.btn-primary { background: var(--text); color: var(--accent-contrast); border-color: var(--text); }
.btn.btn-primary:hover { background: var(--text); opacity: .92; }
.btn.btn-ghost { border-color: transparent; background: transparent; }
.btn.btn-ghost:hover { background: var(--hover); }
.btn.btn-danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn.btn-danger:hover { background: var(--danger-soft); }
.btn.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; gap: 0; }

.input, .select, .textarea {
    width: 100%; padding: 11px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text); font-size: 13px;
    transition: border-color .15s, background .15s; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--text); }
.textarea { border-radius: var(--radius-md); resize: vertical; min-height: 80px; }
.input-search {
    background: var(--surface);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239a9aa3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.35-4.35'/></svg>");
    background-repeat: no-repeat; background-position: 14px center; padding-left: 38px;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label {
    font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
    color: var(--text-mute); font-family: var(--font-body-bold);
}

.toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle input { display: none; }
.toggle .slider {
    position: absolute; inset: 0;
    background: var(--border-strong); border-radius: 999px;
    cursor: pointer; transition: background .2s;
}
.toggle .slider::before {
    content: ""; position: absolute;
    width: 14px; height: 14px; left: 3px; top: 3px;
    background: #ffffff; border-radius: 999px;
    transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.toggle input:checked + .slider { background: var(--text); }
.toggle input:checked + .slider::before { transform: translateX(16px); }

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: var(--radius-pill);
    font-size: 11.5px; font-family: var(--font-body-bold);
    background: var(--surface-alt); color: var(--text-dim);
    border: 1px solid var(--border);
}
.badge.badge-ok      { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge.badge-warn    { color: var(--warn); background: #fff3d6; border-color: transparent; }
.badge.badge-danger  { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge.badge-info    { color: var(--info); background: #e2ecff; border-color: transparent; }
.badge.badge-mute    { color: var(--text-mute); }
[data-theme="dark"] .badge.badge-warn { background: #3a2c0c; }
[data-theme="dark"] .badge.badge-info { background: #16243f; }

.btn-outline-pill {
    display: inline-flex; align-items: center;
    padding: 6px 16px; border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text); font-family: var(--font-body-bold); font-size: 12px;
    cursor: pointer;
}
.btn-outline-pill:hover { background: var(--hover); }

.table-wrap {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
    text-align: left; padding: 14px 18px; font-size: 11px;
    letter-spacing: 1.2px; text-transform: uppercase;
    color: var(--text-mute); font-family: var(--font-body-bold);
    border-bottom: 1px solid var(--border); background: var(--surface);
    font-weight: normal;
}
.table thead th .sort-caret { opacity: .55; margin-left: 6px; font-size: 11px; }
.table tbody td {
    padding: 16px 18px; border-bottom: 1px solid var(--border);
    vertical-align: middle; color: var(--text);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--hover); }
.table .row-name { font-family: var(--font-body-bold); color: var(--text); }
.table .row-sub { color: var(--text-mute); font-size: 12px; margin-top: 2px; }
.table .col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    padding-right: 18px;
}
/* Edit/Delete buttons in row actions get a flex row with breathing room */
.table .col-actions .btn,
.table .col-actions .btn-icon {
    margin-left: 8px;
    transition:
        background .18s ease,
        color .18s ease,
        border-color .18s ease,
        transform .12s ease,
        box-shadow .18s ease;
}
.table .col-actions .btn:first-child,
.table .col-actions .btn-icon:first-child { margin-left: 0; }
.table .col-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.table .col-actions .btn-danger:hover {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}
.table .col-actions .btn-primary:hover {
    background: var(--text);
    opacity: 1;
    box-shadow: var(--shadow-md);
}

.popover {
    background: var(--surface-elev); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
    padding: 6px; min-width: 200px; position: absolute; z-index: 100;
}
.popover-row {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-md);
    cursor: pointer; font-size: 13px;
}
.popover-row:hover { background: var(--hover); }
.popover-row.head {
    cursor: default; border-bottom: 1px solid var(--border); border-radius: 0;
    padding: 10px 12px 12px; margin-bottom: 4px; justify-content: space-between;
}
.popover-row.head:hover { background: transparent; }
.popover-row.danger { color: var(--danger); }

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(15,15,22,.45);
    display: none; align-items: center; justify-content: center;
    z-index: 200; backdrop-filter: blur(6px);
}
.modal-backdrop.is-open { display: flex; }
.modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: min(560px, 92vw); max-height: 86vh; overflow: hidden;
    display: flex; flex-direction: column; box-shadow: var(--shadow-pop);
}
.modal.modal-lg { width: min(880px, 96vw); }
.modal-head {
    padding: 18px 22px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: var(--font-display); font-size: 16px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
    padding: 14px 22px; border-top: 1px solid var(--border);
    display: flex; gap: 10px; justify-content: flex-end;
}

.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px; margin-bottom: 20px;
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 18px;
}
.stat-label {
    font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
    color: var(--text-mute); font-family: var(--font-body-bold);
}
.stat-value {
    font-family: var(--font-display-xl); font-size: 32px; letter-spacing: -1px;
    margin-top: 6px; color: var(--text);
}
.stat-trend { color: var(--ok); font-size: 12px; margin-top: 4px; }
.stat-trend.down { color: var(--danger); }

.row    { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.col    { display: flex; flex-direction: column; gap: 12px; }
.flex-1 { flex: 1; }
.gap-8  { gap: 8px; }
.gap-16 { gap: 16px; }
.mt-12  { margin-top: 12px; }
.mt-24  { margin-top: 24px; }

.empty { text-align: center; padding: 60px 20px; color: var(--text-mute); font-size: 14px; }
.empty .empty-title { font-family: var(--font-display); color: var(--text); font-size: 16px; margin-bottom: 6px; }

.theme-picker { position: relative; }
.theme-picker-btn {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 12px; border-radius: var(--radius-md);
    border: 1px solid var(--border); background: var(--surface-alt);
    cursor: pointer; font-size: 13px; color: var(--text);
}
.theme-picker-btn:hover { background: var(--hover); }
.theme-picker-btn .swatch {
    width: 16px; height: 16px; border-radius: 50%;
    background: linear-gradient(135deg, var(--text) 50%, var(--surface) 50%);
    border: 1px solid var(--border-strong);
}
.theme-picker-menu {
    position: absolute; bottom: calc(100% + 6px); left: 0; right: 0;
    background: var(--surface-elev); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 6px;
    box-shadow: var(--shadow-pop); display: none;
}
.theme-picker.is-open .theme-picker-menu { display: block; }
.theme-picker-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 13px;
}
.theme-picker-item:hover { background: var(--hover); }
.theme-picker-item.is-active { background: var(--accent-soft); }

/* ============================ BUILDER ============================ */
.builder {
    display: grid; grid-template-columns: 280px 1fr 320px;
    gap: 14px; height: calc(100vh - 130px);
}
.builder-side {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 14px; overflow-y: auto;
}
.builder-canvas {
    background: var(--surface-alt); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
    display: flex; flex-direction: column;
}
.builder-canvas-toolbar {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.builder-preview-frame { flex: 1; border: none; width: 100%; background: white; }

.builder-block-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.builder-block-btn {
    background: var(--surface-alt); border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md); padding: 14px 10px;
    text-align: center; cursor: pointer; font-size: 12px; color: var(--text-dim);
    transition: background .15s, border-color .15s, color .15s;
}
.builder-block-btn:hover { border-color: var(--text); color: var(--text); background: var(--surface); }
.builder-block-btn .ico { display: block; margin: 0 auto 6px; }

.block-list-edit { display: flex; flex-direction: column; gap: 8px; }
.block-row {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 10px 12px;
    display: flex; align-items: center; gap: 10px;
}
.block-row .block-type {
    font-size: 11px; color: var(--text-mute);
    text-transform: uppercase; letter-spacing: 1.2px; font-family: var(--font-body-bold);
}
.block-row .block-preview {
    flex: 1; color: var(--text); font-size: 13px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.block-row .block-actions { display: flex; gap: 4px; }
.block-row.is-selected { border-color: var(--text); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
    padding: 10px 16px; color: var(--text-dim); cursor: pointer;
    font-family: var(--font-body-bold); font-size: 13px;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--text); }

.toast {
    position: fixed; bottom: 22px; right: 22px;
    background: var(--text); color: var(--accent-contrast);
    padding: 12px 18px; border-radius: var(--radius-pill);
    font-size: 13px; font-family: var(--font-body-bold);
    box-shadow: var(--shadow-pop); transform: translateY(120%);
    transition: transform .25s; z-index: 300;
}
.toast.show { transform: translateY(0); }
.toast.error { background: var(--danger); color: white; }

.clickable { cursor: pointer; }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: var(--radius-pill);
    background: var(--surface); border: 1px solid var(--border);
    font-size: 12px; color: var(--text-dim); cursor: pointer;
}
.chip:hover { background: var(--hover); color: var(--text); }
.chip.is-active { background: var(--text); color: var(--accent-contrast); border-color: var(--text); }

@media (max-width: 1100px) {
    .builder { grid-template-columns: 240px 1fr; }
    .builder-side.right { display: none; }
}
@media (max-width: 720px) {
    .app { grid-template-columns: 64px 1fr; }
    .sidebar { padding: 14px 8px; }
    .nav-item .label, .brand-name, .nav-section-title, .theme-picker-btn { display: none; }
    .nav-item { justify-content: center; }
    .builder { grid-template-columns: 1fr; }
}

/* ============================ SPA TRANSITIONS ============================ */
/* The view root and the title both animate on every navigate() call.
   Pattern: opacity + a small Y/X translate, ~160ms each side, ease-out.
   Modeled on the hub-2.0 background swap aesthetic but lighter. */

#viewRoot {
    transition: opacity .18s ease, transform .22s cubic-bezier(.2,.7,.2,1), filter .22s ease;
    will-change: opacity, transform, filter;
}

/* Exit phase — fade & nudge out before the swap */
#viewRoot.view-exit {
    opacity: 0;
    transform: translateY(6px);
    filter: blur(2px);
    pointer-events: none;
}

/* Enter prep states — set BEFORE the class is removed in rAF */
#viewRoot.view-enter-right {
    opacity: 0;
    transform: translateX(14px);
    filter: blur(2px);
}
#viewRoot.view-enter-left {
    opacity: 0;
    transform: translateX(-14px);
    filter: blur(2px);
}

/* Title crossfade — small offset, not distracting */
#pageTitle, #pageSub {
    transition: opacity .14s ease, transform .18s cubic-bezier(.2,.7,.2,1);
}
.view-title-out { opacity: 0 !important; transform: translateY(-4px); }
.view-title-in  { opacity: 1; transform: translateY(0); }

/* Sidebar nav-item active glow uses the same motion language */
.nav-item { transition: background .15s ease, color .15s ease, transform .12s ease; }
.nav-item:active { transform: translateY(1px); }

/* ============================ HOVER TRANSITIONS ============================
   Smooth background-color transitions on every interactive element. Override
   any earlier rules without one so hover state animates in/out instead of
   snapping. */
.table tbody tr,
.popover-row,
.theme-picker-btn,
.theme-picker-item,
.theme-picker-item .swatch,
.btn-outline-pill,
.chip,
.tab,
.builder-block-btn,
.block-row,
.stat-card,
.card,
.pill-toolbar .pill {
    transition:
        background-color .18s ease,
        color .18s ease,
        border-color .18s ease,
        box-shadow .18s ease;
}

/* A touch of warmth on full table rows (already had the color rule, now it eases) */
.table tbody tr:hover { background: var(--hover); }

/* Tab — animate the underline-color too */
.tab {
    transition:
        color .18s ease,
        border-bottom-color .18s ease,
        background-color .18s ease;
}

/* Stat cards lift slightly on hover (subtle) */
.stat-card { transition: background-color .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.stat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

/* Cards in grids (templates, dashboard cards) get a soft border highlight on hover */
.card { transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease; }

/* Block-row in the builder structure list — softer hover */
.block-row:hover { background: var(--hover); }

/* ============================ MEDIA LIBRARY ============================
   Layout: sidebar with folder filter + grid of file cards on the right.
   Cards show an image preview (or icon) above the filename / metadata. */
.media-page { display: flex; flex-direction: column; gap: 16px; }
.media-toolbar { display: flex; gap: 12px; align-items: center; }
.media-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; }
@media (max-width: 760px) {
    .media-layout { grid-template-columns: 1fr; }
}

.media-sidebar {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.media-folder {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}
.media-folder:hover { background: var(--hover); }
.media-folder.is-active {
    background: var(--hover);
    border-color: var(--border-strong);
}
.media-folder-name { text-transform: lowercase; }
.media-folder-count {
    font-size: 11px;
    color: var(--muted);
    background: var(--bg-raised);
    border-radius: 999px;
    padding: 1px 8px;
}

.media-grid-wrap { min-width: 0; }
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}
.media-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color .15s ease, transform .15s ease;
}
.media-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
}
.media-card-preview {
    aspect-ratio: 16 / 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    overflow: hidden;
}
.media-card-img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.media-card-icon {
    color: var(--muted);
}
.media-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px 12px;
}
.media-card-name {
    font-size: 12px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.media-card-meta {
    font-size: 11px;
    color: var(--muted);
}
.media-card-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}
.media-card-actions .btn {
    flex: 0 0 auto;
}

/* Inline upload button next to URL inputs in the article editor */
.upload-field { width: 100%; }
.upload-status:empty { display: none; }

/* ============================ HUB BADGE PREVIEW ============================
   Mirrors the network-badge styling used in the hub-2.0 news section so
   editors can see exactly how their logo / accent / tint combination
   will render before saving. */
.hub-badge-preview-wrap {
    margin: 4px 0 0;
}
.hub-badge-preview-frame {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)),
        #1a1a22;
    border: 1px dashed var(--border-strong, #555);
    border-radius: 8px;
}
.hub-badge-preview-row-label {
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted, #888);
    flex: 1 1 auto;
}
.hub-badge-preview {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(10, 10, 14, 0.78);
    backdrop-filter: blur(10px) saturate(1.2);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0a0a0a;
    font-family: monospace;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.hub-badge-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
}
.hub-badge-preview.is-fallback {
    background: var(--badge-tint, #7afff0);
}
/* Custom-colour silhouette: SVG masks the badge's background-color. */
.hub-badge-preview-mask {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-position: center;
            mask-position: center;
    -webkit-mask-size: 70%;
            mask-size: 70%;
}

/* ============================ MEDIA DROPZONE ===============================
   Themed file-drop area used by the Media Library upload dialog. The native
   OS file picker is still triggered on click (browsers don't expose any
   way to enumerate the local filesystem from a web page), but the
   surrounding visual stays inside the app's design system. */
.media-dropzone {
    margin-top: 14px;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 2px dashed var(--border-strong, #555);
    border-radius: 10px;
    background: var(--bg-raised, #1a1a22);
    color: var(--text, #eaeaf0);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, transform .12s ease;
    text-align: center;
    outline: none;
}
.media-dropzone:hover,
.media-dropzone:focus-visible {
    border-color: var(--accent, #6b8242);
    background: var(--hover, #232331);
}
.media-dropzone.is-dragover {
    border-color: var(--accent, #6b8242);
    background: var(--hover, #232331);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.media-dropzone-icon {
    opacity: 0.85;
    pointer-events: none;
}
.media-dropzone-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text, #eaeaf0);
}
.media-dropzone-hint {
    font-size: 12px;
    color: var(--muted, #888);
}

.media-upload-filelist {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}
.media-upload-fileitem {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-raised, #1a1a22);
    border: 1px solid var(--border, #333);
    border-radius: 6px;
    font-size: 12px;
}
.media-upload-filename {
    color: var(--text, #eaeaf0);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.media-upload-filesize {
    color: var(--muted, #888);
    font-variant-numeric: tabular-nums;
}
.media-upload-fileremove {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted, #888);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: color .12s ease, border-color .12s ease, background-color .12s ease;
}
.media-upload-fileremove:hover {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.08);
}

/* Avatars view — same card grid as Media Library but with round
   previews on a checker-style backdrop so SVG silhouettes read
   regardless of the active theme. */
.avatar-page .media-toolbar {
    margin-bottom: 12px;
}
.avatar-grid-wrap {
    width: 100%;
}
.avatar-card-preview {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(45deg, rgba(0,0,0,0.04) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(0,0,0,0.04) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.04) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.04) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.avatar-card-img {
    max-width: 80%;
    max-height: 80%;
    border-radius: 50%;
    object-fit: cover;
}

/* ─────────────────────────────────────────────────────────────────────────
   Permissions view — table + grant row + role-matrix split layout.
   Reuses .table / .card / .badge / .input / .select primitives.
   ───────────────────────────────────────────────────────────────────────── */

.permissions-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.permissions-table .row-name { font-weight: 600; color: var(--text); }
.permissions-table .row-sub  { color: var(--text-mute); font-size: 12px; margin-top: 2px; }
.permissions-table .guid-line {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px;
    word-break: break-all;
}

.permissions-table .col-actions { width: 1%; white-space: nowrap; text-align: right; }

/* Grant access row sits below the users table; reused for "+ Create role". */
.permissions-grant-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    padding: 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: 12px;
}
.permissions-grant-row .field { display: flex; flex-direction: column; gap: 4px; }
.permissions-grant-row label { font-size: 11px; color: var(--text-mute); letter-spacing: 0.6px; }
.permissions-grant-label {
    flex: 0 0 100%;
}
.permissions-grant-label .card-title { font-size: 13px; }

/* Roles tab: list on the left, matrix on the right. */
.permissions-roles-layout {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 2fr;
    gap: 18px;
}
@media (max-width: 900px) {
    .permissions-roles-layout { grid-template-columns: 1fr; }
}
.permissions-roles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.permissions-roles-matrix {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.permissions-roles-matrix .card-head { padding: 0; border: 0; }

.permissions-matrix-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 50vh;
    overflow-y: auto;
}
.permissions-matrix-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    background: var(--surface-alt);
}
.permissions-matrix-row:hover {
    border-color: var(--border-strong);
}
.permissions-matrix-row label { width: 100%; align-items: flex-start; }
.permissions-matrix-row .row-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
}
.permissions-matrix-row .row-sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}

.permissions-matrix-foot {
    display: flex;
    justify-content: flex-end;
}

.select-sm { font-size: 12px; padding: 4px 8px; }

/* ─────────────────────────────────────────────────────────────────────
   Quick menu — top-right pill with a dropdown for the signed-in
   operator (alias / email / GUID + Sign out). Lives inside .topbar.
   ───────────────────────────────────────────────────────────────────── */
.qm-wrap {
    position: relative;
    margin-left: 8px;
    flex-shrink: 0;
}
.qm-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    transition: border-color .15s, background .15s;
    max-width: 220px;
}
.qm-pill:hover  { border-color: var(--border-strong); }
.qm-pill:focus  { outline: none; border-color: var(--text); }
.qm-pill svg    { width: 12px; height: 12px; opacity: .7; }
.qm-pill-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
    line-height: 1;
}
.qm-pill-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface-alt);
    flex-shrink: 0;
}
.qm-pill-avatar-fallback {
    display: grid;
    place-items: center;
    color: var(--text);
    font-family: var(--font-display, sans-serif);
    font-size: 11px;
    letter-spacing: .2px;
    text-transform: uppercase;
    border: 1px solid var(--border);
}

.qm-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 240px;
    max-width: 320px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 32px -16px rgba(0,0,0,0.25),
                0 1px 0 rgba(0,0,0,0.02);
    padding: 6px;
    display: none;
    z-index: 50;
}
.qm-wrap.is-open .qm-menu { display: block; }

.qm-menu-head {
    padding: 8px 10px 10px;
}
.qm-menu-name {
    font-family: var(--font-display, sans-serif);
    font-size: 14px;
    color: var(--text);
    margin-bottom: 2px;
}
.qm-menu-line {
    font-size: 12px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qm-menu-guid {
    margin-top: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10.5px;
    color: var(--text-mute);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    user-select: all;
}

.qm-menu-sep {
    height: 1px;
    background: var(--border);
    margin: 4px -6px;
}

.qm-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
}
.qm-menu-item:hover  { background: var(--hover, var(--surface-alt)); }
.qm-menu-item svg    { width: 14px; height: 14px; }
.qm-menu-danger      { color: #b3261e; }
.qm-menu-danger:hover{
    background: rgba(179, 38, 30, 0.08);
    color: #b3261e;
}
html[data-theme="dark"] .qm-menu-danger        { color: #ff7a7a; }
html[data-theme="dark"] .qm-menu-danger:hover  { background: rgba(255, 122, 122, 0.10); }

/* ─────────────────────────────────────────────────────────────────────
   Right-click quick menu — small fixed-position overlay anchored to
   the cursor. Built imperatively in public/src/quickMenu.js; this
   block just paints it.
   ───────────────────────────────────────────────────────────────────── */
.qm-context {
    position: fixed;
    min-width: 220px;
    max-width: 280px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow:
        0 1px 0 rgba(0,0,0,0.02),
        0 24px 60px -20px rgba(0,0,0,0.28);
    z-index: 200;
    opacity: 0;
    transform: scale(0.97);
    transform-origin: top left;
    transition: opacity .12s ease, transform .12s ease;
    user-select: none;
}
.qm-context.is-open {
    opacity: 1;
    transform: scale(1);
}

.qm-context-head {
    padding: 6px 10px 8px;
}
.qm-context-eyebrow {
    font-size: 10px;
    letter-spacing: 1.6px;
    color: var(--text-mute);
    text-transform: uppercase;
}
.qm-context-name {
    font-family: var(--font-display, sans-serif);
    font-size: 14px;
    color: var(--text);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qm-context-sep {
    height: 1px;
    background: var(--border);
    margin: 4px -6px;
}

.qm-context-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.qm-context-item:hover    { background: var(--hover, var(--surface-alt)); }
.qm-context-item:focus    { outline: none; background: var(--hover, var(--surface-alt)); }

.qm-context-danger        { color: #b3261e; }
.qm-context-danger:hover  { background: rgba(179, 38, 30, 0.08); color: #b3261e; }

html[data-theme="dark"] .qm-context-danger        { color: #ff7a7a; }
html[data-theme="dark"] .qm-context-danger:hover  { background: rgba(255, 122, 122, 0.10); }

/* ─────────────────────────────────────────────────────────────────────
   Hub Layout view — list of nav-section toggles.
   ───────────────────────────────────────────────────────────────────── */
.hub-sections-card { padding: 0; }
.hub-sections-card .card-head { padding: 18px 20px 14px; }

.hub-sections-list {
    list-style: none;
    margin: 0;
    padding: 0 8px 12px;
}
.hub-section-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 14px;
    padding: 12px 12px;
    border-top: 1px solid var(--border);
}
.hub-section-row:first-child { border-top: 0; }
.hub-section-row.is-locked { opacity: 0.85; }

.hub-section-meta .row-name {
    font-family: var(--font-display, sans-serif);
    font-size: 14px;
    color: var(--text);
}
.hub-section-meta .row-sub {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px;
    color: var(--text-mute);
    margin-top: 2px;
}
.hub-section-state .badge { white-space: nowrap; }

.hub-section-row.is-locked .toggle input[type="checkbox"]:disabled + .slider {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Sub-section rows inside the Hub Layout admin — indented under
   their parent so the hierarchy reads at a glance. */
.hub-section-row.is-child {
    padding-left: 36px;
    background: var(--surface-alt);
}
.hub-section-row.is-child .row-name {
    font-size: 13px;
    color: var(--text-dim);
}
.hub-section-tree {
    color: var(--text-mute);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    margin-right: 4px;
}

/* Delete button on a hub section row — sits at the right edge of
   the row, ghost-style, only renders for unlocked rows. */
.hub-section-row {
    /* 5 columns so the edit + delete buttons each get their own
       slot without crowding the toggle column. */
    grid-template-columns: 1fr auto auto auto auto;
}
.hub-section-edit,
.hub-section-delete {
    color: var(--text-mute);
}
.hub-section-edit:hover {
    color: var(--text);
    background: rgba(122, 255, 240, 0.08);
}
.hub-section-delete:hover {
    color: #b3261e;
    background: rgba(179, 38, 30, 0.08);
}
html[data-theme="dark"] .hub-section-delete:hover {
    color: #ff7a7a;
    background: rgba(255, 122, 122, 0.10);
}

/* ─── Card list inside the hub section content editor modal ───
   Compact rows so an operator can scan a section's cards quickly.
   Each row pairs the title + a one-line summary with Edit/Delete
   buttons on the right. */
.hub-cards-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 14px 0 6px;
}
.hub-cards-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.hub-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-raised);
}
.hub-card-row-meta { min-width: 0; flex: 1; }
.hub-card-row-title {
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hub-card-row-sub {
    font-size: 12px;
    color: var(--text-mute);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hub-card-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ─── Content block builder inside a card dialog ─── */
.hub-block-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.hub-blocks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}
.hub-block-row {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px;
    background: var(--bg-raised);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.hub-block-ctrls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}
.hub-block-type {
    flex: 1;
    font-family: var(--mono, monospace);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-mute);
}

/* Accent colour picker on the card editor — small native swatch + a
   hex text mirror + a clear button (×). The swatch keeps its native
   chrome so the OS picker opens on click; the text input flexes to
   take the rest of the row. */
.hub-accent-field { gap: 6px; }
.hub-accent-swatch {
    width: 36px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0;
    background: transparent;
    cursor: pointer;
    flex: 0 0 36px;
}
.hub-accent-swatch::-webkit-color-swatch-wrapper { padding: 2px; }
.hub-accent-swatch::-webkit-color-swatch        { border-radius: 3px; border: 0; }
.hub-accent-text  { flex: 1; min-width: 0; }

/* Section content editor — Home logo row.
   The right-hand "Show on home" stack stays compact and left-aligns
   its toggle below the label so it lines up cleanly with the input
   on its left. */
.hub-section-home-row .hub-section-show-home {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.hub-section-home-row .hub-section-show-home > label:first-child {
    margin: 0;
}

/* Collapse / expand caret on a parent row in the Hub Layout view.
   Lives inside .row-name so it sits flush against the section
   label. Tiny ghost button — colour follows --text-mute and lifts
   to --text on hover. */
.hub-section-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-mute);
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    border-radius: 3px;
    transition: color .12s, background .12s, transform .12s;
}
.hub-section-caret:hover {
    color: var(--text);
    background: var(--hover, var(--surface-alt));
}
.hub-section-caret.is-collapsed {
    /* Same glyph; the JS swaps ▾/▸ but a tiny rotation on hover keeps
       the affordance obvious for keyboard / focus users. */
    transform: none;
}
