/* =============================================================================
   Postroom — design system
   A calm, editorial take on email. Warm paper, generous space, one quiet accent.
   ========================================================================== */

/* ---- Tokens ---------------------------------------------------------------*/
:root {
    --bg:        #f4f3ef;
    --panel:     #ffffff;
    --panel-2:   #faf9f6;
    --panel-3:   #f1efea;

    --ink:       #1b1b1f;
    --ink-2:     #57575f;
    --ink-3:     #8a8a93;

    --line:      #eceae4;
    --line-2:    #e2e0d8;

    --accent:    #5b54e8;
    --accent-2:  #7a73f0;
    --accent-weak: rgba(91, 84, 232, .10);
    --accent-ink: #ffffff;

    --star:      #f2a417;
    --danger:    #d6493f;
    --ok:        #2ba770;

    --radius:    14px;
    --radius-sm: 10px;
    --radius-lg: 20px;

    --shadow-sm: 0 1px 2px rgba(24,24,28,.05), 0 1px 3px rgba(24,24,28,.04);
    --shadow-md: 0 4px 16px rgba(24,24,28,.08), 0 2px 6px rgba(24,24,28,.04);
    --shadow-lg: 0 24px 60px rgba(24,24,28,.16), 0 8px 24px rgba(24,24,28,.10);

    --ease: cubic-bezier(.2, .7, .2, 1);
    --sidebar-w: 264px;
    --list-w: 400px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:        #131315;
        --panel:     #1d1d21;
        --panel-2:   #191a1d;
        --panel-3:   #24242a;

        --ink:       #eceaf1;
        --ink-2:     #a4a3ad;
        --ink-3:     #71707a;

        --line:      #2a2a30;
        --line-2:    #33333a;

        --accent:    #8983ff;
        --accent-2:  #a29cff;
        --accent-weak: rgba(137, 131, 255, .14);
        --accent-ink: #16161a;

        --star:      #f5b53f;
        --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
        --shadow-md: 0 6px 20px rgba(0,0,0,.45);
        --shadow-lg: 0 28px 70px rgba(0,0,0,.6);
    }
}

/* ---- Reset ---------------------------------------------------------------*/
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }   /* wins over component display rules */
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-size: 14px;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, button { font-size: inherit; }
::selection { background: var(--accent-weak); }

/* ---- Buttons -------------------------------------------------------------*/
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 18px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    font-weight: 600; letter-spacing: -.01em;
    transition: transform .12s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-block { width: 100%; }
.btn-primary {
    background: var(--accent); color: var(--accent-ink);
    box-shadow: 0 2px 8px var(--accent-weak);
}
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost {
    background: transparent; color: var(--ink-2);
    border-color: var(--line-2);
}
.btn-ghost:hover { background: var(--panel-3); color: var(--ink); }
.btn .ic { width: 18px; height: 18px; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 10px;
    color: var(--ink-2); background: transparent; border: none;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--panel-3); color: var(--ink); }
.ic { display: block; }

/* =============================================================================
   AUTH  (sign-in)
   ========================================================================== */
.auth-body { display: grid; place-items: stretch; }
.auth-shell {
    display: grid; grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}
.auth-panel { display: grid; place-items: center; padding: 32px; }
.auth-card { width: 100%; max-width: 380px; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
    display: grid; place-items: center; width: 34px; height: 34px;
    border-radius: 10px; color: var(--accent-ink);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: var(--shadow-sm);
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.02em; }

.auth-title { font-size: 28px; font-weight: 700; letter-spacing: -.03em; margin: 40px 0 6px; }
.auth-sub { color: var(--ink-2); margin: 0 0 28px; }

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.field input {
    width: 100%; height: 46px; padding: 0 14px;
    border: 1px solid var(--line-2); border-radius: var(--radius-sm);
    background: var(--panel); color: var(--ink);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field input::placeholder { color: var(--ink-3); }
.field input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-weak);
}
.field-password { position: relative; }
.field-password input { padding-right: 62px; }
.pw-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    height: 34px; padding: 0 10px; border: none; background: transparent;
    color: var(--ink-3); font-weight: 600; font-size: 12.5px; border-radius: 8px;
}
.pw-toggle:hover { color: var(--ink); background: var(--panel-3); }

.auth-form .btn-primary { margin-top: 8px; height: 46px; }

