/* =============================================================
   FACT SHEET EDITOR — Urban Living Properties
   Theme: gold / white / black, classy, luxury
   Page size: US Letter 8.5" x 11"
============================================================= */

:root {
    --gold: #c9a14a;
    --gold-soft: #d6b974;
    --gold-deep: #a07d2c;
    --black: #0f0f0f;
    --ink: #1a1a1a;
    --muted: #6b6b6b;
    --hairline: #e3e3e3;
    --row-zebra: #f4f4f4;
    --paper: #ffffff;
    --canvas: #2a2a2a;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.10);
    --radius: 4px;

    --page-w: 8.5in;
    --page-h: 11in;
    --page-margin: 0.5in;          /* default; toggled by JS */
    --label-col: 38%;
    --row-min-h: 0.40in;

    --font-head: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
    --font-body: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
/* Author rules with explicit `display` (e.g. `.toolbar { display: grid }`)
   override the user-agent `[hidden] { display: none }`, so `hidden=true`
   silently fails. Force hidden to win for any element. */
[hidden] { display: none !important; }
/* Visible main views stretch to fill space between toolbar and footer so the
   footer sits at the viewport bottom even when content is short. */
body > main,
body > section.list-view,
body > section.users-view { flex: 1 0 auto; }

/* ============================================================
   TOOLBAR
============================================================ */
.toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: #1b1b1b;
    border-bottom: 1px solid #000;
    color: #f1f1f1;
    box-shadow: var(--shadow-sm);
}
.toolbar-left,
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.toolbar-right { justify-content: flex-end; }
.toolbar-center { display: flex; justify-content: center; }
.toolbar-divider {
    width: 1px;
    height: 22px;
    background: #3a3a3a;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #f1f1f1;
    background: transparent;
    border: 1px solid #3a3a3a;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.toolbar-btn:hover {
    background: #2a2a2a;
    border-color: var(--gold);
    color: var(--gold-soft);
}
.toolbar-btn.is-primary {
    background: var(--gold);
    border-color: var(--gold);
    color: #111;
}
.toolbar-btn.is-primary:hover {
    background: var(--gold-soft);
    border-color: var(--gold-soft);
    color: #111;
}

.toolbar-status {
    font-family: var(--font-body);
    font-size: 12px;
    color: #9a9a9a;
    text-transform: none;
    letter-spacing: 0;
}
.toolbar-status.is-dirty { color: var(--gold-soft); }
.toolbar-status.is-saved { color: #7ab87a; }

/* TEMPLATE badge — only visible when toolbar.is-template-mode */
.toolbar-badge {
    display: none;
    align-items: center;
    padding: 4px 10px;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #111;
    background: var(--gold);
    border-radius: 3px;
}
.toolbar.is-template-mode .toolbar-badge { display: inline-flex; }

.seg-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 4px 12px;
    background: #111;
    border: 1px solid #3a3a3a;
    border-radius: var(--radius);
}
.seg-label {
    font-family: var(--font-head);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9a9a9a;
}
.seg-btn {
    padding: 6px 12px;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #c4c4c4;
    background: transparent;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}
.seg-btn:hover { color: #fff; }
.seg-btn.is-active {
    background: var(--gold);
    color: #111;
}

/* ============================================================
   EDITOR CANVAS
============================================================ */
.editor {
    padding: 28px 0 80px;
    /* No min-height: the body flex column + `flex: 1 0 auto` on this element
       already grows it to fill space between toolbar and footer. Setting one
       made the page taller than the viewport (toolbar + 100vh-60 + footer). */
}
.pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* ============================================================
   PAGE — 8.5" x 11"
============================================================ */
.page {
    position: relative;
    width: var(--page-w);
    height: var(--page-h);
    background: var(--paper);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.page-inner {
    position: relative;
    width: 100%;
    height: 100%;
    padding: var(--page-margin);
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 0;
}

/* ---------- HEADER (repeats on every page) ---------- */
.page-header {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 18px;
    padding-bottom: 14px;
    border-bottom: 0;
}
.header-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 13pt;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--black);
    white-space: nowrap;
    padding-right: 18px;
    border-right: 1px solid var(--gold);
    line-height: 1.1;
}
.header-title .title-faqs { font-weight: 800; }
.header-title .title-sep { color: var(--gold); margin: 0 6px; font-weight: 400; }
.header-title .title-fact { font-weight: 500; }

