/* Dashboard and portal styling. Shares the landing page palette and fonts. */

/* Self-hosted so headless Chromium renders PDFs with the real typefaces. */
@font-face {
    font-family: "Cormorant Garamond";
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("fonts/cormorant-garamond-latin.woff2") format("woff2");
}

@font-face {
    font-family: "Cormorant Garamond";
    font-style: italic;
    font-weight: 300 700;
    font-display: swap;
    src: url("fonts/cormorant-garamond-latin-italic.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("fonts/inter-latin.woff2") format("woff2");
}

:root {
    color-scheme: light;

    --ink: #191510;
    --muted: #6f695d;
    --paper: #f7f2e9;
    --surface: #fffdf8;
    --surface-2: #efe8db;
    --line: rgba(25, 21, 16, 0.12);
    --hairline: rgba(25, 21, 16, 0.08);
    --accent: #a87b3d;
    --accent-strong: #92682f;
    --accent-soft: rgba(168, 123, 61, 0.12);
    --on-accent: #fdfbf6;
    --header-bg: rgba(247, 242, 233, 0.82);
    --shadow: 0 30px 60px -32px rgba(25, 21, 16, 0.35);
    --danger: #9a3b2e;

    --serif: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    --sans: "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

    --maxw: 1080px;
    --pad-x: clamp(18px, 4vw, 48px);
    --radius: 3px;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;

        --ink: #efe9dd;
        --muted: #a49d90;
        --paper: #100e0b;
        --surface: #181511;
        --surface-2: #201c16;
        --line: rgba(239, 233, 221, 0.13);
        --hairline: rgba(239, 233, 221, 0.07);
        --accent: #cba368;
        --accent-strong: #d8b676;
        --accent-soft: rgba(203, 163, 104, 0.16);
        --on-accent: #14110b;
        --header-bg: rgba(16, 14, 11, 0.82);
        --shadow: 0 34px 70px -30px rgba(0, 0, 0, 0.72);
        --danger: #d4715f;
    }
}

* {
    box-sizing: border-box;
}

body.app {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

h1 {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(1.9rem, 3.4vw, 2.6rem);
    line-height: 1.1;
    margin: 0 0 0.6em;
}

h2 {
    font-family: var(--sans);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    margin: 1.8em 0 0.7em;
}

.eyebrow {
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.26em;
    margin: 0 0 1.2em;
    text-transform: uppercase;
}

.lede {
    color: var(--muted);
    font-size: 1.05rem;
    max-width: 54ch;
}

/* Layout */

.app-header {
    align-items: center;
    backdrop-filter: saturate(150%) blur(10px);
    background: var(--header-bg);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    padding: 14px var(--pad-x);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    flex: 0 0 auto;
    text-decoration: none;
    white-space: nowrap;
}

.brand-name {
    font-family: var(--serif);
    font-size: 1.08rem;
    font-weight: 500;
}

.nav {
    align-items: center;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.74rem;
    gap: clamp(14px, 2.6vw, 28px);
    justify-content: flex-end;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.nav a {
    text-decoration: none;
}

.nav a:hover {
    color: var(--ink);
}

.app-main {
    margin: 0 auto;
    max-width: var(--maxw);
    padding: clamp(24px, 4vw, 48px) var(--pad-x) 80px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 28px;
    padding: clamp(22px, 3vw, 36px);
}

.panel.narrow {
    margin: 8vh auto 0;
    max-width: 420px;
}

.flashes {
    margin-bottom: 20px;
}

.flash {
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    margin: 0 0 8px;
    padding: 10px 16px;
}

.meta-note {
    color: var(--muted);
    font-size: 0.84rem;
}

/* Background queue banner */

.task-banner {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left-width: 3px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    padding: 12px 16px;
}

.task-banner-busy {
    border-left-color: var(--accent);
}

.task-banner-failed {
    border-left-color: var(--danger);
}

.task-banner-head {
    align-items: center;
    display: flex;
    font-size: 0.9rem;
    gap: 0.5rem;
    margin: 0;
}

.task-banner-failed .task-banner-head {
    color: var(--danger);
}

.task-banner-list {
    color: var(--muted);
    font-size: 0.84rem;
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
}

.task-banner-list li {
    padding: 2px 0;
}

.task-banner-meta {
    color: var(--muted);
    font-size: 0.76rem;
    opacity: 0.8;
}

.task-banner-meta::before {
    content: " — ";
}

.task-banner .inline-form {
    margin-top: 6px;
}

.task-spinner {
    animation: task-spin 0.9s linear infinite;
    border: 2px solid var(--line);
    border-radius: 50%;
    border-top-color: var(--accent);
    display: inline-block;
    flex: none;
    height: 0.85em;
    width: 0.85em;
}

@keyframes task-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .task-spinner {
        animation: none;
    }
}

.meta-nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1.4rem;
    margin: 0 0 1.1rem;
}