.alert {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent);
    color: var(--danger); padding: 11px 14px; border-radius: var(--radius-sm);
    font-size: 13px; margin-bottom: 18px; font-weight: 500;
}
.demo-hint {
    margin-top: 20px; padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--accent-weak); color: var(--ink-2); font-size: 12.5px;
}
.demo-hint strong { color: var(--ink); }
.auth-foot { margin-top: 22px; color: var(--ink-3); font-size: 12px; line-height: 1.6; }

/* Right atmosphere panel */
.auth-aside {
    position: relative; overflow: hidden;
    background:
        radial-gradient(120% 90% at 80% 10%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 60%),
        linear-gradient(160deg, #23213a, #14131f 70%);
    color: #efeefb;
}
.aside-inner { position: relative; height: 100%; display: grid; align-items: end; padding: 56px; z-index: 2; }
.aside-tagline { font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; margin-bottom: 14px; }
.aside-quote p { max-width: 380px; color: #b9b7cf; font-size: 15px; line-height: 1.6; margin: 0; }
.aside-glow {
    position: absolute; inset: -20% -10% auto auto; width: 520px; height: 520px;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent) 55%, transparent), transparent 60%);
    filter: blur(30px); opacity: .5; z-index: 1;
}

@media (max-width: 860px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
}

/* =============================================================================
   APP SHELL
   ========================================================================== */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) var(--list-w) 1fr;
    height: 100vh; overflow: hidden;
}

/* ---- Sidebar -------------------------------------------------------------*/
.sidebar {
    display: flex; flex-direction: column;
    padding: 18px 14px; gap: 14px;
    background: var(--panel-2);
    border-right: 1px solid var(--line);
}
.sidebar .brand { padding: 6px 8px 2px; }
.btn-compose { align-self: stretch; height: 46px; }