.header-contact {
    font-family: var(--font-body);
    font-size: 9.5pt;
    color: var(--gold-deep);
    letter-spacing: 0.02em;
    text-align: right;
}
.header-contact [contenteditable] { outline: none; }
.header-contact span { font-weight: 700; }

.header-rule {
    grid-column: 1 / -1;
    height: 1px;
    background: linear-gradient(to right, var(--gold) 0%, var(--gold) 34%, var(--hairline) 22%, var(--hairline) 100%);
    margin-top: 6px;
}

/* ---------- ADDRESS TITLE (page 1 only) ---------- */
.address-title {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 22pt;
    letter-spacing: 0.12em;
    text-align: center;
    color: var(--gold);
    text-transform: uppercase;
    padding: 10px 0 24px;
    outline: none;
    border: 2px dashed transparent;
    border-radius: 4px;
    margin: 4px 0;
    transition: border-color 0.15s, background 0.15s;
}
.address-title:empty {
    border-color: var(--gold);
    background: rgba(201, 161, 74, 0.04);
}
.address-title:empty:not(:focus)::before {
    content: attr(data-placeholder);
    display: inline-block;
    color: var(--gold-soft);
    font-style: italic;
    font-weight: 500;
    font-size: 13pt;
    letter-spacing: 0.04em;
    text-transform: none;
    pointer-events: none;
}
.address-title .num {
    color: var(--ink);
    font-weight: 500;
}

/* (Empty-state print/PDF overrides for .address-title now live in the
   global print + body.pdf-rendering blocks at the bottom of this file —
   they hide the border and placeholder unconditionally.) */

/* ---------- ROWS ---------- */
.page-content {
    position: relative;
    /* overflow: visible so the row handle/delete can render in the page margin
       area (just inside the page edge) without being clipped. The .page itself
       still has overflow: hidden which clips anything past the sheet boundary. */
    overflow: visible;
}
.rows-table {
    position: relative;
    width: 100%;
    border-left: 1px solid transparent; /* the gold vertical divider lives in each row */
}
.row {
    position: relative;
    display: grid;
    /* Handle and delete are absolutely positioned outside the row; the grid
       only contains the visible "table" columns. */
    grid-template-columns: 30px var(--label-col) 1px 1fr;
    align-items: stretch;
    min-height: var(--row-min-h);
    background: var(--paper);
    border-bottom: 0;
}
.row:nth-child(even) { background: var(--row-zebra); }
.row.is-dragging { opacity: 0.4; }
.row.is-drop-target-above::before,
.row.is-drop-target-below::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gold);
    z-index: 5;
}
.row.is-drop-target-above::before { top: -1px; }
.row.is-drop-target-below::after  { bottom: -1px; }

.row-handle {
    /* Floats outside the row to the LEFT, with a small gap. */
    position: absolute;
    right: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #bdbdbd;
    cursor: grab;
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

/* Lucide icon slot — first visible column of the row. */
.row-icon {
    grid-column: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    color: var(--gold);
    background: transparent;
    border: none;
    padding: 0 2px 0 10px;
    transition: color 0.15s, background 0.15s;
    position: relative;
}
.row-icon:hover { background: rgba(201, 161, 74, 0.10); }
.row-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}
/* Empty placeholder when no icon set — visible only on hover/focus */
.row-icon.is-empty::before {
    content: "+";
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 14px;
    color: var(--gold-soft);
    opacity: 0;
    transition: opacity 0.15s;
}
.row:hover .row-icon.is-empty::before,
.row-icon.is-empty:focus::before { opacity: 1; }
.row-icon.is-loading::before {
    content: "";
    width: 10px;
    height: 10px;
    border: 1.5px solid var(--gold);
    border-top-color: transparent;
    border-radius: 50%;
    opacity: 1;
    animation: icon-spin 0.7s linear infinite;
}
@keyframes icon-spin { to { transform: rotate(360deg); } }
.row:hover .row-handle { opacity: 1; }
.row-handle:hover { color: var(--gold); }
.row-handle:active { cursor: grabbing; }

