/* ==========================================================================
   Photo CRM - admin + client styling
   One stylesheet, no build step, no dependencies.
   ========================================================================== */

:root {
    --ink:        #15181d;
    --ink-soft:   #5a6372;
    --ink-faint:  #8b94a3;
    --line:       #e3e7ee;
    --line-soft:  #eef1f6;
    --bg:         #f6f7fa;
    --card:       #ffffff;
    --brand:      #1f6feb;
    --brand-dark: #1a5bc4;
    --ok:         #16794a;
    --ok-bg:      #e6f4ec;
    --warn:       #9a5b00;
    --warn-bg:    #fdf1dd;
    --err:        #b3261e;
    --err-bg:     #fdeceb;
    --info:       #1f5fa9;
    --info-bg:    #e8f1fd;
    /*
     * The stages of a session, in order, each with its own colour. Defined
     * once here and used by every place a stage is shown - the badges, the
     * galleries list, the dashboard pipeline - so a colour always means the
     * same thing wherever it appears.
     *
     *   draft   grey    not shared with anyone yet
     *   choose  blue    with the client, waiting on them
     *   todo    amber   back with you: something to do
     *   sent    violet  final photos delivered, waiting to be collected
     *   done    green   finished
     *   off     red     cancelled
     */
    --stage-draft:     #6b7280;
    --stage-draft-bg:  #f1f3f7;
    --stage-choose:    #1f6feb;
    --stage-choose-bg: #e8f1fd;
    --stage-todo:      #9a5b00;
    --stage-todo-bg:   #fdf1dd;
    --stage-sent:      #6b3fa0;
    --stage-sent-bg:   #f2ecfb;
    --stage-done:      #16794a;
    --stage-done-bg:   #e6f4ec;
    --stage-off:       #b3261e;
    --stage-off-bg:    #fdeceb;

    --radius:     10px;
    --radius-sm:  7px;
    --shadow:     0 1px 2px rgba(18, 24, 36, .06), 0 4px 16px rgba(18, 24, 36, .05);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* No image may ever be wider than what contains it. Without this one rule a
   large upload - a 4000px watermark, say - renders at full size and pushes
   the whole page sideways. */
img {
    max-width: 100%;
    height: auto;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

h1 { font-size: 1.6rem; margin: 0 0 .2rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p  { margin: 0 0 .7rem; }
a  { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .86em;
    background: var(--line-soft);
    padding: .1em .35em;
    border-radius: 4px;
}

.muted  { color: var(--ink-soft); }
.small  { font-size: .85rem; }
.right  { text-align: right; }
.req    { color: var(--err); }
.grow   { flex: 1 1 auto; }
.linkish {
    background: none; border: 0; padding: 0; font: inherit;
    color: var(--brand); cursor: pointer; text-decoration: underline;
}

/* ------------------------------------------------------------ top bar */

.topbar {
    display: flex; align-items: center; gap: 1.5rem;
    padding: .7rem 1.5rem;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 30;
}
.topbar__brand { display: flex; align-items: center; gap: .5rem; font-weight: 650; color: var(--ink); }
.topbar__brand:hover { text-decoration: none; }
.topbar__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.topbar__nav { display: flex; gap: .25rem; margin-left: auto; }
.topbar__nav a {
    padding: .4rem .75rem; border-radius: var(--radius-sm);
    color: var(--ink-soft); font-weight: 500;
}
.topbar__nav a:hover { background: var(--line-soft); text-decoration: none; color: var(--ink); }
.topbar__nav a.is-active { background: var(--info-bg); color: var(--info); }
.topbar__user { display: flex; align-items: center; gap: .75rem; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 1.5rem; }

/* --------------------------------------------------------- page header */

.page-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.crumbs { display: flex; gap: .5rem; align-items: center; font-size: .9rem; color: var(--ink-soft); margin-bottom: .75rem; }
.crumbs span { color: var(--ink-faint); }
.section-title { margin: 1.75rem 0 .75rem; }

/* -------------------------------------------------------------- cards */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}
.card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.card--form { border-color: #cfdcf3; background: #fcfdff; }
.card--danger { border-color: #f0c9c6; background: #fffbfb; }
.card--warn { border-color: #f0dcb4; background: #fffdf7; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.side-stack > .card:last-child { margin-bottom: 0; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ buttons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem .9rem;
    font: inherit; font-weight: 550;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    background: var(--line-soft); color: var(--ink);
    cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { background: var(--line-soft); }
.btn--danger { background: var(--err); color: #fff; }
.btn--danger-ghost { background: transparent; border-color: #e7bdb9; color: var(--err); }
.btn--danger-ghost:hover { background: var(--err-bg); }
.btn--sm { padding: .35rem .65rem; font-size: .88rem; }
.btn--xs { padding: .2rem .5rem; font-size: .8rem; }
.btn--block { width: 100%; margin-top: .5rem; }
.btn-group { display: flex; gap: .5rem; align-items: center; }
.btn-group--wrap { flex-wrap: wrap; margin-top: .5rem; }

.chip {
    font: inherit; font-size: .85rem; cursor: pointer;
    background: var(--card); border: 1px solid var(--line);
    border-radius: 999px; padding: .3rem .7rem; text-align: left;
}
.chip:hover { background: var(--info-bg); border-color: #bcd6f6; }
.quick-replies { display: flex; flex-direction: column; gap: .4rem; }

/* ------------------------------------------------------------- forms */

label { display: block; font-weight: 550; font-size: .9rem; margin-bottom: .8rem; }
label small, label .muted { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date],
input[type=number], input[type=url], input[type=search], select, textarea {
    display: block; width: 100%; margin-top: .3rem;
    padding: .5rem .6rem;
    font: inherit; color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
textarea { resize: vertical; }
input[readonly] { background: var(--line-soft); color: var(--ink-soft); }

.grid-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1rem; }
.grid-form .span-2 { grid-column: span 2; }
.grid-form .span-3 { grid-column: 1 / -1; }
@media (max-width: 760px) {
    .grid-form { grid-template-columns: 1fr; }
    .grid-form .span-2, .grid-form .span-3 { grid-column: 1; }
}
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; padding-top: .4rem; }
/* A row of buttons always gets the full width of a grid form. Left in a
   single column it was squeezed to a third of the card and the button - which
   does not wrap - spilled straight out of it. */
.grid-form .form-actions { grid-column: 1 / -1; }
/* Grid items default to min-width:auto, so a long select or a wide button
   can force a column wider than the card. */
.grid-form > * { min-width: 0; }
.checkline { display: flex; align-items: center; gap: .5rem; align-self: end; padding-bottom: .9rem; }
.checkline input { width: auto; margin: 0; }
.inline-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin-bottom: 0; }
.inline-form--tight { border-top: 1px solid var(--line-soft); margin-top: .75rem; padding-top: .75rem; }
.searchbar { display: flex; gap: .5rem; margin-bottom: 1rem; max-width: 520px; }
.searchbar input { margin-top: 0; }

.field-copy { display: flex; gap: .4rem; margin-bottom: .5rem; }
.field-copy input { margin-top: 0; font-size: .82rem; }

/* -------------------------------------------------------------- flash */

.flash {
    padding: .6rem .9rem; border-radius: var(--radius-sm);
    margin-bottom: 1rem; border: 1px solid;
}
.flash--ok    { background: var(--ok-bg);   border-color: #bfe0cd; color: var(--ok); }
.flash--error { background: var(--err-bg);  border-color: #f2c4c0; color: var(--err); }
.flash--info  { background: var(--info-bg); border-color: #c3dafa; color: var(--info); }

.note-box {
    background: #fffdf4; border: 1px solid #ecdfb8;
    border-radius: var(--radius-sm); padding: .6rem .8rem; margin-bottom: 1rem; font-size: .92rem;
}
.empty {
    text-align: center; padding: 2.5rem 1rem; color: var(--ink-soft);
    background: var(--card); border: 1px dashed var(--line);
    border-radius: var(--radius); margin-bottom: 1rem;
}

/* ------------------------------------------------------------- badges */

.badge {
    display: inline-block; font-size: .74rem; font-weight: 650;
    padding: .12rem .45rem; border-radius: 999px; vertical-align: middle;
    border: 1px solid;
}
.badge--ok      { background: var(--ok-bg);   color: var(--ok);   border-color: #bfe0cd; }
.badge--warn    { background: var(--warn-bg); color: var(--warn); border-color: #ecd6ab; }
.badge--error   { background: var(--err-bg);  color: var(--err);  border-color: #f2c4c0; }
.badge--info    { background: var(--info-bg); color: var(--info); border-color: #c3dafa; }
.badge--neutral { background: var(--line-soft); color: var(--ink-soft); border-color: var(--line); }

/* The session stages. One border colour for all of them: against these pale
   backgrounds a faint dark edge reads better than six hand-picked ones. */
.badge--draft,
.badge--choose,
.badge--todo,
.badge--sent,
.badge--done,
.badge--off     { border-color: rgba(21, 24, 29, .12); }
.badge--draft   { background: var(--stage-draft-bg);  color: var(--stage-draft); }
.badge--choose  { background: var(--stage-choose-bg); color: var(--stage-choose); }
.badge--todo    { background: var(--stage-todo-bg);   color: var(--stage-todo); }
.badge--sent    { background: var(--stage-sent-bg);   color: var(--stage-sent); }
.badge--done    { background: var(--stage-done-bg);   color: var(--stage-done); }
.badge--off     { background: var(--stage-off-bg);    color: var(--stage-off); }

/* -------------------------------------------------------------- stats */

.stat-row { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.stat {
    flex: 1 1 120px; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: .75rem .9rem;
}
.stat__n { display: block; font-size: 1.5rem; font-weight: 650; line-height: 1.1; }
.stat__l { font-size: .82rem; color: var(--ink-soft); }
.stat--warn { border-color: #ecd6ab; background: var(--warn-bg); }
.stat--info { border-color: #c3dafa; background: var(--info-bg); }

.kv { list-style: none; margin: 0 0 .75rem; padding: 0; }
.kv li { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid var(--line-soft); }
.kv li:last-child { border-bottom: 0; }
.kv span { color: var(--ink-soft); }
.kv--wide li { padding: .45rem 0; }
.kv--small li { padding: .2rem 0; font-size: .88rem; }
.kv__total { border-top: 2px solid var(--line); margin-top: .25rem; font-size: 1.05rem; }

.timeline { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.timeline li { padding: .3rem 0; border-bottom: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; gap: .4rem; }
.timeline__who { font-weight: 600; }
.timeline__when { flex: 0 0 100%; font-size: .78rem; }

/* ------------------------------------------------------------- tables */

.table {
    width: 100%; border-collapse: collapse; background: var(--card);
    border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; margin-bottom: 1rem;
}
.table th, .table td { padding: .65rem .8rem; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); background: #fafbfd; }
.table tr:last-child td { border-bottom: 0; }
.table--compact th, .table--compact td { padding: .4rem .7rem; font-size: .88rem; }
.row--muted { opacity: .55; }

/* Visible only to a screen reader. A column of pictures still needs a
   heading for anyone who cannot see them, but a visible one would be noise. */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ----------------------------------- the picture beside a delivered file

   Photo transfer shows each delivered file as a small picture in the first
   column, so the wrong client's photos cannot be uploaded unnoticed. Its
   size is a slider in Settings and arrives as --tfile-px on :root; the
   fallback here is the default, so the stylesheet makes sense on its own.
   (The galleries page has its own card styles further down.) */

.tfile-col { width: calc(var(--tfile-px, 96px) + 16px); padding-right: .35rem; }

.tfile {
    display: grid; place-items: center; overflow: hidden;
    width: var(--tfile-px, 96px); height: var(--tfile-px, 96px);
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: #1b1d22;   /* shows through while the picture loads */
}
.tfile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tfile:hover { border-color: var(--brand); text-decoration: none; }
/* It is a button - it opens the enlarged view. */
button.tfile { padding: 0; font: inherit; color: inherit; cursor: zoom-in; }

/* The two samples under the sliders in Settings, which resize as you drag.
   The gallery one is a card's picture at a typical card width. */
.size-sample { display: flex; align-items: flex-end; gap: 1.25rem; flex-wrap: wrap; margin: .2rem 0 .4rem; }
.size-sample__label { font-size: .8rem; color: var(--ink-faint); margin: 0 0 .3rem; }
.size-sample .gal__cover { width: 385px; max-width: 100%; border-radius: var(--radius-sm); }

/* A ZIP, a PDF or a video has no picture, so its type is written instead -
   quieter than a broken-image icon and more useful than an empty box. */
.tfile--type {
    background: var(--line-soft); color: var(--ink-faint);
    font-size: .66rem; font-weight: 700; letter-spacing: .04em;
}

/* On a phone the picture is the first thing to go: the numbers are the
   information, the thumbnail is the nicety. The narrow-screen rule further
   down hides the fifth column of every table, so here the fifth column of
   *content* is the sixth cell in the row. */
@media (max-width: 600px) {
    .tfile-col { display: none; }
    .table.table--pics th:nth-child(5), .table.table--pics td:nth-child(5) { display: table-cell; }
    .table.table--pics th:nth-child(6), .table.table--pics td:nth-child(6) { display: none; }
}

.person { display: flex; align-items: center; gap: .6rem; color: var(--ink); }
.person:hover { text-decoration: none; }
.person--lg { gap: .9rem; }
.avatar {
    display: grid; place-items: center; flex: 0 0 34px;
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--info-bg); color: var(--info);
    font-size: .8rem; font-weight: 650;
}
.avatar--lg { flex-basis: 48px; width: 48px; height: 48px; font-size: 1rem; }

.pills { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.pill {
    padding: .3rem .75rem; border-radius: 999px; font-size: .88rem;
    background: var(--card); border: 1px solid var(--line); color: var(--ink-soft);
}
.pill:hover { text-decoration: none; background: var(--line-soft); }
.pill.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* --------------------------------------------------------- galleries */

.gallery-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem; }
.gcard {
    display: block; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: .9rem 1rem; color: var(--ink); box-shadow: var(--shadow);
}
.gcard:hover { text-decoration: none; border-color: #bcd0ef; transform: translateY(-1px); }
.gcard__head { display: flex; justify-content: space-between; gap: .5rem; align-items: start; margin-bottom: .2rem; }
.gcard__facts { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin: .6rem 0 0; padding: 0; font-size: .84rem; color: var(--ink-soft); }
.gcard__facts span { font-weight: 650; color: var(--ink); }
.gcard__due { margin: .6rem 0 0; font-size: .9rem; }
.gcard__foot { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }

/* -------------------------------------------------------- share strip */

.share-strip {
    display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center;
    background: #eef3fb; border: 1px solid #cfdcf3;
    border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; font-size: .9rem;
}
.share-strip__label { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--info); }
.share-strip__link { background: transparent; word-break: break-all; }
.share-strip__code { background: var(--card); font-size: 1rem; font-weight: 700; letter-spacing: .1em; }
.share-strip__hint { flex: 1 1 200px; font-size: .82rem; }

/* ---------------------------------------------------------------- tabs */

/* Wraps onto a second line rather than scrolling sideways: with seven
   settings tabs the last ones (Update, Account & server) could sit off the
   edge of the screen where nobody would find them. */
.tabs {
    display: flex; flex-wrap: wrap; gap: .2rem;
    border-bottom: 1px solid var(--line); margin-bottom: 1.25rem;
}
.tab {
    padding: .6rem .9rem; color: var(--ink-soft); font-weight: 550; white-space: nowrap;
    border-bottom: 2px solid transparent; display: flex; align-items: center; gap: .4rem;
}
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.tab__count {
    font-size: .74rem; font-weight: 700; background: var(--line-soft);
    color: var(--ink-soft); border-radius: 999px; padding: 0 .4rem;
}
.tab__count--alert { background: var(--err); color: #fff; }

/* -------------------------------------------------------- photo admin */

.dropzone {
    border: 2px dashed #c6d4ea; border-radius: var(--radius);
    background: #fafcff; padding: 1.5rem; text-align: center; transition: .15s;
}
.dropzone.is-over { border-color: var(--brand); background: var(--info-bg); }
.dropzone__title { font-weight: 600; margin-bottom: .3rem; }

.upload-progress { margin-top: .75rem; }
.upload-progress__bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.upload-progress__bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }

.photo-toolbar { display: flex; justify-content: space-between; margin-bottom: .6rem; font-size: .9rem; }
.photo-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: .75rem; align-items: start;
}
.photo {
    margin: 0; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden;
}
.photo--hidden { opacity: .5; }
.photo--picked { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
/* The tile takes the shape of the photo (set inline), so a portrait shot is
   not cropped into a landscape box. 4/3 is only the fallback. */
.photo__img { position: relative; aspect-ratio: var(--ar, 4 / 3); background: #1b1d22; }
.photo__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo__zoom {
    position: absolute; bottom: .4rem; right: .4rem;
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(12, 14, 18, .62); border: 1px solid rgba(255, 255, 255, .35);
    color: #fff; font-size: .9rem; cursor: pointer;
    display: grid; place-items: center; opacity: 0; transition: opacity .12s;
}
.photo:hover .photo__zoom, .photo__zoom:focus-visible { opacity: 1; }
.photo__zoom:hover { background: rgba(12, 14, 18, .92); }
.photo__pick {
    position: absolute; top: .4rem; left: .4rem;
    background: var(--ok); color: #fff; font-size: .72rem; font-weight: 700;
    padding: .1rem .4rem; border-radius: 999px;
}
.photo figcaption { padding: .5rem .6rem; display: flex; flex-direction: column; gap: .15rem; }
.photo__name { font-size: .82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo__actions { display: flex; align-items: center; gap: .4rem; margin-top: .4rem; flex-wrap: wrap; }

.switch { display: flex; align-items: center; gap: .3rem; font-size: .8rem; margin: 0; font-weight: 500; }
.switch input { width: auto; margin: 0; }

.thumb-strip { display: flex; gap: .4rem; flex-wrap: wrap; margin: .75rem 0; }
.thumb-strip__item {
    width: 68px; height: 68px; border-radius: var(--radius-sm); overflow: hidden;
    background: #1b1d22; display: grid; place-items: center;
}
.thumb-strip__item img { width: 100%; height: 100%; object-fit: cover; }
.thumb-strip__item--gone { font-size: .7rem; color: var(--ink-faint); background: var(--line-soft); }
.filelist { font-size: .85rem; margin-bottom: .5rem; }
.filelist summary { cursor: pointer; color: var(--ink-soft); }
.filelist ol { margin: .5rem 0 0; padding-left: 1.3rem; columns: 2; }
/* The "exactly as the client sees it" sample. Served at 600px and capped
   here as well, so it cannot take over the page - particularly once the
   sidebar stacks underneath on a narrow screen. */
.wm-preview {
    display: block;
    max-width: 100%;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    background: #1b1d22;
}
.recompress {
    border-top: 1px solid var(--line-soft);
    margin-top: .9rem; padding-top: .9rem;
}
.wm-preview__label {
    margin: .6rem 0 .25rem;
    text-transform: uppercase; letter-spacing: .06em; font-size: .72rem;
}
.wm-preview + .wm-preview { margin-top: .5rem; }

.order__total { text-align: right; }
.order__total strong { font-size: 1.2rem; }

/* ---------------------------------------------------------------- chat */

.chat-card { display: flex; flex-direction: column; }
.chat {
    display: flex; flex-direction: column; gap: .6rem;
    max-height: 55vh; min-height: 220px; overflow-y: auto;
    padding: .75rem; background: #fafbfd;
    border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
}
.chat__empty { text-align: center; margin: auto; }
.msg { max-width: 78%; }
.msg--me { align-self: flex-end; }
.msg--them { align-self: flex-start; }
.msg__body {
    padding: .5rem .75rem; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word;
    background: var(--card); border: 1px solid var(--line);
}
.msg--me .msg__body { background: var(--brand); color: #fff; border-color: var(--brand); }
.msg__meta { font-size: .72rem; color: var(--ink-faint); margin-top: .2rem; }
.msg--me .msg__meta { text-align: right; }
.chat-form { display: flex; gap: .5rem; align-items: flex-end; margin-top: .75rem; }
.chat-form textarea { margin-top: 0; }
.two-col--chat { align-items: stretch; }

/* --------------------------------------------------------- auth cards */

.auth-body {
    display: grid; place-items: center; min-height: 100vh;
    background: linear-gradient(160deg, #eef2f9, #f7f8fb 60%);
    padding: 1.5rem;
}
.auth-body--client { background: linear-gradient(160deg, #15181d, #262a32); }
.auth-card {
    width: 100%; max-width: 420px; background: var(--card);
    border: 1px solid var(--line); border-radius: 14px;
    padding: 1.75rem; box-shadow: 0 10px 40px rgba(14, 18, 28, .12);
}
.auth-card h1 { margin-bottom: .1rem; }
.auth-alt { margin-top: 1rem; font-size: .88rem; text-align: center; }
.setup-steps { font-size: .9rem; color: var(--ink-soft); padding-left: 1.2rem; }
.code-input { text-transform: uppercase; letter-spacing: .22em; font-size: 1.15rem; text-align: center; font-weight: 600; }

/* ------------------------------------------------------- client shell */

body.client { background: #14161a; color: #e9ecf1; }
.wrap--client { max-width: 1400px; }
body.client .card {
    background: #1c1f25; border-color: #2b3039; color: #e9ecf1; box-shadow: none;
}
body.client h1, body.client h2, body.client h3 { color: #f4f6f9; }
body.client .muted { color: #9aa3b2; }
body.client .table { background: #1c1f25; border-color: #2b3039; }
body.client .table th { background: #22262e; color: #9aa3b2; }
body.client .table th, body.client .table td { border-color: #2b3039; }
body.client .kv li { border-color: #2b3039; }
body.client .kv span { color: #9aa3b2; }
body.client .kv__total { border-top-color: #3a414d; }
body.client .empty { background: #1c1f25; border-color: #2b3039; color: #9aa3b2; }
body.client textarea, body.client input[type=text] {
    background: #14161a; border-color: #343b46; color: #e9ecf1;
}
body.client .btn--ghost { background: #22262e; border-color: #343b46; color: #e9ecf1; }
body.client .chat { background: #16191e; border-color: #2b3039; }
body.client .msg__body { background: #22262e; border-color: #343b46; }
body.client .note-box { background: #231f16; border-color: #4a3d20; color: #e8dcc0; }
body.client .flash--info { background: #16263c; border-color: #2a4a74; color: #bcd6f6; }

.chead {
    background: #1a1d22; border-bottom: 1px solid #2b3039;
    padding: 1rem 1.5rem 0; position: sticky; top: 0; z-index: 25;
}
.chead__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; max-width: 1400px; margin: 0 auto; }
.chead__studio { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: #8d96a5; margin: 0; }
.chead h1 { font-size: 1.35rem; margin: .1rem 0; }
.tabs--client { border-bottom: 0; max-width: 1400px; margin: .75rem auto 0; }
.tabs--client .tab { color: #9aa3b2; }
.tabs--client .tab.is-active { color: #fff; border-bottom-color: #fff; }
.tabs--client .tab__count { background: #2b3039; color: #c3cad6; }

.welcome {
    background: #1c1f25; border: 1px solid #2b3039; border-left: 3px solid #6ea8fe;
    border-radius: var(--radius-sm); padding: .8rem 1rem; margin-bottom: 1rem;
}
.howto { margin-bottom: 1.25rem; font-size: .95rem; }
.howto strong { color: #fff; }
.cfoot { max-width: 1400px; margin: 2rem auto 0; padding: 1.25rem 1.5rem 5rem; border-top: 1px solid #2b3039; }

.submit-order { border-top: 1px solid #2b3039; margin-top: 1rem; padding-top: 1rem; }

/* ------------------------------------------------------ selection bar */

.selbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .7rem 1.5rem;
    background: rgba(20, 22, 26, .96);
    border-top: 1px solid #343b46;
    backdrop-filter: blur(8px);
}
.selbar__counts { font-size: .95rem; }
.selbar__counts strong { font-size: 1.15rem; }
.selbar__extra { color: #ffd479; margin-left: .4rem; }

/* ------------------------------------------------------------ toasts */

.toast-host { position: fixed; top: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; }
.toast {
    background: #22262e; color: #fff; border-radius: var(--radius-sm);
    padding: .6rem .9rem; font-size: .88rem; box-shadow: 0 8px 24px rgba(0,0,0,.25);
    max-width: 320px; animation: toast-in .18s ease-out;
}
.toast--error { background: var(--err); }
.toast--ok { background: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------- logos and branding */

.topbar__logo { max-height: 30px; max-width: 170px; display: block; }
/* A fixed window onto an image of any size. The height is fixed and the
   overflow clipped, so nothing dropped in here can stretch the layout -
   watermark files are routinely thousands of pixels across. */
.logo-preview {
    background: var(--line-soft); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: .6rem;
    margin-bottom: .6rem;
    display: flex; align-items: center; justify-content: center;
    height: 110px;
    max-width: 100%;
    overflow: hidden;
}
.logo-preview img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}
/* On the sign-in cards the logo stands alone, with no frame. */
.logo-preview--bare { background: none; border: 0; padding: 0 0 .5rem; height: auto; }
.logo-preview--bare img { max-height: 70px; }
/* Checkerboard, so a transparent PNG is obvious. */
.logo-preview--checker {
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #dfe3ea 25%, transparent 25%, transparent 75%, #dfe3ea 75%),
        linear-gradient(45deg, #dfe3ea 25%, transparent 25%, transparent 75%, #dfe3ea 75%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
}
.chead__id { display: flex; align-items: center; gap: 1rem; }
.chead__logo { max-height: 46px; max-width: 180px; display: block; }

/* -------------------------------------------------- stage / workflow UI */

.stage-card { border-color: #cfdcf3; background: #fbfdff; }
.subhead { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--line-soft); }
.inline-form--bare { display: inline-flex; margin-left: .5rem; }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.steps li {
    counter-increment: step;
    position: relative; padding: .25rem 0 .7rem 1.9rem;
    border-left: 2px solid var(--line);
    margin-left: .55rem;
}
.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps li::before {
    content: counter(step);
    position: absolute; left: -.75rem; top: .1rem;
    width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: .72rem; font-weight: 700;
    background: var(--card); border: 2px solid var(--line); color: var(--ink-faint);
}
.steps li.is-done::before { content: "\2713"; background: var(--stage-done); border-color: var(--stage-done); color: #fff; }
.steps li.is-done { border-left-color: var(--stage-done); }
.steps li span { display: block; font-weight: 600; font-size: .92rem; }
.steps li small { display: block; font-size: .8rem; }

/* ------------------------------------------------------- email settings */

.maillog { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.maillog li { display: flex; gap: .5rem; align-items: flex-start; padding: .35rem 0; border-bottom: 1px solid var(--line-soft); }
.maillog li:last-child { border-bottom: 0; }
.maillog__err { display: block; color: var(--err); font-size: .78rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; margin-top: .45rem; }
.dot--ok { background: var(--ok); }
.dot--bad { background: var(--err); }
.placeholders li { display: flex; justify-content: space-between; gap: .75rem; }
.placeholders code { font-size: .78rem; }
.auth-card--wide { max-width: 520px; }

/* --------------------------------------------- client payment message */

.card--sent { border-color: #bfe0cd; background: #f7fdf9; }
body.client .card--sent { background: #16251d; border-color: #2c5a43; }

.paybox {
    border: 1px solid #ecd6ab; background: #fffdf5;
    border-radius: var(--radius-sm); padding: 1rem 1.15rem; margin: .75rem 0;
}
body.client .paybox { background: #251f14; border-color: #5a4a24; }
.paybox__amount {
    font-size: 1.5rem; font-weight: 700; margin: 0 0 .35rem; color: var(--warn);
}
body.client .paybox__amount { color: #ffd479; }
.paybox__text { margin: 0 0 .5rem; font-size: 1rem; }
.paybox--demo { margin: 0; }

/* The bank details block: easy to read and easy to copy by hand. */
.paydetails {
    display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem;
    margin: .85rem 0; padding: .8rem .9rem;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
body.client .paydetails { background: #14161a; border-color: #3a3426; }
.paydetails dt { color: var(--ink-soft); font-size: .85rem; align-self: center; }
body.client .paydetails dt { color: #9aa3b2; }
.paydetails dd { margin: 0; }
.paydetails__value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.02rem; font-weight: 600; letter-spacing: .04em;
    user-select: all;   /* one click selects the whole number */
}

/* --------------------------------------------- client urgency notice */

/* The "download now, these go in a month" warning. Loud on purpose. */
.urgent {
    border: 2px solid #e0574f;
    border-left-width: 5px;
    background: #fdeceb;
    color: #7f1d17;
    border-radius: var(--radius-sm);
    padding: .9rem 1.1rem;
    margin: 0 0 1rem;
}
.urgent p { margin: 0 0 .5rem; }
.urgent p:last-child { margin-bottom: 0; }
.urgent__title {
    font-weight: 700; font-size: 1.05rem;
    text-transform: uppercase; letter-spacing: .03em;
}
.urgent strong { color: #a3201a; }
body.client .urgent {
    background: #2a1512; border-color: #c4463d; color: #ffc9c4;
}
body.client .urgent strong { color: #fff; }
/* Already gone: same shape, no alarm. */
.urgent--gone {
    border-color: var(--line); border-left-color: var(--ink-faint);
    background: var(--line-soft); color: var(--ink);
}
body.client .urgent--gone {
    background: #22262e; border-color: #343b46; border-left-color: #6b7280; color: #c3cad6;
}
body.client .urgent--gone strong { color: #fff; }

/* ------------------------------------------------------------ the updater */

.pending { border-top: 1px solid var(--line-soft); margin-top: .5rem; padding-top: .9rem; }
.confirm-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-top: .75rem; }
.confirm-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.confirm-form label { margin-bottom: 0; min-width: 220px; }
.is-bad { color: var(--err); }

@media (max-width: 600px) {
    .wrap { padding: 1rem; }
    .topbar { padding: .6rem 1rem; gap: .75rem; flex-wrap: wrap; }
    .topbar__user .muted { display: none; }
    .chead { padding: .8rem 1rem 0; }
    .chead__id { gap: .7rem; }
    .chead__logo { max-height: 34px; max-width: 120px; }
    .table th:nth-child(5), .table td:nth-child(5) { display: none; }
}

/* ==========================================================================
   Enlarged view (lightbox). Shared: the client gallery uses it to choose
   photos, the admin Photos tab to inspect them.
   ========================================================================== */
/* -------------------------------------------------------- the lightbox */

.lightbox {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(8, 9, 11, .96);
    display: grid; place-items: center; padding: 3.5rem 1rem 6rem;
}
.lightbox[hidden] { display: none; }
.lightbox__stage { position: relative; max-width: 100%; max-height: 100%; }
.lightbox__stage img {
    max-width: 100%; max-height: 76vh; display: block; border-radius: 6px;
    -webkit-user-drag: none; -webkit-touch-callout: none;
    user-select: none; pointer-events: none;
}
.lightbox__close {
    position: absolute; top: .75rem; right: 1.25rem; z-index: 3;
    background: none; border: 0; color: #fff; font-size: 2rem; line-height: 1; cursor: pointer;
}

/* Step through the gallery without leaving the enlarged view. */
.lightbox__nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
    width: 52px; height: 52px; border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(28, 31, 37, .8); border: 1px solid rgba(255, 255, 255, .22);
    color: #fff; font-size: 1.2rem; cursor: pointer;
}
.lightbox__nav:hover { background: rgba(50, 55, 64, .95); }
.lightbox__nav[hidden] { display: none; }
.lightbox__nav--prev { left: 1rem; }
.lightbox__nav--next { right: 1rem; }

/* The select control, mirroring the tick on the grid tiles. */
.lightbox__bar {
    position: absolute; bottom: 0; left: 0; right: 0; z-index: 3;
    display: flex; align-items: center; justify-content: center; gap: 1.25rem;
    flex-wrap: wrap;
    padding: 1rem 1.25rem 1.4rem;
    background: linear-gradient(to top, rgba(8, 9, 11, .95), rgba(8, 9, 11, 0));
}
.lightbox__count { color: #c3cad6; font-size: .9rem; font-variant-numeric: tabular-nums; }
.lightbox__hint { font-size: .82rem; }

.lightbox__select {
    display: inline-flex; align-items: center; gap: .55rem;
    padding: .6rem 1.3rem;
    font: inherit; font-weight: 600; font-size: 1rem;
    border-radius: 999px; cursor: pointer;
    background: rgba(255, 255, 255, .1);
    border: 2px solid rgba(255, 255, 255, .55);
    color: #fff;
    transition: background .12s, border-color .12s, transform .08s;
}
.lightbox__select:hover { background: rgba(255, 255, 255, .2); }
.lightbox__select:active { transform: scale(.97); }
.lightbox__select:disabled { opacity: .45; cursor: default; }
.lightbox__select .lightbox__tick {
    display: grid; place-items: center;
    width: 24px; height: 24px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .7);
    font-size: .8rem; color: transparent;
}
/* Picked: the whole control lights up, same blue as the grid tick. */
.lightbox__select.is-picked {
    background: #1f6feb; border-color: #1f6feb;
}
.lightbox__select.is-picked .lightbox__tick {
    background: #fff; border-color: #fff; color: #1f6feb;
}

@media (max-width: 600px) {
    .lightbox { padding: 3rem .5rem 6rem; }
    .lightbox__nav { width: 42px; height: 42px; }
    .lightbox__nav--prev { left: .35rem; }
    .lightbox__nav--next { right: .35rem; }
    .lightbox__hint { display: none; }
}

/* Admin extras in the enlarged view: filename, dimensions, visibility. */
.lightbox__name {
    color: #c3cad6; font-size: .9rem;
    max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lightbox__toggle {
    display: inline-flex; align-items: center; gap: .4rem;
    margin: 0; color: #fff; font-size: .9rem; font-weight: 500; cursor: pointer;
}
.lightbox__toggle input { width: auto; margin: 0; }
/* The admin view has no shield overlay, so the image must stay interactive
   enough to sit under the controls without blocking them. */
#admin-lightbox .lightbox__stage img { pointer-events: none; }

/* Client "download everything" queue. */
.dlall { margin: 0 0 1rem; }
.dlall .upload-progress { margin-top: .75rem; max-width: 420px; }

/* ==========================================================================
   Dashboard
   ========================================================================== */

.attn { display: flex; flex-wrap: wrap; gap: .6rem; }
.attn__item {
    display: flex; align-items: baseline; gap: .45rem;
    padding: .55rem .85rem; border-radius: var(--radius-sm);
    background: var(--line-soft); border: 1px solid var(--line); color: var(--ink);
}
.attn__item:hover { text-decoration: none; border-color: #bcd0ef; }
.attn__item strong { font-size: 1.25rem; font-weight: 700; }
.attn__item span { font-size: .88rem; color: var(--ink-soft); }
.attn__item--info { background: var(--info-bg); border-color: #c3dafa; }
.attn__item--warn { background: var(--warn-bg); border-color: #ecd6ab; }

/* Attention items carry the stage colours too, so the dashboard and the
   galleries list are telling you the same thing in the same language. */
.attn__item--draft,
.attn__item--choose,
.attn__item--todo,
.attn__item--sent,
.attn__item--done,
.attn__item--off   { border-color: rgba(21, 24, 29, .12); }
.attn__item--draft  { background: var(--stage-draft-bg); }
.attn__item--choose { background: var(--stage-choose-bg); }
.attn__item--todo   { background: var(--stage-todo-bg); }
.attn__item--sent   { background: var(--stage-sent-bg); }
.attn__item--done   { background: var(--stage-done-bg); }
.attn__item--off    { background: var(--stage-off-bg); }
.attn__item--draft  strong { color: var(--stage-draft); }
.attn__item--choose strong { color: var(--stage-choose); }
.attn__item--todo   strong { color: var(--stage-todo); }
.attn__item--sent   strong { color: var(--stage-sent); }
.attn__item--done   strong { color: var(--stage-done); }
.attn__item--off    strong { color: var(--stage-off); }

.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; }
.pipe {
    display: block; padding: .8rem .9rem; border-radius: var(--radius-sm);
    background: var(--card); border: 1px solid var(--line); color: var(--ink);
    border-left: 4px solid var(--line);
}
.pipe:hover { text-decoration: none; border-color: #bcd0ef; }
.pipe__n { display: block; font-size: 1.6rem; font-weight: 650; line-height: 1.1; }
.pipe__l { font-size: .82rem; color: var(--ink-soft); }
/* Same six colours as the badges, from the same variables. */
.pipe--draft     { border-left-color: var(--stage-draft); }
.pipe--selection { border-left-color: var(--stage-choose); }
.pipe--selected  { border-left-color: var(--stage-todo); }
.pipe--delivery  { border-left-color: var(--stage-sent); }
.pipe--completed { border-left-color: var(--stage-done); }
.pipe--cancelled { border-left-color: var(--stage-off); }
.pipe--draft     .pipe__n { color: var(--stage-draft); }
.pipe--selection .pipe__n { color: var(--stage-choose); }
.pipe--selected  .pipe__n { color: var(--stage-todo); }
.pipe--delivery  .pipe__n { color: var(--stage-sent); }
.pipe--completed .pipe__n { color: var(--stage-done); }
.pipe--cancelled .pipe__n { color: var(--stage-off); }

.period { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.period__pills { display: flex; gap: .25rem; }
.period__jump { margin: 0 0 1rem; }
.inline-label { display: inline-flex; align-items: center; gap: .5rem; font-size: .88rem; margin: 0; }
.inline-label select { margin-top: 0; width: auto; }

.chart-wrap { overflow-x: auto; padding: .25rem 0 .5rem; }
.chart { width: 100%; min-width: 320px; height: 190px; display: block; }
.chart__bar { fill: var(--brand); }
.chart__bar:hover { fill: var(--brand-dark); }
.chart__bar--empty { fill: var(--line); }
.chart__axis { stroke: var(--line); stroke-width: 1; }
.chart__label { fill: var(--ink-faint); font-size: 10px; font-family: var(--font); }

/* ==========================================================================
   Promotions
   ========================================================================== */

.promo { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.promo__main { min-width: 0; }
@media (max-width: 900px) { .promo { grid-template-columns: 1fr; } }

.presets {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    padding: .6rem .7rem; margin-bottom: 1rem;
    background: var(--line-soft); border-radius: var(--radius-sm);
}
.presets__label { text-transform: uppercase; letter-spacing: .05em; }
.presets__list { display: flex; gap: .4rem; flex-wrap: wrap; flex: 1 1 auto; }
.preset { display: inline-flex; align-items: center; }
.preset .chip { border-radius: 999px 0 0 999px; }
.preset__x {
    border: 1px solid var(--line); border-left: 0; background: var(--card);
    border-radius: 0 999px 999px 0; cursor: pointer;
    color: var(--ink-faint); padding: .3rem .5rem; font-size: .9rem; line-height: 1;
}
.preset__x:hover { background: var(--err-bg); color: var(--err); }

.editor { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: .6rem; }
.editor__bar {
    display: flex; align-items: center; gap: .2rem; flex-wrap: wrap;
    padding: .4rem .5rem; background: #fafbfd; border-bottom: 1px solid var(--line);
}
.editor__btn {
    min-width: 30px; padding: .25rem .5rem; font: inherit; font-size: .85rem;
    background: var(--card); border: 1px solid var(--line); border-radius: 5px; cursor: pointer;
}
.editor__btn:hover { background: var(--info-bg); border-color: #bcd6f6; }
.editor__sep { width: 1px; height: 18px; background: var(--line); margin: 0 .25rem; }
.editor__area {
    min-height: 280px; max-height: 60vh; overflow-y: auto;
    padding: 1rem 1.1rem; background: var(--card); font-size: 15px; line-height: 1.6;
}
.editor__area:focus { outline: 2px solid var(--brand); outline-offset: -2px; }
.editor__area img { max-width: 100%; height: auto; border-radius: 8px; }

.promo__send { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }
.promo-preview {
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 1.25rem; background: #f6f7fa; font-size: 15px; line-height: 1.6;
}
.promo-preview img { max-width: 100%; height: auto; border-radius: 8px; }

/* The recipient chooser */
.picker { position: fixed; inset: 0; z-index: 70; background: rgba(14, 18, 28, .55); display: grid; place-items: center; padding: 1.5rem; }
.picker[hidden] { display: none; }
.picker__box {
    background: var(--card); border-radius: 14px; width: 100%; max-width: 720px;
    max-height: 85vh; display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 20px 60px rgba(14, 18, 28, .3);
}
.picker__head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.picker__head h2 { margin: 0; }
.picker__close { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ink-soft); }
.picker__tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .75rem 1.25rem; border-bottom: 1px solid var(--line-soft); }
.picker__tools input[type=search] { margin-top: 0; flex: 1 1 200px; }
.picker__list { overflow-y: auto; padding: .25rem 0; flex: 1 1 auto; }
.picker__row {
    display: grid; grid-template-columns: auto 1fr 1fr; gap: .25rem .75rem;
    align-items: center; margin: 0; padding: .5rem 1.25rem; font-weight: 400;
    border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.picker__row:hover { background: #fafbfd; }
.picker__row input { width: auto; margin: 0; grid-row: span 2; }
.picker__name { font-weight: 600; }
.picker__email { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; }
.picker__meta { grid-column: 2 / -1; }
.picker__row.is-out { opacity: .5; }
.picker__foot { display: flex; gap: .6rem; padding: 1rem 1.25rem; border-top: 1px solid var(--line); }

.import-report { border-top: 1px solid var(--line-soft); margin-top: 1rem; padding-top: 1rem; }

/* The hourly rate slider in Settings. */
.rate { display: flex; align-items: center; gap: .75rem; margin-top: .35rem; }
.rate input[type=range] { flex: 1 1 auto; margin: 0; max-width: 420px; accent-color: var(--brand); }
.rate__value {
    font-size: 1.3rem; font-weight: 700; color: var(--brand);
    min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums;
}

/* Clients list: search and sort side by side. */
.list-tools { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.list-tools .searchbar { margin-bottom: 0; }
.pills__label { text-transform: uppercase; letter-spacing: .05em; align-self: center; }

/* Subscribed / unsubscribed toggle in the clients table. */
.subform { display: inline; }
.sub {
    font: inherit; font-size: .74rem; font-weight: 650;
    padding: .12rem .5rem; border-radius: 999px; cursor: pointer; border: 1px solid;
}
.sub--on  { background: var(--ok-bg);   color: var(--ok);   border-color: #bfe0cd; }
.sub--off { background: var(--line-soft); color: var(--ink-soft); border-color: var(--line); }
.sub:hover { filter: brightness(.96); }

/* An in-flight promotion run. */
.run { border-top: 1px solid var(--line-soft); margin-top: .6rem; padding-top: .6rem; }
.run strong { display: block; font-size: .9rem; }
.promo__when { max-width: 320px; }

/* Editor toolbar: dropdowns sit alongside the buttons. */
.editor__select {
    margin-top: 0; width: auto; max-width: 160px;
    padding: .25rem .4rem; font-size: .85rem;
    border: 1px solid var(--line); border-radius: 5px; background: var(--card);
}
.editor__select--sm { max-width: 118px; }
.editor__colour {
    display: inline-flex; align-items: center; margin: 0;
    border: 1px solid var(--line); border-radius: 5px; background: var(--card); padding: .1rem .15rem;
}
.editor__colour input[type=color] {
    width: 26px; height: 22px; border: 0; padding: 0; background: none; cursor: pointer; margin: 0;
}
.editor__area h2 { font-size: 1.35em; margin: .6em 0 .3em; }
.editor__area h3 { font-size: 1.15em; margin: .6em 0 .3em; }
.editor__area p { margin: 0 0 .85em; }
.editor__area a { color: var(--brand); }

/* The preview, dressed as the email actually arrives. */
.promo-preview {
    background: #f4f5f7; border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 1.75rem 1rem;
}
.promo-preview__card {
    max-width: 600px; margin: 0 auto; background: #fff;
    border-radius: 14px; box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
    padding: 1.6rem 1.8rem;
}
.promo-preview__logo { text-align: center; padding-bottom: 1.1rem; border-bottom: 1px solid #eceff3; margin-bottom: 1.3rem; }
.promo-preview__logo img { max-height: 54px; max-width: 200px; display: inline-block; }
.promo-preview__logo span { font-size: 1.25rem; font-weight: 600; }
.promo-preview__foot {
    max-width: 600px; margin: 1.1rem auto 0; text-align: center;
    font-size: 12px; line-height: 1.7; color: #9aa1ad;
}
.promo-preview__foot strong { color: #4b5563; }
.promo-preview__body h2 { font-size: 1.35em; margin: .6em 0 .3em; }
.promo-preview__body h3 { font-size: 1.15em; margin: .6em 0 .3em; }
.promo-preview__body p { margin: 0 0 .85em; }
.promo__pre { max-width: 520px; }

/* Content advice under the promotion editor. */
.checks { list-style: none; margin: .5rem 0 1rem; padding: 0; }
.checks__item {
    font-size: .85rem; line-height: 1.5;
    padding: .4rem .65rem .4rem 1.9rem; margin-bottom: .3rem;
    border-radius: var(--radius-sm); position: relative;
}
.checks__item::before { position: absolute; left: .6rem; font-weight: 700; }
.checks__item--ok   { background: var(--ok-bg); color: var(--ok); }
.checks__item--ok::before { content: "\2713"; }
.checks__item--warn { background: var(--warn-bg); color: var(--warn); }
.checks__item--warn::before { content: "!"; }
.checks__item--info { background: var(--line-soft); color: var(--ink-soft); }
.checks__item--info::before { content: "i"; font-style: italic; }
.dnscheck { margin: .75rem 0; }
.dnscheck .checks { margin-top: .6rem; }
.checks__item strong { font-weight: 700; }

/* A simulated inbox row, so the preview line is visibly doing something. */
.inboxrow {
    display: grid; gap: .1rem;
    padding: .7rem .9rem; margin-bottom: .75rem;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.inboxrow__from { font-size: .82rem; font-weight: 700; }
.inboxrow__subject { font-size: .92rem; font-weight: 600; }
.inboxrow__pre {
    font-size: .85rem; color: var(--ink-faint);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Client list pager. */
.pager { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; margin: 0 0 1.5rem; }
.pager__info { margin-right: .5rem; }
.pager__link {
    min-width: 34px; padding: .3rem .55rem; text-align: center;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--card); color: var(--ink); font-size: .88rem;
}
.pager__link:hover { text-decoration: none; background: var(--line-soft); }
.pager__link.is-active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 650; }
.pager__gap { padding: 0 .2rem; color: var(--ink-faint); }

/* ------------------------------------------------- has the client been in? */

.seen {
    padding: .7rem .85rem; margin-bottom: .8rem;
    border: 1px solid; border-radius: var(--radius-sm);
}
.seen strong      { display: block; font-size: .92rem; }
.seen__when       { display: block; font-size: .78rem; opacity: .85; margin-top: .1rem; }
.seen p           { margin: .45rem 0 0; }
.seen .kv         { margin: .55rem 0 0; }
.seen .kv li      { border-color: rgba(21, 24, 29, .08); }
.seen--in    { background: var(--ok-bg);   border-color: #bfe0cd; color: var(--ok); }
.seen--stuck { background: var(--warn-bg); border-color: #efd7ab; color: var(--warn); }
.seen--away  { background: var(--bg);      border-color: var(--line); color: var(--ink-soft); }

.run__foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: .5rem; margin-top: .5rem;
}
.run__foot form { margin: 0; }

/* Past runs: the follow-up to the people who have not opened a run. */
.resend { margin-top: .5rem; }
.resend > summary { list-style: none; cursor: pointer; }
.resend > summary::-webkit-details-marker { display: none; }
.resend[open] > summary { margin-bottom: .5rem; }
.resend__form {
    display: grid; gap: .45rem; padding: .65rem .7rem;
    background: var(--line-soft); border-radius: var(--radius-sm);
}
.resend__form label { margin: 0; font-size: .85rem; }
.resend__form .btn { justify-self: start; }
.run__note { margin: .5rem 0 0; }

/* Galleries list: the offer to tidy the capitalisation of older names. */
.tidy-strip {
    display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
    background: var(--stage-todo-bg); border: 1px solid rgba(154, 91, 0, .2);
    border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; font-size: .9rem;
}
.tidy-strip > div { flex: 1 1 420px; display: grid; gap: .25rem; }
.tidy-strip form { margin: 0; }

/* New client form: the address typed is already on file. */
.dupe-hint {
    display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
    background: var(--warn-bg); border: 1px solid rgba(154, 91, 0, .25); color: var(--warn);
    border-radius: var(--radius-sm); padding: .55rem .75rem; font-size: .9rem;
}
.dupe-hint[hidden] { display: none; }
.dupe-hint .btn { margin-left: auto; }

/* ==========================================================================
   Galleries page: a grid of cards, three across.

   Each card reads top to bottom in the order you need it: what stage the
   session is at (in its stage colour, the same one used everywhere else),
   whose it is by sight, then by name, then the numbers.
   ========================================================================== */

.gal-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.15rem; margin-bottom: 1.5rem;
}
@media (max-width: 1000px) { .gal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px)  { .gal-grid { grid-template-columns: 1fr; } }

.gal {
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.gal:hover {
    transform: translateY(-3px); border-color: #c9d3e3;
    box-shadow: 0 2px 4px rgba(18, 24, 36, .06), 0 14px 32px rgba(18, 24, 36, .12);
}
/* Keyboard users get the same "this card" cue as the mouse. */
.gal:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 111, 235, .18); }

/* The stage bar. It lies across the top of the photograph rather than above
   it, at 90% so the picture shows faintly through: the card is shorter for
   the same size of photo, and the bar reads as a label on the picture.
   Clicks pass straight through it to the card underneath. */
.gal__stage {
    position: absolute; top: 0; left: 0; right: 0; z-index: 1;
    opacity: .9; pointer-events: none;
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .5rem .85rem;
    font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    background: var(--line-soft); color: var(--ink-soft);
}
.gal__stage .badge { letter-spacing: 0; text-transform: none; background: #fff; }
.gal--draft  .gal__stage { background: var(--stage-draft-bg);  color: var(--stage-draft); }
.gal--choose .gal__stage { background: var(--stage-choose-bg); color: var(--stage-choose); }
.gal--todo   .gal__stage { background: var(--stage-todo-bg);   color: var(--stage-todo); }
.gal--sent   .gal__stage { background: var(--stage-sent-bg);   color: var(--stage-sent); }
.gal--done   .gal__stage { background: var(--stage-done-bg);   color: var(--stage-done); }
.gal--off    .gal__stage { background: var(--stage-off-bg);    color: var(--stage-off); }

/* The picture. Its height is the slider in Settings; its width is the card. */
.gal__cover {
    position: relative; overflow: hidden;
    height: var(--cover-h, 280px); background: #1b1d22;
}
.gal__cover img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform .35s ease;
}
.gal:hover .gal__cover img { transform: scale(1.035); }
.gal__empty {
    display: grid; place-items: center; height: 100%; padding: 0 1rem; text-align: center;
    background: var(--line-soft); color: var(--ink-faint); font-size: .85rem;
}
.gal__flag {
    position: absolute; left: .6rem; bottom: .6rem;
    padding: .2rem .6rem; border-radius: 999px;
    background: var(--brand); color: #fff; font-size: .74rem; font-weight: 650;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

.gal__body { display: flex; flex-direction: column; flex: 1 1 auto; padding: .85rem .95rem .9rem; }
.gal__name { margin: 0; font-size: 1.02rem; line-height: 1.3; font-weight: 650; }
.gal__link { color: var(--ink); }
.gal__link:hover { text-decoration: none; color: var(--brand); }
/* Stretches the title's link over the whole card. */
.gal__link::after { content: ""; position: absolute; inset: 0; }
.gal__link:focus-visible { outline: none; }

.gal__who { margin: .2rem 0 .85rem; font-size: .88rem; color: var(--ink-faint); }
/* Above the stretched link, so the client's name goes to the client. */
.gal__who a { position: relative; z-index: 1; color: var(--ink-soft); }
.gal__who a:hover { color: var(--brand); }

.gal__facts {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem;
    /* Pinned to the bottom, so the numbers line up across a row of cards
       whatever the length of the names above them. */
    margin: auto 0 0; padding-top: .75rem; border-top: 1px solid var(--line-soft);
}
.gal__facts dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); }
.gal__facts dd { margin: .1rem 0 0; font-size: 1.02rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.gal__of   { font-weight: 500; color: var(--ink-faint); }
.gal__due  { color: var(--stage-todo); }
.gal__none { color: var(--ink-faint); font-weight: 500; }


/* Messages tab: "also email the client" under the message box. */
.chat-notify { align-items: flex-start; padding: .55rem 0 0; font-size: .88rem; font-weight: 500; }
.chat-notify input { margin-top: .2rem; }
.chat-notify small { display: block; }

/* Client payment box: how the amount to pay is made up. */
.paysum {
    display: grid; grid-template-columns: 1fr auto; gap: .3rem 1rem;
    margin: .25rem 0 .75rem; font-size: .92rem;
}
.paysum dt { color: var(--ink-soft); }
.paysum dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.paysum .paysum__total { font-weight: 700; color: var(--ink); padding-top: .35rem; border-top: 1px solid #ecd6ab; }
body.client .paysum dt { color: #9aa3b2; }
body.client .paysum .paysum__total { color: #ffd479; border-top-color: #5a4a24; }

/* Settings -> Notifications. */
.push-devices td { vertical-align: middle; }
.push-actions form { display: inline-flex; gap: .3rem; margin: 0; }
.push-this { margin-left: .35rem; }
.push-failed { color: var(--err); }
.push-ok { color: var(--ok); }
.push-add { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line-soft); }
.push-add h3 { margin: 0 0 .3rem; }
.push-add__row { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin-top: .5rem; }
.push-add__row label { flex: 1 1 220px; margin: 0; }
.push-events { display: grid; gap: .1rem; }
.push-events .checkline { padding-bottom: .55rem; align-items: flex-start; }
.push-events .checkline input { margin-top: .2rem; }
.push-events .checkline small { display: block; }
.push-steps { margin: .4rem 0 .6rem; padding-left: 1.2rem; display: grid; gap: .35rem; }
