/* =========================================================================
   odot·dispatch — dispatch-console design system
   Concept: dark operator chrome + light compose surfaces, a channel rail that
   glows in each channel's colour (teal = email, amber = SMS), and a monospace
   transmission log. Type: Space Grotesk (display) / IBM Plex Sans (body) /
   IBM Plex Mono (console voice).
   ========================================================================= */

:root {
    /* Paper & ink */
    --paper:      #eaeeeb;
    --surface:    #ffffff;
    --surface-2:  #f5f8f6;
    --ink:        #16241e;
    --muted:      #5d6c66;
    --faint:      #8a978f;
    --line:       #dde4df;

    /* Channels & accents */
    --teal:       #0f766e;
    --teal-600:   #0b615a;
    --teal-soft:  #e1efec;
    --amber:      #bd7714;
    --amber-600:  #9f6210;
    --amber-soft: #f8ecd5;
    --danger:     #bd433a;
    --danger-soft:#f7e1df;
    --ok:         #2e7d5b;

    /* Dark operator panel */
    --panel-bg:   #10201b;
    --panel-ink:  #eaf1ee;
    --panel-dim:  #7f9990;
    --panel-line: rgba(255,255,255,.09);

    /* Shape & depth */
    --radius:     15px;
    --radius-sm:  10px;
    --radius-pill:999px;
    --shadow-sm:  0 1px 2px rgba(16,32,26,.06);
    --shadow:     0 1px 2px rgba(16,32,26,.05), 0 18px 40px -26px rgba(16,32,26,.32);

    /* Type */
    --f-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
    --f-body:    'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    --f-mono:    'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper:      #0e1613;
        --surface:    #16211d;
        --surface-2:  #1a2621;
        --ink:        #e7eeea;
        --muted:      #9aa8a2;
        --faint:      #6f7e78;
        --line:       #263029;
        --teal:       #34b3a4;
        --teal-600:   #2b9b8e;
        --teal-soft:  #14312d;
        --amber:      #d99a3f;
        --amber-600:  #c1852f;
        --amber-soft: #322414;
        --danger:     #e0655b;
        --danger-soft:#331d1b;
        --ok:         #52b487;
        --panel-bg:   #0a120f;
        --shadow:     0 1px 2px rgba(0,0,0,.4), 0 18px 40px -26px rgba(0,0,0,.7);
    }
}

/* Explicit theme toggles win over the media query if ever set. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    font-family: var(--f-body);
    color: var(--ink);
    background: var(--paper);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--f-display); font-weight: 600; margin: 0; letter-spacing: -0.015em; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--teal); color: #fff; }

/* -------------------------------------------------------------------------
   Shared bits: kicker, buttons, fields
   ------------------------------------------------------------------------- */
.kicker {
    font-family: var(--f-mono);
    font-size: 11.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 .6rem;
}
.kicker--email { color: var(--teal); }
.kicker--sms   { color: var(--amber); }

.btn {
    --btn-bg: var(--ink);
    --btn-fg: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-family: var(--f-body);
    font-weight: 600;
    font-size: 14.5px;
    line-height: 1;
    padding: .8rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--btn-bg);
    color: var(--btn-fg);
    cursor: pointer;
    transition: transform .08s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
    text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.btn--primary { --btn-bg: var(--teal); --btn-fg: #fff; }
.btn--primary:hover { background: var(--teal-600); }
.btn--amber { --btn-bg: var(--amber); --btn-fg: #fff; }
.btn--amber:hover { background: var(--amber-600); }
.btn--amber:focus-visible { outline-color: var(--amber); }

.btn--ghost {
    --btn-bg: transparent;
    --btn-fg: var(--ink);
    border-color: var(--line);
    background: var(--surface);
}
.btn--ghost:hover { background: var(--surface-2); }

.btn--block { width: 100%; }
.btn--sm { padding: .5rem .8rem; font-size: 13px; }

/* Fields */
.form { display: flex; flex-direction: column; gap: 1.05rem; }
.field { display: flex; flex-direction: column; gap: .4rem; }
.field__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.field__opt {
    font-family: var(--f-mono);
    font-weight: 400;
    font-size: 10.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--faint);
}
.field__hint { font-size: 12.5px; color: var(--muted); }

.field input,
.field textarea {
    width: 100%;
    font-family: var(--f-body);
    font-size: 15px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .78rem .85rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
.field input::placeholder,
.field textarea::placeholder { color: var(--faint); }
.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-soft);
}

/* Reveal-password control */
.field__reveal { position: relative; display: flex; align-items: center; }
.field__reveal input { padding-right: 4rem; }
.reveal {
    position: absolute;
    right: .5rem;
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: .3rem .5rem;
    cursor: pointer;
}
.reveal:hover { color: var(--ink); }

.counter { font-family: var(--f-mono); font-size: 11px; color: var(--faint); font-weight: 400; letter-spacing: .04em; }

.form__actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-top: .3rem; }

/* -------------------------------------------------------------------------
   Rich-text editor (progressive enhancement)
   Without JS the plain <textarea.editor__input> is shown; with JS the toolbar
   editor replaces it. The <html> element gets .has-js synchronously in <head>.
   ------------------------------------------------------------------------- */
.editor { display: none; }                       /* revealed only when JS is on */
.has-js .editor { display: block; }
.has-js .editor__input { display: none; }        /* still submits its value while hidden */

