/* Evenpost app: NOIR (identity.autmori.com), the same system as evenpost.app.
   "Less is everything": black ground, one orange per screen, the typography carries the brand.
   Every colour, font and radius comes from the token blocks below. DECISIONS 282. */

/* ── Fonts: self-hosted, the site's files. To change the typography, swap these two files and the FONTS tokens. ── */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("/static/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); }

/* ═══ Tokens: dark (NOIR, the default) ═══ */
:root {
    /* FONTS: edit here only. The same families as evenpost-site/app/globals.css. */
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
    --display-family: var(--sans);
    --display-weight: 200;
    --display-tracking: .1em;
    --display-case: uppercase;

    /* VIDEO-CARD-1: the video tile is black in every theme, so its ink does not follow the theme. */
    --video-ink: #FFFFFF;
    --video-ink-dim: #E6E6E6;
    --video-danger: #FF8080;

    --bg: #000000;
    --surface: #080808;
    --elevated: #101010;
    --hover: #181818;
    --glass: rgba(255, 255, 255, .02);
    --inset: #000000;                 /* code blocks and inputs inside a card */
    --border: rgba(255, 255, 255, .06);
    --edge: rgba(255, 255, 255, .10);
    --field: rgba(255, 255, 255, .18);
    --strong: rgba(255, 255, 255, .35);

    --text: #FFFFFF;
    --body: #CFCFCF;
    --text-secondary: #999999;        /* 7.4:1 on black */
    --quiet: #808080;                 /* 5.3:1 on black */
    --text-tertiary: #555555;         /* decoration only: brackets, rails, chevrons */
    --caption: #999999;               /* every caption under 12 px: 7.4:1 on black */

    --accent: #FF6B35;
    --accent-text: #FF6B35;
    --accent-hover: #FF8555;
    --on-accent: #000000;             /* black on orange: white on #FF6B35 fails AA */
    --accent-tint: rgba(255, 107, 53, .10);
    --accent-border: rgba(255, 107, 53, .38);
    --accent-glow: rgba(255, 107, 53, .15);
    --dot-glow: rgba(255, 107, 53, .6);

    --pill-bg: #FFFFFF;               /* the identity's white pill: the active nav item, the theme segment */
    --pill-fg: #000000;
    --bar-bg: rgba(14, 14, 14, .96);
    --bar-shadow: 0 12px 32px rgba(0, 0, 0, .55);
    --sheet-shadow: 0 24px 64px rgba(0, 0, 0, .6);

    --success: #22C55E;
    --success-tint: rgba(34, 197, 94, .08);
    --success-border: rgba(34, 197, 94, .28);
    --danger: #F25555;
    --danger-tint: rgba(239, 68, 68, .09);
    --danger-border: rgba(239, 68, 68, .35);
    --warn: #F5A524;
    --warn-tint: rgba(245, 158, 11, .08);
    --warn-border: rgba(245, 158, 11, .30);
    --info: #5CC8FF;
    --info-tint: rgba(0, 212, 255, .07);
    --info-border: rgba(0, 212, 255, .25);

    --overlay: rgba(0, 0, 0, .72);
    --chip-bg: rgba(0, 0, 0, .72);
    --photo-border: rgba(255, 255, 255, .06);
    --statusbar-bg: #000000;

    /* the lightbox is a dark room in both themes */
    --lightbox-bg: rgba(0, 0, 0, .94);
    --on-lightbox: #FFFFFF;
    --on-lightbox-muted: #999999;
    --lightbox-btn-bg: rgba(255, 255, 255, .08);
    --lightbox-btn-border: rgba(255, 255, 255, .14);
    --lightbox-btn-hover: rgba(255, 255, 255, .18);

    /* shape and rhythm */
    --r-card: 0;      /* NOIR is square: cards, inputs, sheets and buttons have no radius */
    --r-inner: 0;
    --r-input: 0;
    --r-sheet: 0;
    --r-btn: 0;
    --r-tag: 4px;     /* tags */
    --r-pill: 999px;  /* nav items, badges and the segmented controls only */
    --gutter: 16px;
    --column: 680px;
    --side-w: 0px;
    --top-h: 56px;
    --bar-h: 58px;
    --bar-bottom: max(14px, env(safe-area-inset-bottom, 0px));

    /* old names, kept as aliases */
    --bg-primary: var(--bg);
    --bg-secondary: var(--surface);
    --bg-elevated: var(--elevated);
    --bg-hover: var(--hover);
    --text-primary: var(--text);
    --text-muted: var(--quiet);

    color-scheme: dark;
}

/* ═══ Tokens: NOIR-light. theme-boot.js sets data-theme=light for Light and for Auto on a light device. ═══ */
:root[data-theme="light"] {
    --bg: #F4F4F5; --surface: #FFFFFF; --elevated: #FFFFFF; --hover: #EBEBED; --glass: rgba(0, 0, 0, .02); --inset: #F7F7F8;
    --border: rgba(0, 0, 0, .07); --edge: rgba(0, 0, 0, .11); --field: rgba(0, 0, 0, .22); --strong: rgba(0, 0, 0, .40);
    --text: #0A0A0B; --body: #2A2A2E; --text-secondary: #55555C; --quiet: #66666E; --text-tertiary: #A1A1A8; --caption: #55555C;
    --accent: #FF6B35; --accent-text: #B0350A; --accent-hover: #FF7F4F; --on-accent: #0A0A0B;
    --accent-tint: rgba(255, 107, 53, .10); --accent-border: rgba(176, 53, 10, .35); --accent-glow: rgba(255, 107, 53, .18); --dot-glow: rgba(255, 107, 53, .45);
    --pill-bg: #0A0A0B; --pill-fg: #FFFFFF;
    --bar-bg: rgba(255, 255, 255, .96); --bar-shadow: 0 10px 30px rgba(0, 0, 0, .12); --sheet-shadow: 0 16px 48px rgba(0, 0, 0, .18);
    --success: #166534; --success-tint: rgba(22, 101, 52, .07); --success-border: rgba(22, 101, 52, .25);
    --danger: #B91C1C; --danger-tint: rgba(185, 28, 28, .06); --danger-border: rgba(185, 28, 28, .30);
    --warn: #92400E; --warn-tint: rgba(146, 64, 14, .07); --warn-border: rgba(146, 64, 14, .28);
    --info: #075985; --info-tint: rgba(7, 89, 133, .07); --info-border: rgba(7, 89, 133, .25);
    --overlay: rgba(10, 10, 12, .45); --chip-bg: rgba(255, 255, 255, .92); --photo-border: rgba(0, 0, 0, .10);
    color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #000000; --surface: #080808; --elevated: #101010; --hover: #181818; --glass: rgba(255, 255, 255, .02); --inset: #000000;
    --border: rgba(255, 255, 255, .06); --edge: rgba(255, 255, 255, .10); --field: rgba(255, 255, 255, .18); --strong: rgba(255, 255, 255, .35);
    --text: #FFFFFF; --body: #CFCFCF; --text-secondary: #999999; --quiet: #808080; --text-tertiary: #555555; --caption: #999999;
    --accent: #FF6B35; --accent-text: #FF6B35; --accent-hover: #FF8555; --on-accent: #000000;
    --accent-tint: rgba(255, 107, 53, .10); --accent-border: rgba(255, 107, 53, .38); --accent-glow: rgba(255, 107, 53, .15); --dot-glow: rgba(255, 107, 53, .6);
    --pill-bg: #FFFFFF; --pill-fg: #000000;
    --bar-bg: rgba(14, 14, 14, .96); --bar-shadow: 0 12px 32px rgba(0, 0, 0, .55); --sheet-shadow: 0 24px 64px rgba(0, 0, 0, .6);
    --success: #22C55E; --success-tint: rgba(34, 197, 94, .08); --success-border: rgba(34, 197, 94, .28);
    --danger: #F25555; --danger-tint: rgba(239, 68, 68, .09); --danger-border: rgba(239, 68, 68, .35);
    --warn: #F5A524; --warn-tint: rgba(245, 158, 11, .08); --warn-border: rgba(245, 158, 11, .30);
    --info: #5CC8FF; --info-tint: rgba(0, 212, 255, .07); --info-border: rgba(0, 212, 255, .25);
    --overlay: rgba(0, 0, 0, .72); --chip-bg: rgba(0, 0, 0, .72); --photo-border: rgba(255, 255, 255, .06);
    color-scheme: dark;
}

@media (min-width: 768px) { :root { --gutter: 32px; --side-w: 216px; } }
@media (min-width: 1024px) { :root { --gutter: 48px; --side-w: 256px; } }

/* ═══ Base ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); scroll-padding-top: calc(var(--top-h) + env(safe-area-inset-top, 0px) + 12px); }
body {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font: 400 15px/1.5 var(--sans);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
    -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--accent); color: var(--on-accent); }
img { max-width: 100%; }
a { color: var(--text); text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: var(--strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { text-wrap: balance; font-weight: 500; }
p { text-wrap: pretty; }
code { font-family: var(--mono); font-size: .86em; background: var(--inset); border: 1px solid var(--edge); border-radius: var(--r-tag); padding: 1px 6px; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
[hidden] { display: none !important; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip {
    position: fixed; left: 12px; top: -200px; z-index: 2000;
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px;
    border-radius: var(--r-btn); background: var(--pill-bg); color: var(--pill-fg);
    font: 500 11px/1 var(--mono); letter-spacing: .15em; text-transform: uppercase; text-decoration: none;
}
.skip:focus { top: calc(12px + env(safe-area-inset-top, 0px)); }

/* type */
.eyebrow { font: 500 10px/1.6 var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--text-secondary); }
.display {
    font-family: var(--display-family); font-weight: var(--display-weight); letter-spacing: var(--display-tracking);
    text-transform: var(--display-case); color: var(--text); line-height: 1.04;
}