.meta-nav a {
    text-decoration: none;
}

.meta-nav a.is-busy {
    opacity: 0.55;
    pointer-events: none;
}

.empty-state {
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    padding: 22px;
    text-align: center;
}

/* Forms */

.stack {
    display: grid;
    gap: 14px;
    max-width: 720px;
}

.stack label,
.field-grid label {
    display: grid;
    font-size: 0.82rem;
    gap: 5px;
    letter-spacing: 0.03em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    font: inherit;
    font-size: 0.92rem;
    padding: 9px 12px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    outline: none;
}

.field-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.row-form {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 10px;
}

.inline-form {
    display: inline-flex;
    gap: 6px;
}

.btn {
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: var(--on-accent);
    cursor: pointer;
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    padding: 12px 24px;
    text-decoration: none;
    text-transform: uppercase;
    transition: background 200ms ease;
}

.btn:hover {
    background: var(--accent-strong);
}

.btn-secondary {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--ink);
    padding: 10px 18px;
}

.btn-secondary:hover {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--accent);
}

.quiet-button {
    background: none;
    border: none;
    border-bottom: 1px solid var(--line);
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    padding: 0 0 2px;
    text-decoration: none;
    text-transform: uppercase;
}

.quiet-button:hover {
    border-bottom-color: var(--accent);
    color: var(--accent);
}

.quiet-button.danger {
    color: var(--danger);
}

.link-button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font: inherit;
    letter-spacing: inherit;
    padding: 0;
    text-transform: inherit;
}

.link-button:hover {
    color: var(--ink);
}

/* Tables and lists */

.data-table {
    border-collapse: collapse;
    margin-top: 14px;
    width: 100%;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--hairline);
    font-size: 0.88rem;
    padding: 10px 12px 10px 0;
    text-align: left;
    vertical-align: middle;
}