.folders { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.folder {
    display: flex; align-items: center; gap: 12px;
    height: 40px; padding: 0 12px; border-radius: 11px;
    color: var(--ink-2); font-weight: 500;
    transition: background .13s var(--ease), color .13s var(--ease);
}
.folder:hover { background: var(--panel-3); color: var(--ink); }
.folder.is-active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.folder.is-active .folder-ic { color: var(--accent); }
.folder-ic { display: inline-flex; color: var(--ink-3); }
.folder-label { flex: 1; }
.folder-count {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
    background: var(--accent); color: var(--accent-ink);
    font-size: 11.5px; font-weight: 700; display: grid; place-items: center;
}
.folder.is-active .folder-count { background: var(--accent); }

.sidebar-foot {
    margin-top: auto; display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: var(--radius); background: var(--panel);
    border: 1px solid var(--line);
}
.me { flex: 1; min-width: 0; }
.me-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-status { font-size: 11.5px; color: var(--ok); font-weight: 500; }

/* ---- Avatars -------------------------------------------------------------*/
.avatar {
    flex: none; display: grid; place-items: center;
    width: 38px; height: 38px; border-radius: 50%;
    font-weight: 600; font-size: 14px; letter-spacing: -.02em;
    color: hsl(var(--hue, 250) 42% 32%);
    background: hsl(var(--hue, 250) 62% 92%);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .avatar {
        color: hsl(var(--hue, 250) 70% 82%);
        background: hsl(var(--hue, 250) 40% 26%);
    }
}
.avatar-lg { width: 46px; height: 46px; font-size: 16px; }

/* =============================================================================
   MESSAGE LIST
   ========================================================================== */
.maillist {
    display: flex; flex-direction: column;
    background: var(--panel); border-right: 1px solid var(--line);
    min-width: 0;
}
.list-head {
    display: flex; align-items: center; gap: 8px;
    padding: 16px 16px 10px;
}
.list-title { font-size: 19px; font-weight: 700; letter-spacing: -.02em; margin: 0; flex: 1; }

.search {
    position: relative; margin: 0 14px 8px;
}
.search-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input {
    width: 100%; height: 40px; padding: 0 12px 0 40px;
    border: 1px solid transparent; border-radius: 11px;
    background: var(--panel-3); color: var(--ink);
    transition: background .15s var(--ease), box-shadow .15s var(--ease), border-color .15s;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus {
    outline: none; background: var(--panel); border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-weak);
}

.rows { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }

.mailrow {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 12px; border-radius: var(--radius);
    position: relative; cursor: pointer;
    transition: background .12s var(--ease);
}
.mailrow:hover { background: var(--panel-2); }
.mailrow.is-active { background: var(--accent-weak); }
.mailrow + .mailrow { margin-top: 1px; }

.mailrow-main { flex: 1; min-width: 0; }
.mailrow-top { display: flex; align-items: baseline; gap: 8px; }
.mailrow-name {
    font-weight: 600; color: var(--ink); flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em;
}
.mailrow-time { font-size: 11.5px; color: var(--ink-3); flex: none; }
.mailrow-subject {
    display: block; color: var(--ink); font-size: 13.5px; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mailrow-snippet {
    display: block; color: var(--ink-3); font-size: 12.5px; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.star-dot { color: var(--star); margin-right: 3px; }
.clip { display: inline-flex; vertical-align: -4px; color: var(--ink-3); margin-right: 2px; }
.clip .ic { width: 15px; height: 15px; }

/* unread emphasis — quiet, not loud */
.mailrow.is-unread .mailrow-name,
.mailrow.is-unread .mailrow-subject { font-weight: 700; }
.mailrow.is-unread .mailrow-snippet { color: var(--ink-2); }
.unread-dot {
    position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
    width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.mailrow.is-unread { padding-left: 16px; }

.empty-list, .reader-empty {
    display: grid; place-items: center; text-align: center;
    color: var(--ink-3); height: 100%; padding: 40px;
}
.empty-emoji { font-size: 30px; color: var(--accent); opacity: .6; margin-bottom: 8px; }

.loader {
    width: 26px; height: 26px; border-radius: 50%;
    border: 2.5px solid var(--line-2); border-top-color: var(--accent);
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.notice { margin: 12px; padding: 14px; border-radius: var(--radius); font-size: 13px; }
.notice-error {
    background: color-mix(in srgb, var(--danger) 9%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
    color: var(--danger);
}

/* =============================================================================
   READING PANE
   ========================================================================== */
.reader { min-width: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); }
.reader-empty-mark {
    width: 84px; height: 84px; display: grid; place-items: center;
    border-radius: 24px; background: var(--panel); color: var(--ink-3);
    box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.reader-empty h3 { margin: 0 0 6px; color: var(--ink); font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.reader-empty p { margin: 0; }

.reader-scroll { overflow-y: auto; padding: 40px clamp(24px, 5vw, 72px); max-width: 860px; width: 100%; margin: 0 auto; }
.reader-head { border-bottom: 1px solid var(--line); padding-bottom: 22px; margin-bottom: 26px; }
.reader-subject { font-size: 25px; font-weight: 700; letter-spacing: -.03em; line-height: 1.25; margin: 0 0 20px; }
.reader-meta { display: flex; align-items: center; gap: 14px; }
.reader-who { flex: 1; min-width: 0; }
.reader-from { font-weight: 600; color: var(--ink); }
.reader-addr { color: var(--ink-3); font-weight: 400; }
.reader-to { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.reader-date { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }

.reader-body { font-size: 15px; line-height: 1.7; color: var(--ink); }
.reader-body .plain { white-space: normal; }
.reader-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.reader-body img { max-width: 100%; height: auto; border-radius: 8px; }
.reader-body p { margin: 0 0 1em; }

.reader-actions { display: flex; gap: 10px; margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--line); }

.reader-topbar { display: none; padding: 10px 12px; border-bottom: 1px solid var(--line); }

/* =============================================================================
   Reader toolbar + actions
   ========================================================================== */
.reader-toolbar {
    display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
    margin-bottom: 26px; padding-bottom: 4px;
}
.tool-btn {
    display: inline-flex; align-items: center; gap: 7px;
    height: 36px; padding: 0 10px; border: none; border-radius: 9px;
    background: transparent; color: var(--ink-2); font-weight: 500;
    transition: background .13s var(--ease), color .13s var(--ease);
}
.tool-btn:hover { background: var(--panel-3); color: var(--ink); }
.tool-btn.is-on { color: var(--star); }
.tool-btn.is-on .ic path { fill: var(--star); }
.tool-label { font-size: 13px; }
.tool-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 6px; }

.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; }

/* Row hover quick-actions */
.row-actions {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    display: flex; gap: 2px; padding: 3px; border-radius: 10px;
    background: var(--panel); box-shadow: var(--shadow-md);
    opacity: 0; pointer-events: none; transition: opacity .12s var(--ease);
}
.mailrow:hover .row-actions { opacity: 1; pointer-events: auto; }
.row-act {
    display: inline-flex; width: 30px; height: 30px; border: none; border-radius: 7px;
    align-items: center; justify-content: center; background: transparent; color: var(--ink-2);
}
.row-act:hover { background: var(--panel-3); color: var(--ink); }
.row-act .ic { width: 17px; height: 17px; }
.row-act.is-on { color: var(--star); }
.row-act.is-on .ic path { fill: var(--star); }

/* =============================================================================
   Agenda (reminders + calendar)
   ========================================================================== */
.agenda-day {
    font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase;
    letter-spacing: .04em; padding: 14px 12px 6px;
}
.agenda-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 13px 12px; border-radius: var(--radius);
    transition: background .12s var(--ease);
}
.agenda-item:hover { background: var(--panel-2); }
.agenda-item + .agenda-item { margin-top: 1px; }
.agenda-mark {
    display: grid; place-items: center; width: 34px; height: 34px; flex: none;
    border-radius: 9px; background: var(--accent-weak); color: var(--accent);
}
.agenda-time {
    flex: none; width: 62px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
    padding-top: 2px;
}
.agenda-main { flex: 1; min-width: 0; }
.agenda-title { font-weight: 600; color: var(--ink); }
.agenda-note { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.agenda-when { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.agenda-when.due { color: var(--danger); font-weight: 600; }
.agenda-item.is-due .agenda-mark { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.agenda-item.is-done { opacity: .5; }
.agenda-item.is-done .agenda-title { text-decoration: line-through; }
.agenda-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s var(--ease); }
.agenda-item:hover .agenda-actions { opacity: 1; }
.agenda-actions .icon-btn { width: 32px; height: 32px; }
.agenda-actions .ic { width: 17px; height: 17px; }

.folder-divider { height: 1px; background: var(--line); margin: 10px 8px; }
.folder-count--due { background: var(--danger); }
.folder-count--muted {
    background: transparent; color: var(--ink-3); font-weight: 600;
    min-width: auto; padding: 0 4px;
}
.folder.is-active .folder-count--muted { background: transparent; color: var(--accent); }
.folder-count[hidden] { display: none; }

.draft-tag {
    display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
    color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent);
    padding: 1px 6px; border-radius: 5px; vertical-align: 1px; text-transform: uppercase;
}

/* =============================================================================
   Modals
   ========================================================================== */
.modal-root { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal-root[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20,20,26,.42); backdrop-filter: blur(2px); }
.modal {
    position: relative; z-index: 1; width: 100%; max-width: min(440px, 100%);
    max-height: calc(100vh - 32px);
    display: flex; flex-direction: column;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    animation: pop .18s var(--ease);
}
.modal-lg { max-width: min(560px, 100%); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 18px 6px;
}
.modal-head h3 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.modal-head .ic { color: var(--accent); }
.modal-body { padding: 8px 18px 6px; overflow-y: auto; }
.modal-sub { color: var(--ink-2); font-size: 13px; margin: 0 0 14px; padding: 10px 12px; background: var(--panel-3); border-radius: 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px 18px; }
.modal .field input, .modal .field textarea {
    width: 100%; min-width: 0; max-width: 100%; padding: 11px 12px; border: 1px solid var(--line-2);
    border-radius: var(--radius-sm); background: var(--panel); color: var(--ink);
    font-family: inherit; resize: vertical;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.modal-foot { flex-wrap: wrap; }
.modal .field input:focus, .modal .field textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-weak);
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
    height: 34px; padding: 0 14px; border-radius: 999px;
    border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2);
    font-weight: 500; font-size: 13px; transition: all .13s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.compose-hint { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); padding: 10px 12px; background: var(--accent-weak); border-radius: 10px; }
.compose-hint strong { color: var(--ink-2); }

/* event editor extras */
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }
@media (max-width: 460px) {
    .field-row { flex-direction: column; gap: 0; }
}
.switch-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.switch-row input { width: 18px; height: 18px; accent-color: var(--accent); }
/* ---- Category & colour picker ---- */
.cat-block { margin-top: 6px; }
.cat-list {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px;
    max-height: 168px; overflow-y: auto; padding: 2px;
}
.cat-pill {
    display: inline-flex; align-items: center; gap: 8px;
    height: 34px; padding: 0 13px 0 9px; border-radius: 999px;
    border: 1.5px solid var(--line-2); background: var(--panel); color: var(--ink);
    font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
    transition: border-color .12s var(--ease), background .12s var(--ease);
}
.cat-pill:hover { border-color: var(--ink-3); }
.cat-pill.is-active { border-color: var(--ink); background: var(--panel-3); box-shadow: 0 0 0 3px var(--accent-weak); }
.cat-dot-sm { width: 15px; height: 15px; border-radius: 50%; flex: none; }
.cat-name { line-height: 1; }

.cat-add {
    display: grid; place-items: center; width: 36px; height: 34px;
    border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--panel);
    color: var(--ink-2); cursor: pointer; transition: all .12s var(--ease);
}
.cat-add:hover { border-color: var(--accent); color: var(--accent); }

.cat-palette { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cat-dot {
    width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
    transition: transform .1s var(--ease);
}
.cat-dot:hover { transform: scale(1.12); }
.cat-dot.is-active { border-color: var(--panel); box-shadow: 0 0 0 2px var(--ink); }

.cat-default {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; height: 42px; margin-top: 12px; border-radius: 12px;
    border: 1.5px solid var(--line-2); background: var(--panel-2); color: var(--ink-2);
    font-weight: 600; cursor: pointer; transition: all .12s var(--ease);
}
.cat-default::before { content: ''; width: 16px; height: 16px; border-radius: 50%; background: #A78BE0; }
.cat-default:hover { border-color: var(--ink-3); }
.cat-default.is-active { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }

.cat-addform { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.cat-newdot { width: 20px; height: 20px; border-radius: 50%; flex: none; background: var(--accent); }
.cat-addform input { flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel); color: var(--ink); }
.cat-addform input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.foot-spacer { flex: 1; }

/* =============================================================================
   Toasts
   ========================================================================== */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 12px;
    background: #1e1e24; color: #f3f2f7; box-shadow: var(--shadow-lg);
    font-size: 13.5px; font-weight: 500; animation: pop .18s var(--ease);
}
.toast .toast-action { color: #b9b5ff; font-weight: 700; background: none; border: none; padding: 0 2px; }
.toast .toast-action:hover { text-decoration: underline; }

/* =============================================================================
   Scrollbars
   ========================================================================== */
.rows::-webkit-scrollbar, .reader-scroll::-webkit-scrollbar { width: 10px; }
.rows::-webkit-scrollbar-thumb, .reader-scroll::-webkit-scrollbar-thumb {
    background: var(--line-2); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box;
}
.rows::-webkit-scrollbar-thumb:hover, .reader-scroll::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: padding-box; }

/* =============================================================================
   Responsive
   ========================================================================== */
.only-mobile { display: none; }

@media (max-width: 1080px) {
    :root { --sidebar-w: 72px; --list-w: 360px; }
    .brand-name, .folder-label, .me, .btn-compose span:not(.ic),
    .sidebar-foot .icon-btn { display: none; }
    .btn-compose { padding: 0; }
    .folder { justify-content: center; padding: 0; }
    .folder-count { position: absolute; margin-left: 22px; margin-top: -16px; }
    .folders { position: relative; }
    .sidebar-foot { justify-content: center; padding: 8px; }
}

@media (max-width: 760px) {
    :root { --sidebar-w: 0px; }
    .app { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 264px;
        transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); }
    :root { --sidebar-w: 264px; }
    .sidebar { --sidebar-w: 264px; }
    .brand-name, .folder-label, .me, .btn-compose span { display: revert; }
    .folder { justify-content: flex-start; padding: 0 12px; }
    body.nav-open .sidebar { transform: translateX(0); }
    .only-mobile { display: inline-flex; }
    .maillist { border-right: none; }
    /* One pane at a time on phones */
    .reader { position: fixed; inset: 0; z-index: 30; transform: translateX(100%);
        transition: transform .25s var(--ease); }
    .app.has-open .reader { transform: translateX(0); }
    .reader-topbar { display: flex; }
}