.editor {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.editor:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.compose--sms .editor:focus-within { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }

.editor__toolbar {
    display: flex; align-items: center; gap: .15rem; flex-wrap: wrap;
    padding: .4rem .5rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}
.editor__btn {
    min-width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 .45rem;
    font-family: var(--f-body); font-size: 14px; line-height: 1;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.editor__btn:hover { background: var(--surface); color: var(--ink); border-color: var(--line); }
.editor__btn.is-active { background: var(--teal-soft); color: var(--teal); border-color: color-mix(in srgb, var(--teal) 30%, var(--line)); }
.editor__btn i { font-style: italic; }
.editor__sep { width: 1px; height: 18px; background: var(--line); margin: 0 .3rem; }

.editor__area {
    padding: .85rem .9rem;
    min-height: 190px;
    max-height: 460px;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink);
    outline: none;
}
.editor__area:empty::before {
    content: attr(data-placeholder);
    color: var(--faint);
    pointer-events: none;
}
.editor__area h2 { font-family: var(--f-display); font-size: 1.15rem; margin: .4rem 0; }
.editor__area p { margin: 0 0 .6rem; }
.editor__area ul, .editor__area ol { margin: 0 0 .6rem; padding-left: 1.4rem; }
.editor__area a { color: var(--teal); }
.editor__area blockquote { margin: .4rem 0; padding-left: .9rem; border-left: 3px solid var(--line); color: var(--muted); }
.editor__area pre, .editor__area code { font-family: var(--f-mono); font-size: 13px; background: var(--surface-2); border-radius: 5px; }
.editor__area pre { padding: .6rem .7rem; overflow-x: auto; }

/* -------------------------------------------------------------------------
   Auth split panel
   ------------------------------------------------------------------------- */
.auth { min-height: 100vh; background: var(--paper); }
.auth__grid { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }

.panel {
    position: relative;
    background:
        radial-gradient(120% 80% at 12% 0%, rgba(15,118,110,.30), transparent 55%),
        radial-gradient(120% 80% at 100% 100%, rgba(189,119,20,.22), transparent 50%),
        var(--panel-bg);
    color: var(--panel-ink);
    padding: 2.6rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}
.panel::before {
    /* faint operator grid */
    content: "";
    position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--panel-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--panel-line) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: .5;
    pointer-events: none;
    mask-image: radial-gradient(120% 90% at 30% 30%, #000 30%, transparent 75%);
}
.panel > * { position: relative; }

.panel__brand { display: inline-flex; align-items: center; }
.panel__brand img { display: block; width: 172px; height: auto; }

.panel__eyebrow {
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--teal);
    margin: 0 0 1rem;
}
.panel__headline {
    font-size: clamp(1.9rem, 3.2vw, 2.9rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    margin: 0 0 1.1rem;
    max-width: 15ch;
}
.panel__sub { color: var(--panel-dim); font-size: 15.5px; max-width: 40ch; margin: 0; }
.panel__art {
    position: relative;
    width: min(100%, 470px);
    margin: 1.45rem 0 -2.2rem;
    overflow: hidden;
    border: 1px solid rgba(173, 232, 222, .18);
    border-radius: 20px;
    background: #0c1918;
    box-shadow: 0 22px 42px rgba(0, 0, 0, .28);
}
.panel__art::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 52%, rgba(4, 17, 17, .8) 100%);
}
.panel__art img { display: block; width: 100%; aspect-ratio: 1.35 / 1; object-fit: cover; object-position: 57% center; }
.panel__art figcaption {
    position: absolute;
    left: 1rem;
    bottom: .85rem;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .36rem .6rem;
    border: 1px solid rgba(206, 255, 248, .22);
    border-radius: var(--radius-pill);
    background: rgba(5, 25, 24, .7);
    backdrop-filter: blur(10px);
    color: #eaf8f4;
    font-family: var(--f-mono);
    font-size: 10.5px;
    letter-spacing: .07em;
    text-transform: uppercase;
}
.panel__art figcaption span { width: 7px; height: 7px; border-radius: 50%; background: #56d1a1; box-shadow: 0 0 0 3px rgba(86, 209, 161, .18); }

.panel__log {
    font-family: var(--f-mono);
    font-size: 12.5px;
    line-height: 1.9;
    color: var(--panel-dim);
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--panel-line);
    padding-top: 1.2rem;
}
.panel__log span { white-space: nowrap; }
.panel__log .blink { color: var(--teal); }
.panel__log .blink::after {
    content: "";
    display: inline-block;
    width: .55ch; height: 1.05em;
    background: var(--teal);
    margin-left: .1ch;
    vertical-align: -0.15em;
    animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.formside {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2.5rem 1.5rem;
    background: var(--paper);
}
.formcard { width: 100%; max-width: 400px; }
.formcard__wordmark { display: block; width: 182px; height: auto; margin: 0 0 1.2rem -4px; }
.formcard__head { margin-bottom: 1.65rem; }
.formcard__head h2 { font-size: 1.65rem; }
.formcard__head p:last-child { margin: .6rem 0 0; color: var(--muted); font-size: 14.5px; }
.formcard__foot { margin-top: 1.5rem; font-size: 14px; color: var(--muted); }

.auth .field { gap: .5rem; }
.field__control, .field__reveal { position: relative; display: flex; align-items: center; }
.auth .field__control input, .auth .field__reveal input { width: 100%; padding-left: 2.9rem; }
.field__icon { position: absolute; left: .92rem; width: 19px; height: 19px; color: var(--teal); pointer-events: none; z-index: 1; }
.auth .field__reveal .field__icon { left: .92rem; }
.field__reveal .reveal { position: absolute; right: .65rem; }
.field__hint { display: flex; align-items: flex-start; gap: .38rem; line-height: 1.45; }
.field__hint svg { width: 15px; height: 15px; margin-top: .08rem; flex: 0 0 auto; color: var(--teal); }
.btn--login { display: inline-flex; justify-content: center; align-items: center; gap: .5rem; min-height: 48px; margin-top: .35rem; }
.btn--login svg { width: 18px; height: 18px; transition: transform .18s ease; }
.btn--login:hover svg { transform: translateX(3px); }

/* -------------------------------------------------------------------------
   Developer team accounts
   ------------------------------------------------------------------------- */
.team { max-width: 980px; margin: 0 auto; }
.team__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.8rem; }
.team__head h1 { font-size: clamp(1.9rem, 4vw, 2.5rem); margin: 0 0 .55rem; }
.team__head p:not(.kicker) { max-width: 54ch; margin: 0; color: var(--muted); }
.team__badge { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .65rem; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); font-family: var(--f-mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.team__badge span { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(46,125,91,.14); }
.team__grid { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(300px, 1.1fr); gap: 1.2rem; align-items: start; }
.team__create, .team__list { padding: 1.35rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.team h2 { font-size: 1.08rem; margin: 0 0 .45rem; }
.team__note { margin: 0 0 1.25rem; color: var(--muted); font-size: 14px; }
.team__empty { padding: 1rem; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--muted); font-size: 14px; }
.memberlist { display: flex; flex-direction: column; margin-top: .9rem; border-top: 1px solid var(--line); }
.memberrow { display: flex; align-items: center; gap: .75rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.memberrow__avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--teal-soft); color: var(--teal); font-family: var(--f-display); font-weight: 700; font-size: 14px; flex: none; }
.memberrow strong, .memberrow span:not(.memberrow__avatar):not(.memberrow__status) { display: block; }
.memberrow strong { font-size: 14px; }
.memberrow div span { color: var(--muted); font-size: 12.5px; }
.memberrow__status { margin-left: auto; padding: .2rem .46rem; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--faint); font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.memberrow__status.is-active { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.hero__owner, .compose__owner { margin: .7rem 0 0; color: var(--teal); font-size: 13px; }

/* -------------------------------------------------------------------------
   App chrome (signed-in header)
   ------------------------------------------------------------------------- */
.app { display: flex; flex-direction: column; min-height: 100vh; }

.chrome {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: .85rem 1.6rem;
    background: var(--panel-bg);
    color: var(--panel-ink);
    position: sticky;
    top: 0;
    z-index: 20;
}
.chrome__brand { display: inline-flex; align-items: center; color: var(--panel-ink); }
.chrome__brand:hover { text-decoration: none; }
.chrome__brand img { display: block; width: 140px; height: auto; }

.chrome__nav { display: flex; gap: .35rem; margin-left: .5rem; }
.navlink {
    font-family: var(--f-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--panel-dim);
    padding: .45rem .8rem;
    border-radius: var(--radius-pill);
    transition: color .15s ease, background .15s ease;
}
.navlink:hover { color: var(--panel-ink); text-decoration: none; background: rgba(255,255,255,.06); }
.navlink.is-active { color: var(--panel-ink); background: rgba(255,255,255,.1); }

.chrome__end { margin-left: auto; display: flex; align-items: center; gap: .9rem; }
.whoami {
    display: inline-flex; align-items: center; gap: .45rem;
    font-family: var(--f-mono); font-size: 12px; color: var(--panel-dim);
    max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.whoami__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(46,125,91,.25); flex: none; }

/* On desktop the menu wrapper is transparent (nav + end stay inline) and the
   hamburger is hidden; both flip at the mobile breakpoint below. */
.chrome__menu { display: contents; }
.chrome__burger {
    display: none;
    margin-left: auto;
    width: 42px; height: 38px;
    flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    background: transparent; border: 1px solid var(--panel-line); border-radius: 9px; cursor: pointer;
}
.chrome__burger span { display: block; width: 20px; height: 2px; background: var(--panel-ink); border-radius: 2px; transition: transform .22s ease, opacity .18s ease; }

.stage { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 2.2rem 1.6rem 3rem; }
/* Richer two-pane pages (compose studio, contacts) get more breathing room. */
.stage:has(.mail-studio),
.stage:has(.sms-studio),
.stage:has(.contacts),
.stage:has(.compose) { max-width: 1280px; }

.footer {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: 1.1rem 1.6rem;
    border-top: 1px solid var(--line);
    color: var(--faint);
    font-size: 12.5px;
    font-family: var(--f-mono);
    flex-wrap: wrap;
}

/* -------------------------------------------------------------------------
   Flash messages
   ------------------------------------------------------------------------- */
.db-banner {
    display: flex; align-items: center; gap: .6rem;
    padding: .8rem 1rem; margin-bottom: 1.2rem;
    border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line));
    border-radius: var(--radius-sm);
    background: var(--amber-soft); color: var(--amber-600);
    font-size: 13.5px;
}
.db-banner svg { width: 20px; height: 20px; flex: none; }
.db-banner b { color: var(--ink); }