/* the brand mark: the site's dot + tracked caps */
.brand {
    display: inline-flex; align-items: center; gap: 12px; min-height: 44px;
    font: 400 12px/1 var(--sans); letter-spacing: .4em; text-transform: uppercase;
    color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }

/* ═══ Shell ═══ */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    height: calc(var(--top-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(var(--gutter), env(safe-area-inset-left, 0px));
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
/* the iPhone notch strip stays black in both themes: black-translucent draws white status-bar glyphs */
.topbar::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: env(safe-area-inset-top, 0px); background: var(--statusbar-bg); pointer-events: none; }
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
    .topbar { background: color-mix(in srgb, var(--bg) 94%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(18px); backdrop-filter: saturate(1.4) blur(18px); }
}

.avatar {
    display: inline-grid; place-items: center; flex: none;
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--elevated); border: 1px solid var(--edge);
    font: 500 13px/1 var(--mono); color: var(--text); text-transform: uppercase;
    overflow: hidden;
}
.avatar:empty::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--text-tertiary); }
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }
.avatar-btn {
    display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
    border: 0; border-radius: 50%; background: transparent; cursor: pointer;
}
.avatar-btn[aria-expanded="true"] .avatar, body[data-screen="tab-settings"] .avatar-btn .avatar { border-color: var(--text); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    position: relative;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    min-height: 44px; padding: 0 16px;
    border: 0; border-radius: 999px; background: transparent;
    color: var(--text-secondary); font: 500 14px/1 var(--sans); letter-spacing: 0;
    text-decoration: none; text-align: left; cursor: pointer; white-space: nowrap;
}
.nav-item:hover { color: var(--text); background: var(--hover); text-decoration: none; }
.nav-item.active, .nav-item[aria-current="page"] { background: var(--pill-bg); color: var(--pill-fg); }
.nav-item:focus-visible { outline-offset: 2px; }
.nav-count { font: 500 11px/1 var(--mono); letter-spacing: .04em; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.nav-count:empty { display: none; }
.nav-item[aria-current="page"] .nav-count, .nav-item.active .nav-count { color: inherit; }
.nav-count.attention { color: var(--accent-text); opacity: 1; }
.nav-item[aria-current="page"] .nav-count.attention { color: var(--pill-fg); }
.nav-item[aria-current="page"] .nav-count.attention::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.nav-chev { font: 300 20px/1 var(--sans); color: var(--text-tertiary); }
.nav-item[aria-current="page"] .nav-chev { color: inherit; opacity: .5; }

/* the account block */
.account { display: flex; flex-direction: column; gap: 14px; }
.account-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.account-id { min-width: 0; }
.account-handle { font: 500 14px/1.3 var(--sans); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-handle:empty::before { content: "Signed in"; color: var(--text-secondary); }
.account-plan { margin-top: 3px; font: 500 11px/1.4 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--text-secondary); }
.account-plan:empty { display: none; }
.account-usage-line { font: 400 13px/1.4 var(--sans); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.account-usage-warn .account-usage-line { color: var(--danger); }
.account-usage-warn .account-usage-line a { color: inherit; font-weight: 500; }
.account-usage-warn .meter { display: none; }
.meter { margin-top: 8px; height: 3px; border-radius: 0; background: var(--edge); overflow: hidden; }
.meter > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--text); }
.meter > span.low { background: var(--warn); }

/* the identity's white-pill toggle */
.theme-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; padding: 3px; border: 1px solid var(--edge); border-radius: 999px; background: var(--surface); }
.theme-seg button {
    min-height: 34px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; cursor: pointer;
    font: 500 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-secondary);
}
.theme-seg button:hover { color: var(--text); }
.theme-seg button[aria-pressed="true"] { background: var(--pill-bg); color: var(--pill-fg); }
.theme-seg button:focus-visible { outline-offset: 1px; }
.account .account-signout { justify-content: flex-start; padding: 0 2px; color: var(--text-secondary); }
.account .account-signout:hover { background: transparent; color: var(--text); }

/* the content column */
.tab-container { display: block; min-width: 0; outline: none; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.panel-inner { width: 100%; max-width: calc(var(--column) + 2 * var(--gutter)); margin: 0 auto; padding: 28px var(--gutter) 64px; }
#tab-calendar .panel-inner { max-width: calc(1120px + 2 * var(--gutter)); }
.admin-inner { max-width: calc(1040px + 2 * var(--gutter)); }

/* ── Laptop and tablet (768 px and up): the sidebar ── */
@media (min-width: 768px) {
    .topbar, .scrim, .grabber, .sheet-close { display: none !important; }
    .side {
        position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
        width: var(--side-w);
        display: flex; flex-direction: column;
        padding: calc(20px + env(safe-area-inset-top, 0px)) 12px calc(16px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
        background: var(--bg); border-right: 1px solid var(--border);
        overflow-y: auto; overscroll-behavior: contain;
    }
    .side-brand { margin: 0 0 28px 16px; }
    .account-sheet { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
    .nav-more { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
    .nav-more .nav-chev { display: none; }
    .account { margin-top: auto; padding: 18px 4px 0; border-top: 1px solid var(--border); }
    .tab-container { margin-left: var(--side-w); }
    .nav-spacer { height: 196px; flex: none; }
    #nav {
        position: fixed; z-index: 41; top: 84px; left: 0; width: var(--side-w);
        padding: 0 12px; box-sizing: border-box;
    }
    .panel-inner { padding-top: 56px; padding-bottom: 96px; }
}

/* ── Phone (under 768 px): top bar, the floating pill bar, the account sheet ── */
@media (max-width: 767px) {
    .side { display: contents; }
    .nav-spacer { display: none; }
    .side-brand { display: none; }
    #nav {
        position: fixed; z-index: 60;
        left: 50%; bottom: var(--bar-bottom); transform: translateX(-50%);
        width: min(calc(100% - 24px), 460px);
        display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px;
        padding: 5px;
        border: 1px solid var(--edge); border-radius: 999px;
        background: var(--bar-bg); box-shadow: var(--bar-shadow);
        -webkit-backdrop-filter: saturate(1.6) blur(22px); backdrop-filter: saturate(1.6) blur(22px);
    }
    #nav .nav-item {
        justify-content: center; gap: 5px; min-height: 46px; padding: 0 4px;
        font: 500 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
    }
    #nav .nav-item:hover { background: transparent; }
    #nav .nav-item[aria-current="page"], #nav .nav-item.active { background: var(--pill-bg); color: var(--pill-fg); }
    #nav .nav-count { font-size: 10px; letter-spacing: 0; }

    .account-sheet {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
        display: flex; flex-direction: column; gap: 6px;
        max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain;
        padding: 8px max(20px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
        background: var(--elevated); border: 1px solid var(--edge); border-bottom: 0;
        border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--sheet-shadow);
        transform: translateY(105%); visibility: hidden;
    }
    .sheet-open .account-sheet { transform: none; visibility: visible; }
    .grabber { width: 36px; height: 4px; margin: 0 auto 14px; border-radius: 2px; background: var(--strong); flex: none; }
    .account { display: contents; }
    .account-who { order: 1; padding: 4px 0 2px; }
    .account-usage { order: 2; padding-bottom: 10px; }
    .nav-more { order: 3; margin: 0 -8px; padding: 6px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
    .nav-more .nav-item { min-height: 52px; padding: 0 8px; border-radius: var(--r-pill); font-size: 16px; color: var(--text); }
    .nav-more .nav-item[aria-current="page"] { background: var(--hover); color: var(--text); }
    .theme-seg button { min-height: 44px; }
    .admin-swipe { display: block; margin: 0 0 8px; font: 400 12px/1.4 var(--sans); color: var(--caption); }
    .admin-scroll { position: relative; }
    .admin-scroll::after {
        content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 28px; pointer-events: none;
        background: linear-gradient(90deg, transparent, var(--surface));
    }
    .account .account-signout { order: 5; justify-content: center; margin-top: 4px; }
    .sheet-close { order: 6; }
    .scrim { position: fixed; inset: 0; z-index: 80; background: var(--overlay); }
    .sheet-open { overflow: hidden; }

    .panel-inner { padding-top: 22px; padding-bottom: calc(var(--bar-h) + var(--bar-bottom) + 40px); }
    html { scroll-padding-bottom: calc(var(--bar-h) + var(--bar-bottom) + 16px); }
}

/* ═══ Screen heading ═══ */
.screen-head { position: relative; margin-bottom: 24px; }
.screen-head .eyebrow { margin-bottom: 10px; }
.screen-title {
    font-family: var(--display-family); font-weight: var(--display-weight);
    font-size: 30px; line-height: 1; letter-spacing: .1em; text-transform: uppercase; color: var(--text);
    padding-left: .02em;
}
.screen-head::after { content: ""; display: block; height: 1px; margin-top: 22px; background: linear-gradient(to right, var(--edge), transparent 80%); }
.screen-aside { margin-top: 12px; font: 400 12px/1.6 var(--mono); letter-spacing: .03em; color: var(--text-secondary); }
.screen-aside:empty { display: none; }
@media (min-width: 768px) { .screen-title { font-size: 40px; } .screen-head { margin-bottom: 32px; } }

/* ═══ Buttons: square. Orange once per screen. ═══ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 20px;
    border: 1px solid var(--field); border-radius: var(--r-btn);
    background: transparent; color: var(--text);
    font: 500 15px/1.15 var(--sans); letter-spacing: -.003em; text-align: center; text-decoration: none;
    white-space: nowrap; cursor: pointer; user-select: none; -webkit-user-select: none;
}
.btn:hover { border-color: var(--strong); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .38; cursor: default; box-shadow: none; }
.btn:disabled:hover { border-color: var(--field); }
.btn-small, .btn-sm { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn-large { min-height: 52px; padding: 0 28px; font-size: 16px; }
.btn-full { width: 100%; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
.btn-secondary { background: transparent; }
.btn-secondary:hover { background: var(--hover); }
.btn-ghost { border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { border-color: transparent; background: var(--hover); color: var(--text); }
.btn-danger { border-color: var(--danger-border); color: var(--danger); background: transparent; }
.btn-danger:hover { border-color: var(--danger); background: var(--danger-tint); }
.btn-link {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0; margin: -12px 0;
    border: 0; background: none; cursor: pointer;
    color: var(--text); font: inherit; text-decoration: underline; text-decoration-color: var(--strong);
    text-decoration-thickness: 1px; text-underline-offset: 4px;
}
.btn-link:hover { text-decoration-color: var(--accent); }
.btn-close {
    display: inline-grid; place-items: center; flex: none;
    width: 40px; height: 40px; padding: 0; border: 1px solid var(--edge); border-radius: 50%;
    background: transparent; color: var(--text-secondary); font: 300 22px/1 var(--sans); cursor: pointer;
}
.btn-close:hover { color: var(--text); border-color: var(--strong); }
@media (pointer: coarse) { .btn-close { width: 44px; height: 44px; } }
@media (pointer: fine) and (min-width: 768px) { .btn-small { min-height: 38px; } }

/* ═══ Inputs ═══ */
input[type="text"], input[type="url"], input[type="number"], input[type="time"], input[type="email"], select, textarea, .confirm-input {
    display: block; width: 100%; min-height: 48px;
    padding: 12px 14px;
    background-color: var(--inset); color: var(--text);
    border: 1px solid var(--edge); border-radius: var(--r-input);
    font: 400 16px/1.4 var(--sans);
    -webkit-appearance: none; appearance: none;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
select, select.confirm-input {
    padding-right: 40px; cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%), linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
    background-position: calc(100% - 21px) 50%, calc(100% - 16px) 50%;
    background-size: 5px 5px; background-repeat: no-repeat;
}
input[type="time"] { min-width: 0; }
input:hover, select:hover, textarea:hover { border-color: var(--field); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-tint); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
::placeholder { color: var(--quiet); opacity: 1; }
input[aria-invalid="true"] { border-color: var(--danger); }
label { display: block; font: 500 10px/1.6 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--text-secondary); }
input[type="radio"], input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

/* ═══ Cards ═══ */
.card-list { display: flex; flex-direction: column; gap: 14px; }
.draft-card, .queue-card, .posted-card, .settings-card, .get-started, .a2hs-card {
    position: relative; min-width: 0; max-width: 100%;
    background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r-card);
    padding: 18px 16px 16px;
}
@media (min-width: 768px) {
    .draft-card, .queue-card, .posted-card, .settings-card, .get-started, .a2hs-card { padding: 24px 24px 20px; }
}
.card-focus { outline: 2px solid var(--accent-border); outline-offset: 3px; }