.row-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 6px 14px;
    font-size: 11pt;
    line-height: 1.35;
    color: var(--ink);
    outline: none;
    word-break: break-word;
    overflow-wrap: anywhere;
}
/* Bullet lists inside cells */
.row-cell ul,
.row-cell ol {
    margin: 2px 0;
    padding-left: 18px;
}
.row-cell li {
    margin: 1px 0;
}
.row-cell ul { list-style-type: disc; }
.row-cell ul ul { list-style-type: circle; }
.row-cell ul ul ul { list-style-type: square; }
/* Inline-size spans should not collapse vertical centering */
.row-cell span[style*="font-size"] { line-height: 1.3; }
.row-cell:focus { background: rgba(201, 161, 74, 0.08); }
.row-cell[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: #b8b8b8;
    font-style: italic;
    pointer-events: none;
}

.row-label {
    grid-column: 2;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 11pt;
    color: var(--black);
    padding-right: 18px;
}

.col-resizer {
    grid-column: 3;
    width: 1px;
    background: var(--gold);
    cursor: col-resize;
    position: relative;
}
.col-resizer::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -4px;
    right: -4px;
}
.col-resizer:hover { background: var(--gold-deep); box-shadow: 0 0 0 1px var(--gold-deep); }

.row-answer {
    grid-column: 4;
    font-family: var(--font-body);
    color: #2a2a2a;
}

.row-delete {
    /* Floats outside the row to the RIGHT, with a small gap. */
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #bdbdbd;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.row:hover .row-delete { opacity: 1; }
.row-delete:hover { color: #b53b3b; }

.row-resizer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px;
    height: 6px;
    cursor: row-resize;
    z-index: 4;
}
.row-resizer:hover {
    background: rgba(201, 161, 74, 0.4);
}

.add-row-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* Inside .page-content; spans the full content-area width. */
    width: 100%;
    margin: 6px 0 0;
    padding: 8px 10px;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 10pt;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold-deep);
    background: transparent;
    border: 1px dashed var(--gold);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.add-row-btn:hover {
    background: rgba(201, 161, 74, 0.08);
    color: var(--gold);
}

/* ---------- FOOTER (repeats on every page) ---------- */
.page-footer {
    margin-top: 0;
    background: var(--black);
    color: #efefef;
    display: grid;
    grid-template-columns: 1fr 2fr;
    align-items: center;
    gap: 24px;
    padding: 22px 26px;
    margin-left: calc(var(--page-margin) * -1);
    margin-right: calc(var(--page-margin) * -1);
    margin-bottom: calc(var(--page-margin) * -1);
}
.footer-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border-right: 1px solid #3a3a3a;
    padding-right: 24px;
}
.footer-logo img {
    width: 140px;
    height: auto;
    background: transparent;
    padding: 0;
}
.footer-broker {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 9.5pt;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #efefef;
    text-align: center;
}
.footer-broker .broker-role { color: var(--gold); font-weight: 600; }

.footer-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 9pt;
    color: #efefef;
    text-align: center;
}
.footer-info .row-1 {
    font-size: 8pt;
    letter-spacing: 0.04em;
}
.footer-info .row-2 {
    border-top: 1px solid var(--gold);
    padding-top: 8px;
    color: #d6d6d6;
}
.footer-info [contenteditable] { outline: none; }

/* ---------- PAGE BREAK INDICATOR (edit only) ---------- */
.page-break-indicator {
    position: absolute;
    bottom: -16px;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--font-head);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold-soft);
    pointer-events: none;
}
.page-break-indicator::before,
.page-break-indicator::after {
    content: "";
    display: inline-block;
    vertical-align: middle;
    width: 38%;
    height: 1px;
    background: repeating-linear-gradient(to right, var(--gold-soft) 0 6px, transparent 6px 12px);
    margin: 0 10px;
}
.page:last-child .page-break-indicator { display: none; }

/* ============================================================
   FLOATING SELECTION TOOLBAR
============================================================ */
.selection-toolbar {
    position: fixed;
    z-index: 200;
    display: none;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: #1b1b1b;
    border: 1px solid var(--gold);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    transform: translate(-50%, -100%);
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto;
}
.selection-toolbar.is-visible {
    display: inline-flex;
}
.selection-toolbar::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: #1b1b1b;
    border-right: 1px solid var(--gold);
    border-bottom: 1px solid var(--gold);
    transform: translateX(-50%) rotate(45deg);
}
.sel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    font-family: var(--font-head);
    font-size: 12px;
    font-weight: 600;
    color: #efefef;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.sel-btn:hover {
    background: #2a2a2a;
    color: var(--gold-soft);
}
.sel-btn.is-active {
    background: var(--gold);
    color: #111;
    border-color: var(--gold);
}
.sel-btn b, .sel-btn i, .sel-btn u { font-style: inherit; pointer-events: none; }
.sel-btn b { font-weight: 800; }
.sel-btn i { font-style: italic; font-family: 'Open Sans', serif; }
.sel-size {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    font-family: var(--font-body);
    font-size: 11px;
    color: #c4c4c4;
    background: #111;
    border: 1px solid #3a3a3a;
    border-radius: 3px;
}
.sel-sep {
    width: 1px;
    height: 18px;
    background: #3a3a3a;
    margin: 0 2px;
}

