html { font-size: calc(16px * var(--th-scale, 1)); }
/* Covercraft Portal — shared styles.
   Identity: matched to covercraftupholstery.com — monochrome luxe.
   Near-black chrome, ivory ground, champagne gold accents, Fraunces display.
   (Variable names kept from the workroom palette so markup never changes.) */

:root {
    --calico:  #F4F2ED;   /* ivory ground */
    --paper:   #FCFBF8;   /* warm white panels */
    --green:   #171614;   /* near-black — primary chrome & headings */
    --green-2: #302E2A;   /* charcoal hover */
    --brass:   #A8863C;   /* champagne gold accent */
    --walnut:  #4A4741;   /* deep warm grey */
    --ink:     #1E1D1A;
    --muted:   #716E67;
    --line:    #E0DDD5;
    --danger:  #9C2B1F;
    --ok:      #2C6E49;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--calico);
    color: var(--ink);
    font: 15px/1.55 "Public Sans", "Segoe UI", system-ui, sans-serif;
}

h1, h2, h3, .wordmark {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--green);
}
h1 { font-size: 1.7rem; }
h3 { font-size: 1.15rem; margin-top: 0; }

a { color: var(--green-2); text-decoration-color: var(--brass); text-underline-offset: 2px; }
a:hover { color: var(--brass); }