/* the meta line: what the card is, and when */
.card-meta, .queue-time {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 14px;
    font: 500 10px/1.5 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--text-secondary);
}
.card-meta > span:last-child:not(:first-child) { letter-spacing: .04em; text-transform: none; color: var(--quiet); white-space: nowrap; }

/* ═══ The thread ═══ */
.thread-preview, .queue-thread { display: flex; flex-direction: column; min-width: 0; }
.tweet, .queue-tweet { display: flex; flex-wrap: wrap; align-items: center; min-width: 0; max-width: 100%; position: relative; }
.tweet > *, .queue-tweet > * { flex: 1 1 100%; min-width: 0; }
.tweet + .tweet, .queue-tweet + .queue-tweet { margin-top: 18px; }
.tweet-reply, .queue-tweet + .queue-tweet { padding-left: 18px; border-left: 1px solid var(--edge); }
.tweet-number { order: 1; margin-bottom: 6px; font: 500 11px/1.4 var(--mono); letter-spacing: .14em; color: var(--caption); }
.thread-preview > .tweet:only-child .tweet-number, .queue-thread > .queue-tweet:only-child .tweet-number { display: none; }
.diff-new-label { order: 0; }
.tweet-content {
    order: 2; font: 400 16px/1.55 var(--sans); color: var(--text);
    white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
    font-feature-settings: "calt" 0;
}
.x-post-text, #draft-editor textarea { font-feature-settings: "calt" 0; }
.tweet-reply .tweet-content, .queue-tweet + .queue-tweet .tweet-content { color: var(--body); }
.tweet-content a { color: inherit; text-decoration-color: var(--strong); }
.tweet-content a:hover { text-decoration-color: var(--accent); }
.diff-removed { order: 3; }
.tweet-quote { order: 4; margin-top: 8px; font: 400 12px/1.5 var(--mono); color: var(--text-secondary); }
.tweet-media, .queue-photos { order: 5; }
.tweet > .btn-add-photo, .tweet > .btn-add-video { order: 6; flex: 0 0 auto; margin: 6px 0 -6px -12px; min-height: 44px; padding: 0 12px; border-color: transparent; color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.tweet > .btn-add-video { margin-left: 0; }
.tweet > .btn-add-photo:hover, .tweet > .btn-add-video:hover { color: var(--text); background: var(--hover); }
.tweet > .btn-add-photo:disabled { opacity: .5; }
.tweet-count { order: 7; flex: 0 0 auto; margin: 10px 0 0 auto; font: 500 11px/1 var(--mono); letter-spacing: .04em; color: var(--caption); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tweet > .btn-add-photo ~ .tweet-count, .tweet-count { align-self: center; }
.tweet-count.over { color: var(--danger); }
@media (pointer: coarse) { .tweet > .btn-add-photo, .tweet > .btn-add-video { min-height: 44px; } }

/* photos: stacked at full card width in posting order (photo 1 is the lead image X shows) */
.tweet-photo-stack { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.tweet-photo { position: relative; border-radius: var(--r-inner); overflow: hidden; background: var(--inset); touch-action: pan-y; }
.tweet-photo img, .tweet-media.tweet-photo-stack img {
    display: block; width: 100%; height: auto; max-height: 520px; object-fit: contain;
    border-radius: var(--r-inner); -webkit-user-drag: none; user-select: none; cursor: zoom-in;
}
.tweet-photo img, .queue-photos img, .x-media-item img, .cal-thumb { outline: 1px solid var(--photo-border); outline-offset: -1px; }
.tweet-photo-pos {
    position: absolute; top: 10px; left: 10px;
    display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px;
    border-radius: 0; background: var(--chip-bg); color: var(--text);
    font: 500 11px/1 var(--mono); pointer-events: none;
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.tweet-photo-first, .tweet-photo-handle, .tweet-photo-remove {
    position: absolute; top: 6px; display: inline-grid; place-items: center;
    height: 36px; border: 1px solid var(--edge); border-radius: 0;
    background: var(--chip-bg); color: var(--text); cursor: pointer;
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.tweet-photo-remove { right: 6px; width: 36px; font: 300 20px/1 var(--sans); }
.tweet-photo-handle { right: 48px; width: 36px; font: 400 15px/1 var(--sans); cursor: grab; touch-action: none; }
.tweet-photo-first { left: 44px; top: 6px; padding: 0 12px; font: 500 12px/1 var(--sans); }
.tweet-photo-first:hover, .tweet-photo-remove:hover, .tweet-photo-handle:hover { border-color: var(--strong); }
.tweet-photo-remove::after, .tweet-photo-handle::after, .tweet-photo-first::after { content: ""; position: absolute; inset: -4px; }
.tweet-photo-stack.reordering .tweet-photo { cursor: grabbing; }
.tweet-photo.dragging { opacity: .6; outline: 2px solid var(--accent-border); outline-offset: 2px; z-index: 2; }
.media-error {
    display: grid; place-items: center; min-height: 120px; padding: 16px;
    border: 1px dashed var(--edge); border-radius: var(--r-inner);
    font: 400 13px/1.4 var(--sans); color: var(--text-secondary); text-align: center;
}
.queue-photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.queue-video { grid-column: 1 / -1; }
.queue-photos img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--r-inner); cursor: zoom-in; }
.queue-photos img:only-child { grid-column: 1 / -1; aspect-ratio: auto; max-height: 360px; object-fit: contain; background: var(--inset); }

/* the fee line and the actions */
.draft-fee { margin-top: 16px; font: 400 12px/1.5 var(--mono); letter-spacing: .03em; color: var(--caption); }
.draft-fee:empty { display: none; }
.draft-card .draft-fee:first-letter { text-transform: uppercase; }
.draft-actions, .posted-actions {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.draft-actions .btn, .posted-actions .btn { flex: 1 1 calc(50% - 4px); }
.draft-actions .btn-edit-draft, .draft-actions .btn-archive-draft { border-color: transparent; color: var(--text-secondary); }
.draft-actions .btn-edit-draft:hover, .draft-actions .btn-archive-draft:hover { color: var(--text); background: var(--hover); }
.btn-stop-draft { white-space: normal; line-height: 1.25; padding-top: 8px; padding-bottom: 8px; }
@media (min-width: 560px) {
    .draft-actions .btn, .posted-actions .btn { flex: 0 0 auto; }
    .draft-actions .btn-queue-draft { min-width: 112px; }
    .draft-actions .btn-edit-draft { margin-left: auto; }
}

/* ═══ Notices on a card ═══ */
/* the live notice: an orange strip across the top of the card; Post now and Queue under it stay disabled (C1) */
.live-notice {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px;
    margin: -18px -16px 16px; padding: 12px 16px;
    background: var(--accent-tint); border-bottom: 1px solid var(--accent-border);
    border-radius: var(--r-card) var(--r-card) 0 0;
    font: 500 14px/1.4 var(--sans); color: var(--text);
}
.live-notice::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; margin-right: -6px; }
.live-notice { justify-content: flex-start; }
.live-notice .btn-link {
    margin: -12px 0 -12px auto; padding: 0 2px;
    font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
    text-decoration: none; color: var(--text); border-bottom: 1px solid var(--accent);
    min-height: 44px; border-radius: 0;
}
.live-notice.live-gone { background: var(--glass); border-bottom-color: var(--edge); color: var(--text-secondary); }
.live-notice.live-gone::before { background: var(--text-tertiary); box-shadow: none; }
.live-notice.live-gone .btn-link { border-bottom-color: var(--strong); }
.draft-card:has(> .live-notice:not(.live-gone)) { border-color: var(--accent-border); }
@media (min-width: 768px) { .live-notice { margin: -24px -24px 20px; padding: 12px 24px; } }

.draft-changed-notice, .draft-queue-note, .draft-lock, .stale-notice, .settings-warn, .posted-stopped {
    margin-bottom: 14px; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: var(--r-inner); background: var(--glass);
    font: 400 14px/1.5 var(--sans); color: var(--body); overflow-wrap: anywhere;
}
.draft-changed-notice { border-color: var(--warn-border); background: var(--warn-tint); color: var(--text); }
.draft-queue-note { border-color: var(--warn-border); background: var(--warn-tint); color: var(--text); }
.draft-lock { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 6px 4px 14px; color: var(--text-secondary); font-size: 13px; }
.draft-lock::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--text-secondary); flex: none; margin-right: -4px; }
.draft-lock { justify-content: flex-start; }
.draft-lock .btn-link { margin: 0 0 0 auto; padding: 0 10px; font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; text-decoration: none; color: var(--text); }
.tweet-yours { margin-left: 8px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--edge); font: 500 10px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-secondary); vertical-align: 1px; }
.tweet-live { margin-left: 8px; font: 500 10px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--success); }