/* ============================================================
   ICON PICKER POPOVER
============================================================ */
.icon-picker {
    position: fixed;
    z-index: 210;
    display: none;
    flex-direction: column;
    gap: 8px;
    width: 260px;
    padding: 12px 14px;
    background: #1b1b1b;
    color: #efefef;
    border: 1px solid var(--gold);
    border-radius: 6px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    transform: translate(0, 0);
}
.icon-picker.is-visible { display: flex; }
.icon-picker::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 16px;
    width: 10px;
    height: 10px;
    background: #1b1b1b;
    border-left: 1px solid var(--gold);
    border-top: 1px solid var(--gold);
    transform: rotate(45deg);
}
.icon-picker.is-below::before {
    top: auto;
    bottom: -6px;
    transform: rotate(225deg);
}
.icon-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-head);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #c4c4c4;
}
.icon-picker-header a {
    color: var(--gold);
    text-decoration: none;
    font-size: 10px;
    letter-spacing: 0.04em;
}
.icon-picker-header a:hover { color: var(--gold-soft); text-decoration: underline; }
.icon-picker-input {
    width: 100%;
    padding: 8px 10px;
    font-family: var(--font-body);
    font-size: 13px;
    color: #fff;
    background: #0f0f0f;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    outline: none;
}
.icon-picker-input:focus { border-color: var(--gold); }
.icon-picker-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}
.icon-picker-actions button {
    padding: 6px 14px;
    font-family: var(--font-head);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #efefef;
    background: transparent;
    border: 1px solid #3a3a3a;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.icon-picker-actions button:hover { border-color: var(--gold); color: var(--gold-soft); }
.icon-picker-actions .is-primary {
    background: var(--gold);
    color: #111;
    border-color: var(--gold);
}
.icon-picker-actions .is-primary:hover {
    background: var(--gold-soft);
    border-color: var(--gold-soft);
    color: #111;
}
.icon-picker-error {
    font-family: var(--font-body);
    font-size: 11px;
    color: #e9a3a3;
    padding: 4px 0 0;
}

/* Hide the entire picker UI when printing */
@media print {
    .icon-picker { display: none !important; }
}

/* ============================================================
   MARGINS TOGGLE
============================================================ */
body[data-margins="default"] { --page-margin: 0.5in; }
body[data-margins="minimal"] { --page-margin: 0.25in; }

/* ============================================================
   LIST VIEW
============================================================ */
.list-view {
    background: #f7f6f2;
    color: var(--ink);
}
.list-header {
    background: #1b1b1b;
    padding: 28px 0;
    border-bottom: 4px solid var(--gold);
}
.list-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.list-header-actions {
    display: flex;
    gap: 10px;
}
.list-header h1 {
    margin: 0;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 22pt;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #fff;
}
.list-header h1::after {
    content: "";
    display: block;
    width: 60px;
    height: 2px;
    background: var(--gold);
    margin-top: 10px;
}

.list-body {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 32px 80px;
}
.list-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--muted);
    font-family: var(--font-body);
}
.list-empty p { margin: 0; font-size: 14pt; }
.list-empty-sub { font-size: 11pt; margin-top: 8px !important; }