.flash-stack { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.4rem; }
.formside .flash-stack, .auth .flash-stack { width: 100%; max-width: 400px; }

.flash {
    display: flex; align-items: flex-start; gap: .7rem;
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}
.flash__icon { width: 8px; height: 8px; border-radius: 50%; margin-top: .5rem; flex: none; }
.flash__msg { flex: 1; }
.flash__close { background: none; border: none; color: var(--faint); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 .1rem; }
.flash__close:hover { color: var(--ink); }
.flash--success { border-color: rgba(46,125,91,.35); background: color-mix(in srgb, var(--ok) 8%, var(--surface)); }
.flash--success .flash__icon { background: var(--ok); }
.flash--error { border-color: rgba(189,67,58,.35); background: var(--danger-soft); }
.flash--error .flash__icon { background: var(--danger); }

/* -------------------------------------------------------------------------
   Dashboard hero + channel bays
   ------------------------------------------------------------------------- */
.hero {
    display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem;
    margin-bottom: 2rem; flex-wrap: wrap;
}
.hero__title { font-size: clamp(1.7rem, 3.4vw, 2.5rem); line-height: 1.1; }
.hero__sub { color: var(--muted); margin: .8rem 0 0; max-width: 46ch; }
.hero__status { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }

.statuschip {
    display: inline-flex; align-items: center; gap: .5rem;
    font-family: var(--f-mono); font-size: 12px;
    padding: .4rem .7rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    white-space: nowrap;
}
.statuschip__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.statuschip--ok { color: var(--ok); }
.statuschip--warn { color: var(--amber); }

.bays { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-bottom: 2.2rem; }
.bay {
    position: relative;
    display: flex;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
    transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease;
}
.bay:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.bay__rail { width: 5px; flex: none; align-self: stretch; }
.bay--email .bay__rail { background: linear-gradient(var(--teal), var(--teal-600)); }
.bay--sms .bay__rail   { background: linear-gradient(var(--amber), var(--amber-600)); }
.bay--email:hover { border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); }
.bay--sms:hover   { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }

.bay__body { padding: 1.4rem 1.5rem; flex: 1; }
.bay__head { display: flex; align-items: center; gap: .7rem; margin-bottom: .55rem; }
.bay__head h2 { font-size: 1.35rem; }
.bay__icon { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 10px; }
.bay--email .bay__icon { color: var(--teal); background: var(--teal-soft); }
.bay--sms .bay__icon   { color: var(--amber); background: var(--amber-soft); }
.bay__desc { color: var(--muted); font-size: 14px; margin: 0 0 1.1rem; }