/* the diff after Show changes */
mark.diff-add { background: var(--accent-tint); color: inherit; border-radius: 3px; padding: 0 2px; box-shadow: inset 0 -1px 0 var(--accent-border); }
.diff-new-tweet { outline: 1px dashed var(--accent-border); outline-offset: 8px; border-radius: 4px; }
.diff-new-label, .diff-removed { margin: 6px 0; font: 400 12px/1.5 var(--mono); letter-spacing: .03em; color: var(--text-secondary); }
.diff-removed { text-decoration: line-through; text-decoration-color: var(--strong); }
.thread-preview > .diff-removed { margin-top: 14px; text-decoration: none; }

/* the new-draft pill */
#drafts-new-pill {
    align-self: center; position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px) + 10px); z-index: 5;
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px;
    border: 0; border-radius: var(--r-pill); background: var(--pill-bg); color: var(--pill-fg);
    font: 500 14px/1 var(--sans); cursor: pointer; box-shadow: var(--bar-shadow);
}
#drafts-new-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
@media (min-width: 768px) { #drafts-new-pill { top: 16px; } }

/* ═══ Inline status messages: shown as a floating toast so they are seen wherever the page is scrolled ═══ */
.status-message, .cal-toast, .verify-toast {
    position: fixed; z-index: 1200;
    left: 16px; width: calc(100% - 32px); max-width: 100vw; transform: none; box-sizing: border-box;
    bottom: calc(var(--bar-h) + max(var(--bar-bottom), env(safe-area-inset-bottom, 0px)) + 14px);
    padding: 12px 18px;
    border: 1px solid var(--edge); border-radius: 0;
    background: var(--elevated); color: var(--text); box-shadow: var(--sheet-shadow);
    font: 400 14px/1.45 var(--sans); text-align: left; overflow-wrap: anywhere;
    pointer-events: none;
}
.status-message a.toast-x { pointer-events: auto; margin-left: 10px; }
.status-message::before, .cal-toast::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 10px; border-radius: 50%; background: var(--text-secondary); vertical-align: 2px; }
.status-success::before, .cal-toast.ok::before { background: var(--success); }
.status-error, .cal-toast.err { border-color: var(--danger-border); color: var(--text); }
.status-error::before, .cal-toast.err::before { background: var(--danger); }
.status-warning { border-color: var(--warn-border); }
.status-warning::before { background: var(--warn); }
.status-info::before { background: var(--info); }
@media (min-width: 768px) {
    .status-message, .cal-toast, .verify-toast { left: auto; right: 24px; width: min(440px, calc(100% - 48px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: none; }
}
/* inside a dialog the message stays where it is */
.modal .status-message { position: static; transform: none; width: auto; max-width: none; box-shadow: none; margin-bottom: 12px; animation: none; }

/* ═══ Empty states: the identity's corner brackets ═══ */
.card-list-empty {
    --c: var(--strong); --s: 16px; --o: 10px;
    position: relative; padding: 56px 28px; text-align: center;
    border: 1px solid var(--border); border-radius: var(--r-card);
    background:
        linear-gradient(var(--c), var(--c)) top var(--o) left var(--o) / var(--s) 1px no-repeat,
        linear-gradient(var(--c), var(--c)) top var(--o) left var(--o) / 1px var(--s) no-repeat,
        linear-gradient(var(--c), var(--c)) top var(--o) right var(--o) / var(--s) 1px no-repeat,
        linear-gradient(var(--c), var(--c)) top var(--o) right var(--o) / 1px var(--s) no-repeat,
        linear-gradient(var(--c), var(--c)) bottom var(--o) left var(--o) / var(--s) 1px no-repeat,
        linear-gradient(var(--c), var(--c)) bottom var(--o) left var(--o) / 1px var(--s) no-repeat,
        linear-gradient(var(--c), var(--c)) bottom var(--o) right var(--o) / var(--s) 1px no-repeat,
        linear-gradient(var(--c), var(--c)) bottom var(--o) right var(--o) / 1px var(--s) no-repeat,
        var(--glass);
    font-family: var(--display-family); font-weight: 300; font-size: 17px; line-height: 1.6;
    letter-spacing: .14em; text-transform: uppercase; color: var(--text-secondary); text-wrap: balance;
}
.card-list-empty::before { content: ""; display: block; width: 6px; height: 6px; margin: 0 auto 20px; border-radius: 50%; background: var(--accent); }
.empty {
    position: relative; text-align: center; padding: 48px 24px;
    border: 1px solid var(--border); border-radius: var(--r-card); background: var(--glass);
}
.empty .corner { position: absolute; width: 24px; height: 24px; border: 0 solid var(--edge); pointer-events: none; }
.empty .c-tl { top: 10px; left: 10px; border-top-width: 1px; border-left-width: 1px; }
.empty .c-tr { top: 10px; right: 10px; border-top-width: 1px; border-right-width: 1px; }
.empty .c-bl { bottom: 10px; left: 10px; border-bottom-width: 1px; border-left-width: 1px; }
.empty .c-br { bottom: 10px; right: 10px; border-bottom-width: 1px; border-right-width: 1px; }
.empty-k { margin-bottom: 10px; font: 500 10px/1.6 var(--mono); letter-spacing: .26em; text-transform: uppercase; color: var(--accent-text); }
.empty-title { font-family: var(--display-family); font-weight: var(--display-weight); font-size: 22px; line-height: 1.2; letter-spacing: var(--display-tracking); text-transform: var(--display-case); color: var(--text); }
.empty-line { max-width: 36em; margin: 12px auto 0; font: 400 15px/1.55 var(--sans); color: var(--body); }
.empty .btn { margin-top: 18px; }
.avatar img, .x-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
@media (min-width: 768px) { .card-list-empty { padding: 88px 40px; font-size: 19px; } }
.modal .card-list-empty, .settings-empty {
    padding: 16px 0; border: 0; background: none; text-align: left;
    font: 400 15px/1.5 var(--sans); letter-spacing: 0; text-transform: none; color: var(--text-secondary);
}
.modal .card-list-empty::before { display: none; }

.load-more { display: flex; justify-content: center; padding: 8px 0 0; }
.loading { opacity: .5; pointer-events: none; }

/* ═══ First run: Get started, Home Screen card ═══ */
.get-started { counter-reset: gs; margin-bottom: 14px; padding-top: 22px; }
.get-started h2 { margin-right: 52px; font-family: var(--display-family); font-weight: var(--display-weight); font-size: 24px; line-height: 1.1; letter-spacing: .1em; text-transform: uppercase; }
.get-started h2::before { content: "First run"; display: block; margin-bottom: 10px; font: 500 10px/1.6 var(--mono); letter-spacing: .3em; color: var(--text-secondary); }
.get-started section { counter-increment: gs; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--border); }
.get-started section::before {
    content: counter(gs, decimal-leading-zero); display: block; margin-bottom: 12px;
    font: 200 40px/1 var(--display-family); letter-spacing: .04em; color: var(--text-tertiary);
}
@supports (-webkit-text-stroke: 1px #000) { .get-started section::before { color: transparent; -webkit-text-stroke: 1px var(--strong); } }
.get-started h3 { font: 500 17px/1.35 var(--sans); margin-bottom: 12px; }
.get-started p { font-size: 15px; color: var(--text-secondary); }
.get-started-dismiss {
    position: absolute; top: 12px; right: 12px;
    width: 44px; min-height: 44px; padding: 0; border-color: transparent; color: var(--text-secondary);
    font: 300 22px/1 var(--sans);
}
.get-started-dismiss:hover { border-color: var(--edge); color: var(--text); }
.a2hs-callout { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; margin: 0 0 14px; background: var(--accent-tint); }
.a2hs-callout > p { margin: 0; font-size: 15px; color: var(--body); }
.a2hs-callout .settings-hint { margin-top: 6px; color: var(--text-secondary); font-size: 13px; }
.a2hs-kicker { color: var(--accent-text); margin: 0; }
#a2hs-sheet-title { font-family: var(--display-family); font-weight: var(--display-weight); font-size: 22px; line-height: 1.1; letter-spacing: .1em; text-transform: uppercase; color: var(--text); }
.a2hs-lead { margin: 0; font-size: 14px; color: var(--text-secondary); }
.a2hs-steps { list-style: none; margin: 4px 0 0; padding: 0; counter-reset: a2hs; }
.a2hs-steps li { counter-increment: a2hs; display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; font-size: 15px; color: var(--body); }
.a2hs-steps li::before { content: counter(a2hs, decimal-leading-zero); width: 44px; flex: none; font: 200 32px/1 var(--display-family); letter-spacing: .04em; color: var(--strong); }
@supports (-webkit-text-stroke: 1px #000) { .a2hs-steps li::before { color: transparent; -webkit-text-stroke: 1px var(--strong); } }
.a2hs-key { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: 0 4px; border: 1px solid var(--edge); border-radius: var(--r-tag); background: var(--elevated); color: var(--accent-text); vertical-align: middle; }
#a2hs-sheet { z-index: 990; }
#a2hs-later { color: var(--text-secondary); margin: 0; }

/* snippets and the connect block */
.snippet {
    margin: 0; padding: 14px 16px;
    background: var(--inset); border: 1px solid var(--edge); border-radius: var(--r-inner);
    font: 400 13px/1.7 var(--mono); color: var(--text);
    white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; overflow-x: auto;
}
.snippet + .settings-actions { margin-top: 8px; }
.connect-block { margin-top: 14px; }
.connect-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; padding: 3px; margin-bottom: 14px; border: 1px solid var(--edge); border-radius: 999px; background: var(--inset); }
.connect-tab {
    min-height: 44px; padding: 4px 8px; border: 0; border-radius: 999px; background: transparent; cursor: pointer;
    font: 500 13px/1.2 var(--sans); color: var(--text-secondary); white-space: normal;
}
.connect-tab:hover { color: var(--text); }
.connect-tab.active { background: var(--pill-bg); color: var(--pill-fg); }
.connect-panel > .settings-hint { margin: 14px 0 8px; }
.connect-panel > .snippet + .settings-actions + .snippet { margin-top: 14px; }
#mcp-cli { white-space: pre-wrap; word-break: break-all; }
@media (pointer: coarse) { .connect-tab { min-height: 44px; } }

.new-key-box { margin: 14px 0; padding: 16px; border: 1px solid var(--accent-border); border-radius: var(--r-inner); background: var(--accent-tint); }
.new-key-title { margin-bottom: 10px; font: 500 15px/1.4 var(--sans); color: var(--text); }
.new-key-value {
    display: block; margin: 8px 0 10px; padding: 12px 14px; border-radius: 0;
    background: var(--inset); border: 1px solid var(--edge);
    font: 400 13px/1.6 var(--mono); word-break: break-all; user-select: all; -webkit-user-select: all;
}
#get-started-keybox:not(:empty) { margin-top: 12px; padding: 16px; border: 1px solid var(--edge); border-radius: var(--r-inner); background: var(--inset); }

/* ═══ Queue ═══ */
.queue-summary { font: 400 12px/1.6 var(--mono); letter-spacing: .03em; color: var(--text-secondary); }
.queue-section-title {
    display: flex; align-items: center; gap: 14px; margin: 18px 0 2px;
    font: 500 10px/1.6 var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--text-secondary);
}
.queue-section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(to right, var(--edge), transparent); }
#queue-list > .queue-section-title:first-child { margin-top: 0; }
.queue-time { color: var(--text); letter-spacing: .16em; margin-bottom: 14px; justify-content: flex-start; }
.queue-time:empty { display: none; }
/* the next post to go out is the Queue screen's one orange */
#queue-list > :nth-child(1 of .queue-card:not(.queue-card-failed)) .queue-time { color: var(--accent-text); }
#queue-list > :nth-child(1 of .queue-card:not(.queue-card-failed)) .queue-time::before { content: ""; width: 6px; height: 6px; margin-right: -4px; border-radius: 50%; background: var(--accent); }
.queue-note { margin-top: 10px; font: 400 12px/1.5 var(--mono); letter-spacing: .03em; color: var(--caption); overflow-wrap: anywhere; }
.queue-thread + .queue-note { margin-top: 16px; }
.queue-card .draft-fee { margin-top: 4px; }
.queue-card-failed { border-color: var(--danger-border); }
.queue-card-failed .queue-time { color: var(--danger); }
.queue-error { margin-top: 12px; font: 500 15px/1.45 var(--sans); color: var(--danger); overflow-wrap: anywhere; }
.queue-error-sub { margin-top: 4px; font-weight: 400; color: var(--body); }
.queue-result { margin-top: 10px; font: 400 14px/1.5 var(--sans); color: var(--text-secondary); }
.queue-result:empty { display: none; }
.queue-result-ok { color: var(--success); }
.queue-result-error { color: var(--danger); }
.queue-card > .queue-note:last-child { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ═══ Calendar ═══ */
.calendar-body { min-width: 0; }
.cal-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-title { order: -1; flex: 1 1 100%; margin-bottom: 6px; font: 300 20px/1.2 var(--display-family); letter-spacing: .12em; text-transform: uppercase; color: var(--text); }
.cal-nav .btn { flex: 1 1 0; }
@media (min-width: 700px) {
    .cal-nav { flex-wrap: nowrap; }
    .cal-title { order: 0; flex: 1 1 auto; margin: 0 0 0 12px; text-align: right; }
    .cal-nav .btn { flex: 0 0 auto; }
}
.cal-legend { margin-bottom: 18px; font: 400 12px/1.6 var(--mono); letter-spacing: .02em; color: var(--text-secondary); }
.cal-grid {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px;
    background: var(--border); border: 1px solid var(--edge); border-radius: var(--r-card); overflow: hidden;
}
.cal-dow { padding: 10px 10px 8px; background: var(--surface); font: 500 10px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--text-secondary); }
.cal-cell { min-width: 0; min-height: 118px; padding: 8px; background: var(--bg); }
.cal-cell-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; font: 500 11px/1 var(--mono); }
.cal-daynum { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.cal-other .cal-daynum, .cal-past .cal-daynum { color: var(--quiet); }
.cal-other, .cal-past { background: var(--surface); }
.cal-today .cal-daynum { background: var(--pill-bg); color: var(--pill-fg); }
.cal-count { font: 500 11px/1 var(--mono); color: var(--caption); font-variant-numeric: tabular-nums; }
.cal-count.cal-full { color: var(--warn); }
.cal-cell.cal-drop-ok { background: var(--accent-tint); outline: 1px dashed var(--accent-border); outline-offset: -4px; }
.cal-cell.cal-drop-no { outline: 1px dashed var(--danger-border); outline-offset: -4px; cursor: not-allowed; }
.cal-chips { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-chip {
    display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; min-width: 0;
    padding: 6px 8px; border-radius: 0; border: 1px solid var(--border);
    background: transparent; color: var(--text-secondary); text-decoration: none;
    font: 400 12px/1.35 var(--sans);
}
a.cal-chip:hover { background: var(--hover); text-decoration: none; }
.cal-chip-queued { background: var(--elevated); border-color: var(--edge); color: var(--text); cursor: grab; }
.cal-chip-queued.cal-dragging { opacity: .4; cursor: grabbing; }
.cal-chip-locked { cursor: default; }
.cal-time { font: 500 10px/1.4 var(--mono); letter-spacing: .04em; color: inherit; white-space: nowrap; }
.cal-chip-posted .cal-time { color: var(--quiet); }
.cal-text { flex: 1 1 60px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-badge { padding: 1px 6px; border-radius: 999px; border: 1px solid var(--warn-border); font: 500 11px/1.4 var(--mono); letter-spacing: .06em; color: var(--warn); white-space: nowrap; }
.cal-thumb { width: 20px; height: 20px; border-radius: 4px; object-fit: cover; flex: none; -webkit-user-drag: none; }
.cal-glyph { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; border: 1px solid var(--edge); font: 500 9px/1 var(--mono); color: var(--caption); flex: none; }
.cal-move { min-height: 32px; min-width: 36px; padding: 0 10px; font-size: 12px; margin-left: auto; }
.cal-move-dots { display: none; }
.cal-posting { font: 500 10px/1 var(--mono); color: var(--text-secondary); margin-left: auto; }
.cal-ghost {
    position: fixed; z-index: 1300; pointer-events: none; max-width: 260px;
    padding: 8px 12px; border-radius: 0; border: 1px solid var(--accent-border);
    background: var(--elevated); color: var(--text); box-shadow: var(--sheet-shadow);
    font: 400 12px/1.4 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (min-width: 700px) {
    .cal-grid .cal-move { min-height: 26px; min-width: 26px; padding: 0 6px; }
    .cal-grid .cal-move-full { display: none; }
    .cal-grid .cal-move-dots { display: inline; }
}
@media (hover: hover) and (pointer: fine) and (min-width: 700px) {
    .cal-grid .cal-chip-queued .cal-move { opacity: 0; }
    .cal-grid .cal-chip-queued:hover .cal-move, .cal-grid .cal-move:focus-visible { opacity: 1; }
}
/* phone: the 4-week list, one quiet row per day */
.cal-week { margin-bottom: 8px; }
.cal-week .queue-section-title { margin: 22px 0 4px; }
.cal-week .cal-cell { min-height: 0; padding: 12px 2px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: none; }
.cal-week .cal-past { color: var(--quiet); }
.cal-week .cal-cell-head { margin-bottom: 0; font-size: 12px; min-height: 24px; }
.cal-week .cal-cell:has(.cal-chip) .cal-cell-head { margin-bottom: 10px; }
.cal-week .cal-daynum { display: inline-flex; align-items: center; padding: 0; min-width: 0; height: auto; font: 500 14px/1.4 var(--sans); letter-spacing: 0; color: var(--text); background: none; }
.cal-week .cal-today { border-bottom-color: var(--edge); }
.cal-week .cal-today .cal-daynum::after { content: "Today"; margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--pill-bg); color: var(--pill-fg); font: 500 9px/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.cal-week .cal-chips:empty { display: none; }
.cal-week .cal-chip { padding: 8px 8px 8px 12px; font-size: 14px; border-radius: 0; }
.cal-week .cal-chip-posted { background: var(--glass); }
.cal-week .cal-text { flex-basis: 100px; }
.cal-week .cal-move { min-height: 40px; }
@media (pointer: coarse) { .cal-week .cal-move, .cal-week .cal-chip { min-height: 44px; } .admin-table select { min-height: 44px; } }
.move-picker-list { display: flex; flex-direction: column; gap: 6px; }
.move-picker-list .cal-pick { justify-content: space-between; width: 100%; min-height: 52px; border-radius: 0; font-weight: 400; }
.move-picker-list .cal-pick:disabled { opacity: .4; cursor: default; }

/* ═══ Posted ═══ */
.posted-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.posted-toolbar-note { font: 500 10px/1.6 var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--text-secondary); }
.x-post-card { display: flex; flex-direction: column; gap: 12px; }
.x-post-header { display: flex; align-items: center; gap: 12px; min-width: 0; }
.x-avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover; }
.x-avatar-fallback { background: var(--elevated); border: 1px solid var(--edge); font: 500 14px/1 var(--mono); color: var(--text); }
.x-post-author { flex: 1; min-width: 0; }
.x-name-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.x-name { font: 500 15px/1.3 var(--sans); }
.x-handle { font: 500 15px/1.3 var(--sans); color: var(--text); }
.x-meta-row { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
.posted-timestamp { font: 400 12px/1.4 var(--mono); letter-spacing: .02em; color: var(--text-secondary); }
.x-open {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; flex: none;
    border: 1px solid var(--field); border-radius: var(--r-btn);
    font: 500 13px/1 var(--sans); color: var(--text); text-decoration: none; white-space: nowrap;
}
.x-open:hover { border-color: var(--strong); text-decoration: none; background: var(--hover); }
@media (pointer: coarse) { .x-open { min-height: 44px; } }
.x-post-text { font: 400 16px/1.55 var(--sans); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.x-post-text + .x-post-text { padding-left: 18px; border-left: 1px solid var(--edge); color: var(--body); }
.x-post-text .tweet-number { display: inline; margin-right: 4px; }
.x-media-grid { display: grid; gap: 6px; border-radius: var(--r-inner); overflow: hidden; }
.x-media-grid.cols-1 { grid-template-columns: 1fr; }
.x-media-grid.cols-2, .x-media-grid.cols-3, .x-media-grid.cols-4 { grid-template-columns: 1fr 1fr; }
.x-media-item img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 0; cursor: zoom-in; }
.x-media-grid.cols-1 .x-media-item img { aspect-ratio: auto; max-height: 440px; object-fit: contain; background: var(--inset); }
.x-metrics { display: flex; gap: 14px; font: 400 12px/1.5 var(--mono); color: var(--text-secondary); }
.x-error { font: 400 13px/1.5 var(--sans); color: var(--danger); }
.posted-stopped { border-color: var(--warn-border); background: var(--warn-tint); color: var(--text); }
.posted-card .posted-actions .btn { border-color: transparent; color: var(--text-secondary); }
.posted-card .posted-actions .btn:hover { color: var(--text); background: var(--hover); }

/* ═══ Settings ═══ */
.settings .settings-card { margin-bottom: 14px; }
.settings-card h3 { margin-bottom: 8px; font: 500 17px/1.35 var(--sans); color: var(--text); }
.settings-card h4 { margin: 24px 0 4px; font: 500 10px/1.6 var(--mono); letter-spacing: .24em; text-transform: uppercase; color: var(--text-secondary); }
.settings-card label { margin: 16px 0 8px; }
.settings-hint { margin: 6px 0; font: 400 15px/1.5 var(--sans); color: var(--text-secondary); }
.settings-hint:empty { display: none; }
.settings-hint code, .settings-card code { font-size: 13px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 2px; }
.connect-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.connect-countdown { margin: 8px 0 0; font: 500 13px/1.4 var(--mono); color: var(--text-secondary); }
.manual-setup { margin-top: 16px; }
.manual-setup > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--text-secondary); font: 500 14px/1.4 var(--sans); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.schedule-preview { margin: 16px 0 0; font: 400 15px/1.5 var(--sans); color: var(--text); }
.tz-combo { position: relative; }
#settings-tz-list {
    position: absolute; z-index: 5; left: 0; right: 0; top: 100%;
    max-height: 240px; overflow: auto; margin: 4px 0 0; padding: 4px; list-style: none;
    background: var(--elevated); border: 1px solid var(--edge); border-radius: var(--r-inner);
}
#settings-tz-list [role="option"] { min-height: 44px; display: flex; align-items: center; padding: 0 10px; cursor: pointer; border-radius: 0; }
#settings-tz-list [role="option"][aria-selected="true"] { background: var(--hover); box-shadow: inset 2px 0 0 var(--accent-text); }
.tz-empty { padding: 10px; color: var(--text-secondary); }
@media (min-width: 900px) { .settings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.settings-problems { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--danger-border); border-radius: var(--r-inner); background: var(--danger-tint); font: 400 14px/1.5 var(--sans); color: var(--danger); }
.settings-problems ul { padding-left: 18px; }
.settings-warn { border-color: var(--danger-border); background: var(--danger-tint); color: var(--text); }
.settings-warn a { color: inherit; font-weight: 500; }
.usage-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0 18px; }
.usage-facts dt { font: 500 10px/1.6 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--text-secondary); }
.usage-facts dd { margin-top: 4px; font: 500 15px/1.4 var(--sans); color: var(--text); }
.usage-row { margin: 16px 0; }
.usage-label { font: 500 14px/1.4 var(--sans); color: var(--text); }
.usage-row progress {
    display: block; width: 100%; height: 4px; margin: 10px 0 8px; border: 0; border-radius: 0;
    background: var(--edge); -webkit-appearance: none; appearance: none; overflow: hidden; color: var(--text);
}
.usage-row progress::-webkit-progress-bar { background: var(--edge); border-radius: 0; }
.usage-row progress::-webkit-progress-value { background: var(--text); border-radius: 0; }
.usage-row progress::-moz-progress-bar { background: var(--text); border-radius: 0; }
.usage-nums { font: 400 12px/1.5 var(--mono); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.usage-left { color: var(--text); font-weight: 500; }
.key-list { list-style: none; margin: 14px 0 0; }
.key-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
    min-height: 60px; padding: 8px 0; border-top: 1px solid var(--border);
}
.key-row:last-child { border-bottom: 1px solid var(--border); }
.key-name { font: 500 15px/1.4 var(--sans); color: var(--text); }
.key-prefix { font-size: 13px; }
.key-when { flex: 1 1 auto; font: 400 14px/1.4 var(--sans); color: var(--text-secondary); }
.device-name { font: 500 15px/1.4 var(--sans); color: var(--text); }
.key-row .btn { margin-left: auto; }
.key-revoked { color: var(--quiet); }
.key-state { margin-left: auto; padding: 3px 10px; border: 1px solid var(--edge); border-radius: 999px; font: 500 10px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-secondary); }
.key-fold { list-style: none; border-top: 1px solid var(--border); }
.key-fold > details > summary, .danger-fold > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font: 500 11px/1.4 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--caption); }
.key-fold .key-list { margin-top: 0; }
.danger-fold > summary { color: var(--text-secondary); }
.danger-block + .danger-block { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.danger-block h3 { margin-bottom: 8px; font: 500 17px/1.35 var(--sans); color: var(--text); }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { color: var(--danger); }
#appearance-card .theme-seg { max-width: 360px; margin-top: 14px; }
.device-note { flex: 1 1 12rem; font: 400 14px/1.4 var(--sans); color: var(--text-secondary); }
.key-list > .settings-empty { padding: 12px 0; border-top: 1px solid var(--border); }
.archived-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.archived-text { flex: 1 1 100%; font: 400 15px/1.5 var(--sans); color: var(--body); overflow-wrap: anywhere; }
.archived-meta { flex: 1; font: 500 10px/1.6 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--text-secondary); }
#archived-list > .load-more { justify-content: flex-start; }
.settings-title { margin: 0; }