.data-table thead th {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.data-table .group-row th {
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    padding-top: 26px;
    text-transform: uppercase;
}

.data-table tbody:first-of-type .group-row th {
    padding-top: 14px;
}

.group-count {
    color: var(--muted);
    font-size: 0.9em;
    letter-spacing: 0.06em;
    opacity: 0.7;
}

.group-count::before {
    content: "\00b7\00a0";
}

.actions-cell {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: flex-end;
    white-space: nowrap;
}

.actions-cell>* {
    margin-right: 0;
}

.actions-cell .quiet-button {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
}

.one-pagers-table td {
    white-space: nowrap;
}

.one-pagers-table .col-address {
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.one-pagers-table .col-date {
    width: 1%;
}

.comps-table input,
.tenants-table input,
.tenants-table textarea {
    width: 100%;
}

.tenants-table textarea {
    min-height: 2.6rem;
    resize: vertical;
}

.pill {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 20px;
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    padding: 2px 10px;
    text-transform: uppercase;
}

.pill-published {
    border-color: var(--accent);
    color: var(--accent);
}

.check-list {
    display: grid;
    gap: 8px;
    list-style: none;
    margin: 10px 0;
    padding: 0;
}

/* Package one-pager picker — must override .stack label { display: grid } */
.package-form {
    max-width: 760px;
}

.package-form.is-processing {
    cursor: wait;
    opacity: 0.72;
    pointer-events: none;
}

.package-form.is-processing .btn {
    cursor: wait;
}

.pick-block {
    display: grid;
    gap: 6px;
}

.pick-list {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    list-style: none;
    margin: 0;
    max-height: 420px;
    overflow: auto;
    padding: 0;
}

.pick-list li+li {
    border-top: 1px solid var(--line);
}

.pick-group {
    background: var(--surface);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    padding: 9px 14px;
    position: sticky;
    text-transform: uppercase;
    top: 0;
}

.stack .pick-item,
.pick-item {
    align-items: flex-start;
    cursor: pointer;
    display: flex;
    font-size: 0.92rem;
    gap: 12px;
    letter-spacing: 0;
    padding: 11px 14px;
}

.pick-item:hover {
    background: var(--accent-soft);
}

.pick-item input[type="checkbox"] {
    accent-color: var(--accent);
    flex: 0 0 auto;
    margin: 0.28em 0 0;
}

.pick-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.pick-title {
    font-weight: 500;
    overflow-wrap: anywhere;
}

.pick-meta {
    color: var(--muted);
    font-size: 0.82rem;
}

.pick-price {
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 500;
}

.content-list {
    border-top: 1px solid var(--line);
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
}

.content-list li {
    align-items: baseline;
    border-bottom: 1px solid var(--hairline);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 10px 0;
}

.content-list a {
    font-weight: 500;
    text-decoration: none;
}

.content-list a:hover {
    color: var(--accent);
}

.content-meta {
    color: var(--accent);
    font-size: 0.86rem;
}

.row-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.share-row {
    display: flex;
    gap: 10px;
    margin: 14px 0 6px;
}

.share-input {
    flex: 1;
    font-size: 0.86rem;
}

/* Dashboard */

.kpi-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    margin-top: 16px;
}

.kpi-grid-compact {
    grid-template-columns: repeat(2, minmax(120px, 180px));
}

.kpi-grid-todos {
    grid-template-columns: repeat(5, minmax(100px, 1fr));
    margin-bottom: 8px;
}

@media (max-width: 900px) {
    .kpi-grid-todos {
        grid-template-columns: repeat(3, minmax(100px, 1fr));
    }
}

@media (max-width: 560px) {
    .kpi-grid-todos {
        grid-template-columns: repeat(2, minmax(100px, 1fr));
    }
}

.kpi {
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    display: grid;
    gap: 2px;
    padding: 16px;
}

a.kpi-link {
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

a.kpi-link:hover {
    background: var(--surface);
    border-color: var(--accent);
}

a.kpi-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.kpi-value {
    font-family: var(--serif);
    font-size: 1.9rem;
    font-weight: 500;
    line-height: 1;
}

.kpi-label {
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.trend-wrap {
    margin-top: 8px;
    position: relative;
}

.trend-chart {
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    cursor: crosshair;
    display: block;
    height: auto;
    width: 100%;
}

.hover-guide {
    stroke: var(--muted);
    stroke-dasharray: 3 3;
    stroke-width: 1;
}

.hover-dot-followers {
    fill: var(--accent);
    stroke: var(--surface);
    stroke-width: 1.5;
}

.hover-dot-connections {
    fill: var(--muted);
    stroke: var(--surface);
    stroke-width: 1.5;
}

.chart-tooltip {
    background: var(--ink);
    border-radius: var(--radius);
    color: var(--paper);
    font-size: 0.78rem;
    left: 0;
    letter-spacing: 0.02em;
    line-height: 1.45;
    padding: 8px 12px;
    pointer-events: none;
    position: absolute;
    top: 0;
    white-space: nowrap;
    z-index: 2;
}

.chart-tooltip strong {
    display: block;
    font-weight: 500;
    margin-bottom: 2px;
}

.month-divider {
    stroke: var(--line);
    stroke-width: 1;
}

.month-label {
    fill: var(--muted);
    font-family: var(--sans);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.line-followers {
    stroke: var(--accent);
}

.line-connections {
    stroke: var(--muted);
}

.legend {
    color: var(--muted);
    font-size: 0.78rem;
    margin-top: 8px;
}

.legend-followers {
    border-bottom: 2px solid var(--accent);
}

.legend-connections {
    border-bottom: 2px solid var(--muted);
}

.viewer-list {
    display: grid;
    gap: 4px;
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
}

.viewer-row {
    align-items: start;
    border-bottom: 1px solid var(--hairline);
    display: flex;
    gap: 14px;
    padding: 14px 0;
}

.tier-badge {
    align-items: center;
    border: 1px solid var(--accent);
    border-radius: 50%;
    color: var(--accent);
    display: inline-flex;
    flex: 0 0 auto;
    font-family: var(--serif);
    font-size: 1rem;
    font-weight: 600;
    height: 32px;
    justify-content: center;
    margin-top: 2px;
    width: 32px;
}

.tier-badge.tier-a {
    background: var(--accent);
    color: var(--on-accent);
}

.viewer-body {
    flex: 1;
}

.viewer-name {
    font-weight: 500;
    text-decoration: none;
}

.viewer-name:hover {
    color: var(--accent);
}

.viewer-headline {
    color: var(--muted);
    font-size: 0.88rem;
    margin: 2px 0;
}

.viewer-meta {
    color: var(--muted);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    margin: 2px 0 0;
}

.rationale {
    font-size: 0.84rem;
    margin-top: 6px;
}

.rationale summary {
    color: var(--accent);
    cursor: pointer;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.rationale p {
    color: var(--muted);
    margin: 6px 0 0;
    max-width: 70ch;
}

.activity-list {
    display: grid;
    gap: 10px;
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
}

.activity-list li {
    border-bottom: 1px solid var(--hairline);
    display: flex;
    gap: 16px;
    padding-bottom: 10px;
}

.activity-time {
    color: var(--muted);
    flex: 0 0 auto;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    min-width: 90px;
}

.activity-text {
    font-size: 0.9rem;
}

/* Follow-up queue */

.followup-list {
    display: grid;
    gap: 4px;
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
}

.followup-row {
    align-items: start;
    border-bottom: 1px solid var(--hairline);
    display: flex;
    gap: 16px;
    padding: 14px 0;
}

.followup-row:last-child {
    border-bottom: none;
}

.followup-flag {
    border: 1px solid var(--line);
    border-radius: 20px;
    color: var(--muted);
    flex: 0 0 auto;
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    margin-top: 2px;
    /* Fixed width so the names below line up down the column. */
    min-width: 116px;
    padding: 4px 12px;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
}

a.followup-flag:hover {
    filter: brightness(0.97);
    text-decoration: none;
}

.flag-hot {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}

.flag-cold {
    border-color: var(--danger);
    color: var(--danger);
}

.flag-soon {
    border-color: var(--accent);
    color: var(--accent);
}

.flag-unread {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.flag-tier-a {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}

.flag-tier-b {
    border-color: var(--accent);
    color: var(--accent);
}

.flag-awaiting {
    border-color: var(--line);
    color: var(--muted);
}

.flag-reply {
    border-color: var(--danger);
    color: var(--danger);
}

.flag-archive {
    border-color: var(--line);
    color: var(--muted);
}

.flag-reconnect {
    border-color: var(--accent);
    color: var(--accent);
}

.weekly-cadence {
    border-top: 1px solid var(--line);
    margin-top: 28px;
    padding-top: 22px;
}

.weekly-cadence h3 {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    margin: 0 0 12px;
    text-transform: uppercase;
}

.weekly-suggest {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-top: 12px;
    padding: 12px 0;
}

.weekly-suggest+.weekly-suggest {
    border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.weekly-suggest-body {
    flex: 1;
    min-width: 0;
}

.weekly-suggest-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.weekly-suggest-copy {
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
    margin: 6px 0 0;
    max-width: 42rem;
}

.weekly-suggest-actions {
    margin: 10px 0 0;
}

.weekly-suggest-actions a {
    font-size: 0.92rem;
}

.todos-header {
    align-items: baseline;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.todos-header h2 {
    margin: 0;
}

.todo-alert {
    background: color-mix(in srgb, var(--danger) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
    border-radius: 8px;
    margin: 18px 0 8px;
    padding: 14px 16px;
}

.todo-alert-title {
    color: var(--danger);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    margin: 0;
    text-transform: uppercase;
}

.todo-alert-copy {
    color: var(--ink);
    font-size: 0.92rem;
    margin: 6px 0 0;
}

.todo-group {
    margin-top: 22px;
    scroll-margin-top: 24px;
}

#todo-tier {
    scroll-margin-top: 24px;
}

.todo-group h3 {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    margin: 0;
    text-transform: uppercase;
}

.followup-body {
    flex: 1;
    min-width: 0;
}

.followup-name {
    font-weight: 500;
    text-decoration: none;
}

.followup-name:hover {
    color: var(--accent);
}

.followup-why {
    font-size: 0.9rem;
    margin: 2px 0 0;
}

.followup-msg {
    font-size: 0.9rem;
    line-height: 1.35;
    margin: 6px 0 0;
}

.followup-msg-who {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    margin-right: 0.35em;
    text-transform: uppercase;
}

.followup-meta {
    color: var(--muted);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    margin: 4px 0 0;
}

.followup-dossier {
    border-left: 2px solid var(--accent);
    margin: 8px 0 2px;
    padding-left: 12px;
}

.followup-suggested {
    background: var(--accent-soft);
    border-radius: 3px;
    font-size: 0.9rem;
    line-height: 1.35;
    margin: 8px 0 0;
    padding: 8px 10px;
}

.followup-suggested .quiet-button {
    margin-left: 8px;
    vertical-align: baseline;
}

.followup-row .quiet-button {
    flex: 0 0 auto;
    margin-top: 4px;
}

.panel-quiet {
    background: none;
    padding: 18px clamp(22px, 3vw, 36px);
}

.panel-quiet h2 {
    font-size: 0.68rem;
    letter-spacing: 0.26em;
    margin: 0;
    text-transform: uppercase;
}

.inline-stats {
    align-items: baseline;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.88rem;
    gap: 8px 22px;
    margin: 8px 0 0;
}

.inline-stats strong {
    color: var(--ink);
    font-weight: 500;
}

/* Photos */

.photo-list {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    list-style: none;
    margin: 10px 0;
    padding: 0;
}

.photo-list li {
    display: grid;
    gap: 6px;
    justify-items: start;
}

.photo-list img {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: block;
    height: 110px;
    object-fit: cover;
    width: 160px;
}

/* Package cards (client view) */

.package-cards {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    list-style: none;
    margin: 20px 0;
    padding: 0;
}

.package-card a {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: block;
    overflow: hidden;
    text-decoration: none;
    transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.package-card a:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-4px);
}

.card-image {
    display: block;
    height: 170px;
    object-fit: cover;
    width: 100%;
}

.card-body {
    display: grid;
    gap: 3px;
    padding: 16px;
}

.card-title {
    font-family: var(--serif);
    font-size: 1.25rem;
    font-weight: 500;
}

.card-address {
    color: var(--muted);
    font-size: 0.84rem;
}

.card-price {
    color: var(--accent);
    font-size: 0.86rem;
    font-weight: 500;
    margin-top: 4px;
}

/* One-pager document (dossier-aligned) */

.one-pager {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin: 0 auto;
    max-width: 880px;
    padding: clamp(28px, 4vw, 72px) clamp(20px, 3vw, 40px);
    position: relative;
}

.op-wm {
    /* Matches whichever surface it sits on; Chromium keeps this in the PDF
       text layer. Transparent / off-screen / long ZWSP runs get stripped. */
    color: var(--surface);
    display: block;
    font-size: 1px;
    letter-spacing: 0;
    line-height: 1px;
    margin: 0;
    overflow: hidden;
    user-select: text;
    white-space: nowrap;
}

.op-masthead-block {
    border-bottom: 1px solid var(--line);
    margin-bottom: 28px;
    padding-bottom: 22px;
}

.op-brand-row {
    /* Headshot is absolute — don't reserve its full height in flow. */
    margin-bottom: 18px;
    min-height: 0;
    overflow: visible;
    position: relative;
}

.op-wordmark {
    color: var(--ink);
    font-size: 1.55rem;
    font-weight: 600;
    letter-spacing: 0.18em;
}

.op-headshot {
    border: 1.5px solid var(--accent);
    border-radius: 50%;
    display: block;
    height: 112px;
    overflow: hidden;
    position: absolute;
    right: 0;
    top: 0;
    width: 112px;
}

.op-headshot img {
    display: block;
    height: 100%;
    object-fit: cover;
    object-position: center;
    width: 100%;
}

.op-prepared-for {
    border-top: 1px solid var(--accent-soft);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.15rem;
    letter-spacing: 0.03em;
    margin: 20px 0 0;
    padding-top: 14px;
}

.op-prepared-for span {
    color: var(--muted);
    display: block;
    font-family: var(--sans);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.24em;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.nda-panel {
    max-width: 720px;
}

.nda-party {
    display: grid;
    gap: 0.75rem 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin: 1rem 0 1.25rem;
}

.nda-label {
    color: var(--muted);
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.nda-body {
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--ink);
    border-radius: var(--radius);
    max-height: 22rem;
    overflow: auto;
    padding: 1rem 1.15rem;
}

.nda-body p {
    margin: 0 0 0.85rem;
}

.nda-body p:last-child {
    margin-bottom: 0;
}

.nda-form {
    margin-top: 1.25rem;
}

.nda-version {
    color: var(--muted);
    font-size: 0.72rem;
    margin: 1.5rem 0 0;
}

.nda-agree {
    align-items: flex-start;
    display: flex !important;
    gap: 0.65rem;
    max-width: none;
}

.nda-agree input {
    margin-top: 0.25rem;
}

.op-eyebrow {
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.26em;
    margin: 0 0 0.75em;
    max-width: calc(100% - 128px);
    text-transform: uppercase;
}

.op-address-title {
    display: flex;
    flex-direction: column;
    font-family: var(--serif);
    font-weight: 400;
    gap: 0.18em;
    letter-spacing: 0.02em;
    line-height: 1.08;
    margin: 0 0 0.35em;
    max-width: calc(100% - 128px);
    font-feature-settings: "lnum" 1;
    font-variant-numeric: lining-nums;
}

.op-address-title .op-street,
.op-address-title .op-cityline {
    display: block;
}

.op-address-title .op-street {
    font-feature-settings: "lnum" 1;
    font-size: clamp(2rem, 5.5vw, 3.4rem);
    font-variant-numeric: lining-nums;
    line-height: 1.05;
    /* Never wrap the street; JS shrinks font-size to fit the masthead width. */
    overflow: hidden;
    white-space: nowrap;
}

.op-address-title .op-ordinal {
    font-size: 0.55em;
    font-weight: inherit;
    letter-spacing: 0.04em;
    line-height: 0;
    margin-left: 0.02em;
    vertical-align: super;
}

.op-address-title .op-cityline {
    color: var(--muted);
    font-size: clamp(0.95rem, 2vw, 1.25rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 1.25;
}

.op-fact-grid {
    border-top: 1px solid var(--accent-soft);
    display: grid;
    gap: 4px 28px;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    margin: 18px 0 0;
    padding: 14px 0 0;
    width: 100%;
}

.op-fact-grid>div {
    min-width: 0;
}

.op-fact-grid dt {
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    margin: 0 0 6px;
    text-transform: uppercase;
    white-space: nowrap;
}

.op-fact-grid dd {
    font-family: var(--serif);
    font-size: 1.22rem;
    font-weight: 600;
    font-variant-numeric: lining-nums;
    line-height: 1.2;
    margin: 0;
    overflow-wrap: anywhere;
}

.op-visuals {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 1fr;
    margin: 0 0 28px;
}

/* Lone visual stays one panel wide — never full-bleed. */
.op-visuals-single {
    grid-template-columns: 1fr 1fr;
}

.op-visuals figure {
    margin: 0;
}

.op-visuals img {
    aspect-ratio: 1 / 1;
    background: var(--surface);
    border: 1px solid var(--accent);
    display: block;
    object-fit: cover;
    width: 100%;
}

.op-bullets {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.op-bullets li {
    font-size: 0.92rem;
    margin-bottom: 6px;
    padding-left: 1.15em;
    position: relative;
    text-align: justify;
    text-justify: inter-word;
}

.op-bullets li::before {
    background: var(--accent);
    content: "";
    height: 0.42em;
    left: 0;
    position: absolute;
    top: 0.48em;
    width: 0.42em;
}

.op-columns {
    border-bottom: 1px solid var(--hairline);
    display: grid;
    gap: 0 40px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    margin: 0 0 28px;
    padding: 0 0 22px;
}

.op-columns>.op-section {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.op-section {
    border-bottom: 1px solid var(--hairline);
    margin: 0 0 28px;
    padding: 0 0 22px;
}

.op-section h2 {
    color: var(--accent);
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 0;
    margin: 0 0 0.55em;
    padding-bottom: 0;
    text-transform: none;
    border-bottom: none;
}

.op-table {
    border-collapse: collapse;
    width: 100%;
}

.op-table th,
.op-table td {
    border-bottom: 1px solid var(--hairline);
    font-size: 0.9rem;
    padding: 7px 10px 7px 0;
    text-align: left;
    vertical-align: top;
}

.op-table tr:last-child th,
.op-table tr:last-child td {
    border-bottom: none;
}

.op-table th {
    color: var(--muted);
    font-weight: 400;
    max-width: 11em;
    padding-right: 14px;
    white-space: nowrap;
    width: 28%;
}

.op-tenants {
    display: grid;
    gap: 0.65rem;
}

.op-tenant {
    display: grid;
    gap: 0.15rem;
}

.op-tenant-name {
    font-weight: 600;
}

.op-tenant-details {
    color: var(--ink);
    display: block;
    line-height: 1.45;
}

.op-comps thead th {
    color: var(--muted);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.op-summary {
    border-bottom: 1px solid var(--hairline);
    font-family: var(--serif);
    font-size: 1.22rem;
    font-style: italic;
    font-weight: 600;
    hyphens: auto;
    line-height: 1.45;
    margin: 0 0 28px;
    padding: 0 0 22px;
    text-align: justify;
    text-justify: inter-word;
    text-wrap: pretty;
}

.op-gallery {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.op-gallery img {
    border: 1px solid var(--accent);
    display: block;
    height: 150px;
    object-fit: cover;
    width: 100%;
}

.op-contact {
    color: var(--muted);
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    margin-top: 8px;
    padding-top: 18px;
}

.op-contact p {
    margin: 0 0 2px;
}

.op-contact a {
    color: inherit;
}

.op-contact-name {
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 400;
    letter-spacing: 0;
}

.op-contact-role {
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* Form helpers: type switcher groups, wide textarea cells, photo dropzone */

.field-grid-wide {
    grid-column: 1 / -1;
}

.field-subhead {
    color: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    margin: 14px 0 8px;
}

.repeatable {
    display: grid;
    gap: 12px;
}

.repeatable-list {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: grid;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.repeatable-row {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 10px;
    grid-template-columns: 1.1rem 1fr auto;
    padding: 8px 10px;
}

.repeatable-row:last-child {
    border-bottom: none;
}

.repeatable-row input[type="text"] {
    background: var(--surface);
    margin: 0;
    width: 100%;
}

.repeatable-bullet {
    color: var(--accent);
    font-size: 1.1rem;
    line-height: 1;
    text-align: center;
}

.repeatable-remove {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    padding: 4px 2px;
    text-transform: uppercase;
    white-space: nowrap;
}

.repeatable-remove:hover {
    color: var(--danger);
}

.repeatable>.btn-secondary {
    justify-self: start;
}

.select-other-input {
    margin-top: 6px;
}

.dropzone {
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    margin: 10px 0;
    padding: 18px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.drag {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.dropzone p {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0 0 8px;
}

.dropzone .file-label {
    color: var(--accent);
    cursor: pointer;
    display: inline;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.dropzone .file-label:hover {
    color: var(--ink);
}

.form-footer {
    margin: 1.5rem 0 0;
}

/* Confirmation dialog (replaces native confirm()) */

.confirm-dialog {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--ink);
    max-width: 380px;
    padding: 24px;
}

.confirm-dialog::backdrop {
    background: rgba(0, 0, 0, 0.45);
}

.confirm-dialog p {
    margin: 0 0 18px;
}

.confirm-dialog-actions {
    display: flex;
    gap: 14px;
    justify-content: flex-end;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}

/* Print / Chromium PDF: the one-pager is the deliverable */

body.pdf-export {
    background: #fff;
    color: #191510;
    margin: 0;
}

body.pdf-export .one-pager {
    border: none;
    border-radius: 0;
    max-width: none;
    overflow: visible;
    padding: 0 0.04in 0 0;
}

/* Force light dossier palette inside Chromium regardless of host dark mode. */
body.pdf-export {
    --ink: #191510;
    --muted: #6f695d;
    --paper: #f7f2e9;
    --surface: #fffdf8;
    --surface-2: #efe8db;
    --line: rgba(25, 21, 16, 0.12);
    --hairline: rgba(25, 21, 16, 0.08);
    --accent: #a87b3d;
    --accent-soft: rgba(168, 123, 61, 0.12);
}

@media print {
    body.app {
        background: #fff;
        color: var(--ink);
        font-size: 10pt;
        -webkit-font-smoothing: antialiased;
        text-rendering: optimizeLegibility;
    }

    .app-header,
    .flashes,
    .no-print {
        display: none !important;
    }

    .app-main {
        max-width: none;
        padding: 0;
    }

    .one-pager {
        background: #fff;
        border: none;
        max-width: none;
        /* Keep the gold rules, bullet squares and hairlines on paper. */
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        /* Tiny right inset so the absolute headshot border isn't clipped. */
        overflow: visible;
        padding: 0 0.04in 0 0;
    }

    p,
    li {
        orphans: 2;
        widows: 2;
    }

    .op-masthead-block {
        margin-bottom: 24px;
        padding-bottom: 20px;
    }

    .op-brand-row {
        margin-bottom: 10pt;
        min-height: 0;
        overflow: visible;
    }

    .op-wordmark {
        font-size: 13.5pt;
        letter-spacing: 0.16em;
    }

    .op-headshot {
        border-width: 0.75pt;
        height: 0.95in;
        right: 0;
        width: 0.95in;
    }

    .op-eyebrow {
        font-size: 6.5pt;
        letter-spacing: 0.22em;
        margin-bottom: 0.7em;
        max-width: calc(100% - 1.1in);
    }

    .op-address-title {
        max-width: calc(100% - 1.1in);
    }

    .op-address-title .op-street {
        font-size: 26pt;
        overflow: hidden;
        white-space: nowrap;
    }

    .op-address-title .op-cityline {
        font-size: 10.5pt;
    }

    .op-fact-grid {
        gap: 4px 32px;
        margin-top: 16px;
        padding-top: 13px;
    }

    .op-fact-grid dt {
        font-size: 6pt;
        margin-bottom: 4px;
    }

    .op-fact-grid dd {
        font-size: 12pt;
        font-weight: 600;
    }

    .op-prepared-for {
        font-size: 12pt;
        margin-top: 16px;
        padding-top: 13px;
    }

    .op-prepared-for span {
        font-size: 6pt;
        margin-bottom: 4px;
    }

    .op-summary {
        font-size: 11.5pt;
        font-weight: 600;
        line-height: 1.55;
        margin-bottom: 22px;
        padding-bottom: 18px;
    }

    .op-section {
        margin-bottom: 22px;
        padding-bottom: 18px;
    }

    .op-section h2 {
        font-size: 13pt;
        font-weight: 600;
        margin-bottom: 0.6em;
    }

    .op-bullets li {
        font-size: 9.5pt;
        line-height: 1.45;
        margin-bottom: 6px;
    }

    .op-table th,
    .op-table td {
        font-size: 9.5pt;
        line-height: 1.45;
        padding: 6px 0;
    }

    /* Shrink-to-fit label column: tight in wide tables, roomy in the two-up. */
    .op-table th {
        padding-right: 22px;
        width: 1%;
    }

    .op-table td {
        padding-right: 6px;
    }

    .op-comps thead th {
        font-size: 6.5pt;
    }

    .op-comps th,
    .op-comps td {
        padding-right: 14px;
        width: auto;
    }

    .op-columns {
        gap: 0 44px;
        margin-bottom: 22px;
        padding-bottom: 18px;
    }

    .op-visuals {
        gap: 14px;
        margin-bottom: 22px;
    }

    .op-contact {
        font-size: 9pt;
        line-height: 1.6;
        padding-top: 4px;
    }

    .op-contact-name {
        font-size: 13pt;
        margin-bottom: 4px;
    }

    .op-contact-role {
        font-size: 7pt;
    }

    /* Keep rows and headings intact, but let tall sections flow so pages
       don't end with a half-empty column. */
    .op-table tr,
    .op-summary,
    .op-contact,
    .op-visuals,
    .op-gallery {
        break-inside: avoid;
    }

    .op-section h2,
    .op-masthead-block {
        break-after: avoid;
    }

    .op-visuals img {
        max-height: 2.85in;
    }

    .op-gallery img {
        max-height: 2.2in;
    }

    a {
        text-decoration: none;
    }

    @page {
        size: Letter;
        margin: 0.55in 0.65in 0.5in;
    }
}

@media (max-width: 640px) {
    .app-header {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
        padding: 12px var(--pad-x);
    }

    .nav {
        gap: 10px 16px;
        justify-content: flex-start;
        letter-spacing: 0.1em;
    }

    .viewer-row {
        display: block;
    }

    .tier-badge {
        float: left;
        margin: 2px 12px 8px 0;
    }

    .viewer-row>.inline-form {
        float: right;
        margin: 2px 0 8px 12px;
    }

    .viewer-body {
        /* Flows around the floated badge and Mark done button. */
        display: block;
    }

    .viewer-row::after {
        clear: both;
        content: "";
        display: block;
    }

    .data-table {
        display: block;
        overflow-x: auto;
    }
}