/*
    Kazman Construction & Remodeling - the backend.

    Loaded after site.css for anyone signed in, so it uses the same colors,
    fonts, and buttons. The code editors use a monospaced font.
*/

:root {
    --font-code: ui-monospace, "SF Mono", "Cascadia Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
    --good: #2f7d4f;
    --bad: #b3261e;
    --surface: #ffffff;
    --surface-alt: #f6f3ec;
    --selection: #f0dfbd;
}

code {
    padding: 1px 6px;
    background: var(--gold-soft);
    border-radius: 3px;
    font-family: var(--font-code);
    font-size: 1em;
}

/* Page head and body */

.admin-head {
    position: relative;
    padding: 34px 0 26px;
    background:
        radial-gradient(circle at 85% 20%, rgba(42, 154, 168, 0.16), transparent 45%),
        linear-gradient(135deg, var(--navy) 0%, var(--ink) 100%);
    color: rgba(255, 255, 255, 0.85);
}
.admin-head::after {
    content: "";
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright), var(--gold-deep));
}
.admin-head h1 { color: var(--white); font-size: var(--size-headline); margin-bottom: 0.3em; }
.admin-head .eyebrow { color: var(--gold-bright); }
.admin-head .lead { max-width: 860px; margin: 0; font-size: var(--size-normal); color: rgba(255, 255, 255, 0.82); }
.admin-head code { background: rgba(255, 255, 255, 0.12); color: var(--gold-bright); }

.admin-body { padding: 24px 0 48px; background: var(--stone); }
/* The backend has no footer, so the page below its content is the same
   colour as the body of the page rather than the paper behind the site. */
body.section-admin, body.section-staff { background: var(--stone); }

/* Dashboard */

.admin-group {
    margin: 0 0 11px;
    font-size: var(--size-normal);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold-deep);
}

.admin-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.admin-card {
    display: flex; flex-direction: column; gap: 8px;
    padding: 17px 16px;
    background: var(--white);
    border: 1px solid var(--line);
    border-top: 4px solid var(--gold);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s, box-shadow 0.2s;
}
.admin-card:hover { color: var(--text); transform: translateY(-3px); box-shadow: var(--shadow); }
.admin-card strong { font-family: var(--font-head); font-size: var(--size-big); color: var(--navy); }
.admin-card span:last-child { color: var(--muted); font-size: var(--size-normal); }
.admin-card-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: var(--navy);
    border-radius: var(--radius);
    color: var(--gold-bright);
}

/* Line icons (Lucide shapes, drawn inline), in the card's gold. */
.admin-card-mark svg {
    width: 22px; height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.admin-card-mark svg .dot { fill: currentColor; stroke: none; }
.admin-card:hover .admin-card-mark { background: var(--gold); color: var(--ink); }

/* Panels */

.admin-panel {
    padding: 14px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}
.admin-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 7px; margin-bottom: 10px; }
.admin-panel-head h2 { margin: 0; font-size: var(--size-big); }
.admin-count { color: var(--muted); font-size: var(--size-small); }

.field-note { margin: 8px 0; color: var(--muted); font-size: var(--size-small); }

.form-message { min-height: 1.4em; margin: 10px 0; font-weight: 600; }
.form-message.good { color: var(--good); }
.form-message.bad { color: var(--bad); }

.admin-panel input[type="search"], .admin-panel input[type="text"], .admin-panel input[type="password"] {
    width: 100%;
    padding: 10px 7px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    font-size: var(--size-normal);
}
.admin-panel input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(42, 154, 168, 0.2); }

.admin-panel .button-row { margin-top: 10px; }
.admin-panel .button { padding: 10px 12px; font-size: var(--size-normal); }

/* Sign in */

.login-form { max-width: 440px; }
.login-form .button { width: 100%; margin-top: 6px; }
.login-form h2 { margin: 0 0 8px; font-size: var(--size-big); }
.login-form > .field-note { margin: 0 0 8px; }

/* /login/: Sign In centred, switched for Create Account by the link beside its title. */
.login-center { display: flex; justify-content: center; }
.login-center .login-form { width: 100%; }
.login-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; }
.login-head h2 { margin: 0; }
.login-switch { color: var(--teal); font-size: var(--size-small); font-weight: 600; }
.login-switch:hover { color: var(--navy); }

/* Consoles: templates, CSS, SQL */

.split-console {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}
.console-side { position: sticky; top: 100px; max-height: calc(100vh - 120px); overflow-y: auto; }

.editor-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; margin-bottom: 7px; }
.editor-state {
    font-family: var(--font-head);
    font-size: var(--size-big);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--navy);
}
.editor-found { color: var(--muted); font-family: var(--font-code); font-size: var(--size-small); }

#file-list, #sql-tables { margin-top: 10px; }

#file-list button, #sql-tables button {
    display: flex; justify-content: space-between; gap: 8px;
    width: 100%;
    padding: 7px 10px;
    background: transparent;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 0;
    color: var(--text);
    font: inherit;
    font-size: var(--size-normal);
    text-align: left;
    cursor: pointer;
}
#file-list button:hover, #sql-tables button:hover { background: var(--surface-alt); }
#file-list .file-item.open { background: var(--gold-soft); border-left-color: var(--gold); font-weight: 700; }
#file-list .file-item.hit { border-left-color: var(--teal); }
#file-list .file-size, #file-list .file-hits, #sql-tables small { color: var(--muted); font-size: var(--size-small); font-weight: 400; }
#file-list .file-line {
    justify-content: flex-start;
    padding-left: 13px;
    font-family: var(--font-code);
    font-size: var(--size-small);
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#file-list .file-lineno { flex: none; min-width: 2.6rem; color: var(--gold-deep); }

.sql-columns {
    margin: 0 0 10px 8px;
    padding: 0;
    list-style: none;
    font-family: var(--font-code);
    font-size: var(--size-small);
    color: var(--muted);
}
.sql-columns li.key { color: var(--gold-deep); font-weight: 700; }

.sql-result { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sql-statement {
    padding: 8px 7px;
    background: var(--navy);
    color: var(--gold-bright);
    font-family: var(--font-code);
    font-size: var(--size-small);
    white-space: pre-wrap;
}
.sql-note { margin: 0; padding: 6px 7px; color: var(--muted); font-size: var(--size-small); }
.sql-error { color: var(--bad); font-weight: 600; }
.sql-scroll { max-height: 28rem; overflow: auto; }
.sql-grid { border-collapse: collapse; font-family: var(--font-code); font-size: var(--size-small); }
.sql-grid th, .sql-grid td { padding: 5px 10px; border: 1px solid var(--line); white-space: nowrap; text-align: left; }
.sql-grid th { position: sticky; top: 0; background: var(--surface-alt); color: var(--navy); }
.sql-grid tbody tr:nth-child(even) { background: #fcfbf8; }

/* The line numbered editor box (typescript/admin/linedtextarea.ts). The frame
   has the fixed height; the textarea fills it and scrolls inside it, and the
   gutter is clipped to the same height with the same padding, font, and line
   height, so each number sits level with its line. */

.linedwrap {
    display: flex;
    align-items: stretch;
    height: 62vh;
    min-height: 16rem;
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    background: var(--surface);
    font-family: var(--font-code);
    font-size: var(--size-small);
    line-height: 1.55;
    overflow: hidden;
    resize: vertical;
}
.linedwrap:has(#sql-text) { height: 30vh; }
.linedwrap .lines {
    flex: none;
    width: 3.6rem;
    padding: 7px 10px 7px 0;
    background: var(--navy);
    color: rgba(255, 255, 255, 0.45);
    text-align: right;
    overflow: hidden;
    user-select: none;
}
.linedwrap .lineno { line-height: inherit; }
.linedwrap textarea {
    flex: 1 1 auto;
    width: auto;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 7px;
    background: var(--surface);
    border: 0;
    border-radius: 0;
    color: var(--text);
    font: inherit;
    line-height: inherit;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    overflow-y: auto;
    resize: none;
}
.linedwrap textarea:focus { outline: none; }
.linedwrap:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(42, 154, 168, 0.2); }
.linedwrap textarea.nowrap { white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.linedwrap textarea::selection { background: var(--selection); }

/* Dashboard groups after the first */

.admin-group-next { margin-top: 24px; }

/* Tables */

.table-scroll { margin-top: 8px; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--size-normal); }
.data-table th, .data-table td { padding: 10px 7px; border-bottom: 1px solid var(--line); text-align: left; }
.data-table th { background: var(--surface-alt); }
.data-table tbody tr:hover { background: #fcfaf5; }
.data-table tr.inactive td { color: var(--muted); }
.data-table a { color: var(--navy); }
.data-table .row-link { font-weight: 700; text-decoration: none; }
.data-table .row-link:hover { color: var(--gold-deep); text-decoration: underline; }

.sort-table th button {
    padding: 0;
    background: none;
    border: 0;
    color: var(--navy);
    font-family: var(--font-head);
    font-size: var(--size-normal);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}
.sort-table th[aria-sort] button::after { content: " \25B2"; font-size: var(--size-small); color: var(--gold-deep); }
.sort-table th[aria-sort="descending"] button::after { content: " \25BC"; }

.tag {
    display: inline-block;
    padding: 1px 8px;
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: 99px;
    font-size: var(--size-small);
    color: var(--muted);
}

/* The page editor (typescript/admin/editor.ts, taken from foldersreach), on
   every page for an administrator: a bar under the breadcrumb, the notices
   that open from it, and the editing form in place of the page's content. */

.hidden { display: none !important; }

.editor-bar { background: var(--navy); border-bottom: 3px solid var(--gold); color: rgba(255, 255, 255, 0.85); }
.editor-bar .shell { padding: 8px 0; }
#editor-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.editor-label {
    margin-right: 6px;
    font-family: var(--font-head);
    font-size: var(--size-normal);
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold-bright);
}
#editor-list a {
    display: inline-block;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line-dark);
    border-radius: var(--radius);
    color: var(--white);
    font-size: var(--size-small);
    text-decoration: none;
}
#editor-list a:hover { background: var(--gold); border-color: var(--gold); color: var(--ink); }

/* The editor's notices: the message and its buttons on one line. */
.confirm {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 8px 8px;
    margin-top: 8px;
    padding: 10px 8px;
    background: var(--white);
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    border-radius: var(--radius);
    color: var(--text);
}
.confirm p { flex: 1 1 18rem; margin: 0; font-size: var(--size-normal); }
.confirm .button-row { margin: 0; gap: 6px; }
.confirm .button { padding: 6px 10px; font-size: var(--size-normal); }
.confirm .button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--gold-bright); }

/* Pinned under the site header while a version is being read, so the buttons
   and the slider stay in reach however long the page is. Its width and top are
   set as it is pinned, from the space it left behind and the header. */
.confirm.is-following {
    position: fixed;
    z-index: 40;
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    box-shadow: var(--shadow);
}
.editor-follow-space { height: 0; }