/* ═══ Sheets and dialogs ═══ */
.modal, .confirm-modal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: flex-end; justify-content: center;
}
.modal.hidden, .modal[hidden] { display: none; }
.history-modal { z-index: 1050; }
.confirm-modal { z-index: 1100; }
.modal-backdrop { position: absolute; inset: 0; background: var(--overlay); }
@supports (backdrop-filter: blur(1px)) { .modal-backdrop { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); } }
.modal-content {
    position: relative; width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 12px); overflow-y: auto; overscroll-behavior: contain;
    padding: 8px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    background: var(--elevated); border: 1px solid var(--edge); border-bottom: 0;
    border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--sheet-shadow);
}
.modal-content::before { content: ""; display: block; width: 36px; height: 4px; margin: 0 auto 16px; border-radius: 2px; background: var(--strong); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-header h3, .modal-body > h3, #confirm-sheet-title, #queue-sheet-title { font: 500 19px/1.3 var(--sans); color: var(--text); letter-spacing: -.01em; }
.modal-body { display: flex; flex-direction: column; gap: 10px; font: 400 15px/1.5 var(--sans); color: var(--body); }
.modal-body > p:empty, .modal-body > div:empty { display: none; }
.modal-body > h3 { margin-bottom: 2px; }
.modal-footer { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.modal-footer .btn { width: 100%; min-height: 50px; font-size: 16px; }
.modal-footer .btn-primary, .modal-footer .btn-danger:last-child:not(:only-child) { order: -1; }
#delete-sheet .modal-footer .btn-danger { order: -1; }
.confirm-message { color: var(--body); }
.confirm-footer .btn { width: 100%; }

@media (max-width: 639px) {
    /* the editor and History are tall page sheets on a phone, with the actions pinned at the bottom */
    .modal-wide { min-height: calc(100dvh - env(safe-area-inset-top, 0px) - 12px); display: flex; flex-direction: column; padding-bottom: 0; }
    .modal-wide .modal-body { flex: 1 1 auto; }
    .modal-wide .modal-footer {
        position: sticky; bottom: 0; z-index: 2;
        flex-direction: row; margin: 18px -20px 0; padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
        background: var(--elevated); border-top: 1px solid var(--border);
    }
    .modal-wide .modal-footer .btn { flex: 1 1 0; width: auto; min-height: 48px; font-size: 15px; }
    .modal-wide .modal-footer .btn-primary { order: 2; }
    .modal-wide .modal-header { position: sticky; top: -8px; z-index: 2; margin: -8px -20px 14px; padding: 12px 20px; background: var(--elevated); border-bottom: 1px solid var(--border); }
    .modal-wide::before { position: relative; z-index: 3; }
}
@media (min-width: 640px) {
    .modal, .confirm-modal { align-items: center; padding: 24px; }
    .modal-content { max-width: 460px; max-height: calc(100dvh - 48px); padding: 28px; border-bottom: 1px solid var(--edge); border-radius: var(--r-sheet); }
    .modal-content::before { display: none; }
    .modal-wide { max-width: 720px; }
    .modal-footer { flex-direction: row; justify-content: flex-end; flex-wrap: wrap; }
    .modal-footer .btn { width: auto; min-height: 44px; font-size: 15px; }
    .modal-footer .btn-primary, .modal-footer .btn-danger:last-child:not(:only-child), #delete-sheet .modal-footer .btn-danger { order: 2; }
    #draft-modal-history { margin-right: auto; }
}

/* the confirm sheet (askSheet / askChoice) */
#confirm-sheet-lines { white-space: pre-line; color: var(--body); }
#confirm-sheet-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
#confirm-sheet-choices .btn { width: 100%; min-height: 50px; }

/* the queue sheet */
#queue-sheet-when { font: 500 17px/1.4 var(--sans); color: var(--text); }
#queue-sheet-fee, #queue-sheet-left { font: 400 13px/1.5 var(--mono); letter-spacing: .02em; color: var(--text-secondary); }
#queue-sheet-note { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-inner); background: var(--glass); font-size: 14px; color: var(--body); }
#queue-sheet-choices { display: flex; flex-direction: column; gap: 6px; }
#queue-sheet-choices label {
    display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px;
    border: 1px solid var(--edge); border-radius: 0; cursor: pointer;
    font: 400 15px/1.4 var(--sans); letter-spacing: 0; text-transform: none; color: var(--text);
}
#queue-sheet-choices label:has(input:checked) { border-color: var(--strong); background: var(--glass); }
#queue-sheet-change { align-self: flex-start; margin: 0; font-size: 15px; }
#queue-sheet-pick { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 10px; }
#queue-sheet-pick label { display: flex; flex-direction: column; gap: 8px; }

/* confirm what is live on X */
#confirm-checked label { margin-top: 8px; }
.x-error:empty { display: none; }

/* the editor */
#draft-editor { display: flex; flex-direction: column; gap: 18px; }
#draft-editor .tweet-edit label { display: flex; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
#draft-editor textarea { min-height: 168px; field-sizing: content; max-height: 60vh; font-size: 16px; line-height: 1.55; }
.tweet-edit-live textarea { opacity: .6; cursor: not-allowed; }
.cache-hint { font: 400 12px/1.6 var(--mono); letter-spacing: .02em; color: var(--text-secondary); }
.cache-hint:empty { display: none; }
.stale-notice { border-color: var(--warn-border); background: var(--warn-tint); color: var(--text); }
.stale-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.stale-actions .btn { flex: 1 1 auto; }

/* History */
.history-list, .history-thread { display: flex; flex-direction: column; gap: 6px; }
.history-item {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%;
    min-height: 56px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 0;
    background: transparent; text-align: left; cursor: pointer;
}
.history-item:hover { background: var(--hover); border-color: var(--edge); }
.history-meta { font: 500 11px/1.5 var(--mono); letter-spacing: .06em; color: var(--text-secondary); }
.history-snippet { font: 400 15px/1.45 var(--sans); color: var(--text); overflow-wrap: anywhere; }
.history-detail { display: flex; flex-direction: column; gap: 12px; }
.history-tweet { padding: 14px 0; border-bottom: 1px solid var(--border); }
.history-tweet:last-child { border-bottom: 0; }
.history-tweet .tweet-content { display: block; margin: 4px 0 10px; }
.history-tweet .tweet-number { display: block; }
.history-note { font-size: 14px; color: var(--text-secondary); }
.history-restore { align-self: flex-start; }
.history-back { align-self: flex-start; margin: 0; font-size: 15px; }

/* ═══ Lightbox: a dark room in both themes ═══ */
.lightbox { position: fixed; inset: 0; z-index: 1400; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; visibility: hidden; }
.lightbox.active { opacity: 1; pointer-events: auto; visibility: visible; }
.lightbox-backdrop { position: absolute; inset: 0; background: var(--lightbox-bg); }
.lightbox-content { position: relative; display: flex; flex-direction: column; align-items: center; max-width: 92vw; max-height: 90vh; }
.lightbox-close {
    position: fixed; top: calc(16px + env(safe-area-inset-top, 0px)); right: 16px;
    display: grid; place-items: center; width: 44px; height: 44px;
    background: var(--lightbox-btn-bg); border: 1px solid var(--lightbox-btn-border); border-radius: 50%;
    color: var(--on-lightbox); font: 300 24px/1 var(--sans); cursor: pointer;
}
.lightbox-close:hover { background: var(--lightbox-btn-hover); }
#lightbox-img { max-width: 92vw; max-height: 84vh; object-fit: contain; border-radius: 0; }
.lightbox-caption { margin-top: 12px; font: 400 12px/1.5 var(--mono); letter-spacing: .04em; color: var(--on-lightbox-muted); }

/* ═══ Admin (same shell) ═══ */
.admin-scroll { margin: 12px 0 4px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-inner); }
.admin-table { width: 100%; border-collapse: collapse; font: 400 14px/1.4 var(--sans); }
.admin-table th { padding: 12px; text-align: left; font: 500 10px/1.4 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--text-secondary); background: var(--inset); white-space: nowrap; }
.admin-table td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: middle; font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin-table td:first-child { font-weight: 500; white-space: nowrap; }
.admin-table select { display: inline-block; width: auto; min-height: 40px; padding: 8px 36px 8px 12px; margin-right: 6px; font-size: 14px; }
.admin-table .btn { white-space: nowrap; }
.admin-table .flag-secret { display: block; margin: 0; font-size: 12px; line-height: 1.2; }
.admin-table td { padding-left: 6px; padding-right: 6px; }
.admin-table select { margin-right: 4px; padding-right: 30px; }
@media (max-width: 899px) { .admin-table { min-width: 720px; } }
.admin-swipe { display: none; }
@media (max-width: 719px) { .admin-swipe { display: block; margin: 0 0 8px; font: 400 12px/1.4 var(--sans); color: var(--caption); } }
.invite-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; min-height: 56px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 15px; }
.invite-row .settings-hint { margin: 0; font-size: 13px; }
.invite-row .btn { margin-left: auto; }
.admin-form { display: flex; gap: 8px; margin-top: 16px; }
.admin-form input { flex: 1 1 auto; min-width: 0; }
.admin-form .btn { flex: none; min-height: 48px; }