/* App chrome */
header.app {
    background: var(--green);
    color: #F5F3EE;
    padding: .7rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--brass);
}
header.app a { color: #F5F3EE; text-decoration: none; }
header.app a:hover { color: #D6BC7A; }
header.app .wordmark { color: #F5F3EE; letter-spacing: .06em; text-transform: uppercase; font-size: .95rem; font-size: 1.05rem; font-weight: 600; }
header.app .who > img { border-radius: 50%; vertical-align: middle; border: 2px solid var(--brass); }
header.app .brand img { border-radius: 0; border: 0; }

main { max-width: 68rem; margin: 1.4rem auto 3rem; padding: 0 1rem; }
main.narrow { max-width: 56rem; }

/* Paper panels — the estimate is a document, and looks like one. */
.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-top: 3px solid var(--brass);
    border-radius: 3px;
    padding: 1.2rem 1.4rem;
    margin-bottom: 1.3rem;
    box-shadow: 0 1px 0 rgba(38, 37, 31, .06);
}

/* Centered auth/setup panels */
body.centered { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-top: 4px solid var(--green);
    border-radius: 3px;
    padding: 2.4rem 2.6rem;
    max-width: 34rem;
    width: calc(100% - 2rem);
    box-shadow: 0 12px 30px rgba(38, 37, 31, .12);
}
.panel .wordmark { font-size: 1.7rem; letter-spacing: .05em; display: block; margin-bottom: .1rem; }
.panel .tagline { color: var(--muted); margin-top: 0; }

/* Forms */
label { display: block; font-weight: 600; font-size: .84rem; margin: .6rem 0 .18rem; color: var(--walnut); }
input, select, textarea {
    width: 100%;
    padding: .5rem .6rem;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 1px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 1.1rem; }

button, a.btn {
    display: inline-block;
    padding: .55rem 1.2rem;
    border: 0;
    border-radius: 3px;
    background: var(--green);
    color: #F5F3EE;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
button:hover, a.btn:hover { background: var(--green-2); color: #fff; }
button.alt { background: var(--paper); color: var(--green); border: 1px solid var(--green); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); padding: .25rem .55rem; }
button.danger:hover { background: var(--danger); color: #fff; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .78rem; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
th, td { padding: .5rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover > td { background: rgba(168, 123, 45, .05); }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.spec { white-space: pre-line; color: var(--muted); font-size: .86rem; }

.totals { max-width: 22rem; margin-left: auto; margin-top: .9rem; }
.totals td { border: 0; padding: .22rem .55rem; }
.totals tr:hover > td { background: none; }
.totals tr:last-child td { font-weight: 700; border-top: 2px solid var(--green); }

/* Status chips — colour encodes state */
.status { display: inline-block; padding: .12rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--line); color: var(--walnut); }
.status.sent      { background: #DCE7F5; color: #27476E; }
.status.accepted  { background: #DBEBE0; color: var(--ok); }
.status.rejected  { background: #F3DBD7; color: var(--danger); }
.status.converted { background: #F0E4CC; color: var(--brass); }

.muted { color: var(--muted); font-size: .93rem; }
.ok    { color: var(--ok); }
.err   { color: var(--danger); white-space: pre-wrap; }

.code {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 1.7rem;
    letter-spacing: .18em;
    font-weight: 700;
    background: var(--calico);
    border: 1px dashed var(--brass);
    padding: .45rem 1rem;
    border-radius: 3px;
    display: inline-block;
    margin: .5rem 0;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 1.4rem 0; }

@media (prefers-reduced-motion: no-preference) {
    button, a.btn, input, select, textarea { transition: background-color .12s ease, border-color .12s ease; }
}
@media (max-width: 640px) {
    .panel { padding: 1.6rem 1.3rem; }
    main { margin-top: 1rem; }
}

/* Dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.1rem; }
.tile {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    gap: .45rem; padding: 1.9rem 1.3rem 1.6rem;
    background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--brass);
    border-radius: 3px; box-shadow: 0 1px 0 rgba(38, 37, 31, .06);
    text-decoration: none; color: var(--ink);
}
.tile:hover { border-color: var(--brass); box-shadow: 0 6px 18px rgba(38, 37, 31, .12); color: var(--ink); }
.tile-icon svg { width: 62px; height: 62px; fill: none; stroke: var(--brass); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.tile:hover .tile-icon svg { stroke: var(--green); }
.tile-title { font-family: "Fraunces", Georgia, serif; font-size: 1.18rem; font-weight: 600; color: var(--green); }
.tile-blurb { color: var(--muted); font-size: .87rem; line-height: 1.4; }
@media (prefers-reduced-motion: no-preference) {
    .tile { transition: box-shadow .14s ease, border-color .14s ease, transform .14s ease; }
    .tile:hover { transform: translateY(-2px); }
}

/* Dashboard stats + panels */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: .9rem; margin-bottom: 1.3rem; }
.stat {
    display: flex; flex-direction: column; gap: .1rem; text-decoration: none;
    background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--brass);
    border-radius: 3px; padding: .85rem 1rem; box-shadow: 0 1px 0 rgba(38, 37, 31, .06);
}
.stat-n { font-family: "Fraunces", Georgia, serif; font-size: 1.65rem; font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }
.stat-l { color: var(--muted); font-size: .8rem; }
a.stat:hover { border-left-color: var(--green); }
a.stat:hover .stat-n { color: var(--brass); }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1.1rem; margin-bottom: 1.3rem; }

/* Ring charts */
.rings { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.1rem; margin-bottom: 1.3rem; }
.ring-card { margin-bottom: 0; display: grid; grid-template-columns: 120px 1fr; gap: .2rem 1rem; align-items: center; }
.ring-card h3 { grid-column: 1 / -1; margin-bottom: .4rem; }
.ring { width: 120px; height: 120px; transform: rotate(0deg); }
.ring-n { font-family: "Fraunces", Georgia, serif; font-size: .48em; font-weight: 600; fill: var(--green); }
.ring-s { font-size: .26em; fill: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; font-size: .84rem; color: var(--walnut); }
.legend li { display: flex; align-items: center; gap: .45rem; padding: .14rem 0; }
.legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.legend i { width: .72rem; height: .72rem; border-radius: 2px; flex: none; }

/* Sync modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(23, 22, 20, .55); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-overlay[hidden] { display: none; } /* explicit display beats the hidden attribute otherwise */
.modal { background: var(--paper); border-top: 4px solid var(--brass); border-radius: 3px; padding: 1.4rem 1.6rem; width: min(34rem, calc(100% - 2rem)); box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }
.progress { height: .55rem; background: var(--calico); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--brass); width: 0; transition: width .2s ease; }
.sync-feed { list-style: none; margin: 0; padding: 0; min-height: 8.2rem; }
.sync-feed li { display: flex; align-items: baseline; gap: .5rem; padding: .22rem 0; border-bottom: 1px dotted var(--line); font-size: .87rem; }
.sync-feed b { font-weight: 600; }
.sync-feed .muted { font-size: .8rem; }

/* Header with menu */
header.app { padding: 0; }
.app-inner { display: flex; align-items: center; gap: 1rem; padding: .55rem 1.2rem; flex-wrap: nowrap; max-width: 100rem; margin: 0 auto; }
.menu { white-space: nowrap; }
.brand { display: flex; align-items: center; }
.brand-img { height: 30px; display: block; filter: invert(1) brightness(1.7); }
.brand-img-png { filter: none; height: 34px; }
.menu { display: flex; gap: .1rem; flex-wrap: wrap; flex: 1; }
.menu a { padding: .45rem .7rem; font-size: var(--th-menu-fs, .88rem); font-weight: 600; border-bottom: 2px solid transparent; }
.menu a:hover { border-bottom-color: var(--green-2); }
.menu a.active { border-bottom-color: var(--brass); color: #fff; }
.who { display: flex; align-items: center; gap: .55rem; font-size: .86rem; }
.who .ctx { display: flex; align-items: center; gap: .4rem; margin-right: .4rem; font-family: "Fraunces", Georgia, serif; }
@media (max-width: 700px) { .who-name { display: none; } .app-inner { gap: .6rem; } }

/* Documents: folder browser + type chips */
.doc-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .9rem; }
.doc-folder { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 3px; text-decoration: none; color: var(--ink); box-shadow: 0 1px 0 rgba(38,37,31,.06); }
.doc-folder:hover { border-color: var(--brass); color: var(--ink); }
.doc-folder-name { font-weight: 600; color: var(--green); overflow-wrap: anywhere; }
.chips { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: .9rem; }
.chip { padding: .28rem .8rem; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--walnut); text-decoration: none; background: var(--paper); }
.chip:hover { border-color: var(--brass); color: var(--brass); }
.chip.active { background: var(--green); border-color: var(--green); color: #F5F3EE; }
.ext-badge { display: inline-block; min-width: 2.6rem; text-align: center; font-size: .68rem; font-weight: 700; letter-spacing: .04em; padding: .18rem .3rem; border: 1px solid var(--line); border-radius: 3px; color: var(--walnut); background: var(--calico); }

/* Customer modal */
.modal-wide { width: min(46rem, calc(100% - 2rem)); max-height: 90vh; overflow-y: auto; }
.cust-row, .row-link { cursor: pointer; }
.cust-row:focus-visible, .row-link:focus-visible { outline: 2px solid var(--brass); outline-offset: -2px; }
.pre { white-space: pre-line; margin-top: .1rem; }

/* Sortable column headers */
th.sort-th a { color: var(--muted); text-decoration: none; }
th.sort-th a:hover { color: var(--brass); }
th.sort-th.sorted a { color: var(--green); }
th.sort-th.num, td.num { text-align: right; }

/* Customer map + sparkline */
.cust-map { height: 190px; border: 1px solid var(--line); border-radius: 3px; margin-top: 1rem; z-index: 0; }
.spark { display: block; }


/* File-type icons */
.ficon { display: inline-flex; flex-direction: column; align-items: center; gap: 0; width: 2.4rem; }
.ficon svg { display: block; }
.ficon i { font-style: normal; font-size: .58rem; font-weight: 700; letter-spacing: .05em; color: var(--muted); }
.ficon-pdf  { color: #9C2B1F; }
.ficon-doc  { color: #27476E; }
.ficon-sheet{ color: #2C6E49; }
.ficon-cad  { color: #A8863C; }
.ficon-img  { color: #716E67; }

/* Pagination */
.pager { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .9rem; align-items: center; }
.pg { padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 3px; font-size: .84rem; font-weight: 600; text-decoration: none; color: var(--walnut); background: var(--paper); }
.pg:hover { border-color: var(--brass); color: var(--brass); }
.pg-on { background: var(--green); border-color: var(--green); color: #F5F3EE; }
.pg-off { color: var(--muted); border-color: transparent; background: none; }


/* Document viewer */
.doc-frame { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.doc-preview-img { max-width: 100%; border: 1px solid var(--line); border-radius: 3px; }
.doc-pre { background: var(--calico); border: 1px solid var(--line); border-radius: 3px; padding: .9rem 1rem; overflow: auto; max-height: 70vh; font-size: .82rem; }
.dl-ico { display: inline-flex; padding: .2rem .45rem; border: 1px solid var(--line); border-radius: 3px; color: var(--walnut); }
.dl-ico:hover { border-color: var(--brass); color: var(--brass); }


/* Production */
.parts-list { list-style: none; margin: 0; padding: 0; columns: 2 14rem; }
.parts-list li { padding: .22rem 0; break-inside: avoid; }
.parts-list li.done span { text-decoration: line-through; color: var(--muted); }
.parts-list label { display: flex; align-items: center; gap: .5rem; margin: 0; font-weight: 400; cursor: pointer; }
.parts-list input { width: auto; }
.parts-pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: var(--calico); border: 1px solid var(--line); font-size: .78rem; font-weight: 700; color: var(--walnut); }
.parts-pill.done { background: #DBEBE0; border-color: #DBEBE0; color: var(--ok); }
.chip-done { opacity: .55; text-decoration: line-through; }


/* Order-sheet document folders */
.doc-group { border: 1px solid var(--line); border-radius: 3px; margin-bottom: .55rem; background: var(--paper); }
.doc-group summary { cursor: pointer; padding: .5rem .8rem; font-weight: 600; color: var(--green); display: flex; align-items: center; gap: .5rem; list-style: none; }
.doc-group summary::-webkit-details-marker { display: none; }
.doc-group summary::after { content: "\25BE"; margin-left: auto; color: var(--muted); transition: transform .12s ease; }
.doc-group:not([open]) summary::after { transform: rotate(-90deg); }
.doc-group table { margin: 0 .8rem .6rem; width: calc(100% - 1.6rem); }

/* Order page: main + right sidebar */
main.order-page { max-width: 88rem; }
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 24rem; gap: 1.3rem; align-items: start; }
.order-side { position: sticky; top: 1rem; }
@media (max-width: 980px) { .order-layout { grid-template-columns: 1fr; } .order-side { position: static; } }
.history-feed { list-style: none; margin: 0; padding: 0; max-height: 24rem; overflow-y: auto; }
.history-feed li { padding: .45rem 0; border-bottom: 1px dotted var(--line); display: flex; flex-direction: column; gap: .05rem; }
.history-feed li:last-child { border-bottom: 0; }
.hist-time { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hist-event { font-size: .86rem; color: var(--ink); }
.hist-actor { font-size: .74rem; color: var(--brass); }


/* Popup document viewer */
.viewer-overlay { z-index: 60; }
.viewer-modal { position: relative; width: min(72rem, 95vw); height: min(88vh, 60rem); background: var(--paper); border-radius: 4px; box-shadow: 0 18px 60px rgba(23,22,20,.45); overflow: hidden; }
.viewer-modal iframe { width: 100%; height: 100%; border: 0; display: block; }
.viewer-close { position: absolute; top: .55rem; right: .7rem; z-index: 2; width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--walnut); font-size: .9rem; cursor: pointer; padding: 0; }
.viewer-close:hover { border-color: var(--brass); color: var(--brass); }

.doc-more { margin: .2rem .8rem .7rem; padding: .3rem .8rem; font-size: .78rem; }


/* Production pipeline */
.pipeline { display: flex; align-items: stretch; justify-content: space-between; gap: .1rem; overflow-x: auto; padding: .4rem .2rem .2rem; }
.pipe-node { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .6rem .9rem .55rem; border: 1px solid var(--line); border-radius: 6px; color: var(--walnut); min-width: 6.2rem; background: var(--paper); transition: border-color .12s ease, color .12s ease; }
.pipe-node svg { width: 40px; height: 40px; }
.pipe-node:hover { border-color: var(--brass); color: var(--brass); text-decoration: none; }
.pipe-node.active { border-color: var(--brass); color: var(--brass); box-shadow: 0 0 0 1px var(--brass) inset; }
.pipe-name { font-size: .78rem; font-weight: 600; letter-spacing: .02em; }
.pipe-count { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.pipe-node.active .pipe-count { color: var(--brass); }
.pipe-arrow { flex: 1 1 2rem; min-width: 2rem; max-width: 4.5rem; height: 52px; align-self: center; }

/* Settings + footer */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1.2rem; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.site-foot { max-width: 74rem; margin: 2.2rem auto 1.2rem; padding: 1rem 1.6rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; text-align: center; line-height: 1.55; }
.brand-strap { font-size: .72rem; color: #B9B4A8; margin-left: .7rem; border-left: 1px solid #4A4741; padding-left: .7rem; letter-spacing: .03em; }
main.order-page ~ .site-foot, .site-foot { }

.mail-log { min-height: 12rem; max-height: 24rem; font-size: .75rem; }
.mail-spin { width: .95rem; height: .95rem; border: 2px solid var(--line); border-top-color: var(--brass); border-radius: 50%; display: none; }
.mail-spin.on { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Settings tabs */
.tab-bar { display: flex; gap: .2rem; }
.tab { padding: .55rem 1.1rem; color: var(--walnut); font-weight: 600; font-size: .85rem; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--brass); text-decoration: none; }
.tab.active { color: var(--brass); border-bottom-color: var(--brass); }

/* Sign-in page with building photo */
.login-split { display: flex; width: min(58rem, 94vw); min-height: 34rem; border-radius: 6px; overflow: hidden; box-shadow: 0 18px 60px rgba(23,22,20,.35); }
.login-photo { flex: 1.15; background: url('/assets/signin.webp') center 22% / cover no-repeat #171614; position: relative; min-width: 0; }
.login-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(23,22,20,.55), rgba(23,22,20,.05) 55%); }
.login-photo-caption { position: absolute; left: 1.4rem; right: 1.2rem; bottom: 1.1rem; z-index: 1; color: #F4F2ED; font-family: Fraunces, Georgia, serif; font-size: 1.05rem; letter-spacing: .04em; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.login-panel { flex: 1; border-radius: 0; margin: 0; box-shadow: none; display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 720px) {
    .login-split { flex-direction: column; min-height: 0; }
    .login-photo { min-height: 14rem; flex: none; }
}


/* Tenant users table */
.users-wrap { overflow-x: auto; }
.users-table { font-size: .82rem; width: 100%; }
.users-table td, .users-table th { padding: .45rem .6rem; vertical-align: middle; }
.users-table .ell { max-width: 15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-sel { padding: .25rem .4rem; font-size: .8rem; width: auto; }
.pill-toggle { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--line); border-radius: 999px; background: var(--calico); padding: .18rem .7rem .18rem .22rem; cursor: pointer; font-size: .75rem; font-weight: 700; color: var(--muted); }
.pill-toggle .pill-knob { width: .95rem; height: .95rem; border-radius: 50%; background: #C9C4B8; transition: background .12s ease; }
.pill-toggle.on { border-color: var(--brass); color: var(--brass); background: #F7F2E6; }
.pill-toggle.on .pill-knob { background: var(--brass); }

/* Customer modal: extra-wide, two columns, contacts */
.modal-xwide { width: 95vw; max-width: 95vw; height: 95vh; max-height: 95vh; overflow-y: auto; }
.cust-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; align-items: start; }
@media (max-width: 900px) { .cust-cols { grid-template-columns: 1fr; } }
.contact-table { width: 100%; font-size: .82rem; }
.contact-table td { padding: .4rem .4rem; vertical-align: middle; }
.cc-role { padding: .22rem .35rem; font-size: .78rem; width: auto; }
.cc-actions { white-space: nowrap; text-align: right; }
.cc-actions button { padding: .25rem .6rem; font-size: .74rem; margin-left: .3rem; }
.contact-add { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: .4rem; margin-top: .5rem; }
.contact-add input, .contact-add select { padding: .35rem .5rem; font-size: .82rem; }
@media (max-width: 560px) { .contact-add { grid-template-columns: 1fr; } }

/* Contact role chips */
.role-chips { display: inline-flex; gap: .25rem; flex-wrap: wrap; }
.rchip { padding: .16rem .55rem; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); font-size: .7rem; font-weight: 700; cursor: pointer; }
.rchip.on { border-color: var(--brass); color: var(--brass); background: #F7F2E6; }

.dl-row { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: start; padding: .45rem 0; border-bottom: 1px dotted var(--line); }
.dl-row:last-child { border-bottom: 0; }
.dl-star { border: 0; background: none; color: #C9C4B8; font-size: 1rem; cursor: pointer; padding: 0 .1rem; }
.dl-star.on { color: var(--brass); }
.dl-map { height: 110px; border-radius: 3px; border: 1px solid var(--line); margin-top: .35rem; overflow: hidden; }

/* Two-logo branding */
.logo-preview { display: flex; align-items: center; gap: .7rem; margin: .5rem 0 0; }
.logo-preview img { max-height: 3rem; max-width: 14rem; background: var(--paper); border: 1px solid var(--line); border-radius: 3px; padding: .3rem .5rem; }
.brand-img-upload { filter: none; }
.brand-img-small { height: var(--th-logo-h, 49px); width: auto; }

/* Icon menu */
.menu .nav-link { display: inline-flex; align-items: center; gap: .42rem; }
.menu .nav-link svg { width: var(--th-icon-s, 18px); height: var(--th-icon-s, 18px); flex: none; opacity: .85; }
.menu .nav-link.active svg { opacity: 1; }
@media (max-width: 1080px) {
    .menu .nav-label { display: none; }
    .menu .nav-link { padding: .45rem .55rem; }
    .menu .nav-link svg { width: calc(var(--th-icon-s, 18px) + 2px); height: calc(var(--th-icon-s, 18px) + 2px); }
}


/* Keep the bar to one line: strapline goes first under pressure */
@media (max-width: 1250px) { .brand-strap { display: none; } }

/* Brand watermark — at the very bottom of the page flow, behind the content,
   aligned inside the same width as the main content column */
body { position: relative; overflow-x: clip; }
.brand-watermark { position: absolute; bottom: .5rem; left: 50%; transform: translateX(-50%);
    width: min(68rem, 100%); padding: 0 1rem; box-sizing: border-box;
    display: flex; justify-content: flex-end;
    z-index: 0; pointer-events: none; user-select: none; }
.brand-watermark img { width: var(--th-wm-w, 44rem); max-width: 100%; display: block;
    transform: translateX(20%) rotate(10deg); transform-origin: center;
    filter: grayscale(1) sepia(1) saturate(2.4) hue-rotate(-8deg) brightness(.92);
    opacity: var(--th-wm-op, .07); }
main, .card, header.app, .site-foot { position: relative; z-index: 1; }
@media (max-width: 700px) { .brand-watermark img { width: 26rem; } }
@media print { .brand-watermark { display: none; } }

.logo-preview-dark img { background: var(--ink); border-color: #3A3833; }

/* Back-to-top */
.to-top { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 30;
    width: 2.9rem; height: 2.9rem; border-radius: 50%; border: 1px solid var(--brass);
    background: var(--ink); color: var(--brass); cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 18px rgba(23,22,20,.3); }
.to-top svg { width: 1.25rem; height: 1.25rem; }
.to-top:hover { background: var(--brass); color: var(--ink); }
@media print { .to-top { display: none; } }

/* Settings tab icons */
.tab-bar .tab { display: inline-flex; align-items: center; gap: .42rem; }
.tab-bar .tab svg { width: 16px; height: 16px; flex: none; }