.edit-form { padding: 24px 0 43px; background: var(--stone); }
.edit-form h1 { font-size: var(--size-headline); }
.edit-label {
    display: block;
    margin: 10px 0 4px;
    font-family: var(--font-head);
    font-size: var(--size-normal);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold-deep);
}
.edit-form input {
    width: 100%;
    margin-bottom: 6px;
    padding: 10px 7px;
    background: var(--white);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    font: inherit;
    font-size: var(--size-normal);
}
.edit-form input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(42, 154, 168, 0.2); }
.edit-content-head { display: flex; justify-content: space-between; align-items: baseline; gap: 7px; }
#wrapToggle { font-size: var(--size-small); color: var(--gold-deep); }

/* One box ordinarily; two of equal width while a version is on screen, the
   old one on the left and the page as it is on the right. */
.edit-panes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 14px; }
.edit-form.is-history .edit-panes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.edit-pane { min-width: 0; }

/* Visual draws the version itself, so the boxes stand aside. */
.edit-form.is-visual .edit-panes { display: none; }
.edit-visual h3 { margin: 10px 0 8px; }
.edit-visual-page {
    overflow-x: auto;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}
.edit-visual-page > * { max-width: 100%; }
.edit-visual-page img, .edit-visual-page video { max-width: 100%; height: auto; }

/* The version on the left is read, not written: the same lined frame as the
   box beside it, in a quieter colour. Its text can still be copied. */
.edit-pane-past .linedwrap, .edit-pane-past .linedwrap textarea, .edit-pane-past input[readonly] { background: var(--surface-alt); }
.edit-pane-past .linedwrap:focus-within { border-color: #cfc6b4; box-shadow: none; }
.edit-pane-now input[readonly], .edit-pane-now textarea[readonly] { background: var(--surface-alt); }

/* The slider: one pip for each version, oldest at the left, the page as it
   stands now at the right. */
.history-bar { flex: 1 1 100%; margin-top: 4px; }
.history-track { position: relative; padding: 0 10px 7px; }
.history-track input[type=range] { width: 100%; margin: 0; background: transparent; accent-color: var(--gold-deep); }
.history-track input[type=range]:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.history-pips { position: relative; height: 14px; margin: 0 10px; }
.history-pip {
    position: absolute;
    top: 2px;
    width: 9px; height: 9px;
    margin-left: -4.5px;
    background: #b9ad95;
    border: 1px solid #b9ad95;
    border-radius: 50%;
    transition: transform 0.1s ease-out;
}
.history-pip:hover { background: var(--navy); border-color: var(--navy); transform: scale(1.2); }
.history-pip.is-chosen { background: var(--gold); border-color: var(--gold-deep); transform: scale(1.5); }
.history-when { margin: 2px 0 0; }

/* The date for a pip, hung below it with a tail pointing back up. --tail is
   where the tail sits, set as the tip is placed. */
.history-tip {
    position: fixed;
    z-index: 60;
    padding: 4px 10px;
    background: var(--navy);
    border: 1px solid var(--navy);
    border-radius: var(--radius);
    color: var(--gold-bright);
    font-size: var(--size-small);
    white-space: nowrap;
    pointer-events: none;
    box-shadow: var(--shadow-soft);
}
.history-tip::before, .history-tip::after {
    content: "";
    position: absolute;
    left: var(--tail, 50%);
    width: 0; height: 0;
    margin-left: -6px;
    border: 6px solid transparent;
    border-top: 0;
}
.history-tip::before { bottom: 100%; border-bottom-color: var(--navy); }
.history-tip::after { bottom: calc(100% - 1px); border-bottom-color: var(--navy); }

@media (prefers-reduced-motion: reduce) {
    .history-pip { transition: none; }
}

/* Paste: thumbnails of what has been pasted, newest first. */

.paste-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.paste-item {
    display: flex; flex-direction: column; gap: 4px;
    padding: 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.paste-item:first-child { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.paste-thumb { width: 100%; height: 150px; object-fit: contain; background: var(--surface-alt); border-radius: 3px; }
.paste-when { font-size: var(--size-small); font-weight: 600; color: var(--navy); }
.paste-size { color: var(--muted); }
.paste-empty { margin-top: 8px; }

/* Email (typescript/admin/mail.ts): the mailbox, a list of messages beside the
   one being read, and the form to write one. */

.mail-not-ready { margin-bottom: 14px; }

.mail-split { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 12px; align-items: start; }
.mail-list { max-height: 70vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.mail-row-item {
    display: flex; flex-direction: column; gap: 2px;
    width: 100%;
    padding: 10px 7px;
    background: var(--white);
    border: 0;
    border-bottom: 1px solid var(--line);
    border-left: 3px solid transparent;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.mail-row-item:hover { background: var(--surface-alt); }
.mail-row-item.chosen { background: var(--gold-soft); border-left-color: var(--gold); }
.mail-row-item.unread strong, .mail-row-item.unread .mail-row-subject { font-weight: 700; color: var(--navy); }
.mail-row-item.unread { border-left-color: var(--teal); }
.mail-row-top { display: flex; justify-content: space-between; gap: 10px; }
.mail-row-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mail-row-when { flex: none; color: var(--muted); font-size: var(--size-small); }
.mail-row-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--size-small); }
.mail-unread {
    display: inline-block;
    min-width: 20px;
    padding: 0 6px;
    background: var(--teal);
    border-radius: 99px;
    color: var(--white);
    font-size: var(--size-small);
    text-align: center;
}

.mail-detail { min-width: 0; }
.mail-subject { margin: 0 0 10px; }
.mail-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; margin: 0 0 7px; font-size: var(--size-small); }
.mail-facts dt { font-weight: 700; color: var(--gold-deep); }
.mail-facts dd { margin: 0; overflow-wrap: anywhere; }
.mail-attachments a { margin-right: 4px; }
.mail-body {
    max-height: 60vh;
    overflow: auto;
    margin: 8px 0 0;
    padding: 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: var(--size-normal);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.mail-pager { display: flex; align-items: center; gap: 8px; font-size: var(--size-small); }
/* Centred in the Mailbox heading; on a narrow screen it takes its turn in the line. */
.admin-panel-head:has(> #inbox-pager) { position: relative; }
#inbox-pager { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
@media (max-width: 960px) {
    #inbox-pager { position: static; transform: none; }
}

.mail-row { margin-bottom: 8px; }
.mail-row input[type="text"], .mail-row textarea {
    width: 100%;
    padding: 10px 7px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    font-size: var(--size-normal);
}
.mail-row textarea { resize: vertical; }
.mail-row input:focus, .mail-row textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(42, 154, 168, 0.2); }
.mail-files-button { cursor: pointer; }
.mail-file-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.mail-file-list:empty { display: none; }
.mail-file {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 6px 4px 7px;
    background: var(--gold-soft);
    border-radius: 99px;
    font-size: var(--size-small);
}
.mail-file small { color: var(--muted); }
.mail-file button { background: none; border: 0; color: var(--muted); font-size: var(--size-normal); cursor: pointer; }
.mail-file button:hover { color: var(--bad); }
#mail-files-count.bad, #mail-length.bad { color: var(--bad); font-weight: 700; }

/* Spelling and grammar, taken from foldersreach: the count and its buttons sit
   at the right of the Message label, and the line under the box names the
   problem being looked at. */
.mail-field-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.mail-field-head .edit-label { margin: 0; }
.mail-check-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.mail-check-strip .button { padding: 6px 8px; font-size: var(--size-small); }
.mail-check-summary { color: var(--muted); font-size: var(--size-small); }
.mail-check-summary.good { color: var(--good); font-weight: 700; }
.mail-check-summary.bad { color: var(--bad); font-weight: 700; }
.mail-check-note {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin: 8px 0 0;
    padding: 8px 7px;
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    border-radius: var(--radius);
    font-size: var(--size-small);
}
.mail-check-note del { color: var(--bad); }
.mail-check-note ins { color: var(--good); font-weight: 700; text-decoration: none; }
.mail-check-note button { margin-left: auto; padding: 4px 7px; font-size: var(--size-small); }
.mail-fix-kind {
    padding: 1px 8px;
    background: var(--gold-soft);
    border-radius: 99px;
    color: var(--gold-deep);
    font-size: var(--size-small);
    font-weight: 700;
    text-transform: lowercase;
}
.mail-fix-where, .mail-fix-why { color: var(--muted); }

/* The folders, with the search box at the right of the same line. */
.mail-folder-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 8px; }
.mail-folder-row .group-tabs { margin: 0; }
.mail-search { flex: 1 1 240px; max-width: 360px; margin-left: auto; }
.admin-panel .mail-search input[type="search"] { padding: 5px 8px; }

/* Reply and Move to Trash, in the Mailbox heading beside Check for New Mail. */
.mail-tools { display: inline-flex; gap: 8px; }
.mail-tools:empty { display: none; }
.admin-panel-head:has(.mail-tools) { align-items: center; flex-wrap: wrap; }

/* The facts of the message being read: From and To on one line, the date and
   the files on the next. */
.mail-lines { margin: 0 0 8px; font-size: var(--size-small); }
.mail-line { display: flex; flex-wrap: wrap; gap: 2px 24px; margin-bottom: 2px; }
.mail-line > span { overflow-wrap: anywhere; }
.mail-line b { margin-right: 6px; color: var(--gold-deep); }

/* Read and Compose are tabs on top of the panel they show, not buttons. */
.mail-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.mail-tabs button {
    margin-bottom: -1px;
    padding: 7px 18px;
    background: transparent;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.mail-tabs button:hover { color: var(--text); }
.mail-tabs button.active {
    background: var(--white);
    border-color: var(--line);
    border-top: 2px solid var(--gold);
    color: var(--navy);
}
.mail-view > .admin-panel { border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }

/* One row under the message: Attach Files, the counts, and Send at the
   right. Nothing below it takes room until there is something to show. */
.mail-send-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mail-send-row .field-note { margin: 0; }
.mail-send-row .field-note:empty { display: none; }
.mail-send-row #mail-send { margin-left: auto; }
#mail-message:empty { display: none; }
#email.admin-body { padding-bottom: 16px; }

/* To, Cc, and Subject are labelled beside their boxes rather than above them. */
.mail-row:has(> input[type="text"]) {
    display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 8px; align-items: center;
}
.mail-row:has(> input[type="text"]) .edit-label { margin: 0; }

/* The marked words (typescript/admin/marked.ts): a layer behind the box holds
   the same text, invisible, so only the marks show through behind the words. */
.marked-field { position: relative; }
.marked-layer {
    position: absolute; inset: 0;
    z-index: 0;
    overflow: hidden;
    box-sizing: border-box;
    margin: 0;
    color: transparent;
    pointer-events: none;
}
.marked-field textarea.is-marked, .marked-field input.is-marked { position: relative; z-index: 1; background: transparent; }
.marked-layer mark { color: transparent; background: var(--gold-soft); border-bottom: 2px solid var(--gold); border-radius: 2px; }
.marked-layer mark.is-current {
    background: var(--gold-soft);
    background: color-mix(in srgb, var(--gold) 38%, transparent);
    border-bottom-width: 3px;
}

/* The email page (/staff/email/): the address above the mailbox. */

.staff-section-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.staff-section-head h2 { margin: 0; }

/* Settings */

.settings-panel + .settings-panel { margin-top: 14px; }
/* A list setting takes the full width: its box sits under its words. */
.setting-row.setting-row-list { grid-template-columns: 1fr; gap: 6px; }
.setting-list { width: 100%; }
.setting-row {
    display: grid; grid-template-columns: minmax(0, 1fr) 260px;
    gap: 14px; align-items: start;
    padding: 11px 0;
    border-top: 1px solid var(--line);
}
/* Room for a value and its Save on one line. */
.setting-row:not(.setting-row-list) { grid-template-columns: minmax(0, 1fr) 320px; }
.setting-text label { font-weight: 700; color: var(--navy); font-size: var(--size-normal); }
.setting-text .field-note { margin: 4px 0; }
.setting-range { margin: 0; color: var(--gold-deep); font-size: var(--size-small); }
.setting-number { display: inline-flex; align-items: center; gap: 10px; }
/* Each setting's own Save, at the end of the line its value is on. */
.setting-control { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.setting-control .setting-saved { flex-basis: 100%; }
.setting-save { padding: 4px 12px; font-size: var(--size-small); }
.setting-save:disabled { opacity: 0.45; cursor: default; }
.setting-row-list .setting-control .setting-list { flex: 1 1 240px; width: auto; }
.setting-number input {
    width: 110px;
    padding: 8px 10px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    font: inherit;
    text-align: right;
}
.setting-number input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(42, 154, 168, 0.2); }
.setting-unit { color: var(--muted); font-size: var(--size-small); }
.setting-saved { min-height: 1.2em; margin: 6px 0 0; color: var(--good); font-size: var(--size-small); font-weight: 600; }
.setting-saved.bad { color: var(--bad); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
    position: relative;
    width: 50px; height: 28px;
    background: #cfc6b4;
    border-radius: 99px;
    transition: background 0.2s;
}
.switch-track::after {
    content: "";
    position: absolute; top: 3px; left: 3px;
    width: 22px; height: 22px;
    background: var(--white);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s;
}
.switch input:checked + .switch-track { background: var(--gold-deep); }
.switch input:checked + .switch-track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--teal); outline-offset: 2px; }
.switch-text { font-weight: 700; color: var(--navy); }

/* Contacts */

.list-new { margin-left: auto; padding: 8px 11px; font-size: var(--size-normal); }

.group-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 7px; }
.group-tabs button {
    padding: 6px 10px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 99px;
    color: var(--navy);
    font: inherit;
    font-size: var(--size-normal);
    font-weight: 600;
    cursor: pointer;
}
.group-tabs button:hover { border-color: var(--gold); }
.group-tabs button.active { background: var(--navy); border-color: var(--navy); color: var(--gold-bright); }