/* ═══ Sign-in (login.html) and its notices ═══ */
.signin-page { min-height: 100dvh; display: flex; }
.signin {
    position: relative; width: 100%; max-width: 480px; margin: auto;
    display: flex; flex-direction: column; align-items: flex-start;
    padding: calc(56px + env(safe-area-inset-top, 0px)) 28px calc(40px + env(safe-area-inset-bottom, 0px));
}
.signin .corner { position: absolute; width: 28px; height: 28px; border: 0 solid var(--edge); pointer-events: none; }
.signin .c-tl { top: 16px; left: 12px; border-top-width: 1px; border-left-width: 1px; }
.signin .c-tr { top: 16px; right: 12px; border-top-width: 1px; border-right-width: 1px; }
.signin .c-bl { bottom: 16px; left: 12px; border-bottom-width: 1px; border-left-width: 1px; }
.signin .c-br { bottom: 16px; right: 12px; border-bottom-width: 1px; border-right-width: 1px; }
.signin .brand { margin-bottom: 64px; }
.signin-eyebrow { font: 400 10px/1.7 var(--mono); letter-spacing: .32em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 22px; }
.signin h1, .notice-page h2 {
    font-family: var(--display-family); font-weight: var(--display-weight);
    font-size: clamp(32px, 9vw, 46px); line-height: 1.02; letter-spacing: .06em; text-transform: var(--display-case); color: var(--text);
}
.signin h1 .outline { color: var(--text-secondary); }
@supports (-webkit-text-stroke: 1px #000) { .signin h1 .outline { color: transparent; -webkit-text-stroke: 1px var(--strong); } }
.signin-rule { width: 64px; height: 1px; margin: 28px 0; background: linear-gradient(90deg, var(--accent), transparent); }
.signin .lede { font: 400 17px/1.6 var(--sans); color: var(--body); max-width: 30em; }
.signin-actions { width: 100%; margin-top: 36px; }
.signin-actions .btn { width: 100%; min-height: 54px; font-size: 16px; }
.signin .fine { margin-top: 18px; font: 400 11px/1.7 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); }
.signin .login-note, .signin .notice {
    width: 100%; margin-top: 32px; padding: 16px 18px;
    border: 1px solid var(--edge); border-radius: var(--r-card); background: var(--surface);
    font: 400 15px/1.55 var(--sans); color: var(--text);
}
.signin .notice::before, .signin .login-note::before {
    content: "Sign-in"; display: block; margin-bottom: 6px;
    font: 500 10px/1.6 var(--mono); letter-spacing: .26em; text-transform: uppercase; color: var(--accent-text);
}
.signin .notice:has(.notice-k)::before { display: none; }
.notice-k { display: block; margin-bottom: 6px; font: 500 10px/1.6 var(--mono); letter-spacing: .26em; text-transform: uppercase; color: var(--accent-text); }
.notice-t { margin: 0 0 6px; font: 500 15px/1.4 var(--sans); color: var(--text); }
.notice-d { margin: 0; font: 400 15px/1.55 var(--sans); color: var(--body); }
.signin .notice-cta { width: 100%; margin-top: 28px; }
.signin .notice-cta .btn { width: 100%; min-height: 54px; font-size: 16px; }
.signin:has(.notice-cta) #signin { background: transparent; border-color: var(--field); color: var(--text); box-shadow: none; }
/* not on the list: the notice is the page */
.signin .notice-page { margin-top: 0; padding: 0; border: 0; background: none; }
.signin .notice-page::before { display: none; }
.notice-page h2 { margin-bottom: 24px; }
.notice-page .notice-lede { font: 400 17px/1.6 var(--sans); color: var(--body); }
.notice-page .notice-cta { margin-top: 32px; }
.notice-page .notice-cta .btn { width: 100%; min-height: 54px; font-size: 16px; }
.notice-page .notice-card { margin-top: 24px; padding: 16px 18px; border: 1px solid var(--edge); border-radius: var(--r-card); background: var(--surface); font: 400 15px/1.55 var(--sans); color: var(--body); }
.signin:has(.notice-page) .signin-default { display: none; }
.signin:has(.notice-page) .signin-actions { margin-top: 12px; }
.signin:has(.notice-page) #signin { background: transparent; border-color: var(--field); color: var(--text); box-shadow: none; }
.signin:has(.notice-page) .brand { margin-bottom: 56px; }
@media (min-width: 768px) {
    .signin { padding-left: 48px; padding-right: 48px; }
    .signin .c-tl, .signin .c-bl { left: 0; }
    .signin .c-tr, .signin .c-br { right: 0; }
}