.sheet-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}
.sheet-card {
    background: #fff;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sheet-card:hover {
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.sheet-card-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 13pt;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink);
    line-height: 1.25;
}
.sheet-card-meta {
    font-family: var(--font-body);
    font-size: 10pt;
    color: var(--muted);
}
.sheet-card-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--hairline);
}
.sheet-card-actions button {
    flex: 1;
    padding: 6px 10px;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
    background: transparent;
    border: 1px solid var(--hairline);
    border-radius: 3px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.sheet-card-actions button:hover {
    border-color: var(--gold);
    color: var(--gold-deep);
}
.sheet-card-actions .danger:hover {
    border-color: #b53b3b;
    color: #b53b3b;
}

/* ============================================================
   PDF RENDERING — applied while html2pdf is capturing the canvas.
   Mirrors the print rules so the captured image looks like the print.
============================================================ */
body.pdf-rendering .no-print { display: none !important; }
/* Zero out any ancestor margins/padding so the captured page sits at (0,0)
   and html2canvas doesn't include surrounding whitespace. */
body.pdf-rendering,
body.pdf-rendering html { margin: 0 !important; padding: 0 !important; }
body.pdf-rendering .editor { padding: 0 !important; min-height: auto !important; }
body.pdf-rendering .pages {
    gap: 0 !important;
    align-items: stretch !important;
    margin: 0 !important;
    padding: 0 !important;
}
body.pdf-rendering .page {
    box-shadow: none;
    page-break-after: always;
    break-after: page;
    margin: 0 !important;
}
body.pdf-rendering .page:last-child {
    page-break-after: auto;
    break-after: auto;
}
body.pdf-rendering .row-handle,
body.pdf-rendering .row-delete,
body.pdf-rendering .row-resizer,
body.pdf-rendering .add-row-btn,
body.pdf-rendering .page-break-indicator,
body.pdf-rendering .selection-toolbar,
body.pdf-rendering .icon-picker { display: none !important; }
body.pdf-rendering .row-icon.is-empty::before { display: none !important; content: none !important; }
body.pdf-rendering .row {
    grid-template-columns: 30px var(--label-col) 1px 1fr;
}
body.pdf-rendering .col-resizer {
    display: block !important;
    background: var(--gold);
}
body.pdf-rendering .row-icon {
    display: flex !important;
    color: #c9a14a !important;
}
body.pdf-rendering .row-icon svg {
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    fill: none !important;
    stroke: #c9a14a !important;
}
body.pdf-rendering .row-cell::before,
body.pdf-rendering .address-title::before,
body.pdf-rendering [contenteditable]::before {
    display: none !important;
    content: none !important;
}
body.pdf-rendering .address-title {
    border: none !important;
    background: transparent !important;
}

/* ============================================================
   PRINT
============================================================ */
@page {
    size: letter;
    margin: 0;
}

@media print {
    html, body {
        background: #fff;
        margin: 0;
        padding: 0;
    }
    .no-print { display: none !important; }
    .editor { padding: 0; min-height: auto; }
    .pages { gap: 0; }
    .page {
        box-shadow: none;
        page-break-after: always;
        break-after: page;
        margin: 0;
    }
    .page:last-child {
        page-break-after: auto;
        break-after: auto;
    }
    .row-handle,
    .row-delete,
    .row-resizer,
    .add-row-btn,
    .page-break-indicator,
    .selection-toolbar,
    .icon-picker {
        display: none !important;
    }
    .row-icon.is-empty::before { display: none !important; content: none !important; }
    .row {
        grid-template-columns: 30px var(--label-col) 1px 1fr;
    }
    .col-resizer {
        display: block !important;
        background: var(--gold);
    }
    .row-cell:focus { background: transparent; }
    /* Force row-icons visible with hardcoded gold (avoid currentColor edge cases) */
    .row-icon {
        display: flex !important;
        color: #c9a14a !important;
    }
    .row-icon svg {
        display: block !important;
        width: 18px !important;
        height: 18px !important;
        fill: none !important;
        stroke: #c9a14a !important;
    }
    /* Suppress all editor placeholders ("Answer", "Add address", etc.) */
    .row-cell::before,
    .address-title::before,
    [contenteditable]::before {
        display: none !important;
        content: none !important;
    }
    /* Address title — never show the dashed editor border in print */
    .address-title {
        border: none !important;
        background: transparent !important;
    }
    [contenteditable]:empty::before { display: none; }
    /* keep colors faithful */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ====================================================================
   AUTH OVERLAY (login + change-PIN + user modal)
==================================================================== */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 20, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    padding: 24px;
}
.auth-overlay[hidden] { display: none; }
.auth-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    width: min(100%, 380px);
}
.auth-logo {
    width: 200px;
    max-width: 80%;
    height: auto;
    display: block;
}
.auth-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 28px 28px 24px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-family: var(--font-body);
}
.auth-card h1 {
    font-family: var(--font-head);
    font-size: 18pt;
    font-weight: 600;
    color: var(--black);
    margin: 0;
    letter-spacing: 0.04em;
}
.auth-sub {
    color: #666;
    font-size: 10pt;
    margin: 0 0 6px;
}
.auth-card label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 9pt;
    color: #444;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.auth-card input,