.bay__stats { display: flex; gap: 1.8rem; margin: 0 0 1.2rem; }
.bay__stats div { display: flex; flex-direction: column; }
.bay__stats dt { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.bay__stats dd { font-family: var(--f-display); font-size: 1.7rem; font-weight: 600; margin: .1rem 0 0; }

.bay__cta { font-weight: 600; font-size: 14px; }
.bay--email .bay__cta { color: var(--teal); }
.bay--sms .bay__cta   { color: var(--amber); }

/* -------------------------------------------------------------------------
   Delivery studio dashboard
   ------------------------------------------------------------------------- */
.dash { display: grid; gap: 1.35rem; }
.dash__hero {
    display: grid;
    grid-template-columns: minmax(0, 1.06fr) minmax(320px, .94fr);
    min-height: 340px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.dash__welcome { display: flex; flex-direction: column; align-items: flex-start; padding: clamp(1.55rem, 4vw, 3rem); }
.dash__eyebrow-row { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.35rem; }
.dash__eyebrow { display: inline-flex; align-items: center; gap: .45rem; color: var(--teal); font-family: var(--f-mono); font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.dash__eyebrow span { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }
.dash__guide-toggle { display: inline-flex; align-items: center; gap: .38rem; padding: .43rem .62rem; border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--muted); background: var(--surface-2); font-family: var(--f-body); font-size: 12px; font-weight: 600; cursor: pointer; transition: border-color .16s ease, color .16s ease, background .16s ease; }
.dash__guide-toggle svg { width: 15px; height: 15px; }
.dash__guide-toggle:hover, .dash__guide-toggle[aria-expanded="true"] { border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); color: var(--teal); background: var(--teal-soft); }
.dash__guide-toggle:focus-visible, .guide__close:focus-visible, .guide__foot button:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.dash__welcome h1 { max-width: 11ch; margin: 0; font-size: clamp(2.15rem, 4vw, 3.5rem); line-height: .98; letter-spacing: -.055em; }
.dash__welcome h1 em { color: var(--teal); font-style: normal; }
.dash__welcome > p { max-width: 44ch; margin: 1rem 0 0; color: var(--muted); font-size: 15px; }
.dash__actions { display: flex; gap: .65rem; margin-top: 1.45rem; flex-wrap: wrap; }
.btn--soft { --btn-bg: var(--teal-soft); --btn-fg: var(--teal); border-color: color-mix(in srgb, var(--teal) 18%, var(--line)); }
.btn--soft:hover { background: color-mix(in srgb, var(--teal) 15%, var(--surface)); }
.dash__profile { display: inline-flex; align-items: center; gap: .62rem; margin-top: auto; padding-top: 1.8rem; color: var(--muted); }
.dash__profile-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.dash__profile-mark svg { width: 18px; height: 18px; }
.dash__profile b, .dash__profile small { display: block; }
.dash__profile b { color: var(--ink); font-size: 12.5px; }
.dash__profile small { margin-top: .05rem; font-family: var(--f-mono); font-size: 10.5px; }
.dash__photo { position: relative; min-height: 300px; margin: 0; background: #122a2a; }
.dash__photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,31,31,.18), transparent 45%), linear-gradient(0deg, rgba(7,20,20,.72), transparent 48%); pointer-events: none; }
.dash__photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 57% 47%; }
.dash__photo figcaption { position: absolute; z-index: 1; left: clamp(1rem, 3vw, 1.6rem); bottom: 1.35rem; color: #fff; }
.dash__photo-live { display: inline-flex; align-items: center; gap: .38rem; padding: .36rem .58rem; border: 1px solid rgba(255,255,255,.22); border-radius: var(--radius-pill); background: rgba(8,29,29,.44); backdrop-filter: blur(12px); font-family: var(--f-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.dash__photo-live i, .dash__availability i { width: 7px; height: 7px; border-radius: 50%; background: #5ce0ac; box-shadow: 0 0 0 3px rgba(92,224,172,.18); }
.dash__photo figcaption strong { display: block; margin-top: .6rem; font-family: var(--f-display); font-size: 1.16rem; letter-spacing: -.02em; }
.dash__metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; }
.metric { display: flex; align-items: flex-start; gap: .75rem; padding: 1.1rem 1.15rem; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.metric__icon { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; flex: none; }
.metric__icon svg { width: 19px; height: 19px; }
.metric--mail .metric__icon { color: var(--teal); background: var(--teal-soft); }
.metric--sms .metric__icon { color: var(--amber); background: var(--amber-soft); }
.metric--success .metric__icon { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.metric span, .metric strong, .metric small { display: block; }
.metric div > span { color: var(--muted); font-size: 12.5px; }
.metric strong { margin: .08rem 0; font-family: var(--f-display); font-size: 1.75rem; line-height: 1; letter-spacing: -.04em; }
.metric small { color: var(--faint); font-size: 11.5px; }
.dash__workspace { padding: 1.45rem; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.dash__section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.05rem; }
.dash__section-head .kicker { margin-bottom: .35rem; color: var(--faint); }
.dash__section-head h2 { font-size: 1.3rem; }
.dash__availability { display: inline-flex; align-items: center; gap: .42rem; color: var(--muted); font-family: var(--f-mono); font-size: 10.5px; white-space: nowrap; }
.dash__channels { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.channel-card { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: .7rem; padding: 1rem; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: var(--surface-2); transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.channel-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--teal) 42%, var(--line)); box-shadow: var(--shadow-sm); text-decoration: none; }
.channel-card--sms:hover { border-color: color-mix(in srgb, var(--amber) 48%, var(--line)); }
.channel-card__index { color: var(--faint); font-family: var(--f-mono); font-size: 10.5px; }
.channel-card__icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 11px; color: var(--teal); background: var(--teal-soft); }
.channel-card__icon svg { width: 19px; height: 19px; }
.channel-card--sms .channel-card__icon { color: var(--amber); background: var(--amber-soft); }
.channel-card__body b, .channel-card__body small { display: block; }
.channel-card__body b { font-size: 14px; }
.channel-card__body small { margin-top: .13rem; color: var(--muted); font-size: 12px; }
.channel-card__arrow { color: var(--teal); font-size: 20px; transition: transform .16s ease; }
.channel-card--sms .channel-card__arrow { color: var(--amber); }
.channel-card:hover .channel-card__arrow { transform: translateX(3px); }
.guide { position: fixed; z-index: 40; top: 5.25rem; right: 1.35rem; width: min(380px, calc(100vw - 2rem)); padding: 1.2rem; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 24px 65px rgba(16,32,26,.24); opacity: 0; pointer-events: none; transform: translateY(-8px) scale(.98); transform-origin: top right; transition: opacity .2s ease, transform .2s ease; }
.guide.is-open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.guide__head { display: grid; grid-template-columns: auto 1fr auto; gap: .65rem; align-items: start; }
.guide__head-icon { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; color: var(--teal); background: var(--teal-soft); }
.guide__head-icon svg { width: 19px; height: 19px; }
.guide__head p { margin: 0 0 .1rem; color: var(--teal); font-family: var(--f-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.guide__head h2 { font-size: 1.1rem; }
.guide__close { width: 28px; height: 28px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 23px; line-height: 1; cursor: pointer; }
.guide__close:hover { color: var(--ink); background: var(--surface-2); }
.guide__steps { display: grid; gap: .9rem; margin: 1.15rem 0; padding: 0; list-style: none; }
.guide__steps li { display: grid; grid-template-columns: 23px 1fr; gap: .65rem; }
.guide__steps li > span { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: var(--teal); background: var(--teal-soft); font-family: var(--f-mono); font-size: 10px; font-weight: 600; }
.guide__steps b, .guide__steps small { display: block; }
.guide__steps b { font-size: 13px; }
.guide__steps small { margin-top: .12rem; color: var(--muted); font-size: 12px; line-height: 1.4; }
.guide__foot { padding-top: .85rem; border-top: 1px solid var(--line); }
.guide__foot button { padding: 0; border: 0; color: var(--teal); background: transparent; font-family: var(--f-body); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.guide__foot button:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
    .dash__guide-toggle, .channel-card, .channel-card__arrow, .guide { transition: none; }
}

/* -------------------------------------------------------------------------
   Compose layout (form + side log) with channel rail
   ------------------------------------------------------------------------- */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.4rem; align-items: start; }
.compose__main {
    position: relative;
    display: flex;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.compose__rail { width: 5px; flex: none; align-self: stretch; }
.compose--email .compose__rail { background: linear-gradient(var(--teal), var(--teal-600)); }
.compose--sms .compose__rail   { background: linear-gradient(var(--amber), var(--amber-600)); }
.compose__inner { padding: 1.7rem 1.8rem; flex: 1; }
.compose__head { margin-bottom: 1.4rem; }
.compose__head h1 { font-size: 1.7rem; }
.compose__from { font-size: 13px; color: var(--muted); margin: .5rem 0 0; }
.compose__from code { font-family: var(--f-mono); font-size: 12px; background: var(--surface-2); padding: .1rem .35rem; border-radius: 5px; }
.compose__from--warn { color: var(--amber-600); }

.compose--email .field input:focus,
.compose--email .field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.compose--sms .field input:focus,
.compose--sms .field textarea:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }

.compose__aside { position: sticky; top: 5rem; }

/* -------------------------------------------------------------------------
   Transmission log
   ------------------------------------------------------------------------- */
.log { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.log__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: .95rem 1.2rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}
.log__head h3 { font-size: .95rem; font-family: var(--f-mono); font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.log__count { font-family: var(--f-mono); font-size: 12px; color: var(--faint); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: .05rem .55rem; }
.log__empty { padding: 1.4rem 1.2rem; color: var(--muted); font-size: 14px; margin: 0; }

.log__list { list-style: none; margin: 0; padding: 0; }
.logrow {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: .2rem .8rem;
    padding: .7rem 1.2rem;
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
}
.logrow:last-child { border-bottom: none; }
.logrow__link {
    display: flex; align-items: flex-start; gap: .6rem;
    min-width: 0; color: var(--ink);
    border-radius: var(--radius-sm);
}
.logrow__link:hover { text-decoration: none; }
.logrow__link:hover .logrow__to { color: var(--teal); }
.logrow--sms .logrow__link:hover .logrow__to { color: var(--amber); }
.logrow__chan {
    flex: none; margin-top: .05rem;
    font-family: var(--f-mono); font-size: 10px; font-weight: 500; letter-spacing: .08em;
    padding: .2rem .45rem; border-radius: 5px;
}
.logrow--email .logrow__chan { color: var(--teal); background: var(--teal-soft); }
.logrow--sms .logrow__chan   { color: var(--amber); background: var(--amber-soft); }
.logrow__body { min-width: 0; display: flex; flex-direction: column; }
.logrow__to { display: flex; align-items: center; gap: .3rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .14s ease; }
.logrow__book { width: 14px; height: 14px; flex: none; color: var(--muted); }
.logrow__more { font-family: var(--f-mono); font-weight: 400; font-size: 10.5px; color: var(--faint); }
.logrow__subj { color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logrow__meta { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; text-align: right; }
.logrow__time { font-family: var(--f-mono); font-size: 11px; color: var(--faint); white-space: nowrap; }
.logrow__status {
    font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
    padding: .15rem .5rem; border-radius: var(--radius-pill); white-space: nowrap;
}
.logrow__toggle {
    grid-column: 1 / -1; justify-self: start;
    display: inline-flex; align-items: center; gap: .3rem;
    margin-top: .15rem; padding: .2rem .1rem;
    border: 0; background: none; cursor: pointer;
    font-family: var(--f-mono); font-size: 11px; color: var(--muted);
}
.logrow__toggle svg { width: 14px; height: 14px; transition: transform .18s ease; }
.logrow__toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.logrow__toggle:hover { color: var(--ink); }
.logrow__recips {
    grid-column: 1 / -1; list-style: none; margin: .35rem 0 .1rem; padding: .3rem .1rem 0;
    border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: .05rem;
}
.logrow__recips[hidden] { display: none; }
.logrecip { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .3rem 0; font-size: 12.5px; }
.logrecip__addr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.logrecip__status { flex: none; font-family: var(--f-mono); font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase; padding: .1rem .4rem; border-radius: var(--radius-pill); }
.status--sent { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.status--simulated { color: var(--amber); background: var(--amber-soft); }
.status--failed { color: var(--danger); background: var(--danger-soft); }
.status--partial { color: var(--amber-600); background: var(--amber-soft); }

/* Recall banner on the composer + kept-attachment chips */
.recall-note {
    display: flex; align-items: center; gap: .55rem;
    padding: .7rem .9rem; margin-bottom: 1.2rem;
    border: 1px solid color-mix(in srgb, var(--teal) 30%, var(--line));
    border-radius: var(--radius-sm);
    background: var(--teal-soft); color: var(--teal-600);
    font-size: 13px;
}
.recall-note svg { width: 18px; height: 18px; flex: none; }
.recall-note a { font-weight: 600; text-decoration: underline; }
.recall-note--sms { border-color: color-mix(in srgb, var(--amber) 32%, var(--line)); background: var(--amber-soft); color: var(--amber-600); }
.attachment-item--kept { border-color: color-mix(in srgb, var(--teal) 30%, var(--line)); background: var(--teal-soft); }
.attachment-item__tag { font-family: var(--f-mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: var(--teal); background: var(--surface); border-radius: var(--radius-pill); padding: .1rem .4rem; }

/* -------------------------------------------------------------------------
   Sent history page
   ------------------------------------------------------------------------- */
.history { max-width: 860px; margin: 0 auto; display: grid; gap: 1.2rem; }
.history__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.history__head h1 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); line-height: 1.08; margin: 0 0 .5rem; }
.history__head > div > p:not(.kicker) { color: var(--muted); margin: 0; max-width: 52ch; }
.history__stats { display: flex; gap: 1.4rem; }
.history__stats span { font-family: var(--f-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.history__stats b { font-family: var(--f-display); font-size: 1.35rem; color: var(--ink); margin-right: .3rem; }
.history__tabs { display: inline-flex; gap: .3rem; padding: .3rem; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); width: max-content; }
.history__tab { padding: .4rem .9rem; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; color: var(--muted); }
.history__tab:hover { text-decoration: none; color: var(--ink); background: var(--surface-2); }
.history__tab.is-active { color: #fff; background: var(--teal); }
.history__tab.is-active:hover { color: #fff; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: .3rem; }
.pager__info { font-family: var(--f-mono); font-size: 12px; color: var(--faint); }
.pager__links { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.pager__btn, .pager__num {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 0 .7rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink);
    font-size: 13px; font-weight: 600;
}
.pager__num { padding: 0; }
.pager__btn:hover, .pager__num:hover { text-decoration: none; border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); background: var(--teal-soft); color: var(--teal); }
.pager__num.is-active { background: var(--teal); border-color: var(--teal); color: #fff; }
.pager__num.is-active:hover { background: var(--teal); color: #fff; }
.pager__btn.is-disabled { opacity: .45; pointer-events: none; }
.pager__gap { color: var(--faint); padding: 0 .2rem; }

/* -------------------------------------------------------------------------
   Templates library
   ------------------------------------------------------------------------- */
.templates { display: grid; gap: 1.35rem; }
.templates__hero {
    display: grid; grid-template-columns: 1.4fr .9fr; gap: 1.6rem; align-items: start;
    padding: 1.7rem 1.9rem; overflow: hidden;
    border: 1px solid var(--line); border-radius: 20px;
    background: radial-gradient(120% 130% at 100% 0%, var(--teal-soft), transparent 58%), var(--surface);
    box-shadow: var(--shadow);
}
.templates__hero h1 { font-size: clamp(1.7rem, 3vw, 2.35rem); line-height: 1.06; letter-spacing: -.03em; margin: 0 0 .55rem; max-width: 20ch; }
.templates__hero > div > p:not(.kicker) { color: var(--muted); margin: 0; max-width: 52ch; font-size: 15px; }
.templates__hero-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.2rem; }
.templates__count { font-family: var(--f-mono); font-size: 12px; color: var(--faint); }
.templates__vars { padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.templates__vars b { font-size: 13.5px; }
.templates__vars p { margin: .3rem 0 .7rem; color: var(--muted); font-size: 12.5px; }
.templates__var-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.varchip {
    font-family: var(--f-mono); font-size: 11.5px; color: var(--teal);
    background: var(--surface); border: 1px solid color-mix(in srgb, var(--teal) 25%, var(--line));
    border-radius: var(--radius-pill); padding: .2rem .55rem; cursor: pointer;
}
.varchip:hover { background: var(--teal-soft); }
.varchip--btn { color: var(--muted); border-color: var(--line); }
.varchip--btn:hover { color: var(--teal); border-color: color-mix(in srgb, var(--teal) 30%, var(--line)); background: var(--teal-soft); }

.templates__tabs { display: inline-flex; gap: .3rem; padding: .3rem; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); width: max-content; }
.templates__tab { padding: .4rem .9rem; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; color: var(--muted); }
.templates__tab:hover { text-decoration: none; color: var(--ink); background: var(--surface-2); }
.templates__tab.is-active, .templates__tab.is-active:hover { color: #fff; background: var(--teal); }

.tpl-group { display: grid; gap: .8rem; }
.tpl-group__title { font-size: 1.05rem; color: var(--muted); font-family: var(--f-mono); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.tpl-card {
    display: flex; flex-direction: column; gap: .5rem;
    padding: 1.15rem 1.2rem; border: 1px solid var(--line); border-left: 3px solid var(--teal);
    border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);
}
.tpl-card--sms { border-left-color: var(--amber); }
.tpl-card__head { display: flex; align-items: center; gap: .5rem; }
.tpl-card__chan { font-family: var(--f-mono); font-size: 9.5px; font-weight: 500; letter-spacing: .08em; padding: .18rem .4rem; border-radius: 5px; color: var(--teal); background: var(--teal-soft); }
.tpl-card--sms .tpl-card__chan { color: var(--amber); background: var(--amber-soft); }
.tpl-card__name { font-size: 1rem; }
.tpl-card__subject { font-size: 13px; font-weight: 600; color: var(--ink); margin: 0; }
.tpl-card__preview { font-size: 13px; color: var(--muted); margin: 0; flex: 1; line-height: 1.5; }
.tpl-card__actions { display: flex; align-items: center; gap: .4rem; margin-top: .3rem; }
.tpl-card__actions .btn { margin-right: auto; }

.cdialog--wide { width: min(640px, calc(100vw - 2rem)); }
.tpl-dialog__vars { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.tpl-dialog__vars > span { font-size: 12px; color: var(--muted); margin-right: .2rem; }

.template-picker code { font-family: var(--f-mono); font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; }

@media (max-width: 860px) {
    .templates__hero { grid-template-columns: 1fr; }
}

/* -------------------------------------------------------------------------
   Error page
   ------------------------------------------------------------------------- */
.errpage { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.errpage__card { text-align: center; max-width: 420px; }
.errpage__code { font-family: var(--f-mono); font-size: 13px; letter-spacing: .2em; color: var(--amber); }
.errpage__card h1 { font-size: 1.9rem; margin: .5rem 0 .6rem; }
.errpage__card p { color: var(--muted); margin: 0 0 1.5rem; }

/* -------------------------------------------------------------------------
   Select control (address-book pickers) + small utilities
   ------------------------------------------------------------------------- */
.field select {
    width: 100%;
    font-family: var(--f-body);
    font-size: 15px;
    color: var(--ink);
    background-color: var(--surface);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235d6c66' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right .85rem center;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .78rem 2.4rem .78rem .85rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.compose--sms .field select:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }

.muted { color: var(--faint); }
.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.pill {
    display: inline-flex; align-items: center; gap: .3rem;
    margin-left: .5rem;
    padding: .18rem .55rem;
    border-radius: var(--radius-pill);
    font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .04em;
    white-space: nowrap;
}
.pill--ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.pill--muted { color: var(--faint); background: var(--surface-2); border: 1px solid var(--line); }

/* -------------------------------------------------------------------------
   Email mail-studio (compose redesign)
   ------------------------------------------------------------------------- */
.mail-studio { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.6rem; align-items: start; }
.mail-studio__main { display: grid; gap: 1.2rem; min-width: 0; }

.mail-studio__hero {
    position: relative;
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 1.5rem;
    align-items: center;
    padding: 1.7rem 1.8rem;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(130% 120% at 100% 0%, var(--teal-soft), transparent 60%),
        var(--surface);
    box-shadow: var(--shadow-sm);
}
.mail-studio__hero-copy h1 { font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.08; letter-spacing: -.02em; margin: 0 0 .55rem; max-width: 18ch; }
.mail-studio__hero-copy > p { color: var(--muted); font-size: 14.5px; margin: 0; max-width: 42ch; }
.mail-studio__from {
    display: inline-flex; align-items: center; gap: .45rem;
    margin-top: 1rem;
    font-family: var(--f-mono); font-size: 12px; color: var(--muted);
}
.mail-studio__from i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.mail-studio__from b { color: var(--ink); font-weight: 600; }

.mail-studio__visual { position: relative; margin: 0; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.mail-studio__visual img { display: block; width: 100%; aspect-ratio: 1.25 / 1; object-fit: cover; object-position: 55% center; }
.mail-studio__visual figcaption {
    position: absolute; left: .8rem; bottom: .8rem; right: .8rem;
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .4rem .6rem;
    border-radius: var(--radius-pill);
    background: rgba(6, 24, 22, .62);
    backdrop-filter: blur(10px);
    color: #eaf8f4; font-family: var(--f-mono); font-size: 10px; letter-spacing: .05em; text-transform: uppercase;
    line-height: 1.3;
}
.mail-studio__visual figcaption span { color: #7fe6cf; font-weight: 500; }

.mail-studio__composer {
    padding: 1.6rem 1.7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--teal);
}
.mail-studio__form-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; }
.mail-studio__form-head h2 { font-size: 1.4rem; }
.mail-studio__form-head .kicker { margin-bottom: .3rem; }
.mail-studio__secure {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .4rem .7rem;
    border: 1px solid color-mix(in srgb, var(--teal) 22%, var(--line));
    border-radius: var(--radius-pill);
    background: var(--teal-soft); color: var(--teal);
    font-family: var(--f-mono); font-size: 11px; white-space: nowrap;
}
.mail-studio__secure svg { width: 15px; height: 15px; }

.recipient-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.recipient-grid--advanced { margin-top: .9rem; }

.mail-studio__contacts-link { margin: .3rem 0 .2rem; font-size: 13px; }
.mail-studio__contacts-link a { font-weight: 600; }
.mail-studio__contacts-link span { transition: transform .16s ease; display: inline-block; }
.mail-studio__contacts-link a:hover span { transform: translateX(3px); }

.mail-studio__advanced { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.mail-studio__advanced summary {
    display: flex; align-items: baseline; gap: .5rem;
    padding: .75rem .9rem; cursor: pointer; list-style: none;
    font-weight: 600; font-size: 13.5px;
}
.mail-studio__advanced summary::-webkit-details-marker { display: none; }
.mail-studio__advanced summary::before { content: "＋"; color: var(--teal); font-weight: 700; }
.mail-studio__advanced[open] summary::before { content: "−"; }
.mail-studio__advanced summary small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.mail-studio__advanced .recipient-grid { padding: 0 .9rem .95rem; }

.attachment-box {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .5rem 1rem;
    padding: 1rem 1.1rem;
    border: 1.5px dashed var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.attachment-box__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; color: var(--teal); background: var(--teal-soft); }
.attachment-box__icon svg { width: 20px; height: 20px; }
.attachment-box__copy b { display: block; font-size: 14px; }
.attachment-box__copy span { display: block; color: var(--muted); font-size: 12.5px; }
.attachment-box__choose {
    display: inline-flex; align-items: center;
    padding: .55rem .9rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface);
    font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; white-space: nowrap;
    transition: border-color .15s ease, background .15s ease;
}
.attachment-box__choose:hover { border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); background: var(--teal-soft); color: var(--teal); }
.attachment-box__choose input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.attachment-box__list { grid-column: 1 / -1; list-style: none; margin: .2rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.attachment-box__list:empty { display: none; }
.attachment-item {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .35rem .35rem .35rem .7rem;
    border: 1px solid var(--line); border-radius: var(--radius-pill);
    background: var(--surface); font-size: 12.5px;
}
.attachment-item b { font-weight: 600; max-width: 20ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-item small { font-family: var(--f-mono); font-size: 11px; color: var(--faint); }
.attachment-item button {
    width: 20px; height: 20px; display: grid; place-items: center;
    border: none; border-radius: 50%; background: var(--surface-2); color: var(--muted);
    font-size: 15px; line-height: 1; cursor: pointer;
}
.attachment-item button:hover { background: var(--danger-soft); color: var(--danger); }

.mail-studio__actions { margin-top: .4rem; }
.mail-studio__actions .btn--primary span { transition: transform .16s ease; }
.mail-studio__actions .btn--primary:hover span { transform: translateX(3px); }

.mail-studio__aside { position: sticky; top: 5rem; display: grid; gap: 1.2rem; }
.mail-studio__tip { padding: 1.15rem 1.25rem; border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm); }
.mail-studio__tip span { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--amber); }
.mail-studio__tip p { margin: .35rem 0 0; font-size: 13.5px; color: var(--muted); }

/* -------------------------------------------------------------------------
   SMS studio (compose redesign, amber channel)
   ------------------------------------------------------------------------- */
.sms-studio { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.6rem; align-items: start; }
.sms-studio__main { display: grid; gap: 1.2rem; min-width: 0; }

.sms-studio__hero {
    display: grid; grid-template-columns: 1.15fr .85fr; gap: 1.5rem; align-items: center;
    padding: 1.7rem 1.8rem; overflow: hidden;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: radial-gradient(130% 120% at 100% 0%, var(--amber-soft), transparent 60%), var(--surface);
    box-shadow: var(--shadow-sm);
}
.sms-studio__hero-copy h1 { font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.08; letter-spacing: -.02em; margin: 0 0 .55rem; max-width: 18ch; }
.sms-studio__hero-copy > p { color: var(--muted); font-size: 14.5px; margin: 0; max-width: 42ch; }
.sms-studio__from { display: inline-flex; align-items: center; gap: .45rem; margin-top: 1rem; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.sms-studio__from i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); flex: none; }
.sms-studio__from.is-demo { color: var(--amber-600); }
.sms-studio__from.is-demo i { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }

.sms-studio__visual { position: relative; margin: 0; }
.sms-studio__visual img { display: block; width: 100%; max-width: 340px; margin-left: auto; height: auto; }

.sms-studio__composer {
    padding: 1.6rem 1.7rem; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); box-shadow: var(--shadow-sm); border-top: 3px solid var(--amber);
}
.sms-studio__form-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; }
.sms-studio__form-head h2 { font-size: 1.4rem; }
.sms-studio__form-head .kicker { margin-bottom: .3rem; }
.sms-studio__badge { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border-radius: var(--radius-pill); font-family: var(--f-mono); font-size: 11px; white-space: nowrap; }
.sms-studio__badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sms-studio__badge--live { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.sms-studio__badge--demo { color: var(--amber-600); background: var(--amber-soft); }

.sms-studio__demo-note { margin: -.3rem 0 .2rem; font-size: 13px; color: var(--amber-600); }
.sms-studio__demo-note code { font-family: var(--f-mono); font-size: 12px; background: var(--surface-2); padding: .1rem .35rem; border-radius: 5px; }
.sms-studio__owner { margin: -.3rem 0 .2rem; font-size: 13px; color: var(--amber); }

.sms-meter { display: inline-flex; align-items: center; gap: .5rem; font-weight: 400; }
.sms-meter__seg { font-family: var(--f-mono); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--amber-600); background: var(--amber-soft); border-radius: var(--radius-pill); padding: .1rem .5rem; }

.sms-studio__actions { margin-top: .4rem; }
.sms-studio__actions .btn--amber span { transition: transform .16s ease; }
.sms-studio__actions .btn--amber:hover span { transform: translateX(3px); }

.sms-studio__aside { position: sticky; top: 5rem; display: grid; gap: 1.2rem; }

/* Live phone preview */
.sms-preview { margin: 0; display: grid; gap: .55rem; justify-items: center; }
.sms-preview__phone {
    position: relative; width: 100%; max-width: 250px;
    padding: 1.5rem .7rem .9rem; border-radius: 30px;
    background: linear-gradient(180deg, #101821, #0b1017);
    border: 1px solid #26333f;
    box-shadow: var(--shadow), inset 0 0 0 6px rgba(255, 255, 255, .02);
}
.sms-preview__speaker { position: absolute; top: .7rem; left: 50%; transform: translateX(-50%); width: 42px; height: 5px; border-radius: 3px; background: #29343f; }
.sms-preview__screen { border-radius: 20px; background: #0e141b; overflow: hidden; }
.sms-preview__bar { display: flex; align-items: center; gap: .55rem; padding: .7rem .8rem; border-bottom: 1px solid rgba(255, 255, 255, .06); background: rgba(255, 255, 255, .02); }
.sms-preview__avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; background: linear-gradient(var(--amber), var(--amber-600)); color: #3a260c; font-family: var(--f-display); font-weight: 700; font-size: 13px; }
.sms-preview__meta { min-width: 0; }
.sms-preview__meta b { display: block; color: #eaf1f6; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sms-preview__meta small { display: block; color: #7d8b98; font-size: 10.5px; }
.sms-preview__thread { min-height: 130px; padding: .9rem .8rem; display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; }
.sms-preview__bubble {
    max-width: 85%; padding: .55rem .75rem; border-radius: 15px 15px 4px 15px;
    background: linear-gradient(var(--amber), var(--amber-600)); color: #3a260c;
    font-size: 13px; line-height: 1.45; word-break: break-word; white-space: pre-wrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.sms-preview__bubble.is-empty { background: #1b232c; color: #6c7a87; box-shadow: none; }
.sms-preview figcaption { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

@media (max-width: 860px) {
    .sms-studio { grid-template-columns: 1fr; }
    .sms-studio__aside { position: static; }
    .sms-studio__hero { grid-template-columns: 1fr; }
    .sms-studio__visual { order: -1; }
    .sms-studio__visual img { max-width: 260px; margin: 0 auto; }
    .sms-preview { max-width: 300px; margin: 0 auto; }
}

/* -------------------------------------------------------------------------
   Contacts / address books
   ------------------------------------------------------------------------- */
.contacts { display: grid; gap: 1.35rem; }

.contacts__hero {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    align-items: center;
    gap: 1.5rem;
    padding: 1.7rem 1.9rem;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background:
        radial-gradient(120% 130% at 100% 0%, var(--teal-soft), transparent 58%),
        var(--surface);
    box-shadow: var(--shadow);
}
.contacts__hero-copy h1 { font-size: clamp(1.7rem, 3vw, 2.35rem); line-height: 1.06; letter-spacing: -.03em; margin: 0 0 .6rem; max-width: 17ch; }
.contacts__hero-copy > p { color: var(--muted); margin: 0; max-width: 46ch; font-size: 15px; }
.contacts__hero-stats { display: flex; gap: 1.5rem; margin-top: 1.2rem; }
.contacts__hero-stats span { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.contacts__hero-stats b { font-family: var(--f-display); font-size: 1.4rem; color: var(--ink); margin-right: .3rem; }
.contacts__hero-art { margin: 0; }
.contacts__hero-art img { display: block; width: 100%; max-width: 380px; margin-left: auto; height: auto; }

.contacts__grid { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(0, 2fr); gap: 1.35rem; align-items: start; }

/* Sidebar of books */
.books { position: sticky; top: 5rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.books__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; }
.books__head h2 { font-size: 1.05rem; }
.books__count { font-family: var(--f-mono); font-size: 12px; color: var(--faint); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: .05rem .55rem; }
.books__empty { color: var(--muted); font-size: 13.5px; padding: .5rem 0 1rem; }

.book-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.book-item {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .65rem; border-radius: var(--radius-sm);
    border: 1px solid transparent; color: var(--ink);
    transition: background .14s ease, border-color .14s ease;
}
.book-item:hover { background: var(--surface-2); text-decoration: none; }
.book-item.is-active { background: var(--teal-soft); border-color: color-mix(in srgb, var(--teal) 28%, var(--line)); }
.book-item__mark { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 9px; background: var(--surface-2); color: var(--muted); font-family: var(--f-display); font-weight: 700; font-size: 14px; }
.book-item.is-active .book-item__mark { background: var(--teal); color: #fff; }
.book-item__body { min-width: 0; }
.book-item__name { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-item__meta { display: block; color: var(--muted); font-size: 12px; }
.book-item__lock { color: var(--faint); font-family: var(--f-mono); font-size: 10.5px; }

.book-create { border-top: 1px solid var(--line); padding-top: .9rem; }
.book-create > summary { cursor: pointer; list-style: none; font-weight: 600; font-size: 13.5px; color: var(--teal); display: inline-flex; align-items: center; gap: .35rem; }
.book-create > summary::-webkit-details-marker { display: none; }
.book-create__form { margin-top: .9rem; gap: .8rem; }

/* Main panel */
.book-panel { display: grid; gap: 1.1rem; align-content: start; min-width: 0; }
.book-panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.35rem 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.book-panel__head .kicker { margin-bottom: .3rem; }
.book-panel__title { font-size: 1.4rem; }
.book-panel__desc { margin: .35rem 0 0; color: var(--muted); font-size: 14px; }
.book-panel__owner { margin: .6rem 0 0; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; }
.book-panel__owner b { color: var(--ink); }
.book-panel__send { display: flex; gap: .5rem; flex-wrap: wrap; }
.book-panel__send [aria-disabled="true"] { opacity: .45; pointer-events: none; }

.book-tools { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.book-tools__btn {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .55rem .85rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    font-family: var(--f-body); font-size: 13.5px; font-weight: 600; cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.book-tools__btn svg { width: 17px; height: 17px; color: var(--teal); }
.book-tools__btn:hover { border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); background: var(--teal-soft); }
.book-tools__link { align-self: center; font-size: 13px; font-weight: 600; color: var(--teal); }
.book-tools__hint { margin-left: auto; font-family: var(--f-mono); font-size: 11.5px; color: var(--faint); }

.import-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; }
.import-card[hidden], .addbar[hidden] { display: none; }
.import-card__body { display: flex; gap: .9rem; padding: 1.2rem 1.3rem; }
.import-card__icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 11px; color: var(--teal); background: var(--teal-soft); }
.import-card__icon svg { width: 22px; height: 22px; }
.import-card__copy b { display: block; font-size: 14px; }
.import-card__copy span { display: block; color: var(--muted); font-size: 12.5px; margin-top: .15rem; line-height: 1.5; }
.import-card__copy code { font-family: var(--f-mono); font-size: 11.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; }
.import-card__opt { color: var(--faint); }
.import-card__template { margin-top: .7rem; }
.import-card__template svg { width: 15px; height: 15px; }
.import-card__actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: 0 1.3rem 1.2rem; }
.import-card__file {
    flex: 1; min-width: 180px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: .7rem .9rem; border-radius: var(--radius-sm);
    border: 1px dashed var(--line); background: var(--surface);
    font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; text-align: center;
}
.import-card__file:hover { border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); color: var(--teal); }
.import-card__file input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.addbar { border: 1px solid color-mix(in srgb, var(--teal) 25%, var(--line)); border-radius: var(--radius); background: var(--surface); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); }
.addbar__grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; }
.addbar__grid input {
    width: 100%; font-family: var(--f-body); font-size: 14px; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .7rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.addbar__grid input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.addbar__foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .8rem; flex-wrap: wrap; }
.addbar__hint { font-size: 12.5px; color: var(--muted); }
.addbar__actions { display: flex; gap: .5rem; }

/* Contacts table */
.ctable-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; overflow-x: auto; }
.ctable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ctable thead th {
    text-align: left; padding: .8rem 1rem;
    font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 500; color: var(--faint);
    background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.ctable tbody td { padding: .75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ctable tbody tr:last-child td { border-bottom: none; }
.ctable tbody tr:hover { background: var(--surface-2); }
.ctable__avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; margin-right: .55rem; vertical-align: middle; background: var(--teal-soft); color: var(--teal); font-family: var(--f-display); font-weight: 700; font-size: 12px; }
.ctable__name { font-weight: 600; vertical-align: middle; }
.ctable__org { display: block; }
.ctable__role { display: block; color: var(--muted); font-size: 12px; }
.ctable__actions-col { width: 1%; }
.ctable__actions { white-space: nowrap; text-align: right; }
.iconbtn-form { display: inline; }
.iconbtn {
    width: 30px; height: 30px; display: inline-grid; place-items: center;
    border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted);
    cursor: pointer; vertical-align: middle; margin-left: .3rem; transition: border-color .14s ease, color .14s ease, background .14s ease;
}
.iconbtn svg { width: 16px; height: 16px; }
.iconbtn:hover { border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); color: var(--teal); background: var(--teal-soft); }
.iconbtn--danger:hover { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); color: var(--danger); background: var(--danger-soft); }

/* Empty states */
.book-empty { text-align: center; padding: 3rem 1.5rem; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.book-empty--none { padding: 4rem 1.5rem; }
.book-empty__art { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 16px; color: var(--teal); background: var(--teal-soft); }
.book-empty__art svg { width: 28px; height: 28px; }
.book-empty h2, .book-empty h3 { font-size: 1.25rem; margin-bottom: .4rem; }
.book-empty p { color: var(--muted); margin: 0 auto; max-width: 40ch; }

/* Edit dialog */
.cdialog { width: min(560px, calc(100vw - 2rem)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 30px 70px rgba(16,32,26,.35); padding: 0; }
.cdialog::backdrop { background: rgba(10, 20, 16, .55); backdrop-filter: blur(3px); }
.cdialog__form { padding: 1.4rem 1.5rem; gap: 1rem; }
.cdialog__head { display: flex; align-items: center; justify-content: space-between; }
.cdialog__head h3 { font-size: 1.2rem; }
.cdialog__x { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.cdialog__x:hover { background: var(--surface-2); color: var(--ink); }
.cdialog__grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.cdialog__foot { display: flex; justify-content: flex-end; gap: .6rem; }

/* -------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */
@media (max-width: 860px) {
    .mail-studio { grid-template-columns: 1fr; }
    .mail-studio__aside { position: static; }
    .mail-studio__hero { grid-template-columns: 1fr; }
    .mail-studio__visual { order: -1; }
    .contacts__hero { grid-template-columns: 1fr; }
    .contacts__hero-art { display: none; }
    .contacts__grid { grid-template-columns: 1fr; }
    .books { position: static; }
    .addbar__grid { grid-template-columns: 1fr 1fr; }
    .cdialog__grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .recipient-grid { grid-template-columns: 1fr; }
    .attachment-box { grid-template-columns: auto 1fr; }
    .attachment-box__choose { grid-column: 1 / -1; justify-content: center; }
    .book-panel__head { flex-direction: column; }
    .book-tools__hint { margin-left: 0; width: 100%; }
    .addbar__grid { grid-template-columns: 1fr; }
    /* Stacked card view for the contacts table on small screens */
    .ctable thead { display: none; }
    .ctable, .ctable tbody, .ctable tr, .ctable td { display: block; width: 100%; }
    .ctable tr { border-bottom: 1px solid var(--line); padding: .5rem 0; }
    .ctable tbody td { border: none; padding: .3rem 1rem; }
    .ctable td[data-label]::before { content: attr(data-label) ": "; font-family: var(--f-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin-right: .4rem; }
    .ctable__actions { text-align: left; padding-top: .5rem !important; }
}

/* -------------------------------------------------------------------------
   Legacy responsive (dashboard / auth / compose)
   ------------------------------------------------------------------------- */
@media (max-width: 860px) {
    .auth__grid { grid-template-columns: 1fr; }
    .panel { padding: 2rem 1.6rem; min-height: 44vh; }
    .panel__mid { margin: 1.4rem 0; }
    .panel__art { display: none; }
    .bays { grid-template-columns: 1fr; }
    .compose { grid-template-columns: 1fr; }
    .compose__aside { position: static; }
    .team__grid { grid-template-columns: 1fr; }
    .dash__hero { grid-template-columns: 1fr; }
    .dash__photo { min-height: 280px; }
}

/* Compact the desktop nav before it would overflow. */
@media (max-width: 1200px) {
    .chrome { gap: .8rem; }
    .chrome__nav { gap: .15rem; }
    .navlink { padding: .4rem .55rem; font-size: 13px; }
    .whoami { max-width: 150px; }
}

/* Tablet & phone: collapse the nav into a hamburger dropdown. */
@media (max-width: 1024px) {
    .chrome { padding: .7rem 1rem; }
    .chrome__burger { display: flex; }
    .chrome__menu {
        display: none;
        position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
        flex-direction: column; align-items: stretch; gap: .1rem;
        padding: .7rem .9rem 1rem;
        background: var(--panel-bg);
        border-top: 1px solid var(--panel-line);
        box-shadow: 0 22px 40px rgba(0, 0, 0, .4);
    }
    .chrome.is-open .chrome__menu { display: flex; }
    .chrome__nav { flex-direction: column; width: 100%; margin: 0; gap: .1rem; }
    .chrome__nav .navlink { padding: .8rem .9rem; font-size: 15px; border-radius: var(--radius-sm); }
    .chrome__end { flex-direction: column; align-items: stretch; gap: .7rem; margin: .6rem 0 0; padding-top: .8rem; border-top: 1px solid var(--panel-line); }
    .whoami { max-width: none; font-size: 12.5px; }
    .chrome__end .btn { width: 100%; }

    /* Animate the bars into an X while open. */
    .chrome.is-open .chrome__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .chrome.is-open .chrome__burger span:nth-child(2) { opacity: 0; }
    .chrome.is-open .chrome__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

@media (max-width: 620px) {
    .stage { padding: 1.5rem 1.1rem 2.5rem; }
    .hero { align-items: flex-start; }
    .hero__status { flex-direction: row; flex-wrap: wrap; }
    .dash__welcome { padding: 1.25rem; }
    .dash__welcome h1 { font-size: 2.35rem; }
    .dash__metrics, .dash__channels { grid-template-columns: 1fr; }
    .dash__workspace { padding: 1.15rem; }
    .dash__section-head { align-items: flex-start; flex-direction: column; }
    .dash__availability { white-space: normal; }
    .dash__photo { min-height: 240px; }
    .guide { top: auto; bottom: 1rem; right: 1rem; transform-origin: bottom right; }
    .form__actions .btn { flex: 1; }
}

/* -------------------------------------------------------------------------
   Motion & focus preferences
   ------------------------------------------------------------------------- */
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
    .panel__log .blink::after { animation: none; }
}