/* ═══ Motion: only when allowed, and never on its own ═══ */
@media (prefers-reduced-motion: no-preference) {
    .btn, .nav-item, .theme-seg button, .connect-tab, a, input, select, textarea, .history-item, .cal-chip, .x-open, .btn-close {
        transition: color .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease, transform .15s ease;
    }
    .btn:active:not(:disabled), .nav-item:active { transform: scale(.98); }
    #nav .nav-item:active { transform: scale(.96); }
    .account-sheet { transition: transform .32s cubic-bezier(.25, 1, .5, 1), visibility 0s linear .32s; }
    .sheet-open .account-sheet { transition: transform .32s cubic-bezier(.25, 1, .5, 1), visibility 0s; }
    .modal:not([hidden]):not(.hidden) .modal-content { animation: sheet-in .3s cubic-bezier(.25, 1, .5, 1) both; }
    .modal:not([hidden]):not(.hidden) .modal-backdrop, .scrim:not([hidden]) { animation: fade-in .2s ease both; }
    .status-message, .cal-toast { animation: toast-in .24s cubic-bezier(.25, 1, .5, 1) both; }
    .lightbox { transition: opacity .15s ease; }
    mark.diff-add { animation: mark-in .5s ease both; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast-in { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
@keyframes mark-in { from { background: rgba(255, 107, 53, .35); } }
.tweet-video video, .queue-video video, .x-media-item video { display: block; width: 100%; max-height: 420px; background: #000; border-radius: var(--r-inner); }
.video-facts { margin-top: 6px; font: 500 11px/1.4 var(--mono); letter-spacing: .04em; color: var(--caption); font-variant-numeric: tabular-nums; }
/* VIDEO-CARD-1: the video preview tile. Black ground, the accent only on the play glyph, mono eyebrow. */
.video-tile { position: relative; display: block; width: 100%; padding: 0; margin: 0; overflow: hidden; background: #000; border: 1px solid var(--edge); border-radius: var(--r-inner); color: var(--video-ink); font: inherit; text-align: left; }
button.video-tile { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.video-tile:hover { border-color: var(--field); }
.video-wide { aspect-ratio: 16 / 9; }
.video-square { aspect-ratio: 1 / 1; max-width: 420px; }
.video-tall { aspect-ratio: 3 / 4; max-width: 320px; }
.video-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .55), transparent 36%, transparent 64%, rgba(0, 0, 0, .55)); pointer-events: none; }
.video-eyebrow, .video-badge { position: absolute; z-index: 1; padding: 4px 8px; border-radius: var(--r-tag); background: rgba(0, 0, 0, .72); font: 500 10px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--video-ink-dim); }
.video-eyebrow { top: 10px; left: 10px; }
.video-badge { right: 10px; bottom: 10px; letter-spacing: .04em; font-variant-numeric: tabular-nums; color: var(--video-ink); }
.video-play { position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; }
.video-glyph { width: 56px; height: 56px; padding: 15px 12px 15px 18px; box-sizing: border-box; border-radius: 50%; background: rgba(0, 0, 0, .72); border: 1px solid var(--video-ink-dim); fill: var(--video-ink); }
button.video-tile:hover .video-glyph { background: rgba(0, 0, 0, .9); }
.video-bare .video-eyebrow { background: transparent; }
.video-status { position: absolute; z-index: 1; left: 12px; bottom: 12px; max-width: calc(100% - 24px); padding: 6px 10px; border-radius: var(--r-tag); background: rgba(0, 0, 0, .78); font: 500 12px/1.5 var(--mono); letter-spacing: .03em; color: var(--video-ink-dim); }
.video-refused, .video-processing, .video-failed { min-height: 112px; }
.video-refused { aspect-ratio: auto; min-height: 120px; background: var(--inset); border-style: dashed; }
.video-refused::after { display: none; }
.video-refused { color: var(--text-secondary); }
.video-refused .video-eyebrow { top: 12px; left: 12px; background: transparent; color: var(--text-secondary); padding: 0; }
.video-refused .video-status { position: static; max-width: none; padding: 0; background: none; color: var(--text-secondary); font-weight: 400; display: block; margin: 36px 12px 12px; }
.video-processing .video-status { color: var(--video-ink); }
.video-processing .video-status::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--video-ink); vertical-align: 1px; }
.video-failed { border-color: var(--danger-border); }
.video-failed .video-status { color: var(--video-danger); }
.video-player { display: block; width: 100%; max-height: 420px; background: #000; border-radius: var(--r-inner); }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* EVP-APP-014: new-version bar, in the toast's treatment */
.deploy-bar {
    position: fixed; z-index: 70; left: 16px; width: calc(100% - 32px); max-width: 100vw;
    bottom: calc(var(--bar-h) + max(var(--bar-bottom), env(safe-area-inset-bottom, 0px)) + 14px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - var(--bar-h) - 28px);
    transform: none; box-sizing: border-box; overflow: auto;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px;
    padding: 10px 14px; background: var(--elevated); border: 1px solid var(--edge); border-radius: var(--r-card);
    box-shadow: var(--sheet-shadow); font: 400 14px/1.4 var(--sans);
}
.deploy-bar[hidden] { display: none; }
.receipt { margin-top: 10px; font: 400 12px/1.45 var(--sans); color: var(--text-secondary); }
.receipt summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.receipt p { margin: 4px 0 0; overflow-wrap: anywhere; }
@media (min-width: 768px) {
    .deploy-bar { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
}
.card-posted { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.card-posted-line { flex: 1 1 200px; }
.edit-photos, .edit-photo { display: flex; gap: 8px; margin-top: 8px; }
.edit-photos { flex-direction: column; }
.edit-photo { align-items: center; flex-wrap: wrap; margin: 0; }
.edit-photo img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--r-inner); }
.edit-photo-name { flex: 1; color: var(--text-secondary); }
