/*
 * ZaberaApp design tokens + overrides, layered over vendored Bootstrap 5 CSS (loaded first via importmap).
 * Light theme only. Look: a deep green sidebar, a pale mint canvas, white rounded cards, black pill
 * buttons for the main action, a fresh green accent (replaced by a business's brand colour), big numbers.
 */
:root {
    /* The accent: ZaberaApp green by default; a business's brand colour replaces these five (see base.html.twig). */
    --accent: #2fbf71;
    --accent-dark: #22a25d;
    --accent-light: #9be3bb;
    --accent-soft: #e3f6eb;
    --accent-on: #ffffff;

    --forest: #0d3b31;          /* sidebar, dark cards */
    --forest-deep: #082a23;
    --forest-line: rgba(255, 255, 255, .08);
    --forest-text: rgba(255, 255, 255, .62);
    --ember: #e8643c;           /* the warm second colour, used sparingly */
    --ember-soft: #fdeee8;

    --ink: #0f1a17;
    --ink-hover: #24332e;

    --canvas-bg: #eef4f1;
    --panel-bg: #f4f8f6;
    --surface: #ffffff;
    --border-subtle: #e2ebe6;
    --text-strong: #0f1a17;
    --text-body: #3a4743;
    --text-muted: #85928d;

    --status-green-bg: #e3f6eb;   --status-green-text: #16794a;
    --status-amber-bg: #fff3df;   --status-amber-text: #a96300;
    --status-blue-bg: #e6eefc;    --status-blue-text: #2f56b0;
    --status-lime-bg: #f1f8d8;    --status-lime-text: #4d5a00;
    --status-grey-bg: #edf1ef;    --status-grey-text: #66726e;
    --status-red-bg: #fdecec;     --status-red-text: #c62f35;

    --radius-card: 22px;
    --radius-control: 14px;
    --sidebar-width: 268px;
    --shadow-card: 0 1px 2px rgba(13, 59, 49, .04), 0 6px 20px rgba(13, 59, 49, .05);

    --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-color: var(--text-body);
    --bs-body-bg: var(--canvas-bg);
    --bs-primary: var(--ink);
    --bs-primary-rgb: 15, 26, 23;
    --bs-link-color: var(--forest);
    --bs-link-color-rgb: 13, 59, 49;
    --bs-link-hover-color: var(--accent-dark);
    --bs-border-color: var(--border-subtle);
}

body { background: var(--canvas-bg); color: var(--text-body); font-family: var(--bs-body-font-family); }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--text-strong); font-weight: 700; letter-spacing: -.02em; }
.text-strong { color: var(--text-strong); font-weight: 600; }
a { text-underline-offset: 3px; }

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 22px; line-height: 1; vertical-align: middle;
}

/* ---------- Buttons & controls ---------- */
.btn { border-radius: 999px; font-weight: 600; padding: .6rem 1.15rem; display: inline-flex; align-items: center; gap: .45rem; }
.btn .material-symbols-outlined { font-size: 20px; }
.btn-primary {
    --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff;
    --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink);
    --bs-btn-hover-bg: var(--ink-hover); --bs-btn-hover-border-color: var(--ink-hover);
    --bs-btn-active-bg: var(--ink); --bs-btn-active-border-color: var(--ink);
    --bs-btn-disabled-bg: var(--ink); --bs-btn-disabled-border-color: var(--ink);
}
.btn-accent { background: var(--accent); border: 1px solid var(--accent); color: var(--accent-on); }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: var(--accent-on); }
.btn-soft { background: var(--surface); border: 1px solid var(--border-subtle); color: var(--text-strong); }
.btn-soft:hover { background: var(--panel-bg); color: var(--text-strong); }
.btn-outline-danger { border-radius: 999px; }
.btn-sm { padding: .35rem .8rem; font-size: .85rem; }
.btn-sm .material-symbols-outlined { font-size: 18px; }
.form-control, .form-select { border-radius: var(--radius-control); border-color: var(--border-subtle); padding: .65rem .95rem; background-color: var(--surface); }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem var(--accent-soft); }
.form-control-sm { padding: .4rem .7rem; }
.form-label { font-weight: 600; color: var(--text-strong); font-size: .88rem; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem var(--accent-soft); border-color: var(--accent); }
.input-group-text { border-radius: var(--radius-control); border-color: var(--border-subtle); background: var(--panel-bg); color: var(--text-muted); font-weight: 600; }