.auth-card select {
    font: inherit;
    font-size: 12pt;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--black);
    padding: 9px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    outline: none;
}
.auth-card input:focus,
.auth-card select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(190, 158, 92, 0.2);
}
.auth-error {
    background: #fde7e7;
    color: #8a1a1a;
    border: 1px solid #f0bcbc;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 9.5pt;
}
.auth-submit {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}
.user-modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}
.user-modal-actions .toolbar-btn { flex: 1; justify-content: center; }

/* ====================================================================
   TOOLBAR — user badge, logout, users buttons
==================================================================== */
.toolbar-user {
    color: var(--gold-deep);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 10pt;
    margin-right: 4px;
    letter-spacing: 0.02em;
}

/* ====================================================================
   USERS VIEW (admin only)
==================================================================== */
.users-view {
    background: #f7f5f0;
    padding: 0 0 60px;
}
.users-view[hidden] { display: none; }
.users-table {
    width: min(100%, 960px);
    margin: 24px auto;
    background: #fff;
    border-radius: 6px;
    border-collapse: collapse;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    font-family: var(--font-body);
}
.users-table th,
.users-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #ececec;
    font-size: 10pt;
}
.users-table thead th {
    background: var(--black);
    color: #efefef;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 8.5pt;
}
.users-table tbody tr:last-child td { border-bottom: 0; }
.users-table tbody tr:hover { background: #faf7f0; }
.user-actions { white-space: nowrap; text-align: right; }
.user-actions button {
    margin-left: 4px;
    padding: 4px 10px;
    font-size: 9pt;
    background: #f0eee8;
    border: 1px solid #d8d3c5;
    border-radius: 3px;
    cursor: pointer;
    color: var(--black);
}
.user-actions button:hover { background: var(--gold); color: #fff; border-color: var(--gold); }
.user-actions button.danger:hover { background: #b03030; color: #fff; border-color: #b03030; }
.user-locked  { color: #b03030; font-weight: 600; }
.user-pending { color: #c08300; font-weight: 600; }
.user-ok      { color: #4a7d3c; font-weight: 600; }
.user-empty   { color: #aaa; }
.users-table a { color: var(--gold-deep); text-decoration: none; }
.users-table a:hover { text-decoration: underline; }
.auth-optional {
    color: #999;
    font-weight: 400;
    text-transform: none;
    font-size: 8.5pt;
    letter-spacing: 0;
    margin-left: 4px;
}

/* ====================================================================
   SITE FOOTER (chrome — visible on web pages, never printed)
==================================================================== */
.site-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding: 10px 24px;
    background: var(--black);
    color: #d6d6d6;
    font-family: var(--font-body);
    font-size: 9pt;
    letter-spacing: 0.04em;
    border-top: 1px solid var(--gold);
    /* Pin to viewport bottom even when footer is the only visible flex child
       (e.g. on the login page where all main views are hidden). */
    margin-top: auto;
    /* Sit above the auth overlay (z-index 5000) so the footer remains visible
       on the login page; it strips the bottom 54px from the dim backdrop. */
    position: relative;
    z-index: 5500;
}
.site-footer[hidden] { display: none; }
.site-footer-left  { justify-self: start; }
.site-footer-right { justify-self: end; }
.site-footer-center {
    justify-self: center;
    display: flex;
    align-items: center;
}
.site-footer-center img {
    height: 28px;
    width: auto;
    display: block;
}
.site-footer .toolbar-btn {
    background: transparent;
    color: #efefef;
    border: 1px solid #4a4a4a;
}
.site-footer .toolbar-btn:hover {
    background: var(--gold);
    border-color: var(--gold);
    color: #fff;
}

/* ====================================================================
   TOAST
==================================================================== */
.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    background: var(--black);
    color: #fff;
    padding: 12px 16px;
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 4000;
    font-family: var(--font-body);
    font-size: 10pt;
    max-width: min(92vw, 560px);
}
.toast[hidden] { display: none; }
.toast-text { flex: 1; }
.toast-action {
    background: var(--gold);
    color: #fff;
    border: 0;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}
.toast-action:hover { filter: brightness(1.1); }
.toast-close {
    background: transparent;
    color: #ccc;
    border: 0;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.toast-close:hover { color: #fff; }

/* status: saving */
.toolbar-status.is-saving { color: #c08300; font-weight: 600; }