.group-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: var(--size-small);
    font-weight: 700;
}
.group-customer { background: #e3f1f3; color: #1d6f79; }
.group-contractor { background: var(--gold-soft); color: var(--gold-deep); }
.group-supplier { background: #e8ecf1; color: var(--navy); }

/* A contact's fields, three across: they share the employee screen's field
   rules below, with rows of their own. */
.contact-fields .field-row.field-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* A row as many columns wide as it has fields showing: Business type comes
   and goes with the group. */
.contact-fields .field-row.field-row-flow { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-columns: none; }
.contact-fields .field-row.field-row-street { grid-template-columns: 2fr 1.3fr 0.6fr 0.9fr; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
    display: inline-block;
    padding: 2px 10px;
    background: var(--gold-soft);
    border: 1px solid #e3d3b0;
    border-radius: 99px;
    color: var(--gold-deep);
    font: inherit;
    font-size: var(--size-small);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.tag-chip:hover { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.data-table td.tag-list { display: table-cell; }
.data-table td.tag-list .tag-chip { margin: 2px 4px 2px 0; }

.interaction { border-top: 1px solid var(--line); }
.interaction summary {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 7px;
    padding: 4px 0;
    cursor: pointer;
    list-style: none;
}
.interaction summary::-webkit-details-marker { display: none; }
.interaction summary::before { content: "\25B8"; color: var(--gold-deep); }
.interaction[open] summary::before { content: "\25BE"; }
.interaction summary .field-note { margin: 0; }
/* Create Project, at the right end of an interaction's line. */
.interaction summary .interaction-project { margin-left: auto; padding: 3px 10px; font-size: var(--size-small); }
.interaction-kind {
    padding: 2px 10px;
    background: var(--navy);
    border-radius: 99px;
    color: var(--gold-bright);
    font-size: var(--size-small);
    font-weight: 700;
}
/* An interaction's answers, compact: each label beside its answer, as many
   to a line as fit; a long answer (the description) takes a line of its own. */
.interaction-details {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 2px 16px;
    margin: 0 0 6px 12px;
    font-size: var(--size-small);
}
.interaction-fact { display: flex; gap: 6px; min-width: 0; }
.interaction-fact.wide { grid-column: 1 / -1; }
.interaction-fact dt { flex: none; font-weight: 700; color: var(--gold-deep); }
.interaction-fact dd { margin: 0; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.interaction-files { margin: 0 0 6px 12px; display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: var(--size-small); }
.interaction-contact { margin: 0 0 4px 12px; font-size: var(--size-small); }
.interaction-contact b { margin-right: 6px; color: var(--gold-deep); }
/* The Project line on an interaction, and its list. */
.interaction-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 4px 12px; font-size: var(--size-small); }
.interaction-line b { color: var(--gold-deep); }
.interaction-line select {
    max-width: 100%;
    padding: 2px 6px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
}
.interaction-line .field-note { margin: 0; }
.interaction-project-saved.bad { color: var(--bad); font-weight: 700; }

/* A contact's active projects, one line each. */
.project-row {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
    padding: 5px 0;
    border-top: 1px solid var(--line);
    font-size: var(--size-small);
}
.project-row strong { font-size: var(--size-normal); color: var(--navy); }
.project-row b { margin-right: 4px; color: var(--gold-deep); }
.project-row.inactive { opacity: 0.6; }
.interactions-panel > .admin-count { margin: 0 0 6px; }

/* The new project screen (/staff/projects/new/): the customer on one line,
   the fields four to a line, the description, then 12 small months to choose
   the range on, the files, and the buttons at the bottom right. */
.project-form { display: flex; flex-direction: column; gap: 10px; }
.project-customer { margin: 0; font-size: var(--size-normal); }
.project-customer b { margin-right: 6px; color: var(--gold-deep); font-size: var(--size-small); text-transform: uppercase; letter-spacing: 0.1em; }
.project-customer .field-note { margin: 0 0 0 8px; }
.project-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 12px; }
.project-field-name { grid-column: span 2; }
@media (max-width: 640px) { .project-field-name { grid-column: auto; } }
.project-field .edit-label { margin: 0 0 2px; font-size: var(--size-small); }
.project-form input[type="text"], .project-form select, .project-form textarea {
    width: 100%;
    padding: 5px 8px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    font-size: var(--size-normal);
}
.project-form textarea { resize: vertical; }
.project-form input:focus, .project-form select:focus, .project-form textarea:focus {
    outline: none; border-color: var(--teal); box-shadow: 0 0 0 2px rgba(42, 154, 168, 0.2);
}
/* The 5 day week box, lined up with the fields beside it. */
.project-field-check { display: flex; align-items: flex-end; }
.project-check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; font-size: var(--size-normal); cursor: pointer; }
.project-check small { color: var(--muted); font-size: var(--size-small); }
.cal-day.weekend { text-decoration: line-through; }
.project-range-clear { margin-left: auto; padding: 3px 10px; font-size: var(--size-small); }

.project-calendar { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.cal-title { margin-bottom: 2px; font-weight: 700; font-size: var(--size-small); color: var(--navy); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.cal-weekday { text-align: center; color: var(--muted); font-size: var(--size-small); }
.cal-day {
    height: 24px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    font-size: var(--size-small);
    cursor: pointer;
}
.cal-day:hover:not(:disabled) { border-color: var(--gold); }
.cal-day:disabled { color: var(--muted); opacity: 0.45; cursor: default; }
.cal-day.today { border-color: var(--line); font-weight: 700; }
.cal-day.in-range { background: var(--gold-soft); }
.cal-day.start, .cal-day.end { background: var(--gold); color: var(--ink); font-weight: 700; }

.project-form .mail-check-strip .field-note { margin: 0; }
.project-form .mail-check-strip .field-note:empty { display: none; }
.project-form .mail-file-list { margin: 6px 0 0; }
.project-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.project-actions .form-message { flex: 1 1 200px; margin: 0; min-height: 0; }

/* The project details screen (/staff/projects/project/): the summary, then
   the planner the full width of the page, then the commits. */
.project-facts { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: var(--size-small); }
.project-fact b { margin-right: 6px; color: var(--gold-deep); }
.project-description { margin: 6px 0 0; font-size: var(--size-small); white-space: pre-wrap; }
.project-page .interaction-files { margin: 6px 0 0; }
.project-page .interaction-files b { color: var(--gold-deep); }

.project-planner { margin: 14px 0; padding: 0 8px; }
.planner-tools {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
    margin-bottom: 6px; padding: 6px 8px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: var(--size-small);
}
/* While editing, the timeline's heading (Save, Cancel) and the tools under it
   stay at the top of the window, under the site's header, as the weeks scroll
   past (--planner-top and --planner-head are measured in plannerStickSizes). */
.project-timeline.editing .project-section-head {
    position: sticky; top: var(--planner-top, 0px); z-index: 20;
    margin: -10px -8px 8px; padding: 10px 8px 4px;
    background: var(--white);
}
.project-planner.editing .planner-tools {
    position: sticky; top: calc(var(--planner-top, 0px) + var(--planner-head, 0px)); z-index: 20;
    box-shadow: 0 6px 12px -8px rgba(15, 25, 35, 0.45);
}
.planner-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
/* Ghost: other projects' phases with this project's employees, shown for ten
   seconds under this project's own rows, faded and dashed, in the phase's
   colour. Pointed at, the tooltip names the project and phase; while a drag
   is on they let the pointer through. */
.planner-ghost {
    position: relative; z-index: 2;
    align-self: start;
    height: 21px; margin: 1px 1px 0; padding: 0 6px;
    overflow: visible;
    border: 1px dashed rgba(22, 40, 58, 0.45);
    border-radius: var(--radius);
    color: var(--text);
    font-size: var(--size-small); font-style: italic; line-height: 19px;
    white-space: nowrap;
    opacity: 0.6;
    cursor: default;
    animation: planner-ghost-in 0.3s ease-out;
}
.project-planner.dragging .planner-ghost { pointer-events: none; }
@keyframes planner-ghost-in { from { opacity: 0; } to { opacity: 0.6; } }
/* Ghost's tooltip explains it, below the button, as the heading may be held
   at the top of the window, and leftward, as the button is at the right. */
.planner-ghost-button { position: relative; }
.planner-ghost-button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--white); }
.planner-ghost-button::after {
    content: attr(data-tip);
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
    width: 280px; padding: 5px 8px;
    background: var(--navy);
    border-top: 2px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    color: var(--white);
    font-family: inherit; font-size: var(--size-small); font-weight: 400;
    letter-spacing: normal; text-align: left; text-transform: none;
    white-space: normal;
    opacity: 0; visibility: hidden;
    transition: opacity 0.12s;
    pointer-events: none;
}
.planner-ghost-button:hover::after, .planner-ghost-button:focus-visible::after { opacity: 1; visibility: visible; }
.planner-group .field-note { margin: 0; }
.planner-group .button { padding: 3px 10px; font-size: var(--size-small); }
.planner-group select {
    padding: 3px 6px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
}
.project-planner > .form-message { min-height: 0; margin: 0 0 4px; }
.project-planner > .form-message:empty { display: none; }

/* The weekday names on 7 columns; each week on 84, 12 hour blocks a day, so a
   phase can begin and end on any hour. Weeks sit 4px apart. */
.planner-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.planner-week { display: grid; grid-template-columns: repeat(84, minmax(0, 1fr)); }
.planner-weekdays span {
    padding: 3px 0;
    color: var(--gold-deep);
    font-size: var(--size-small);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-align: center;
}
.planner-weeks { display: flex; flex-direction: column; gap: 4px; background: var(--white); }
.planner-week {
    min-height: 56px; row-gap: 2px;
    background: var(--white);
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}
.planner-day {
    z-index: 1;
    display: flex; align-items: flex-start; justify-content: flex-end;
    padding: 2px 5px;
    background: transparent;
    border: 0;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font: inherit;
    font-size: var(--size-small);
    cursor: default;
}
/* The preliminary range: a band behind the days, round where the project
   starts and ends, with a grip at each end to drag while editing. */
.planner-band { position: relative; z-index: 0; background: var(--gold-soft); }
.planner-band.cap-start { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.planner-band.cap-end { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.planner-grip { position: absolute; top: 0; bottom: 0; z-index: 3; width: 8px; cursor: ew-resize; touch-action: none; }
.planner-date-grip { z-index: 3; width: 10px; background: var(--gold); cursor: ew-resize; touch-action: none; }
.planner-date-grip.grip-start { justify-self: start; border-radius: 8px 0 0 8px; }
.planner-date-grip.grip-end { justify-self: end; border-radius: 0 8px 8px 0; }
.planner-date-grip:hover { background: var(--gold-deep); }
.planner-bar .grip-start { left: 0; }
.planner-bar .grip-end { right: 0; }
.planner-bar .planner-grip:hover, .project-planner.dragging .planner-bar.chosen .planner-grip { background: rgba(0, 0, 0, 0.18); }
.project-planner.dragging, .project-planner.dragging * { cursor: ew-resize !important; user-select: none; }
/* The date, drawn over any phase at the top of its day, and never in the
   way of the pointer: clicks and drags go to what is underneath. */
.planner-date {
    z-index: 4;
    justify-self: end; align-self: start;
    padding: 2px 5px;
    color: var(--muted);
    font-size: var(--size-small);
    line-height: 18px;
    pointer-events: none;
}
.planner-date.today span { padding: 0 5px; background: var(--navy); border-radius: 99px; color: var(--gold-bright); }
.project-planner.editing .planner-day { cursor: pointer; }
.project-planner.editing .planner-day:hover { box-shadow: inset 0 0 0 2px var(--gold); }
.planner-day.no-line { border-right-color: transparent; }
.planner-day.chosen { box-shadow: inset 0 0 0 2px var(--teal); background: rgba(42, 154, 168, 0.18); }

/* A phase: a bar under the days it covers. Eight colours, see through enough
   to read in either theme. A bar that carries on from the week before, or
   into the next, is square at that end. */
.planner-bar {
    position: relative;
    z-index: 2;
    align-self: start;
    height: 21px;
    margin: 1px 1px 0;
    padding: 0 6px;
    overflow: visible;
    border: 0;
    border-left: 3px solid;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    font-size: var(--size-small);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
}
/* A name too long for its bar runs on past the end of it. */
.planner-bar-name { position: relative; z-index: 1; white-space: nowrap; }
/* The phase's resources, written under its bar. */
.planner-bar-who {
    z-index: 2;
    align-self: end;
    margin: 0 1px 1px;
    padding: 0 6px;
    overflow: visible;
    color: var(--muted);
    font-size: var(--size-small);
    line-height: 14px;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

/* The resources dialog: staff and contractors, each with a box to tick. */
.resource-group { margin: 8px 0 4px; font-size: var(--size-small); color: var(--gold-deep); text-transform: uppercase; letter-spacing: 0.1em; }
.resource-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; max-height: 40vh; overflow-y: auto; }
.resource-item { display: flex; align-items: baseline; gap: 6px; font-size: var(--size-small); cursor: pointer; }
.resource-item small { color: var(--muted); }
.project-planner.editing .planner-bar { touch-action: none; }
/* A phase with a note carries a small mark after its name. */
.planner-bar.has-note .planner-bar-name::after { content: " \270E"; color: var(--gold-deep); }

/* The themed tooltip over a phase: what it is, and its note. */
.planner-tip {
    position: fixed; z-index: 250;
    max-width: 340px;
    padding: 6px 10px;
    background: var(--navy);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: rgba(255, 255, 255, 0.92);
    font-size: var(--size-small);
    pointer-events: none;
}
.planner-tip strong { display: block; color: var(--gold-bright); font-weight: 600; }
.planner-tip > span { display: block; }
.planner-tip-note { display: block; margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* The note dialog, over the page. */
.note-dialog {
    width: min(560px, 92vw);
    padding: 14px;
    background: var(--white);
    border-top: 4px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.note-dialog h2 { margin: 0; font-size: var(--size-big); }
.note-dialog > .field-note { margin: 0 0 8px; }
.note-dialog .edit-label { margin: 0; font-size: var(--size-small); }
.note-dialog textarea, .note-dialog input[type="password"] {
    width: 100%;
    padding: 5px 8px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    resize: vertical;
}
.note-dialog textarea:focus, .note-dialog input[type="password"]:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 2px rgba(42, 154, 168, 0.2); }
.note-dialog input[type="password"] { margin-bottom: 8px; }
.note-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.note-actions .button { padding: 5px 14px; font-size: var(--size-small); }
.planner-bar.goes-back { margin-left: 0; border-left-width: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.planner-bar.goes-on { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.project-planner.editing .planner-bar { cursor: grab; }
.planner-bar.chosen { outline: 2px solid var(--teal); outline-offset: -2px; }
.planner-bar.c0, .planner-ghost.c0, .ws-project > .c0 { background: rgba(214, 69, 65, 0.28); border-color: #d64541; }
.planner-bar.c1, .planner-ghost.c1, .ws-project > .c1 { background: rgba(230, 126, 34, 0.28); border-color: #e67e22; }
.planner-bar.c2, .planner-ghost.c2, .ws-project > .c2 { background: rgba(196, 163, 110, 0.36); border-color: #c4a36e; }
.planner-bar.c3, .planner-ghost.c3, .ws-project > .c3 { background: rgba(46, 160, 67, 0.26); border-color: #2ea043; }
.planner-bar.c4, .planner-ghost.c4, .ws-project > .c4 { background: rgba(42, 154, 168, 0.28); border-color: #2a9aa8; }
.planner-bar.c5, .planner-ghost.c5, .ws-project > .c5 { background: rgba(52, 104, 204, 0.26); border-color: #3468cc; }
.planner-bar.c6, .planner-ghost.c6, .ws-project > .c6 { background: rgba(142, 68, 173, 0.26); border-color: #8e44ad; }
.planner-bar.c7, .planner-ghost.c7, .ws-project > .c7 { background: rgba(120, 120, 120, 0.28); border-color: #888888; }

.commit-tools { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.admin-panel .commit-tools input[type="text"] { width: 240px; padding: 4px 8px; font-size: var(--size-small); }
.commit-tools .button { padding: 4px 12px; font-size: var(--size-small); }
.project-commits .admin-panel-head { align-items: center; flex-wrap: wrap; }
.project-commits > .field-note { margin: 0 0 6px; }
.commit-row { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 4px 0; border-top: 1px solid var(--line); font-size: var(--size-small); }
.commit-row strong { color: var(--navy); }
.commit-note { color: var(--muted); }
.commit-compare { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 8px; font-size: var(--size-small); }
.commit-compare select {
    padding: 3px 6px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
}
.commit-compare .button { padding: 3px 10px; font-size: var(--size-small); }
.commit-changes { margin: 6px 0 0; padding-left: 18px; font-size: var(--size-small); }
.commit-changes:empty { display: none; }
.commit-changes .bad { color: var(--bad); }
.project-commits > .form-message:empty { display: none; }

/* The project screen's sections: Summary, Notes, Timeline, and Commits, each
   opened and collapsed with its chevron. The Timeline runs the full width of
   the page. */
.project-section + .project-section, .project-page > .shell + .project-timeline,
.project-timeline + .shell > .project-section { margin-top: 12px; }
.project-section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.project-section-head h2 { margin: 0; font-size: var(--size-big); }
.project-section.collapsed .project-section-head { margin-bottom: 0; }
.project-section.collapsed .project-section-body { display: none; }
.section-tools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.section-tools .button { padding: 4px 12px; font-size: var(--size-small); }
.section-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--gold-deep);
    cursor: pointer;
}
.section-toggle::before {
    content: "";
    width: 7px; height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.2s;
}
.project-section.collapsed .section-toggle::before { transform: rotate(-45deg); }
.section-toggle:hover { border-color: var(--gold); }
.project-timeline { padding: 10px 8px; background: var(--white); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.project-timeline .project-planner { margin: 0; padding: 0; }

/* Editing the summary. */
.summary-form { display: flex; flex-direction: column; gap: 8px; }
.summary-form input[type="text"], .summary-form select, .summary-form textarea {
    width: 100%;
    padding: 5px 8px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    font-size: var(--size-normal);
}
.summary-form textarea { resize: vertical; }
.project-section-body > .form-message { margin: 6px 0 0; min-height: 0; }
.project-section-body > .form-message:empty { display: none; }

/* The notes, each headed by its phase, resources, start, and length. A
   click makes the phase's bar glow on the timeline. */
.admin-panel .notes-search { width: 260px; padding: 4px 8px; font-size: var(--size-small); }
.project-notes { display: flex; flex-direction: column; }
.project-note {
    display: flex; flex-direction: column; gap: 2px;
    width: 100%;
    padding: 6px 4px;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--line);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.project-note:hover { background: var(--surface-alt); }
.project-note-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; color: var(--muted); font-size: var(--size-small); }
.project-note-head .phase-name, .overview-row .phase-name { padding: 0 6px; border-left: 3px solid; border-radius: var(--radius); color: var(--text); }
.project-note-head .phase-name.c0, .overview-row .phase-name.c0 { background: rgba(214, 69, 65, 0.28); border-color: #d64541; }
.project-note-head .phase-name.c1, .overview-row .phase-name.c1 { background: rgba(230, 126, 34, 0.28); border-color: #e67e22; }
.project-note-head .phase-name.c2, .overview-row .phase-name.c2 { background: rgba(196, 163, 110, 0.36); border-color: #c4a36e; }
.project-note-head .phase-name.c3, .overview-row .phase-name.c3 { background: rgba(46, 160, 67, 0.26); border-color: #2ea043; }
.project-note-head .phase-name.c4, .overview-row .phase-name.c4 { background: rgba(42, 154, 168, 0.28); border-color: #2a9aa8; }
.project-note-head .phase-name.c5, .overview-row .phase-name.c5 { background: rgba(52, 104, 204, 0.26); border-color: #3468cc; }
.project-note-head .phase-name.c6, .overview-row .phase-name.c6 { background: rgba(142, 68, 173, 0.26); border-color: #8e44ad; }
.project-note-head .phase-name.c7, .overview-row .phase-name.c7 { background: rgba(120, 120, 120, 0.28); border-color: #888888; }
/* The budget: line items and amounts, the amounts to the right, and a total. */
.project-budget { display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; }
.project-budget + .form-message { max-width: 720px; margin-left: auto; margin-right: auto; }
.budget-row {
    display: grid; grid-template-columns: minmax(0, 1fr) 140px; align-items: center; gap: 8px;
    padding: 3px 4px;
    border-top: 1px solid var(--line);
    font-size: var(--size-small);
}
.budget-money { text-align: right; font-variant-numeric: tabular-nums; }
.budget-total { border-top: 2px solid var(--gold); font-weight: 700; }
.budget-total > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.budget-editing-row { grid-template-columns: minmax(0, 1fr) 140px 24px; }
.budget-total:has(#budget-add) { grid-template-columns: auto minmax(0, 1fr) 140px 24px; }
.budget-total:has(#budget-add)::after { content: ""; }
.budget-total #budget-add { padding: 3px 10px; font-size: var(--size-small); }
.budget-total:has(#budget-add) > span:first-of-type { text-align: right; }
.project-budget input[type="text"] {
    width: 100%;
    padding: 3px 6px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
}
.project-budget .budget-amount { text-align: right; }
/* Payments, under the budget: the day paid, a note, and the amount. */
.budget-heading { margin: 12px 0 4px; font-size: var(--size-small); color: var(--gold-deep); text-transform: uppercase; letter-spacing: 0.1em; }
.payment-row {
    display: grid; grid-template-columns: 120px minmax(0, 1fr) 140px; align-items: center; gap: 8px;
    padding: 3px 4px;
    border-top: 1px solid var(--line);
    font-size: var(--size-small);
}
.payment-note-text { color: var(--muted); overflow-wrap: anywhere; }
.payment-editing-row { grid-template-columns: 150px minmax(0, 1fr) 140px 24px; }
.project-budget input[type="date"] {
    width: 100%;
    padding: 2px 6px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
}
.budget-total:has(#payment-add) { grid-template-columns: auto minmax(0, 1fr) 140px 24px; }
.budget-total:has(#payment-add)::after { content: ""; }
.budget-total #payment-add { padding: 3px 10px; font-size: var(--size-small); }
.budget-total:has(#payment-add) > span:first-of-type { text-align: right; }
/* Cushion and Balance due, under their totals. */
.budget-left { border-top: 0; font-weight: 600; }
.budget-left small { margin-left: 6px; color: var(--muted); font-weight: 400; }
.budget-left .budget-money.bad { color: var(--bad); }
.budget-left-editing { grid-template-columns: minmax(0, 1fr) 140px 24px; }
.budget-left-editing > span:first-child { text-align: right; }
.budget-left-editing > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.budget-left-editing::after { content: ""; }
.budget-remove { background: none; border: 0; color: var(--muted); font-size: var(--size-big); line-height: 1; cursor: pointer; }
.budget-remove:hover { color: var(--bad); }

/* Photos: thumbnails in a grid, each with its caption under it. */
.project-page > .shell + .shell { margin-top: 12px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo-item { position: relative; margin: 0; }
.photo-thumb {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    overflow: hidden;
    background: var(--stone);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: zoom-in;
}
.photo-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-thumb:hover { border-color: var(--gold); }
.photo-none { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: var(--size-small); }
/* A video's thumbnail carries a play mark. */
.photo-thumb.is-video::after {
    content: "\25B6";
    position: absolute; left: 50%; top: 50%;
    width: 36px; height: 36px;
    margin: -18px 0 0 -18px;
    background: rgba(15, 25, 35, 0.65);
    border-radius: 50%;
    color: #fff;
    font-size: 15px;
    line-height: 36px;
    text-align: center;
}
.photo-remove {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px;
    padding: 0;
    background: rgba(15, 25, 35, 0.65);
    border: 0;
    border-radius: 50%;
    color: #fff;
    font-size: var(--size-normal);
    line-height: 22px;
    cursor: pointer;
}
.photo-remove:hover { background: var(--bad); }
.photo-caption { margin: 3px 0 0; font-size: var(--size-small); overflow-wrap: anywhere; cursor: text; }
.photo-caption-empty { color: var(--muted); font-style: italic; }
.photo-caption input {
    width: 100%;
    padding: 2px 6px;
    background: var(--paper);
    border: 1px solid var(--teal);
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
}
.project-section-head .section-tools .field-note { margin: 0; }
#photos-upload { cursor: pointer; }

/* The overview: every phase from start to finish, one line each, in columns. */
.project-overview { display: flex; flex-direction: column; }
.overview-row {
    display: grid; grid-template-columns: minmax(120px, 1.2fr) minmax(150px, 1.4fr) minmax(90px, 0.9fr) minmax(0, 2fr);
    align-items: baseline; gap: 2px 12px;
    width: 100%;
    padding: 4px;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--line);
    color: var(--text);
    font: inherit;
    font-size: var(--size-small);
    text-align: left;
    cursor: pointer;
}
.overview-row:hover { background: var(--surface-alt); }
.overview-row .phase-name { justify-self: start; }
.overview-who { color: var(--muted); overflow-wrap: anywhere; }
.overview-row:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
/* The project manager's resources: a grid of names, each a link to their
   page, with Email and Text icons to its left that show a tooltip. The
   columns line up from row to row. */
.overview-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 12px; }
.overview-person { display: flex; align-items: center; gap: 2px; min-width: 0; }
.overview-person a { flex: 1 1 auto; min-width: 0; }
/* The icons come first, left of the name, whatever order they are written in. */
.overview-person .overview-reach, .overview-person .overview-reach-none { flex: 0 0 24px; order: -1; }
/* The icons keep their place but show only while that name (or its icons)
   is hovered or has the keyboard; on a touch screen, with no hover, they
   always show. */
@media (hover: hover) {
    .overview-reach { visibility: hidden; }
    .overview-person:hover .overview-reach, .overview-person:focus-within .overview-reach { visibility: visible; }
}
.overview-person a { overflow: hidden; color: var(--navy); font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.overview-reach {
    position: relative;
    display: inline-grid; place-items: center;
    width: 24px; height: 22px;
    padding: 0;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--teal);
    cursor: pointer;
}
.overview-reach svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.overview-reach:hover, .overview-reach:focus-visible { border-color: var(--teal); background: var(--white); outline: none; }
.overview-reach::after {
    content: attr(data-tip);
    position: absolute; bottom: calc(100% + 6px); left: 50%; z-index: 20;
    padding: 3px 7px;
    background: var(--navy);
    border-top: 2px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    color: var(--white);
    font-size: var(--size-small); font-weight: 400;
    white-space: nowrap;
    transform: translateX(-50%);
    opacity: 0; visibility: hidden;
    transition: opacity 0.12s;
    pointer-events: none;
}
.overview-reach:hover::after, .overview-reach:focus-visible::after { opacity: 1; visibility: visible; }
.note-dialog .reach-subject {
    width: 100%;
    margin-bottom: 6px;
    padding: 5px 7px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    font: inherit; font-size: var(--size-normal);
}
@media (max-width: 640px) { .overview-row { grid-template-columns: 1fr 1fr; } }
.project-note-text { font-size: var(--size-small); white-space: pre-wrap; overflow-wrap: anywhere; }

/* The glow around a phase's bar after its note is clicked: ten seconds. */
@keyframes planner-glow {
    0%, 100% { box-shadow: 0 0 0 2px var(--gold), 0 0 6px 2px rgba(216, 189, 138, 0.5); }
    50% { box-shadow: 0 0 0 2px var(--gold-bright), 0 0 16px 6px rgba(216, 189, 138, 0.95); }
}
.planner-bar.glow { z-index: 3; animation: planner-glow 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
    .planner-bar.glow { animation: none; box-shadow: 0 0 0 3px var(--gold-bright); }
}

/* One employee */

.admin-head .eyebrow a { color: inherit; text-decoration: none; }
.admin-head .eyebrow a:hover { color: var(--white); }

.employee-head { flex-wrap: wrap; }
.employee-tools { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.employee-tools .button { padding: 8px 12px; font-size: var(--size-normal); }
.employee-tools .button:disabled { opacity: 0.4; cursor: not-allowed; }

.employee-record { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 19px; align-items: start; }
.employee-side { display: grid; gap: 10px; justify-items: center; }
.employee-photo {
    display: flex; align-items: center; justify-content: center;
    width: 200px; height: 300px;
    overflow: hidden;
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.employee-photo img { width: 200px; height: 300px; object-fit: cover; }
.employee-nobody { width: 100%; height: 100%; fill: #d8cfbd; }
.employee-side .button { padding: 8px 10px; font-size: var(--size-normal); }

.employee-fields .field-row, .contact-fields .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.employee-fields .field-row-address, .contact-fields .field-row-address { grid-template-columns: 2fr 1fr 1fr; }
.employee-fields .field, .contact-fields .field { margin-bottom: 8px; }
/* A list is exactly as tall as a box, so a row of them lines up. */
.employee-fields .field input:not([type="checkbox"]):not([type="file"]), .employee-fields .field select,
.contact-fields .field input:not([type="checkbox"]):not([type="file"]), .contact-fields .field select {
    box-sizing: border-box;
    height: 36px;
}
.employee-fields .field label, .contact-fields .field label {
    font-family: var(--font-head);
    font-size: var(--size-normal);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold-deep);
}
.field-value { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); min-height: 2.4em; }
.field-error { margin: 2px 0 0; color: var(--bad); font-size: var(--size-small); font-weight: 600; }
.field-error:empty { display: none; }
.field.has-error input, .field.has-error select { border-color: var(--bad); }

.field-note-tight { margin: -8px 0 8px; }

.field-active { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.field-active .check {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: var(--size-normal);
    letter-spacing: 0.1em;
    cursor: pointer;
}
.field-active .check input { width: 20px; height: 20px; accent-color: var(--gold-deep); cursor: pointer; }
.field-active .check input:disabled { cursor: not-allowed; }
.field-active .field-note { margin: 4px 0 0; }

.employee-notes-panel { margin-top: 14px; }
.employee-note-form textarea {
    width: 100%;
    padding: 7px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    font: inherit;
    font-size: var(--size-normal);
    resize: vertical;
}
.employee-note { padding: 8px 0; border-top: 1px solid var(--line); }
.employee-note p { margin: 6px 0 0; white-space: pre-wrap; }
.employee-note-head { display: flex; align-items: baseline; gap: 7px; }
.employee-note-head .field-note { margin: 0; }
.note-remove {
    margin-left: auto;
    width: 30px; height: 30px;
    background: none;
    border: 1px solid transparent;
    border-radius: 50%;
    color: var(--muted);
    font-size: var(--size-big);
    line-height: 1;
    cursor: pointer;
}
.note-remove:hover { border-color: var(--bad); color: var(--bad); }

/* The photo crop box (the overlay itself, and the photo viewer, are in site.css) */

.crop-dialog {
    width: min(640px, 92vw);
    padding: 14px;
    background: var(--white);
    border-top: 4px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.crop-dialog h2 { margin-bottom: 6px; }
.crop-stage { position: relative; display: inline-block; max-width: 100%; margin-top: 8px; user-select: none; }
.crop-picture { display: block; max-width: 100%; max-height: 60vh; width: auto; }
.crop-frame {
    position: absolute;
    border: 2px solid var(--gold-bright);
    box-shadow: 0 0 0 9999px rgba(15, 25, 35, 0.55);
    cursor: move;
    touch-action: none;
}
.crop-grip {
    position: absolute; right: 0; bottom: 0;
    width: 16px; height: 16px;
    background: var(--gold-bright);
    border: 2px solid var(--navy);
    border-radius: 50%;
    cursor: nwse-resize;
}
.crop-stage { overflow: hidden; }
/* The picture being cropped sits in the middle of the dialog. */
.crop-dialog .crop-stage { display: block; width: fit-content; margin-left: auto; margin-right: auto; }

@media (max-width: 960px) {
    .split-console { grid-template-columns: 1fr; }
    .console-side { position: static; max-height: 40vh; }
    .setting-row, .setting-row:not(.setting-row-list) { grid-template-columns: 1fr; gap: 10px; }
    .mail-split { grid-template-columns: 1fr; }
    .mail-list { max-height: 40vh; }
    .edit-form.is-history .edit-panes { grid-template-columns: minmax(0, 1fr); }
    .edit-pane-past .linedwrap, .edit-form.is-history .linedwrap { height: 30vh; }
    .employee-record { grid-template-columns: 1fr; justify-items: center; }
    .employee-fields { width: 100%; }
}

@media (max-width: 640px) {
    .employee-fields .field-row, .employee-fields .field-row-address,
    .contact-fields .field-row.field-row-3, .contact-fields .field-row.field-row-street, .contact-fields .field-row { grid-template-columns: 1fr; }
    .contact-fields .field-row.field-row-flow { grid-auto-flow: row; }
    .employee-tools { margin-left: 0; }
}

/* Messages between users, /staff/messages/ (typescript/shared/messages.ts).
   Inbox and Sent on the left, the form to write on the right. */

.messages-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    grid-template-areas: "inbox compose" "sent compose";
    gap: 12px;
    align-items: start;
}
.messages-inbox { grid-area: inbox; }
.messages-sent { grid-area: sent; }
.messages-compose { grid-area: compose; position: sticky; top: 72px; }

.message-list { display: flex; flex-direction: column; gap: 4px; }
.message-empty { margin: 0; color: var(--muted); font-size: var(--size-small); }

.message-card {
    border: 1px solid var(--line);
    border-left: 3px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
}
.message-card.is-unread { border-left-color: var(--gold); background: var(--gold-soft); }
.message-card.is-open { border-color: var(--teal); }
.message-card.is-arrived { box-shadow: 0 0 0 3px rgba(42, 154, 168, 0.3); }

.message-head {
    display: flex; align-items: baseline; gap: 8px;
    width: 100%;
    padding: 5px 8px;
    background: none; border: 0;
    color: var(--text);
    font: inherit; font-size: var(--size-normal);
    text-align: left;
    cursor: pointer;
}
.message-who { flex: 0 0 auto; color: var(--navy); }
.message-card.is-unread .message-who { font-weight: 700; }
.message-preview { flex: 1; min-width: 0; overflow: hidden; color: var(--muted); font-size: var(--size-small); white-space: nowrap; text-overflow: ellipsis; }
.message-side { flex: 0 0 auto; display: flex; align-items: baseline; gap: 6px; color: var(--muted); font-size: var(--size-small); }
.message-state { font-weight: 700; color: var(--gold-deep); }
.message-state.is-read { color: var(--good); }

.message-body { padding: 0 8px 7px; }
.message-text { margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-body .field-note { margin: 0 0 6px; }
.message-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-panel .message-actions .button { padding: 4px 10px; font-size: var(--size-small); }
.message-actions .is-confirming { border-color: var(--bad); color: var(--bad); }

.compose-form { display: flex; flex-direction: column; gap: 6px; }
.compose-row { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.compose-form select, .compose-form textarea {
    width: 100%;
    padding: 5px 7px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit; font-size: var(--size-normal);
}
.compose-row select { flex: 1; width: auto; min-width: 0; }
.compose-form textarea { resize: vertical; }
.compose-form select:focus, .compose-form textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(42, 154, 168, 0.2); }
.compose-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.compose-foot .form-message { flex: 1; margin: 0; min-height: 0; font-size: var(--size-small); }
.admin-panel .compose-foot .button { padding: 6px 16px; }
#compose-remaining.bad { color: var(--bad); }

@media (max-width: 860px) {
    .messages-layout { grid-template-columns: 1fr; grid-template-areas: "compose" "inbox" "sent"; }
    .messages-compose { position: static; }
    .message-preview { display: none; }
}

/* Mail Merge, /admin/mail-merge/ (typescript/admin/mailmerge.ts). The forms,
   the chosen form, and the fields side by side; the events below. */

.merge-tools { display: flex; gap: 6px; }
.admin-panel .merge-tools .button, .admin-panel .merge-foot .button { padding: 5px 12px; font-size: var(--size-small); }
.merge-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr) 230px; gap: 12px; align-items: start; }

.merge-forms { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.merge-form {
    display: flex; flex-direction: column; gap: 1px;
    width: 100%;
    padding: 5px 8px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-left: 3px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    font: inherit; font-size: var(--size-normal);
    text-align: left;
    cursor: pointer;
}
.merge-form small { color: var(--muted); font-size: var(--size-small); }
.merge-form:hover { border-left-color: var(--gold); }
.merge-form.is-chosen { border-color: var(--teal); border-left-color: var(--gold); background: var(--gold-soft); }

.merge-editor { display: flex; flex-direction: column; gap: 5px; }
.merge-row { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.merge-text-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-weight: 600; }
.merge-text-head .field-note { margin: 0; font-weight: 400; }
.merge-text-head .field-note.bad { color: var(--bad); }
.merge-editor input[type="text"], .merge-editor textarea, .merge-fields input[type="search"], .merge-events select {
    padding: 5px 7px;
    background: var(--paper);
    border: 1px solid #cfc6b4;
    border-radius: var(--radius);
    color: var(--text);
    font: inherit; font-size: var(--size-normal);
}
.merge-row input[type="text"] { flex: 1; min-width: 0; }
.merge-editor textarea { width: 100%; resize: vertical; }
.merge-editor input:focus, .merge-editor textarea:focus, .merge-fields input:focus, .merge-events select:focus {
    outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(42, 154, 168, 0.2);
}
.merge-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.merge-foot > .field-note { flex: 1 1 100%; margin: 0; }
.merge-foot .form-message { flex: 1; margin: 0; min-height: 0; font-size: var(--size-small); }
.merge-dirty { color: var(--gold-deep); font-size: var(--size-small); font-weight: 700; }
.merge-foot .is-confirming { border-color: var(--bad); color: var(--bad); }

.merge-fields input[type="search"] { width: 100%; margin-bottom: 6px; }
.merge-group { margin-bottom: 6px; }
.merge-group h3 { margin: 0 0 3px; color: var(--muted); font-size: var(--size-small); letter-spacing: 0.06em; text-transform: uppercase; }
.merge-field {
    margin: 0 3px 3px 0;
    padding: 2px 7px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--navy);
    font: inherit; font-size: var(--size-small);
    cursor: pointer;
}
.merge-field:hover, .merge-field:focus { border-color: var(--gold); background: var(--gold-soft); outline: none; }
.merge-field.is-generated { border-style: dashed; border-color: var(--gold-deep); }

.merge-tip {
    position: fixed; z-index: 300;
    max-width: 280px;
    padding: 7px 9px;
    background: var(--navy);
    color: var(--white);
    border-top: 3px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: var(--size-small);
    opacity: 0; visibility: hidden;
    transition: opacity 0.12s;
    pointer-events: none;
}
.merge-tip.is-shown { opacity: 1; visibility: visible; }
.merge-tip p { margin: 3px 0 0; }
.merge-tip-head { display: flex; align-items: center; gap: 6px; }
.merge-tip-head code { color: var(--gold-bright); }
.merge-tip-badge { padding: 0 5px; border: 1px dashed var(--gold-bright); border-radius: 999px; }
.merge-tip-example span { opacity: 0.75; }

.merge-events-panel { margin-top: 12px; }
.merge-events { width: 100%; border-collapse: collapse; font-size: var(--size-normal); }
.merge-events th { padding: 4px 6px; color: var(--muted); font-size: var(--size-small); text-align: left; border-bottom: 1px solid var(--line); }
.merge-events td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.merge-event-when { color: var(--muted); font-size: var(--size-small); }

.merge-dialog { width: min(640px, 92vw); max-height: 86vh; overflow: auto; }
.merge-dialog h3 { margin: 10px 0 4px; font-size: var(--size-normal); }
.merge-dialog p { margin: 4px 0; }
.merge-help-list { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; }
.merge-help-list dd { margin: 0; }
.merge-help-notes { margin: 0; padding-left: 18px; }
.merge-formats { width: 100%; border-collapse: collapse; font-size: var(--size-small); }
.merge-formats th, .merge-formats td { padding: 3px 5px; border-bottom: 1px solid var(--line); text-align: left; }
.merge-check { font-weight: 700; }
.merge-check.is-good { color: var(--good); }
.merge-check.is-bad { color: var(--bad); }
.merge-preview-subject { font-weight: 600; }
.merge-preview-text {
    margin: 0;
    padding: 7px 9px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font: inherit; font-size: var(--size-normal);
    white-space: pre-wrap; overflow-wrap: anywhere;
}

@media (max-width: 980px) {
    .merge-layout { grid-template-columns: 1fr; }
    .merge-forms { flex-direction: row; flex-wrap: wrap; }
    .merge-events thead { display: none; }
    .merge-events tr { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
    .merge-events td { border: 0; }
    .merge-events td:nth-child(1), .merge-events td:nth-child(2) { grid-column: 1 / -1; }
}

/* Admin > Employees: the count, then Work Schedule, at the top right. */
.employees-tools { display: flex; align-items: center; gap: 10px; }
.admin-panel .employees-tools .button { padding: 5px 12px; font-size: var(--size-small); }

/* The work schedule, /admin/employees/schedule/ (typescript/admin/schedule.ts),
   taken from test.codebot.org in this site's colours: the full width of the
   window, each employee's name with their days under it, a track from 7 AM to
   7 PM a day and a gold bar for the hours. */

.schedule-wide { padding: 0 16px; }
.schedule-panel { padding: 10px 8px; }
.schedule-panel #schedule-search { width: 100%; padding: 6px 8px; background: var(--paper); border: 1px solid #cfc6b4; border-radius: var(--radius); font: inherit; font-size: var(--size-normal); }
.ws-icon { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* The toolbar and the day names, held at the top of the window under the header. */
.ws-sticky { position: sticky; top: var(--ws-top, 60px); z-index: 30; margin: 0 -8px; padding: 0 8px; background: var(--white); }
.ws-sticky.is-stuck { box-shadow: 0 6px 12px -8px rgba(15, 25, 35, 0.45); }
.ws-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0 6px; }
.ws-toolbar-left, .ws-toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ws-toolbar-right { margin-left: auto; }
.ws-dirty { color: var(--gold-deep); font-size: var(--size-small); font-weight: 700; }
.admin-panel .ws-action { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; font-size: var(--size-small); }

.ws-spin { display: inline-flex; align-items: stretch; height: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); overflow: hidden; }
.ws-spin:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ws-spin-value { display: flex; align-items: center; min-width: 5.2rem; padding: 0 10px; color: var(--navy); font-size: var(--size-small); font-weight: 700; }
.ws-spin-arrows { display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.ws-spin-arrows button { flex: 1 1 0; display: grid; place-items: center; width: 24px; padding: 0; background: none; border: 0; color: var(--navy); cursor: pointer; }
.ws-spin-arrows button + button { border-top: 1px solid var(--line); }
.ws-spin-arrows .ws-icon { width: 12px; height: 12px; }
.ws-spin-arrows button:hover:not(:disabled) { background: var(--gold-soft); }
.ws-spin-arrows button:disabled { opacity: 0.35; cursor: default; }

.ws-step, .ws-filter-button, .ws-select {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 30px;
    padding: 0 9px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--navy);
    font: inherit; font-size: var(--size-small); font-weight: 700;
    cursor: pointer;
}
.ws-step { width: 30px; padding: 0; }
.ws-step:hover:not(:disabled), .ws-filter-button:hover, .ws-select:hover:not(:disabled) { background: var(--gold-soft); border-color: var(--gold); }
.ws-step:disabled, .ws-select:disabled { opacity: 0.4; border-style: dashed; cursor: default; }
.ws-filter { position: relative; }
.ws-filter-menu { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; min-width: 11rem; padding: 6px; background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.ws-filter-menu label { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--radius); font-size: var(--size-small); cursor: pointer; }
.ws-filter-menu label:hover { background: var(--gold-soft); }

/* The days: the heading, then each employee. Every week keeps a 26px gutter
   at its left for the copy button, so the days line up. */
.ws-week { display: grid; grid-template-columns: repeat(var(--days, 7), minmax(0, 1fr)); gap: 6px; }
.ws-head { padding: 5px 0 5px 26px; border-bottom: 2px solid var(--line); color: var(--muted); font-size: var(--size-small); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.ws-head span { text-align: center; }
.ws-head span.is-today { color: var(--teal); }
.ws-grid { position: relative; z-index: 0; }
.ws-today-column { position: absolute; top: 0; bottom: 0; z-index: -1; background: rgba(42, 154, 168, 0.09); pointer-events: none; }
.ws-person { padding: 6px 0 4px; border-bottom: 1px solid var(--line); }
.ws-person.inactive { opacity: 0.6; }
.ws-name { display: flex; align-items: center; gap: 6px; padding: 0 0 3px 26px; }
.ws-name a { color: var(--navy); font-weight: 700; }
.ws-role { color: var(--muted); font-size: var(--size-small); }
.ws-row { position: relative; padding-left: 26px; }
.ws-week-row + .ws-week-row { margin-top: 5px; }
.ws-copy, .ws-away {
    display: inline-grid; place-items: center;
    width: 22px; height: 22px;
    padding: 0;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--navy);
    cursor: pointer;
}
.ws-copy { position: absolute; left: 0; top: 4px; opacity: 0.6; }
.ws-away { opacity: 0; transition: opacity 0.12s; }
.ws-person:hover .ws-away, .ws-away:focus-visible { opacity: 1; }
.ws-copy:hover, .ws-away:hover { opacity: 1; background: var(--gold-soft); border-color: var(--gold); }
.ws-copy .ws-icon, .ws-away .ws-icon { width: 13px; height: 13px; }

.ws-track {
    position: relative;
    min-height: 26px;
    background-color: var(--surface-alt);
    background-image: repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px calc(100% / var(--hours)));
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.ws-track.is-off { background-color: #fcfbf8; border-color: rgba(0, 0, 0, 0.06); background-image: repeating-linear-gradient(to right, rgba(0, 0, 0, 0.035) 0 1px, transparent 1px calc(100% / var(--hours))); }
.ws-bar { position: absolute; top: 2px; bottom: 2px; min-width: 6px; background: var(--gold); border-radius: var(--radius); touch-action: none; user-select: none; }
.ws-bar.is-on-call { background: var(--gold-bright); opacity: 0.6; }
.ws-bar.is-changed { outline: 1px solid var(--teal); }
#schedule-root.is-editing .ws-bar { cursor: grab; }
.ws-bar.is-dragging { cursor: grabbing; }
.ws-handle { position: absolute; top: 0; bottom: 0; width: 6px; background: rgba(255, 255, 255, 0.3); cursor: ew-resize; }
.ws-handle-start { left: 0; }
.ws-handle-end { right: 0; }
.ws-date { position: absolute; top: 1px; left: 4px; z-index: 1; color: var(--muted); font-size: 10px; line-height: 1.2; pointer-events: none; }
.ws-time-off {
    position: absolute; inset: -1px;
    background-color: #f7f5f0;
    background-image: repeating-linear-gradient(45deg, rgba(22, 40, 58, 0.2) 0 2px, transparent 2px 8px);
    background-attachment: fixed;
    border: 1px solid rgba(22, 40, 58, 0.28);
    border-radius: var(--radius);
    pointer-events: none;
}
.ws-time-off.joins-before { left: -8px; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ws-time-off.joins-after { right: -8px; border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.ws-time-off.is-changed { border-color: var(--teal); }
.ws-day.is-locked .ws-track { opacity: 0.55; }
/* The day selected while editing, for copy (Ctrl+C) and paste (Ctrl+V). */
.ws-day.is-selected .ws-track { box-shadow: 0 0 0 2px var(--teal); }
/* Time on a project: a band across the middle of the day, in the phase's colour
   on the project's timeline (the same .c0 to .c7 rules as .planner-bar), on
   a white base so it reads the same over the hours as on the timeline. */
.ws-project { position: absolute; z-index: 2; height: 8px; min-width: 4px; background: var(--white); border-radius: 2px; }
.ws-project > span { position: absolute; inset: 0; border: 1px solid; border-radius: 2px; }
.ws-project:hover { box-shadow: 0 0 0 1px var(--navy); }

/* The buttons under a day, shown while the day is pointed at. */
.ws-tools { display: flex; justify-content: center; gap: 3px; min-height: 22px; margin-top: 3px; opacity: 0; transition: opacity 0.12s; }
.ws-day:hover .ws-tools, .ws-day:focus-within .ws-tools { opacity: 1; }
.ws-tool { display: inline-grid; place-items: center; width: 24px; height: 22px; padding: 0; background: var(--white); border: 1px solid var(--teal); border-radius: var(--radius); color: var(--navy); cursor: pointer; }
.ws-tool .ws-icon { width: 13px; height: 13px; }
.ws-tool:hover:not(:disabled) { background: var(--surface-alt); color: var(--teal); }
.ws-remove:hover:not(:disabled) { border-color: var(--bad); color: var(--bad); }
.ws-tool[aria-pressed="true"] { background: rgba(42, 154, 168, 0.15); color: var(--teal); }
.ws-tool:disabled { opacity: 0.35; cursor: default; }

/* The schedule's tooltip. */
.ws-tip {
    position: fixed; z-index: 300;
    max-width: 320px;
    padding: 4px 8px;
    background: var(--navy);
    border-top: 2px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    color: var(--white);
    font-size: var(--size-small);
    opacity: 0; visibility: hidden;
    transition: opacity 0.1s;
    pointer-events: none;
}
.ws-tip.is-shown { opacity: 1; visibility: visible; }
.ws-tip-note { display: block; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line-dark); white-space: pre-wrap; overflow-wrap: anywhere; }
/* A bar whose hours have a note carries a small mark at its top right. */
.ws-bar.has-note::after { content: ""; position: absolute; top: 3px; right: 8px; width: 6px; height: 6px; background: var(--navy); border-radius: 50%; pointer-events: none; }

/* Time off ahead: four months of calendars in a popup. */
.ws-away-dialog { width: min(640px, 94vw); max-height: 88vh; overflow: auto; }
.ws-away-dialog h3 { margin: 0 0 4px; color: var(--navy); font-size: var(--size-normal); }
.ws-away-months { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ws-away-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ws-away-weekday { color: var(--muted); font-size: var(--size-small); font-weight: 700; text-align: center; }
.ws-away-day { padding: 3px 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font: inherit; font-size: var(--size-small); cursor: pointer; }
.ws-away-day:hover:not(:disabled) { background: var(--gold-soft); border-color: var(--gold); }
.ws-away-day.has-hours { font-weight: 700; }
.ws-away-day.is-today { color: var(--teal); border-color: var(--teal); }
.ws-away-day.is-off { background-color: #f7f5f0; background-image: repeating-linear-gradient(45deg, rgba(22, 40, 58, 0.22) 0 2px, transparent 2px 8px); }
.ws-away-day.is-changed { box-shadow: 0 0 0 1px var(--teal); border-color: var(--teal); }
.ws-away-day:disabled { opacity: 0.4; cursor: default; }
@media (max-width: 640px) { .ws-away-months { grid-template-columns: minmax(0, 1fr); } }

/* One employee's schedule page: the notes on their schedule, the day and
   hours on a line with the note under them. */
.ws-note-row { align-items: baseline; }
.ws-note-text { flex: 1 1 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
.schedule-one { margin-top: 12px; }

/* The accounting export, /admin/accounting/: the week and Download CSV in
   the head, then the rows and each employee's total. */
.accounting-head { align-items: center; flex-wrap: wrap; }
.accounting-week { display: flex; align-items: center; gap: 8px; }
.accounting-week strong { min-width: 12rem; color: var(--navy); font-size: var(--size-big); text-align: center; }
.admin-panel .accounting-head .button { padding: 6px 12px; font-size: var(--size-small); }
.accounting-table th, .accounting-table td { padding: 5px 7px; font-size: var(--size-small); }
.accounting-hours { text-align: right; font-variant-numeric: tabular-nums; }
.accounting-on-call td { color: var(--muted); }

/* Attachments on an interaction (typescript/shared/attachments.ts): photos as
   thumbnails, other files as cards, and the viewer over the page. */
.interaction-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.attachment-thumb { width: 120px; height: 90px; padding: 0; overflow: hidden; background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius); cursor: zoom-in; }
.attachment-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.attachment-thumb:hover { border-color: var(--gold); box-shadow: var(--shadow-soft); }
.attachment-card { display: flex; flex-direction: column; justify-content: center; gap: 2px; width: 150px; height: 90px; padding: 6px 8px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font-size: var(--size-small); text-decoration: none; overflow: hidden; }
.attachment-card b { color: var(--bad); }
.attachment-card span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--navy); font-weight: 600; }
.attachment-card small { color: var(--muted); }
.attachment-card:hover { border-color: var(--gold); box-shadow: var(--shadow-soft); color: var(--text); }
.attachment-viewer { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 94vw; }
.attachment-viewer img { display: block; max-width: 94vw; max-height: 80vh; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
.attachment-viewer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 6px 10px; background: var(--white); border-radius: var(--radius); }
.attachment-viewer-name { max-width: 50vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--size-small); }
.attachment-viewer-bar .button { padding: 5px 12px; font-size: var(--size-small); }

/* A project's status: in the Projects list and at the bottom of its Summary. */
.projects-tools { display: flex; align-items: center; gap: 10px; }
.admin-panel .projects-tools .button { padding: 5px 12px; font-size: var(--size-small); }
.project-status { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--line); font-size: var(--size-small); font-weight: 600; white-space: nowrap; }
.project-status.status-planning { background: rgba(52, 104, 204, 0.12); border-color: #3468cc; color: #24488f; }
.project-status.status-on-hold { background: rgba(230, 126, 34, 0.14); border-color: #e67e22; color: #9a5213; }
.project-status.status-active { background: rgba(46, 160, 67, 0.14); border-color: #2ea043; color: #1f6f2e; }
.project-status.status-review { background: rgba(142, 68, 173, 0.12); border-color: #8e44ad; color: #6a2f82; }
.project-status.status-completed { background: rgba(120, 120, 120, 0.12); border-color: #888888; color: var(--muted); }
.project-status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: var(--size-small); }
.project-status-line b { color: var(--gold-deep); }
.project-status-line select { padding: 4px 8px; background: var(--paper); border: 1px solid #cfc6b4; border-radius: var(--radius); font: inherit; font-size: var(--size-small); }
.project-status-line .field-note { margin: 0; }
.project-status-line .field-note.bad { color: var(--bad); }

/* Interactions: the search and Archive in the head, and Archive or Restore on
   each interaction's line, beside Create Project. */
.admin-panel .interactions-search { width: 260px; padding: 5px 8px; background: var(--paper); border: 1px solid #cfc6b4; border-radius: var(--radius); font: inherit; font-size: var(--size-small); }
.interaction summary .interaction-archive { margin-left: auto; padding: 3px 10px; font-size: var(--size-small); }
.interaction summary .interaction-project:not([hidden]) + .interaction-archive { margin-left: 6px; }
.interactions-panel > .admin-panel-head { align-items: center; flex-wrap: wrap; }

/* A project's Emails section: the mail between the manager and the customer,
   one line each, and the popup that shows one. Read only. */
.project-emails { display: flex; flex-direction: column; }
.email-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; align-items: baseline; gap: 10px; width: 100%; padding: 5px 4px; background: none; border: 0; border-top: 1px solid var(--line); color: var(--text); font: inherit; font-size: var(--size-small); text-align: left; cursor: pointer; }
.email-row:hover { background: var(--surface-alt); }
.email-way { justify-self: start; padding: 0 7px; border-radius: 999px; font-weight: 700; }
.email-way.is-received { background: rgba(42, 154, 168, 0.14); color: #1d6f79; }
.email-way.is-sent { background: rgba(196, 163, 110, 0.25); color: var(--gold-deep); }
.email-subject { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--navy); font-weight: 600; }
.email-subject small { color: var(--muted); font-weight: 400; }
.email-when { color: var(--muted); white-space: nowrap; }
.email-dialog { width: min(760px, 94vw); max-height: 88vh; overflow: auto; }
.email-line { margin: 2px 0; font-size: var(--size-small); overflow-wrap: anywhere; }
.email-line b { color: var(--gold-deep); margin-right: 4px; }
.email-line a { margin-right: 8px; }
.email-body { margin: 8px 0 0; padding: 8px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); font: inherit; font-size: var(--size-normal); white-space: pre-wrap; overflow-wrap: anywhere; }
.project-emails .field-note.bad { color: var(--bad); }

/* The blog editor, /admin/blog/ (typescript/admin/blog.ts): the posts on the
   left, the post chosen on the right. */
.blog-editor { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 12px; align-items: start; }
.blog-filters { display: flex; gap: 6px; margin-bottom: 6px; }
.blog-filters input, .blog-filters select, .blog-new input { flex: 1; min-width: 0; padding: 5px 8px; background: var(--paper); border: 1px solid #cfc6b4; border-radius: var(--radius); font: inherit; font-size: var(--size-small); }
.blog-filters select { flex: 0 0 auto; }
.blog-table th, .blog-table td { padding: 5px 6px; font-size: var(--size-small); }
.blog-table tr[data-id] { cursor: pointer; }
.blog-table tr.current td { background: var(--gold-soft); }
.blog-table small { color: var(--muted); }
.blog-visit { margin-left: 4px; color: var(--teal); font-size: var(--size-small); }
.blog-state { padding: 1px 7px; border-radius: 999px; background: var(--surface-alt); color: var(--muted); font-weight: 600; white-space: nowrap; }
.blog-state.is-published { background: rgba(46, 160, 67, 0.14); color: #1f6f2e; }
.admin-panel .blog-publish { padding: 2px 8px; font-size: var(--size-small); }
.blog-pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 6px; font-size: var(--size-small); }
.admin-panel .blog-pager .button, .admin-panel .blog-new .button { padding: 5px 12px; font-size: var(--size-small); }
.blog-new { display: flex; gap: 6px; margin-top: 10px; }
.blog-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; }
.blog-form .wide { grid-column: 1 / -1; }
.blog-field { display: flex; flex-direction: column; gap: 2px; font-size: var(--size-small); font-weight: 600; }
.blog-field small { color: var(--muted); font-weight: 400; }
.blog-field input, .blog-field textarea { padding: 5px 7px; background: var(--paper); border: 1px solid #cfc6b4; border-radius: var(--radius); font: inherit; font-size: var(--size-normal); font-weight: 400; }
.blog-field textarea { resize: vertical; }
.blog-field textarea#post-content { font-family: var(--font-code); font-size: var(--size-small); }
.blog-tools { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 4px; }
.admin-panel .blog-tools .button { padding: 2px 8px; font-size: var(--size-small); }
.blog-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.blog-foot .field-note { flex: 1; margin: 0; }
.admin-panel .blog-foot .button { padding: 5px 14px; font-size: var(--size-small); }
.blog-foot .is-confirming { border-color: var(--bad); color: var(--bad); }
.blog-published { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.blog-published input { width: 18px; height: 18px; accent-color: var(--gold-deep); }
@media (max-width: 960px) { .blog-editor { grid-template-columns: 1fr; } }
.interaction summary .interaction-delete { margin-left: 6px; padding: 3px 10px; font-size: var(--size-small); }
.interaction summary .interaction-delete.is-confirming { border-color: var(--bad); color: var(--bad); }
#contact-delete.is-confirming { border-color: var(--bad); color: var(--bad); }

/* Private files and pages (/admin/files/, /admin/pages/, typescript/admin/
   private.ts), the Share popup, and what a person has on /account/. */
.private-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.private-upload input[type="text"] { flex: 1 1 160px; padding: 5px 8px; background: var(--paper); border: 1px solid #cfc6b4; border-radius: var(--radius); font: inherit; font-size: var(--size-small); }
/* The Files page's picker: the estimate form's drop area and cards
   (site.css, .upload-*), compact, the full width above the group and
   description. */
.private-upload-files { flex: 1 1 100%; }
.private-upload .upload-zone { flex-direction: row; gap: 8px; padding: 10px 12px; }
.private-upload .upload-icon { width: 26px; height: 26px; margin: 0; }
.private-upload .upload-zone strong { font-size: var(--size-normal); }
.private-upload .upload-zone span { font-size: var(--size-small); }
.private-upload .upload-list { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin: 6px 0 0; }
.private-upload .upload-item { gap: 8px; padding: 5px; }
.private-upload .upload-thumb { width: 36px; height: 36px; }
.private-upload .upload-remove { width: 24px; height: 24px; }
.admin-panel .private-upload .button { padding: 5px 14px; font-size: var(--size-small); }
.private-address { display: inline-flex; align-items: center; gap: 2px; font-family: var(--font-code); font-size: var(--size-small); }
.private-address input { flex: 0 1 200px; }
.private-list, .shared-list { margin: 0 0 8px; padding: 0; list-style: none; }
.private-list li, .shared-list li { padding: 5px 0; border-top: 1px solid var(--line); }
.private-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.private-line small, .shared-list small { color: var(--muted); font-size: var(--size-small); }
.private-tools { display: flex; gap: 4px; margin-left: auto; }
.admin-panel .private-tools .button, .admin-panel .private-edit .button { padding: 2px 9px; font-size: var(--size-small); }
.private-tools .is-confirming { border-color: var(--bad); color: var(--bad); }
.private-description, .shared-list p { margin: 2px 0 0; font-size: var(--size-small); }
.private-edit { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.private-edit input { flex: 1 1 140px; padding: 3px 7px; background: var(--paper); border: 1px solid #cfc6b4; border-radius: var(--radius); font: inherit; font-size: var(--size-small); }
.shared-group { margin: 8px 0 2px; color: var(--gold-deep); font-size: var(--size-small); letter-spacing: 0.06em; text-transform: uppercase; }
.private-share { width: min(620px, 94vw); max-height: 86vh; overflow: auto; }
.private-share h3 { margin: 10px 0 4px; font-size: var(--size-normal); }
.share-people { margin: 0; padding: 0; list-style: none; }
/* The people to share with, under Customers, Contractors, and Employees. */
.share-group { margin: 8px 0 2px; color: var(--gold-deep); font-family: var(--font-head); font-size: var(--size-small); letter-spacing: 0.08em; text-transform: uppercase; }
.share-group small { color: var(--muted); font-family: inherit; letter-spacing: normal; }
.share-people li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); font-size: var(--size-small); }
.share-people li > span:first-child { flex: 1; }
.share-people small { color: var(--muted); }
.share-people li.is-ended { opacity: 0.6; }
.share-access { color: var(--muted); white-space: nowrap; }
.share-people .button { padding: 2px 9px; font-size: var(--size-small); }
.share-choose { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.share-choose select, .share-choose input { padding: 4px 7px; background: var(--paper); border: 1px solid #cfc6b4; border-radius: var(--radius); font: inherit; font-size: var(--size-small); }
.share-choose input[type="search"] { flex: 1; min-width: 140px; }

/* Audit, /admin/audit/ (typescript/admin/audit.ts). */
.audit-head { align-items: center; flex-wrap: wrap; }
.audit-head select { padding: 5px 8px; background: var(--paper); border: 1px solid #cfc6b4; border-radius: var(--radius); font: inherit; font-size: var(--size-small); }
.audit-table th, .audit-table td { padding: 5px 7px; font-size: var(--size-small); vertical-align: top; }
.audit-when { white-space: nowrap; color: var(--muted); }
.audit-area { padding: 1px 7px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-deep); font-weight: 700; white-space: nowrap; }
.audit-detail { max-width: 460px; overflow-wrap: anywhere; }