/* ---------- Shell ---------- */
.app-shell { min-height: 100vh; }
.app-sidebar { width: var(--sidebar-width); background: linear-gradient(180deg, var(--forest) 0%, var(--forest-deep) 100%); color: #fff; }
@media (min-width: 992px) {
    .app-sidebar { position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; }
    .app-main { margin-left: var(--sidebar-width); }
}
.app-sidebar .offcanvas-body { display: flex; flex-direction: column; padding: 0 1rem; height: 100%; overflow-y: auto; }

.app-brand { display: flex; align-items: center; gap: .6rem; padding: 1.6rem .5rem 1.25rem; font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; color: #fff; text-decoration: none; border-bottom: 1px solid var(--forest-line); margin-bottom: .5rem; }
.app-brand:hover { color: #fff; }
.app-brand-mark { width: 34px; height: 34px; flex-shrink: 0; }

.app-nav-label { padding: 1.1rem .75rem .45rem; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .38); }
.app-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
.app-nav-link { display: flex; align-items: center; gap: .75rem; padding: .5rem .65rem; border-radius: 999px; color: var(--forest-text); text-decoration: none; font-weight: 500; font-size: .93rem; transition: background .15s ease, color .15s ease; }
.app-nav-icon { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .06); flex-shrink: 0; }
.app-nav-icon .material-symbols-outlined { font-size: 19px; }
.app-nav-link:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.app-nav-link.active { color: #fff; background: rgba(255, 255, 255, .1); font-weight: 600; }
.app-nav-link.active .app-nav-icon { background: var(--accent); color: var(--accent-on); }
.app-nav-link.is-soon { opacity: .45; pointer-events: none; }
.app-nav-soon { margin-left: auto; font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .15rem .45rem; border-radius: 999px; background: rgba(255, 255, 255, .1); }
.app-nav-count { margin-left: auto; min-width: 1.5rem; padding: .1rem .5rem; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; }

.app-sidebar-footer { margin-top: auto; padding: 1rem 0 1.25rem; border-top: 1px solid var(--forest-line); }
.app-account { display: flex; align-items: center; gap: .7rem; padding: .25rem .5rem; color: #fff; text-decoration: none; }
.app-version { font-size: .68rem; color: rgba(255, 255, 255, .38); padding: .75rem .5rem 0; }
.app-account-label { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .38); padding: 0 .5rem .6rem; }
.app-account-name { font-weight: 600; line-height: 1.2; }
.app-account-meta { font-size: .8rem; color: var(--forest-text); }

/* Business switcher: top of the sidebar */
.business-switcher { width: 100%; display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid var(--forest-line); color: #fff; text-align: left; }
.business-switcher:hover { background: rgba(255, 255, 255, .1); }
.business-badge { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; background: var(--accent); color: var(--accent-on); }
.business-switcher-text { min-width: 0; flex: 1; line-height: 1.2; }
.business-switcher-name { font-weight: 700; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.business-switcher-meta { font-size: .74rem; color: var(--forest-text); }
.business-menu { min-width: 236px; }
.business-menu .dropdown-item { display: flex; align-items: center; gap: .6rem; }
.business-menu .business-badge { width: 28px; height: 28px; border-radius: 8px; font-size: .7rem; }

.app-topbar { display: flex; align-items: center; gap: 1rem; padding: 1.5rem 2.25rem .5rem; }
.app-topbar-date { color: var(--text-muted); font-size: .88rem; }

.app-icon-button { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface); border: 0; color: var(--text-strong); box-shadow: var(--shadow-card); }
.app-icon-button:hover { background: var(--panel-bg); }
.app-user-chip { display: inline-flex; align-items: center; gap: .6rem; background: var(--surface); border-radius: 999px; padding: .3rem 1rem .3rem .3rem; box-shadow: var(--shadow-card); border: 0; text-align: left; }
.app-user-chip-name { font-weight: 600; color: var(--text-strong); line-height: 1.2; font-size: .9rem; }
.app-user-chip-role { font-size: .75rem; color: var(--text-muted); line-height: 1.1; }
.app-avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--forest); font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.app-sidebar .app-avatar { background: var(--accent); color: var(--accent-on); }
.app-avatar--photo { object-fit: cover; background: var(--panel-bg); }
.app-user-chip { cursor: pointer; }
.app-user-chip-caret { color: var(--text-muted); font-size: 20px; }
.photo-preview { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; background: var(--accent-soft); color: var(--forest); display: grid; place-items: center; font-weight: 700; font-size: 1.8rem; flex-shrink: 0; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

.app-content { padding: .75rem 2.25rem 3rem; }

@media (max-width: 991.98px) {
    .app-topbar { padding: 1rem 1rem .25rem; }
    .app-content { padding: .5rem 1rem 2rem; }
    .app-user-chip-text { display: none; }
    .app-user-chip { padding: .3rem; }
}

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-header-eyebrow { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.page-header-title { font-size: 1.85rem; font-weight: 800; margin: 0; letter-spacing: -.03em; }
.page-header-subtitle { color: var(--text-muted); margin: .15rem 0 0; font-size: .9rem; }
.page-header-actions { margin-left: auto; display: flex; gap: .6rem; flex-wrap: wrap; }
@media (max-width: 575.98px) { .page-header-title { font-size: 1.5rem; } .page-header-actions { margin-left: 0; width: 100%; } }

/* ---------- Cards ---------- */
.app-card { background: var(--surface); border: 0; border-radius: var(--radius-card); padding: 1.5rem; box-shadow: var(--shadow-card); }
.app-card-header { display: flex; align-items: center; gap: .75rem; justify-content: space-between; margin-bottom: 1.1rem; flex-wrap: wrap; }
.app-card-title { font-size: 1.05rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: .6rem; }
.app-card-title .material-symbols-outlined { color: var(--text-muted); font-size: 20px; }
.app-card--forest { background: linear-gradient(150deg, var(--forest) 0%, var(--forest-deep) 100%); color: #fff; }
.app-card--forest .app-card-title, .app-card--forest h2, .app-card--forest h3 { color: #fff; }
.app-card--forest .text-muted { color: var(--forest-text) !important; }
.app-card--forest .detail-list dt { color: var(--forest-text); }
.app-card--forest .detail-list dd { color: #fff; }

/* Stat cards: a quiet label, a big number, a short caption. */
.stat-card { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; transition: transform .15s ease; }
a.stat-card:hover { transform: translateY(-2px); color: inherit; }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.stat-card-label { color: var(--text-muted); font-size: .82rem; font-weight: 500; }
.stat-card-icon { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); display: inline-flex; align-items: center; justify-content: center; color: var(--accent-dark); }
.stat-card-icon .material-symbols-outlined { font-size: 20px; }
.stat-card { container-type: inline-size; }
/* One line (a minus would otherwise wrap), shrinking to fit a narrow card. */
.stat-card-value { font-size: min(2.2rem, 13cqi); font-weight: 800; letter-spacing: -.04em; color: var(--text-strong); line-height: 1.1; margin-top: .9rem; white-space: nowrap; }
.stat-card-caption { color: var(--text-muted); font-size: .8rem; margin-top: .3rem; }
.stat-card--forest { background: linear-gradient(150deg, var(--forest) 0%, var(--forest-deep) 100%); }
.stat-card--forest .stat-card-value { color: #fff; }
.stat-card--forest .stat-card-label, .stat-card--forest .stat-card-caption { color: var(--forest-text); }
.stat-card--forest .stat-card-icon { background: rgba(255, 255, 255, .1); color: var(--accent-light); }
@media (max-width: 575.98px) { .stat-card-value { font-size: min(1.6rem, 13cqi); } }

/* Welcome banner: the dark pill card from the dashboard */
.welcome-card { display: flex; align-items: center; gap: 1.25rem; border-radius: 999px; padding: 1rem 1.75rem 1rem 1rem; background: var(--forest); color: #fff; box-shadow: var(--shadow-card); }
.welcome-ring { --progress: 0; width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: conic-gradient(var(--ember) calc(var(--progress) * 1%), rgba(255, 255, 255, .12) 0); }
.welcome-ring span { width: 50px; height: 50px; border-radius: 50%; background: var(--forest); display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.welcome-card-title { font-weight: 700; color: #fff; margin: 0; font-size: 1rem; }
.welcome-card-text { color: var(--forest-text); font-size: .85rem; margin: 0; }
@media (max-width: 575.98px) { .welcome-card { border-radius: var(--radius-card); } }

/* ---------- Checklist ---------- */
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.checklist a { display: flex; align-items: center; gap: .75rem; padding: .75rem .9rem; border-radius: var(--radius-control); background: var(--panel-bg); color: var(--text-strong); font-weight: 500; text-decoration: none; }
.checklist a:hover { background: var(--accent-soft); }
.checklist-mark { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid #c9d6d0; color: transparent; flex-shrink: 0; }
.checklist .is-done a { color: var(--text-muted); text-decoration: line-through; text-decoration-color: #c9d6d0; }
.checklist .is-done .checklist-mark { background: var(--accent); border-color: var(--accent); color: var(--accent-on); }
.checklist-mark .material-symbols-outlined { font-size: 16px; }

/* ---------- Status pills & chips ---------- */
.status-pill { display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; font-size: .78rem; padding: .25rem .65rem; border-radius: 999px; white-space: nowrap; }
.status-pill--green { background: var(--status-green-bg); color: var(--status-green-text); }
.status-pill--amber { background: var(--status-amber-bg); color: var(--status-amber-text); }
.status-pill--blue { background: var(--status-blue-bg); color: var(--status-blue-text); }
.status-pill--lime { background: var(--status-lime-bg); color: var(--status-lime-text); }
.status-pill--grey { background: var(--status-grey-bg); color: var(--status-grey-text); }
.status-pill--red { background: var(--status-red-bg); color: var(--status-red-text); }
.price-chip { display: inline-flex; align-items: baseline; gap: .25rem; background: var(--panel-bg); border-radius: 10px; padding: .2rem .55rem; margin: .1rem .2rem .1rem 0; font-size: .82rem; white-space: nowrap; }
.price-chip strong { color: var(--text-strong); }
.price-chip span { color: var(--text-muted); font-size: .75rem; }
.ref-chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; background: var(--panel-bg); padding: .1rem .45rem; border-radius: 8px; color: var(--text-body); }

/* ---------- Tabs (status filters) ---------- */
.pill-tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .15rem; scrollbar-width: none; }
.pill-tab { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1rem; border-radius: 999px; background: var(--surface); color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: .88rem; white-space: nowrap; box-shadow: var(--shadow-card); }
.pill-tab:hover { color: var(--text-strong); }
.pill-tab.active { background: var(--ink); color: #fff; }
.pill-tab .material-symbols-outlined { font-size: 1.15rem; }
/* Smaller tabs filtering inside a card (on a panel background, no shadow). */
.pill-tabs--small .pill-tab { padding: .3rem .8rem; font-size: .8rem; background: var(--panel-bg); box-shadow: none; }
.pill-tabs--small .pill-tab.active { background: var(--ink); }
.pill-tab-count { font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: var(--panel-bg); color: var(--text-muted); }
.pill-tab.active .pill-tab-count { background: rgba(255, 255, 255, .15); color: #fff; }

/* ---------- Tables ---------- */
.app-table { width: 100%; margin: 0; }
.app-table th { font-weight: 600; color: var(--text-muted); font-size: .78rem; padding: .65rem .75rem; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.app-table td { padding: .85rem .75rem; vertical-align: middle; color: var(--text-body); border-bottom: 1px solid var(--border-subtle); }
.app-table tbody tr:last-child td { border-bottom: 0; }
.app-table tbody tr.is-inactive td { opacity: .55; }
.app-table a.row-link { color: var(--text-strong); font-weight: 600; text-decoration: none; }
.app-table a.row-link:hover { text-decoration: underline; }
.cell-sub { display: block; font-size: .8rem; color: var(--text-muted); }

/* ---------- Search ---------- */
.search-bar { display: flex; align-items: center; gap: .5rem; background: var(--surface); border-radius: 999px; padding: .3rem .3rem .3rem 1rem; box-shadow: var(--shadow-card); max-width: 420px; flex: 1 1 260px; }
.search-bar .form-control { border: 0; box-shadow: none; padding-left: 0; background: transparent; }
.search-bar .material-symbols-outlined { color: var(--text-muted); }
.app-card .search-bar { background: var(--panel-bg); box-shadow: none; }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state .material-symbols-outlined { font-size: 44px; color: #b9c8c1; display: block; margin: 0 auto .5rem; }
.empty-state-title { color: var(--text-strong); font-weight: 700; margin-bottom: .25rem; }

/* ---------- Flashes ---------- */
.app-flashes .alert, .auth-card .alert, .modal .alert { border-radius: var(--radius-control); border: 0; }
.alert-success { background: var(--status-green-bg); color: var(--status-green-text); }
.alert-danger { background: var(--status-red-bg); color: var(--status-red-text); }
.alert-info { background: var(--status-blue-bg); color: var(--status-blue-text); }
.alert-warning { background: var(--status-amber-bg); color: var(--status-amber-text); }

/* ---------- Auth ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-shell { grid-template-columns: 1.05fr 1fr; } }
.auth-panel { display: none; background: linear-gradient(160deg, var(--forest) 0%, var(--forest-deep) 100%); color: #fff; padding: 3rem; position: relative; overflow: hidden; }
@media (min-width: 992px) { .auth-panel { display: flex; flex-direction: column; } }
.auth-panel .app-brand { border: 0; padding: 0; }
.auth-panel-title { color: #fff; font-size: 2.6rem; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; margin-top: auto; max-width: 28rem; }
.auth-panel-text { color: var(--forest-text); max-width: 26rem; margin-top: 1rem; }
.auth-panel-stripes { position: absolute; right: -80px; top: -60px; width: 340px; opacity: .08; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .app-brand { color: var(--ink); border: 0; justify-content: center; }

/* ---------- Modals & dropdowns ---------- */
.modal-content { border-radius: var(--radius-card); border: 0; }
.modal-content > form { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.modal-header, .modal-footer { border: 0; padding: 1.25rem 1.5rem; }
.modal-body { padding: 0 1.5rem; }
.dropdown-menu { border: 0; border-radius: 16px; box-shadow: 0 12px 32px rgba(13, 59, 49, .14); padding: .45rem; }
.dropdown-item { border-radius: 10px; padding: .5rem .75rem; }
.dropdown-item .material-symbols-outlined { font-size: 19px; margin-right: .3rem; }
.dropdown-item.active, .dropdown-item:active { background: var(--accent-soft); color: var(--text-strong); }

/* ---------- Choice pills ---------- */
.pill-choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill-choice { position: relative; cursor: pointer; margin: 0; }
.pill-choice input { position: absolute; opacity: 0; pointer-events: none; }
.pill-choice span { display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: .45rem 1rem; border-radius: 999px; background: var(--panel-bg); border: 1.5px solid transparent; color: var(--text-strong); font-weight: 500; transition: background .15s ease, border-color .15s ease; }
.pill-choice input:checked + span { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.pill-choice input:focus-visible + span { outline: 2px solid var(--accent-dark); outline-offset: 2px; }

.form-section { padding: 1rem 0 .25rem; border-top: 1px solid var(--border-subtle); margin-top: .5rem; }
.form-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.form-section-title { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: .75rem; }

/* ---------- Price editor (product modal) ---------- */
.price-editor { display: flex; flex-direction: column; gap: .4rem; }
.price-editor-row { display: grid; grid-template-columns: minmax(110px, .9fr) 1fr 1fr 1fr; gap: .5rem; align-items: center; padding: .35rem .5rem; border-radius: 12px; }
.price-editor-row:has(input[type=checkbox]:checked) { background: var(--accent-soft); }
.price-editor-head { font-size: .75rem; font-weight: 600; color: var(--text-muted); padding: 0 .5rem; }
@media (max-width: 575.98px) { .price-editor-row { grid-template-columns: 1fr 1fr; } .price-editor-row > :first-child { grid-column: 1 / -1; } .price-editor-head { display: none; } }

/* ---------- Detail lists, contacts & activity ---------- */
.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.25rem; margin: 0; }
.detail-list dt { font-weight: 500; color: var(--text-muted); font-size: .88rem; }
.detail-list dd { margin: 0; color: var(--text-strong); word-break: break-word; }
.address-block { line-height: 1.55; color: var(--text-strong); }

.contact-card { display: flex; gap: .85rem; padding: .9rem; border-radius: 16px; background: var(--panel-bg); align-items: flex-start; }
.contact-card.is-inactive { opacity: .55; }
.contact-card-name { font-weight: 700; color: var(--text-strong); }
.contact-card-meta { font-size: .85rem; color: var(--text-muted); }
.contact-card-line { display: flex; align-items: center; gap: .35rem; font-size: .88rem; margin-top: .2rem; }
.contact-card-line .material-symbols-outlined { font-size: 16px; color: var(--text-muted); }
.contact-flags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }

.activity-feed { list-style: none; margin: 0; padding: 0; }
.activity-feed li { position: relative; padding: 0 0 1.1rem 1.4rem; border-left: 2px solid var(--border-subtle); margin-left: .35rem; }
.activity-feed li:last-child { padding-bottom: 0; }
.activity-feed li::before { content: ''; position: absolute; left: -7px; top: .3rem; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px #c9d6d0; }
.activity-feed li.is-manual::before { background: var(--ember); }
.activity-meta { font-size: .78rem; color: var(--text-muted); margin-bottom: .1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; }
.activity-tag { font-size: .7rem; padding: .1rem .5rem; }
.activity-tag .material-symbols-outlined { font-size: .9rem; }
.activity-text { color: var(--text-strong); white-space: pre-line; }

.identity-card { display: flex; align-items: center; gap: 1rem; }
.identity-avatar { width: 56px; height: 56px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-dark); flex-shrink: 0; }
.identity-avatar .material-symbols-outlined { font-size: 28px; }

/* ---------- Settings ---------- */
.settings-nav { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: .2rem; }
.settings-nav a { padding: .55rem .9rem; border-radius: 12px; color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: .9rem; }
.settings-nav a:hover { background: var(--surface); color: var(--text-strong); }
.colour-input { width: 56px; height: 44px; padding: .25rem; border-radius: 12px; flex-shrink: 0; }
.colour-swatches { display: flex; flex-wrap: wrap; gap: .35rem; }
.colour-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border-subtle); padding: 0; cursor: pointer; }
.colour-swatch:hover, .colour-swatch:focus-visible { box-shadow: 0 0 0 2px var(--text-strong); }
.logo-field { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.logo-preview { width: 180px; height: 80px; border-radius: 14px; border: 1px dashed var(--border-subtle); background: var(--panel-bg); display: grid; place-items: center; padding: .5rem; flex-shrink: 0; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.app-brand-logo { display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 12px; padding: .4rem .65rem; max-width: 100%; }
.app-brand-logo img { max-height: 40px; max-width: 200px; object-fit: contain; }

/* ---------- Pagination ---------- */
.pagination-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border-subtle); }
.pagination-pages { list-style: none; display: flex; gap: .3rem; margin: 0; padding: 0; flex-wrap: wrap; }
.pagination-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.pagination-size { display: inline-flex; align-items: center; gap: .4rem; margin: 0; white-space: nowrap; }
.pagination-size .form-select { width: auto; padding-top: .2rem; padding-bottom: .2rem; }
.pagination-link { min-width: 36px; height: 36px; padding: 0 .55rem; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: var(--panel-bg); color: var(--text-strong); text-decoration: none; font-weight: 600; font-size: .88rem; }
.pagination-link:hover { background: var(--border-subtle); color: var(--text-strong); }
.pagination-link.is-current { background: var(--ink); color: #fff; }
.pagination-link.is-disabled { opacity: .4; }
.pagination-gap { display: inline-flex; align-items: center; height: 36px; padding: 0 .25rem; color: var(--text-muted); }

/* ---------- Quote / invoice editor ---------- */
.line-table td { vertical-align: top; }
.line-table-head { display: none; }
@media (min-width: 1200px) { .line-table-head { display: table-header-group; } }
.line-cell-description { min-width: 260px; }
.line-cell-number { width: 130px; }
.line-cell-small { width: 90px; }
.line-cell-tax { width: 190px; }
.line-cell-amount { width: 120px; padding-top: 1.35rem !important; white-space: nowrap; }
.line-cell-remove { width: 40px; }
.totals-card { display: flex; flex-direction: column; }
.totals-list { display: grid; grid-template-columns: 1fr auto; gap: .4rem 0; margin: 0; }
.totals-list dd { padding-left: 1rem; }
.totals-list dt { font-weight: 500; color: var(--text-muted); }
.totals-list dd { margin: 0; text-align: right; color: var(--text-strong); font-weight: 600; white-space: nowrap; }
.totals-list .totals-list-grand { font-size: 1.25rem; font-weight: 800; color: var(--text-strong); padding-top: .5rem; border-top: 2px solid var(--accent); }
@media (max-width: 1199.98px) {
    .line-table, .line-table tbody, .line-table tr, .line-table td { display: block; width: 100% !important; }
    .line-table tr.line-row { position: relative; padding: .85rem; margin-bottom: .75rem; border-radius: 16px; background: var(--panel-bg); }
    .line-table td { border: 0 !important; padding: .25rem 0 !important; }
    .line-table .line-cell-number, .line-table .line-cell-small, .line-table .line-cell-tax { display: inline-block; width: 24% !important; min-width: 120px; margin-right: .5rem; vertical-align: top; }
    .line-table .line-cell-tax { width: 30% !important; }
    .line-table .line-cell-amount { padding-top: .5rem !important; font-size: 1.05rem; }
    .line-table .line-cell-remove { position: absolute; top: .25rem; right: .25rem; width: auto !important; }
}

/* ---------- Document page ---------- */
.document-paper { background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 2.25rem; overflow-x: auto; }
.document-paper .doc { min-width: 620px; }
@media (max-width: 575.98px) { .document-paper { padding: 1.1rem; } }
.document-actions { display: flex; flex-direction: column; gap: .5rem; }
.document-actions form { margin: 0; }
.document-actions .btn { width: 100%; justify-content: center; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.timeline li { display: flex; gap: .6rem; font-size: .88rem; }
.timeline .material-symbols-outlined { font-size: 18px; color: var(--accent-dark); }
.timeline-date { color: var(--text-muted); font-size: .8rem; }
.amount-strong { font-weight: 700; color: var(--text-strong); white-space: nowrap; }

/* ---------- Public document view ---------- */
.public-shell { min-height: 100vh; background: var(--canvas-bg); padding: 2rem 1rem 4rem; }
.public-wrap { max-width: 920px; margin: 0 auto; }
.public-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.public-powered { text-align: center; color: var(--text-muted); font-size: .8rem; margin-top: 2rem; }
.public-powered a { color: var(--text-muted); }

/* ---------- Emails ---------- */
.placeholder-list { display: flex; flex-direction: column; gap: .35rem; }
.placeholder-chip { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; text-align: left; border: 1px solid var(--border-subtle); background: var(--panel-bg); border-radius: 12px; padding: .45rem .7rem; }
.placeholder-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.placeholder-chip code { color: var(--forest); font-size: .82rem; }
.placeholder-chip span { color: var(--text-muted); font-size: .78rem; }
.email-body-input { font-family: inherit; line-height: 1.55; }
.email-preview { background: var(--panel-bg); border-radius: var(--radius-control); padding: 1.25rem 1.4rem; color: var(--text-strong); }

@media print {
    .app-sidebar, .app-topbar, .page-header-actions, .app-flashes, .sf-toolbar, .no-print { display: none !important; }
    .document-paper { box-shadow: none; padding: 0; }
    .app-main { margin: 0 !important; }
    .app-content { padding: 0; }
    body, .app-card { background: #fff; box-shadow: none; }
}

/* "View as": the super admin sees the app as one of a subscriber's users, read-only. */
.impersonation-banner { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 0 2.25rem 1rem; padding: .85rem 1.1rem; background: var(--ink); color: #fff; border-radius: 16px; }
.impersonation-banner .material-symbols-outlined { color: var(--accent-light, #9be7b8); }
@media (max-width: 991.98px) { .impersonation-banner { margin: 0 1rem .75rem; } }

/* The customer's account: the unpaid-by-age summary, only as wide as it needs. */
.ageing-card { width: fit-content; min-width: min(100%, 720px); max-width: 100%; padding: 1rem 1.25rem; }
.ageing-card .app-table--compact th, .ageing-card .app-table--compact td { padding: .35rem .9rem; }
.ageing-card .ageing-balance { border-left: 1px solid var(--border-subtle); }
.ageing-card .app-card-title { font-size: .9rem; }
.ageing-card .app-card-title .material-symbols-outlined { font-size: 18px; }
.app-table--compact th, .app-table--compact td { padding: .25rem .6rem; font-size: .78rem; }

/* ---------- Global search (top bar) ---------- */
.global-search { position: relative; flex: 1 1 auto; max-width: 520px; display: flex; align-items: center; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow-card); padding: 0 .9rem; }
.global-search .form-control { border: 0; box-shadow: none; background: transparent; padding: .55rem .5rem; min-width: 0; }
.global-search-icon { color: var(--text-muted); }
.global-search-key { font-size: .72rem; color: var(--text-muted); background: var(--panel-bg); border-radius: 6px; padding: .1rem .45rem; box-shadow: none; }
.global-search-results { display: none; position: absolute; top: calc(100% + .4rem); left: 0; right: 0; z-index: 1050; background: var(--surface); border-radius: 16px; box-shadow: 0 12px 40px rgba(13, 59, 49, .18); max-height: min(70vh, 560px); overflow-y: auto; padding: .4rem; }
.global-search.is-open .global-search-results { display: block; }
.global-search-group + .global-search-group { border-top: 1px solid var(--border-subtle); margin-top: .3rem; padding-top: .3rem; }
.global-search-heading { display: flex; justify-content: space-between; align-items: center; padding: .35rem .6rem .2rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.global-search-heading a { text-transform: none; letter-spacing: 0; font-weight: 600; }
.global-search-result { display: flex; align-items: center; gap: .65rem; padding: .45rem .6rem; border-radius: 10px; color: var(--text-strong); text-decoration: none; }
.global-search-result > .material-symbols-outlined { color: var(--text-muted); font-size: 20px; }
.global-search-result:hover, .global-search-result.is-active { background: var(--accent-soft); color: var(--text-strong); }
.global-search-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.global-search-title { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-search-detail { font-size: .78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-search-empty { padding: .8rem .7rem; color: var(--text-muted); font-size: .88rem; }
@media (max-width: 575.98px) {
    .global-search { padding: 0 .6rem; }
    .global-search-results { position: fixed; top: 4.25rem; left: .75rem; right: .75rem; }
}

/* The search and date bar over a history list. */
.history-filter { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.history-filter .search-bar { flex: 1 1 220px; max-width: none; }
.history-filter-dates { display: flex; align-items: center; gap: .35rem; }
.history-filter-dates .form-control { width: auto; min-width: 0; }
@media (max-width: 575.98px) {
    .history-filter-dates { flex: 1 1 100%; }
    .history-filter-dates .form-control { flex: 1 1 0; }
}

/* A failed background message's stack trace (super admin). */
.queue-trace { max-height: 240px; overflow: auto; font-size: .72rem; background: var(--panel-bg); padding: .5rem; border-radius: 8px; white-space: pre-wrap; }

/* ---------- Profit & loss ---------- */
.pl-table .pl-subtotal td { font-weight: 600; border-top: 1px solid var(--border-strong, #cfdcd6); color: var(--text-strong); }
.pl-table .pl-total td { font-weight: 700; font-size: 1.05rem; border-top: 2px solid var(--ink); color: var(--text-strong); }
.pl-table .pl-heading td { padding-top: 1.1rem; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.pl-table .pl-percent td { font-size: .82rem; color: var(--text-muted); border-top: 0; }
.pl-table .pl-indent td:first-child { padding-left: 1.5rem; }
.app-table .pl-total td { font-weight: 700; border-top: 2px solid var(--ink); }

