/* =========================================================
   DA CULINARY OS V3
   COMPLETE PROTOTYPE STYLESHEET
========================================================= */


/* =========================================================
   1. ROOT / THEME
========================================================= */

:root {
    --bg: #f5f7f5;
    --surface: #ffffff;
    --surface-soft: #f8faf8;
    --surface-muted: #eef3ee;

    --text: #202620;
    --text-soft: #677067;
    --text-faint: #8b938b;

    --line: #dfe5df;
    --line-strong: #ccd6cc;

    --primary: #4f6851;
    --primary-dark: #344a37;
    --primary-soft: #e6eee5;

    --success: #2f7d50;
    --success-soft: #e8f5ed;

    --warning: #a16a12;
    --warning-soft: #fff5dc;

    --danger: #b34a4a;
    --danger-soft: #fceaea;

    --info: #3f6f91;
    --info-soft: #eaf2f8;

    --purple: #765a8e;
    --purple-soft: #f0eaf5;

    --sidebar: #222922;
    --sidebar-soft: #313a31;
    --sidebar-text: #e7ece7;
    --sidebar-muted: #aeb9ae;

    --shadow-sm: 0 1px 3px rgba(20, 35, 20, 0.08);
    --shadow-md: 0 10px 30px rgba(20, 35, 20, 0.10);
    --shadow-lg: 0 20px 55px rgba(20, 35, 20, 0.16);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;

    --sidebar-width: 270px;
}

/* Appearance preferences use the existing token system, so the approved
   layout remains unchanged while each selected colour collection is visible. */
html[data-theme="dark"] {
    --bg: #161b1f;
    --surface: #20282d;
    --surface-soft: #273137;
    --surface-muted: #2d383e;
    --text: #eef3f0;
    --text-soft: #b7c2bc;
    --text-faint: #93a198;
    --line: #3b4742;
    --line-strong: #526058;
    --success: #62bd85;
    --success-soft: #1f3a2b;
    --warning: #e0ad52;
    --warning-soft: #45351a;
    --danger: #ec8585;
    --danger-soft: #482828;
    --info: #83bde2;
    --info-soft: #203b4d;
    --purple: #c5a5db;
    --purple-soft: #3d2d49;
    --sidebar: #11171a;
    --sidebar-soft: #1d282d;
    --sidebar-text: #edf3ef;
    --sidebar-muted: #aebbb3;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.26);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.30);
    --shadow-lg: 0 20px 55px rgba(0, 0, 0, 0.42);
}

html[data-accent="sage"] {
    --primary: #4f6851;
    --primary-dark: #344a37;
    --primary-soft: #e6eee5;
    --sidebar: #222922;
    --sidebar-soft: #313a31;
}

html[data-accent="ocean"] {
    --primary: #28789c;
    --primary-dark: #1b5775;
    --primary-soft: #e5f2f8;
    --sidebar: #162c3a;
    --sidebar-soft: #203d4e;
}

html[data-accent="plum"] {
    --primary: #815b96;
    --primary-dark: #5f4072;
    --primary-soft: #f2eaf6;
    --sidebar: #302538;
    --sidebar-soft: #43334e;
}

html[data-accent="terracotta"] {
    --primary: #ad6243;
    --primary-dark: #81462f;
    --primary-soft: #fceedf;
    --sidebar: #382820;
    --sidebar-soft: #4c362c;
}

html[data-theme="dark"][data-accent="sage"] {
    --primary-soft: #28402b;
}

html[data-theme="dark"][data-accent="ocean"] {
    --primary-soft: #1d4052;
}

html[data-theme="dark"][data-accent="plum"] {
    --primary-soft: #422f4d;
}

html[data-theme="dark"][data-accent="terracotta"] {
    --primary-soft: #4a3025;
}


/* =========================================================
   2. RESET / BASE
========================================================= */

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    min-height: 100%;
    background: var(--bg);
}

body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    font-size: 14px;
    line-height: 1.45;
    overflow-x: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

a {
    color: inherit;
}

.hidden {
    display: none !important;
}

.muted {
    color: var(--text-soft);
}

.eyebrow {
    display: block;
    margin-bottom: 3px;
    color: var(--text-faint);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}


/* =========================================================
   3. APP SHELL
========================================================= */

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.main-area {
    min-width: 0;
    width: 100%;
}


/* =========================================================
   4. SIDEBAR
========================================================= */

.sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    height: 100vh;
    padding: 18px 14px;
    overflow-y: auto;
    background: var(--sidebar);
    color: var(--sidebar-text);
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.brand-block strong {
    display: block;
    color: #ffffff;
    font-size: 15px;
    line-height: 1.2;
}

.brand-block span {
    display: block;
    margin-top: 2px;
    color: var(--sidebar-muted);
    font-size: 11px;
}

.brand-badge {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--surface);
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 850;
}

.sidebar-close-button {
    display: none;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 9px;
    background: transparent;
    color: #ffffff;
    font-size: 22px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
    margin-top: 22px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    color: inherit;
    text-align: left;
}

.sidebar-user:hover,
.sidebar-user:focus-visible {
    border-color: rgba(255,255,255,0.18);
    background: var(--sidebar-soft);
    outline: none;
}

.sidebar-user-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #dce7da;
    color: #314433;
    font-size: 12px;
    font-weight: 800;
}

.sidebar-user-copy {
    min-width: 0;
}

.sidebar-user-copy strong,
.sidebar-user-copy span {
    display: block;
}

.sidebar-user-copy strong {
    overflow: hidden;
    color: #ffffff;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-copy span {
    margin-top: 2px;
    color: var(--sidebar-muted);
    font-size: 11px;
}

.sidebar-brand-filter {
    margin-top: 16px;
}

.sidebar-brand-filter label {
    display: block;
    margin: 0 0 6px 2px;
    color: var(--sidebar-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.sidebar-brand-filter select {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 9px;
    outline: none;
    background: var(--sidebar-soft);
    color: #ffffff;
}


/* =========================================================
   5. SIDEBAR NAVIGATION
========================================================= */

.sidebar-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    margin-top: 18px;
}

.sidebar-nav-button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #cdd5cd;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.sidebar-nav-button:hover {
    background: rgba(255,255,255,0.07);
    color: #ffffff;
}

.sidebar-nav-button.active {
    background: #3b483b;
    color: #ffffff;
}

.sidebar-nav-button.sidebar-nav-submenu {
    min-height: 36px;
    margin-left: 25px;
    width: calc(100% - 25px);
    padding-top: 7px;
    padding-bottom: 7px;
    color: var(--sidebar-muted);
    font-size: 12px;
}

.sidebar-nav-button.sidebar-nav-submenu .sidebar-nav-icon {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    font-size: 11px;
}

.sidebar-nav-button.sidebar-nav-submenu.active {
    color: #ffffff;
}

.sidebar-nav-group {
    display: grid;
    gap: 2px;
}

.sidebar-nav-group-button {
    position: relative;
}

.sidebar-nav-group-symbol {
    margin-left: auto;
    width: 20px;
    color: var(--sidebar-muted);
    font-size: 17px;
    font-weight: 500;
    text-align: center;
}

.sidebar-nav-group-button.active .sidebar-nav-group-symbol {
    color: #ffffff;
}

.sidebar-nav-submenu-list {
    display: grid;
    gap: 2px;
    padding: 1px 0 5px;
}

.sidebar-nav-icon {
    display: grid;
    place-items: center;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: rgba(255,255,255,0.06);
    font-size: 13px;
}

.sidebar-nav-divider {
    height: 1px;
    margin: 10px 6px;
    background: rgba(255,255,255,0.08);
}

.sidebar-bottom {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.sidebar-secondary-button {
    width: 100%;
    min-height: 41px;
    padding: 9px 12px;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 9px;
    background: transparent;
    color: #d7dfd7;
    text-align: left;
    font-size: 12px;
    font-weight: 650;
}

.sidebar-secondary-button:hover {
    background: rgba(255,255,255,0.06);
    color: #ffffff;
}


/* =========================================================
   6. SIDEBAR OVERLAY
========================================================= */

.sidebar-overlay {
    display: none;
}


/* =========================================================
   7. DESKTOP HEADER
========================================================= */

.desktop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 76px;
    padding: 15px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(10px);
}

.desktop-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.desktop-title-wrap h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
}

.desktop-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-button,
.desktop-account-button,
.back-button,
.icon-button {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
}

.header-button {
    position: relative;
    min-height: 42px;
    padding: 9px 13px;
    border-radius: 9px;
    font-weight: 650;
}

.notification-count {
    display: inline-grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
}
.notification-count[hidden] { display: none; }

.desktop-account-button {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 5px 10px 5px 6px;
    border-radius: 10px;
}

.desktop-avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 800;
}

.desktop-account-copy {
    text-align: left;
}

.desktop-account-copy strong,
.desktop-account-copy small {
    display: block;
}

.desktop-account-copy strong {
    font-size: 12px;
}

.desktop-account-copy small {
    margin-top: 1px;
    color: var(--text-soft);
    font-size: 10px;
}

.back-button {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 9px;
    font-size: 19px;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 9px;
    font-size: 20px;
}


/* =========================================================
   8. MOBILE HEADER
========================================================= */

.mobile-header {
    display: none;
}


/* =========================================================
   9. ROLE PREVIEW BANNER
========================================================= */

.role-preview-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 18px 28px 0;
    padding: 11px 14px;
    border: 1px solid #d8e3d5;
    border-radius: 11px;
    background: #edf3eb;
}

.role-preview-banner strong {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
}

.role-preview-banner span {
    color: #657065;
    font-size: 12px;
}


/* =========================================================
   10. PAGE CONTENT
========================================================= */

.page-content {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 24px 28px 40px;
}

.page-stack {
    display: grid;
    gap: 18px;
}

.loading-card {
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-soft);
    text-align: center;
}


/* =========================================================
   11. PAGE INTRO
========================================================= */

.page-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.page-intro-copy {
    max-width: 760px;
}

.page-intro h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.25;
}

.page-intro p {
    margin: 7px 0 0;
    color: var(--text-soft);
}

.page-intro-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}


/* =========================================================
   12. BUTTONS
========================================================= */

.primary-button,
.secondary-button,
.soft-button,
.danger-button,
.text-button {
    min-height: 40px;
    padding: 9px 13px;
    border-radius: 9px;
    font-weight: 700;
}

.primary-button {
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.primary-button:hover {
    background: var(--primary-dark);
}

.secondary-button {
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--text);
}

.secondary-button:hover {
    background: var(--surface-soft);
}

.soft-button {
    border: 1px solid #dbe5d8;
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.danger-button {
    border: 1px solid var(--danger);
    background: var(--danger);
    color: #ffffff;
}

.text-button {
    min-height: auto;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--primary-dark);
}


/* =========================================================
   13. METRICS
========================================================= */

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.metric-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    box-shadow: var(--shadow-sm);
}

.metric-card-label {
    display: block;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}

.metric-card-value {
    display: block;
    margin-top: 6px;
    font-size: 23px;
    font-weight: 800;
    line-height: 1.2;
}

.metric-card-subtext {
    display: block;
    margin-top: 5px;
    color: var(--text-faint);
    font-size: 11px;
}


/* =========================================================
   14. SECTION CARDS
========================================================= */

.section-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.section-header h3 {
    margin: 0;
    font-size: 15px;
}

.section-header p {
    margin: 4px 0 0;
    color: var(--text-soft);
    font-size: 12px;
}

.section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}


/* =========================================================
   15. DASHBOARD GRID
========================================================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.75fr);
    gap: 18px;
}

.dashboard-column {
    display: grid;
    align-content: start;
    gap: 18px;
}


/* =========================================================
   16. ATTENTION ITEMS
========================================================= */

.attention-list {
    display: grid;
    gap: 9px;
}

.attention-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid #ead7b0;
    border-radius: 10px;
    background: var(--warning-soft);
}

.attention-item strong {
    display: block;
    font-size: 12px;
}

.attention-item p {
    margin: 3px 0 0;
    color: #7a6b50;
    font-size: 11px;
}


/* =========================================================
   17. QUICK ACTIONS
========================================================= */

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}


/* =========================================================
   18. TABLES
========================================================= */

.table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--text-faint);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

td {
    font-size: 12px;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: var(--surface-soft);
}

.table-primary {
    font-weight: 700;
}

.table-secondary {
    display: block;
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 10px;
}


/* =========================================================
   19. STATUS PILLS
========================================================= */

.status-pill,
.source-pill {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.status-neutral {
    background: #edf0ed;
    color: #5d675d;
}

.status-success {
    background: var(--success-soft);
    color: var(--success);
}

.status-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.status-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.status-info {
    background: var(--info-soft);
    color: var(--info);
}

.status-purple {
    background: var(--purple-soft);
    color: var(--purple);
}

.source-pill {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text-soft);
}


/* =========================================================
   20. RECORD CARDS
========================================================= */

.record-list {
    display: grid;
    gap: 10px;
}

.record-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
}

.record-main {
    min-width: 0;
}

.record-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
}

.record-title-row strong {
    font-size: 13px;
}

.record-card p {
    margin: 5px 0 0;
    color: var(--text-soft);
    font-size: 11px;
}

.record-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 13px;
    margin-top: 8px;
    color: var(--text-faint);
    font-size: 10px;
}

.record-actions {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.staff-subscription-delivery .record-actions{flex-wrap:wrap;justify-content:flex-end}
@media(max-width:600px){.staff-subscription-delivery .record-actions button{flex:1 1 130px}}


/* =========================================================
   21. SEARCH / FILTER TOOLBARS
========================================================= */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.search-input,
.filter-select,
input,
select,
textarea {
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    outline: none;
    background: var(--surface);
    color: var(--text);
}

.search-input,
.filter-select,
input,
select {
    min-height: 40px;
    padding: 8px 10px;
}

textarea {
    width: 100%;
    min-height: 90px;
    padding: 9px 10px;
    resize: vertical;
}

.search-input {
    width: min(340px, 100%);
}

input:focus,
select:focus,
textarea:focus,
.search-input:focus,
.filter-select:focus {
    border-color: #839b83;
    box-shadow: 0 0 0 3px rgba(79, 104, 81, 0.10);
}


/* =========================================================
   22. CATEGORY CHIPS
========================================================= */

.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 14px;
}

.category-chip {
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 650;
}

.category-chip.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}


/* =========================================================
   23. FORMS
========================================================= */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field.full-width {
    grid-column: 1 / -1;
}

.field label {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}

.field-hint {
    color: var(--text-faint);
    font-size: 10px;
}

.acting-role-banner {
    background: color-mix(in srgb, var(--accent-soft) 78%, var(--surface));
    border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}

.owner-dashboard-metrics .metric-card {
    --metric-accent: var(--primary);
    position: relative;
    min-height: 142px;
    padding: 20px;
    overflow: hidden;
    border-color: color-mix(in srgb, var(--metric-accent) 24%, var(--line));
    background: linear-gradient(140deg, color-mix(in srgb, var(--surface) 94%, var(--metric-accent)) 0%, color-mix(in srgb, var(--surface) 79%, var(--metric-accent)) 100%);
    box-shadow: 0 5px 18px color-mix(in srgb, var(--metric-accent) 10%, transparent);
}

.owner-dashboard-metrics .metric-card:nth-child(1) {
    --metric-accent: var(--info);
}

.owner-dashboard-metrics .metric-card:nth-child(2) {
    --metric-accent: var(--purple);
}

.owner-dashboard-metrics .metric-card:nth-child(3) {
    --metric-accent: var(--warning);
}

.owner-dashboard-metrics .metric-card:nth-child(4) {
    --metric-accent: var(--success);
}

.owner-dashboard-metrics .metric-card::after {
    content: "";
    position: absolute;
    right: -26px;
    bottom: -42px;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--metric-accent) 8%, transparent);
    pointer-events: none;
}

.owner-dashboard-metrics .metric-card-label {
    max-width: calc(100% - 40px);
    font-size: 12px;
}

.owner-dashboard-metrics .metric-card-value {
    max-width: calc(100% - 12px);
    margin-top: 24px;
    color: color-mix(in srgb, var(--text) 86%, var(--metric-accent));
}

.metric-card-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--metric-accent, var(--primary)) 22%, transparent);
    border-radius: 11px;
    background: color-mix(in srgb, var(--surface) 72%, var(--metric-accent, var(--primary)));
    color: var(--metric-accent, var(--primary-dark));
    font-size: 16px;
    font-weight: 800;
}

.metric-card-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.metric-card-action {
    width: 100%;
    text-align: left;
}

.metric-card-action:hover,
.metric-card-action:focus-visible {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    outline: none;
    transform: translateY(-1px);
}

.inline-form-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px auto;
    gap: 8px;
    align-items: end;
}

.compact-list {
    margin-top: 9px;
}

.quantity-label {
    color: var(--text-soft);
    font-weight: 700;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 17px;
}


/* =========================================================
   24. EMPTY STATES
========================================================= */

.empty-state {
    padding: 34px 20px;
    border: 1px dashed var(--line-strong);
    border-radius: 11px;
    background: var(--surface-soft);
    text-align: center;
}

.empty-state strong {
    display: block;
    font-size: 13px;
}

.empty-state p {
    margin: 5px 0 0;
    color: var(--text-soft);
    font-size: 11px;
}


/* =========================================================
   25. FINANCE
========================================================= */

.finance-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.finance-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
}

.finance-card span {
    display: block;
    color: var(--text-soft);
    font-size: 11px;
}

.finance-card strong {
    display: block;
    margin-top: 6px;
    font-size: 20px;
}


/* =========================================================
   26. COSTING WORKBOOK
========================================================= */

.costing-workbook {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
}

.costing-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    background: #f7f9f7;
}

.costing-table-wrap {
    overflow-x: auto;
}

.costing-table {
    min-width: 980px;
}

.costing-table input {
    min-width: 90px;
    padding: 7px 8px;
}

.costing-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
    border-top: 1px solid var(--line);
    background: #fbfcfb;
}

.costing-summary-item {
    padding: 11px;
    border-radius: 8px;
    background: #f1f5f0;
}

.costing-summary-item span {
    display: block;
    color: var(--text-soft);
    font-size: 10px;
}

.costing-summary-item strong {
    display: block;
    margin-top: 4px;
    font-size: 16px;
}


/* =========================================================
   27. MESSAGE / MAIL CARDS
========================================================= */

.message-list {
    display: grid;
    gap: 9px;
}

.message-card {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.message-card.unread {
    border-left: 4px solid var(--primary);
    background: var(--primary-soft);
}

.message-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.message-card strong {
    font-size: 12px;
}

.message-card p {
    margin: 5px 0 0;
    color: var(--text-soft);
    font-size: 11px;
}


/* =========================================================
   28. TEAM CHAT
========================================================= */

.chat-window {
    display: grid;
    gap: 10px;
}

.chat-message {
    max-width: 78%;
    padding: 10px 12px;
    border-radius: 11px;
    background: var(--surface-muted);
}

.chat-message.self {
    justify-self: end;
    background: var(--primary-soft);
}

.chat-message strong {
    display: block;
    margin-bottom: 3px;
    font-size: 10px;
}

.chat-message span {
    font-size: 12px;
}

.chat-message small {
    display: block;
    margin-top: 4px;
    color: var(--text-faint);
}


/* =========================================================
   29. DRAWERS
========================================================= */

.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
    background: rgba(16, 24, 16, 0.42);
}

.drawer {
    width: min(410px, 100%);
    height: 100%;
    overflow-y: auto;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--line);
}

.drawer-header h2 {
    margin: 0;
    font-size: 18px;
}

.drawer-content {
    padding: 18px;
}

.notification-item {
    margin-bottom: 9px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.notification-item.unread {
    border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
    background: color-mix(in srgb, var(--primary-soft) 68%, var(--surface));
    box-shadow: inset 3px 0 var(--primary);
}

.notification-item-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.notification-new-label {
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
}

.notification-item small {
    display: block;
    margin-bottom: 7px;
    color: var(--text-soft);
    font-size: 11px;
}

.notification-more {
    width: 100%;
    min-height: 42px;
    margin: 3px 0 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--primary-dark);
    font-weight: 700;
}

.notification-older-section {
    padding-top: 9px;
    border-top: 1px solid var(--line);
}

.notification-older-section h3 {
    margin: 0 0 12px;
    color: var(--text-soft);
    font-size: 12px;
}

.notification-item strong {
    display: block;
    font-size: 12px;
}

.notification-item p {
    margin: 4px 0 8px;
    color: var(--text-soft);
    font-size: 11px;
}


/* =========================================================
   30. ACCOUNT DRAWER
========================================================= */

.account-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
}

.account-summary-avatar {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 800;
}

.account-summary strong,
.account-summary span {
    display: block;
}

.account-summary span {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 11px;
}

.drawer-action-list {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.drawer-action-list button {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    text-align: left;
    font-weight: 650;
}

.drawer-action-list button:hover {
    background: var(--surface-soft);
}


/* =========================================================
   31. MODALS
========================================================= */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 22, 15, 0.48);
}

.modal-card {
    width: min(760px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--line);
}

.modal-header h2 {
    margin: 0;
    font-size: 19px;
}

.modal-header p {
    margin: 6px 0 0;
    color: var(--text-soft);
    font-size: 11px;
}

.modal-body {
    padding: 20px;
}

.staff-client-chat-thread { display: grid; align-content: start; gap: 6px; max-height: 55vh; min-height: 180px; overflow-y: auto; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--surface) 75%, var(--surface-soft, #edf3eb)); }
#appModal.client-conversation-fullscreen{padding:0;place-items:stretch}
#appModal.client-conversation-fullscreen .modal-card{display:flex;flex-direction:column;width:100%;height:100dvh;max-height:100dvh;border-radius:0;overflow:hidden}
#appModal.client-conversation-fullscreen .modal-header{flex:0 0 auto;align-items:center;padding:14px max(16px,env(safe-area-inset-right));background:var(--surface)}
#appModal.client-conversation-fullscreen #appModalClose{width:auto;min-width:76px;min-height:42px;padding:6px 12px;border-radius:9px;font-size:14px;font-weight:750}
#appModal.client-conversation-fullscreen .modal-body{display:flex;flex:1;min-height:0;overflow:hidden;padding:12px max(16px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom))}
#appModal.client-conversation-fullscreen .staff-client-conversation{display:flex;flex:1;flex-direction:column;gap:10px;min-height:0;width:min(100%,900px);margin:0 auto}
#appModal.client-conversation-fullscreen .staff-client-conversation>p{flex:0 0 auto;margin:0}
#appModal.client-conversation-fullscreen .staff-client-chat-thread{flex:1;min-height:0;max-height:none}
#appModal.client-conversation-fullscreen .staff-client-conversation>.record-list{flex:1;min-height:0;overflow-y:auto}
#appModal.client-conversation-fullscreen .staff-client-conversation .field{flex:0 0 auto}
#appModal.client-conversation-fullscreen .staff-client-conversation #clientConversationReply{min-height:68px;max-height:100px}
#appModal.client-conversation-fullscreen .staff-client-conversation .form-actions{flex:0 0 auto;margin:0}
#appModal.client-conversation-fullscreen .staff-client-conversation details{flex:0 0 auto}
.staff-client-chat-day { display: flex; justify-content: center; margin: 9px 0; }
.staff-client-chat-day span { padding: 5px 10px; border-radius: 999px; background: var(--surface); color: var(--text-soft); font-size: 11px; font-weight: 700; }
.staff-client-chat-row { display: flex; min-width: 0; }
.staff-client-chat-row.incoming { justify-content: flex-start; }
.staff-client-chat-row.outgoing { justify-content: flex-end; }
.staff-client-chat-bubble { max-width: min(78%, 520px); min-width: 90px; padding: 10px 13px 7px; border: 1px solid var(--line); border-radius: 5px 14px 14px 14px; background: var(--surface); overflow-wrap: anywhere; }
.staff-client-chat-row.outgoing .staff-client-chat-bubble { border-radius: 14px 5px 14px 14px; background: color-mix(in srgb, var(--primary-soft) 68%, var(--surface)); }
.staff-client-chat-sender { display: block; margin-bottom: 3px; font-size: 11px; color: var(--text-soft); }
.staff-client-chat-bubble p { margin: 0; white-space: pre-wrap; line-height: 1.5; font-size: 14px; }
.staff-client-chat-bubble small { display: block; margin-top: 4px; color: var(--text-soft); font-size: 10px; text-align: right; }
.staff-client-chat-context { margin-bottom: 8px; padding-bottom: 7px; border-bottom: 1px solid var(--line); font-size: 11px; }
@media (max-width: 600px) { .staff-client-chat-thread { padding: 10px; } .staff-client-chat-bubble { max-width: 86%; } }
@media (max-width: 600px) {
    /* iPhone zooms focused form controls smaller than 16px. Keep the reply action in view. */
    .staff-client-conversation #clientConversationReply,
    .staff-client-conversation #clientConversationSubject { font-size: 16px; line-height: 1.4; }
    .staff-client-conversation .form-actions { position: sticky; bottom: 0; z-index: 2; margin-top: 8px; padding: 10px 0 max(8px, env(safe-area-inset-bottom)); background: var(--surface); }
    #appModal.client-conversation-fullscreen .modal-card { max-height: 100dvh; }
}
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
    select, textarea { font-size: 17px !important; }
}


/* =========================================================
   32. ROLE PREVIEW MODAL
========================================================= */

.role-modal {
    width: min(850px, 100%);
}

.role-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 20px;
}

.role-option {
    min-height: 130px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    text-align: left;
}

.role-option:hover {
    border-color: #94a893;
    background: var(--surface-soft);
}

.role-option.active {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.role-option strong {
    display: block;
    font-size: 13px;
}

.role-option p {
    margin: 6px 0 0;
    color: var(--text-soft);
    font-size: 10px;
    line-height: 1.4;
}


/* =========================================================
   33. DETAIL LISTS
========================================================= */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.detail-item {
    padding: 11px;
    border-radius: 8px;
    background: var(--surface-soft);
}

.detail-item span {
    display: block;
    color: var(--text-faint);
    font-size: 10px;
}

.detail-item strong {
    display: block;
    margin-top: 3px;
    font-size: 12px;
}


/* =========================================================
   34. INFO / WARNING BOXES
========================================================= */

.info-box,
.warning-box,
.success-box,
.danger-box {
    padding: 11px 13px;
    border-radius: 9px;
    font-size: 11px;
}

.info-box {
    border: 1px solid #ccdeea;
    background: var(--info-soft);
    color: #3c607a;
}

.warning-box {
    border: 1px solid #ead5a4;
    background: var(--warning-soft);
    color: #775716;
}

.success-box {
    border: 1px solid #cce4d4;
    background: var(--success-soft);
    color: #306945;
}

.danger-box {
    border: 1px solid #e6c2c2;
    background: var(--danger-soft);
    color: #8b3f3f;
}


/* =========================================================
   35. TOAST
========================================================= */

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 150;
    display: grid;
    gap: 2px;
    width: min(340px, calc(100vw - 30px));
    padding: 13px 15px;
    border-radius: 11px;
    background: #202820;
    color: #ffffff;
    box-shadow: var(--shadow-lg);
}

.toast strong {
    font-size: 12px;
}

.toast span {
    color: #dbe4db;
    font-size: 11px;
}


/* =========================================================
   36. SETTINGS
========================================================= */

.settings-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
}

.settings-nav {
    display: grid;
    align-content: start;
    gap: 5px;
}

.settings-nav button {
    width: 100%;
    min-height: 40px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-soft);
    text-align: left;
    font-weight: 650;
}

.settings-nav button.active {
    border-color: var(--line);
    background: var(--surface);
    color: var(--text);
}


/* =========================================================
   37. APPROVAL CARDS
========================================================= */

.approval-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
}

.approval-card + .approval-card {
    margin-top: 9px;
}

.approval-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.approval-card h4 {
    margin: 0;
    font-size: 13px;
}

.approval-card p {
    margin: 5px 0 0;
    color: var(--text-soft);
    font-size: 11px;
}


/* =========================================================
   38. RESPONSIVE — TABLET
========================================================= */

@media (max-width: 1100px) {

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .finance-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .costing-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .role-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* =========================================================
   39. RESPONSIVE — MOBILE SHELL
========================================================= */

@media (max-width: 860px) {

    body.sidebar-scroll-locked {
        position: fixed;
        right: 0;
        left: 0;
        overflow: hidden;
    }

    .app-shell {
        display: block;
        min-height: 100vh;
    }

    .desktop-header {
        display: none;
    }

    .mobile-header {
        position: sticky;
        top: 0;
        z-index: 70;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-height: 60px;
        padding: 9px 13px;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        background: var(--sidebar);
        color: #ffffff;
    }

    .mobile-header .icon-button,
    .avatar-button {
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
        padding: 0;
        border: 1px solid rgba(255,255,255,0.12);
        border-radius: 9px;
        background: var(--sidebar-soft);
        color: #ffffff;
    }

    .avatar-button {
        display: grid;
        place-items: center;
        border-radius: 50%;
        font-size: 11px;
        font-weight: 800;
    }

    .mobile-title-wrap {
        min-width: 0;
        text-align: center;
    }

    .mobile-title-wrap strong,
    .mobile-title-wrap span {
        display: block;
    }

    .mobile-title-wrap strong {
        overflow: hidden;
        font-size: 14px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-title-wrap span {
        margin-top: 1px;
        color: #adb8ad;
        font-size: 10px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 90;
        width: min(84vw, 310px);
        height: 100vh;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        box-shadow: var(--shadow-lg);
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close-button {
        display: block;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 80;
        display: block;
        background: rgba(0,0,0,0.50);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .sidebar-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    .main-area {
        width: 100%;
    }

    .role-preview-banner {
        margin: 13px 14px 0;
    }

    .page-content {
        padding: 18px 14px 30px;
    }

    .page-intro {
        flex-direction: column;
    }

    .page-intro-actions {
        justify-content: flex-start;
    }

    .settings-layout {
        grid-template-columns: 1fr;
    }

    .settings-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* =========================================================
   40. RESPONSIVE — SMALL MOBILE
========================================================= */

@media (max-width: 600px) {

    .role-preview-banner {
        align-items: flex-start;
        flex-direction: column;
    }

    .role-preview-banner .secondary-button {
        width: 100%;
    }

    .page-content {
        padding-left: 12px;
        padding-right: 12px;
    }

    .page-intro h2 {
        font-size: 20px;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }

    .owner-dashboard-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .owner-dashboard-metrics .metric-card {
        min-height: 132px;
        padding: 15px;
    }

    .owner-dashboard-metrics .metric-card-value {
        margin-top: 20px;
        font-size: 19px;
    }

    .owner-dashboard-metrics .metric-card-icon {
        top: 12px;
        right: 12px;
        width: 27px;
        height: 27px;
        font-size: 14px;
    }

    .finance-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .recipe-edit-line .form-grid {
        grid-template-columns: 1fr;
    }

    .inline-form-actions {
        grid-template-columns: 1fr 78px;
    }

    .inline-form-actions .secondary-button {
        grid-column: 1 / -1;
    }

    .field.full-width {
        grid-column: auto;
    }

    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
    }

    .search-input,
    .filter-select {
        width: 100%;
        max-width: none;
    }

    .record-card {
        grid-template-columns: 1fr;
    }

    .record-actions {
        width: 100%;
    }

    .record-actions button {
        flex: 1;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .costing-summary {
        grid-template-columns: 1fr;
    }

    .role-grid {
        grid-template-columns: 1fr;
    }

    .settings-nav {
        grid-template-columns: 1fr;
    }

    .drawer {
        width: 100%;
    }

    .modal-backdrop {
        align-items: end;
        padding: 0;
    }

    .modal-card {
        width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions button {
        width: 100%;
    }

    .quick-actions {
        flex-direction: column;
    }

    .quick-actions button {
        width: 100%;
    }

    .toast {
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
    }
}


/* =========================================================
   41. EXTRA SMALL MOBILE
========================================================= */

html.auth-checking body { visibility: hidden; }

@media (max-width: 390px) {

    .page-content {
        padding-left: 10px;
        padding-right: 10px;
    }

    .section-card {
        padding: 14px;
    }

    .metric-card {
        padding: 14px;
    }

    .role-preview-banner {
        margin-left: 10px;
        margin-right: 10px;
    }
}

.modal-card.recipe-modal {
    width: min(980px, 100%);
}

.recipe-component-picker {
    max-width: 480px;
    margin-bottom: 14px;
}

.recipe-editor-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px 16px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: 11px;
}

.recipe-editor-summary strong {
    color: var(--text);
    font-size: 13px;
}

.recipe-edit-line {
    margin-bottom: 9px;
}

.recipe-edit-line .form-grid {
    grid-template-columns: minmax(220px, 2fr) minmax(110px, 0.8fr) minmax(100px, 0.8fr) minmax(100px, 0.7fr);
}

.recipe-line-cost strong {
    min-height: 40px;
    display: flex;
    align-items: center;
}

.costing-component-row td {
    background: var(--surface-soft);
    color: var(--text-soft);
}

.costing-component-row span {
    margin-left: 10px;
    font-size: 10px;
}

.recipe-kind {
    display: inline-block;
    margin-right: 7px;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

#invoice-output {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

#invoice-output > *:not(.invoice-watermark) {
    position: relative;
    z-index: 1;
}

.invoice-watermark {
    position: absolute;
    inset: 42% auto auto 50%;
    z-index: 0;
    width: 90%;
    transform: translate(-50%, -50%) rotate(-24deg);
    color: var(--accent-strong);
    font-size: clamp(44px, 9vw, 88px);
    font-weight: 800;
    line-height: 1;
    text-align: center;
    opacity: .045;
    pointer-events: none;
}

.invoice-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.invoice-brand-label {
    margin: 0 0 4px;
    color: var(--accent-strong);
    font-size: 18px;
    font-weight: 800;
}

.invoice-header h2 { margin: 0; }
.invoice-reference { display: grid; gap: 4px; text-align: right; }
.invoice-reference span, .invoice-customer span { color: var(--text-soft); font-size: 12px; }
.invoice-customer { display: grid; gap: 3px; margin-bottom: 18px; }

.invoice-signature {
    display: grid;
    justify-items: center;
    width: min(220px, 55%);
    margin: 42px 0 0 auto;
    padding-top: 8px;
    border-top: 1px solid currentColor;
    font-size: 12px;
}

.invoice-signature img {
    width: auto;
    max-width: 180px;
    height: 52px;
    margin-top: -58px;
    object-fit: contain;
}

#shopping-list-output {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.shopping-list-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.shopping-list-header h2 { margin: 0; }
.shopping-list-brand { margin: 0 0 4px; color: var(--accent-strong); font-weight: 800; }
.shopping-list-reference { display: grid; gap: 4px; text-align: right; }
.shopping-list-reference span, .shopping-list-summary span { color: var(--text-soft); font-size: 12px; }
.shopping-list-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.shopping-list-summary p { display: grid; gap: 3px; margin: 0; padding: 10px; border-radius: 9px; background: var(--surface-soft); }
.shopping-list-check { width: 42px; font-size: 22px; text-align: center; }
.shopping-list-note { margin: 16px 0 0; color: var(--text-soft); font-size: 12px; }

.production-breakdown { display: grid; gap: 16px; margin: 16px 0 22px; }
.production-product-breakdown { overflow: hidden; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.production-product-breakdown > header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px; background: var(--surface-soft); }
.production-product-breakdown > header span { display: block; margin-bottom: 2px; color: var(--text-soft); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.production-product-breakdown > header h3 { margin: 0; font-size: 17px; }
.production-product-breakdown > header > strong { white-space: nowrap; color: var(--accent-strong); }
.production-component-card { padding: 14px 16px 16px; border-top: 1px solid var(--border); }
.production-component-card h4 { margin: 0 0 10px; color: var(--text); font-size: 14px; }
.production-component-card table { font-size: 13px; }
.production-total-heading { margin: 24px 0 12px; }
.production-cost-total { margin: 12px 0 0; text-align: right; }
.success-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.production-owner-costs { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.production-owner-costs > h3 { margin: 0; }
.production-owner-costs > h4 { margin: 20px 0 10px; }
.production-owner-costs > .muted { margin: 4px 0 14px; }
.cost-breakdown-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.cost-breakdown-grid > div { display: grid; gap: 4px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.cost-breakdown-grid span { color: var(--text-soft); font-size: 11px; }
.cost-breakdown-grid strong { font-size: 15px; }
.cost-breakdown-grid .cost-total { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); background: var(--primary-soft); }

.plan-item-editor {
    position: fixed;
    inset: 0;
    z-index: 125;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 22, 15, 0.52);
}

.plan-item-editor-card {
    display: grid;
    gap: 18px;
    width: min(520px, 100%);
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.plan-item-editor-card h3 { margin: 0; }
.plan-item-editor-card p { margin: 4px 0 0; color: var(--text-soft); font-size: 12px; }

@media (max-width: 700px) {
    #shopping-list-output { padding: 16px; }
    .shopping-list-summary { grid-template-columns: 1fr; }
    .production-product-breakdown > header { align-items: flex-start; flex-direction: column; gap: 6px; }
    .production-cost-total { text-align: left; }
    .cost-breakdown-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cost-breakdown-grid .cost-total { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
    #invoice-output { padding: 18px; }
    .invoice-header { gap: 14px; }
    .invoice-brand-label { font-size: 16px; }
}

@media print {
    @page { size: A4 portrait; margin: 12mm; }
    body > *, .app-shell, .toast { display: none !important; }
    body > #appModal { display: block !important; position: static; background: white; }
    #appModal .modal-card { width: 100%; max-height: none; overflow: visible; box-shadow: none; }
    #appModal .modal-header, #appModal .form-actions { display: none !important; }
    #invoice-output { color: black; background: white; border: 0; border-radius: 0; }
    .invoice-watermark { color: #315f50; opacity: .055; }
    #shopping-list-output { color: black; background: white; border: 0; border-radius: 0; }
    #shopping-list-output .shopping-list-summary p { background: #f4f4f4; }
    #shopping-list-output .table-wrap { overflow: visible; }
    #shopping-list-output table { width: 100%; table-layout: fixed; font-size: 9pt; }
    #shopping-list-output th, #shopping-list-output td { padding: 6px 4px; white-space: normal; overflow-wrap: anywhere; }
    #shopping-list-output th:first-child, #shopping-list-output td:first-child { width: 36px; }
    #shopping-list-output th:nth-child(2), #shopping-list-output td:nth-child(2) { width: 24%; }
    #shopping-list-output .production-product-breakdown { break-inside: avoid; }
    #shopping-list-output .production-component-card { break-inside: avoid; }
    #shopping-list-output .production-product-breakdown > header { background: #f4f4f4; }
    #shopping-list-output .production-owner-costs { break-before: auto; }
    #shopping-list-output .cost-breakdown-grid { grid-template-columns: repeat(5, 1fr); break-inside: avoid; }
}
/* The order sequence uses the existing theme and wraps on small screens. */
.order-progress { margin: 16px 0; }
.order-stage-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 8px; padding: 0; list-style: none; }
.order-stage-list li { display: flex; align-items: center; gap: 8px; border: 1px solid currentColor; border-radius: 10px; padding: 12px; opacity: .55; }
.order-stage-list li.current { opacity: 1; border-width: 2px; font-weight: 700; }
.order-stage-list li.done { opacity: .85; }
#contact-options { display: grid; gap: 8px; max-height: 240px; overflow: auto; }
.chat-mentions { max-height: 150px; overflow: auto; display: grid; gap: 8px; }
.break-word { overflow-wrap: anywhere; word-break: break-word; }
.client-broadcast-list{display:grid;gap:8px;max-height:320px;padding:8px;border:1px solid var(--line);border-radius:12px;overflow:auto}.client-broadcast-recipient{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:10px;padding:10px;border-radius:9px;background:var(--surface-soft)}.client-broadcast-recipient strong,.client-broadcast-recipient small{display:block}.client-broadcast-recipient small{margin-top:3px;color:var(--text-soft)}.client-broadcast-recipient input{width:18px;height:18px;accent-color:var(--primary)}
.website-chat-filters{display:flex;gap:8px;flex-wrap:wrap;margin:16px 0}.website-chat-filters .active{background:var(--primary);color:var(--on-primary,#fff)}.website-chat-workspace{display:grid;grid-template-columns:minmax(270px,.8fr) minmax(360px,1.4fr);gap:16px;min-height:520px}.website-chat-list{display:grid;gap:8px;align-content:start;max-height:70vh;overflow:auto}.website-chat-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;width:100%;padding:13px;text-align:left;color:inherit;background:var(--surface-soft);border:1px solid var(--line);border-radius:12px;cursor:pointer}.website-chat-row:hover,.website-chat-row.selected{border-color:var(--primary);transform:translateY(-1px)}.website-chat-row.unread{box-shadow:inset 4px 0 var(--primary)}.website-chat-row span:first-child{min-width:0}.website-chat-row strong,.website-chat-row small{display:block}.website-chat-row small{color:var(--text-soft);margin-top:3px}.website-chat-row p{grid-column:1/-1;margin:3px 0 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.website-chat-detail{border:1px solid var(--line);border-radius:14px;overflow:hidden;background:var(--surface)}.website-chat-detail-header{display:flex;justify-content:space-between;gap:14px;padding:16px;border-bottom:1px solid var(--line)}.website-chat-detail-header h3,.website-chat-detail-header p{margin:0 0 5px}.website-chat-detail-header small{color:var(--text-soft)}.website-chat-thread{display:grid;gap:10px;align-content:start;padding:16px;max-height:460px;overflow:auto}.website-chat-bubble{max-width:82%;padding:10px 12px;border-radius:13px;background:var(--surface-soft)}.website-chat-bubble.staff{justify-self:end;background:var(--selected-nav)}.website-chat-bubble p{margin:5px 0;white-space:pre-wrap;overflow-wrap:anywhere}.website-chat-bubble small{color:var(--text-soft)}#website-chat-reply{padding:14px;border-top:1px solid var(--line)}#website-chat-reply textarea{min-height:85px;width:100%}

/* Client Management: compact, single-column activity dashboard. */
.cm-management{gap:16px}
.cm-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.cm-summary-card{--cm-accent:#4b7894;display:grid;align-content:start;gap:5px;min-width:0;min-height:112px;padding:14px;border:1px solid color-mix(in srgb,var(--cm-accent) 20%,var(--line));border-radius:15px;background:color-mix(in srgb,var(--cm-accent) 10%,var(--surface));color:var(--text);text-align:left;cursor:pointer}
.cm-summary-card:hover,.cm-summary-card:focus-visible{border-color:var(--cm-accent);box-shadow:var(--shadow-sm)}
.cm-summary-card.cm-plans{--cm-accent:#bd782f}.cm-summary-card.cm-subscriptions{--cm-accent:#6e8250}.cm-summary-card.cm-clients{--cm-accent:#85694d}
.cm-summary-top{display:flex;align-items:center;justify-content:space-between;gap:6px;color:var(--cm-accent);font-size:12px;font-weight:750}
.cm-summary-top svg,.cm-section-icon svg{width:19px;height:19px;flex:none}
.cm-summary-card strong{font-size:26px;line-height:1.1}.cm-summary-card small{color:var(--text-soft);font-size:11px;line-height:1.3}
.cm-tabs{display:flex;gap:6px;min-width:0;padding:4px;overflow-x:auto;overscroll-behavior-inline:contain;border:1px solid var(--line);border-radius:12px;background:var(--surface);scrollbar-width:thin}
.cm-tab{flex:0 0 auto;min-height:39px;padding:8px 14px;border:0;border-radius:9px;background:transparent;color:var(--text-soft);font:inherit;font-size:13px;font-weight:700;cursor:pointer}
.cm-tab.active{background:var(--selected-nav);color:var(--primary-dark)}.cm-tab:focus-visible,.cm-row:focus-visible,.cm-view-all:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.cm-content{display:grid;gap:16px;min-width:0}.cm-section{min-width:0;padding:16px}.cm-section-heading{display:flex;align-items:center;gap:10px;min-width:0;margin-bottom:12px}.cm-section-heading h2{min-width:0;margin:0;font-size:17px}.cm-section-icon{--cm-accent:#4b7894;display:grid;width:32px;height:32px;flex:none;place-items:center;border-radius:10px;background:color-mix(in srgb,var(--cm-accent) 13%,var(--surface));color:var(--cm-accent)}
.cm-section-plans .cm-section-icon{--cm-accent:#bd782f}.cm-section-subscriptions .cm-section-icon{--cm-accent:#6e8250}.cm-section-clients .cm-section-icon{--cm-accent:#85694d}
.cm-view-all{margin-left:auto;padding:6px 2px;border:0;background:transparent;color:var(--primary);font:inherit;font-size:12px;font-weight:750;white-space:nowrap;cursor:pointer}
.cm-list{display:grid;gap:8px;min-width:0}.cm-row{display:flex;align-items:center;gap:11px;width:100%;min-width:0;min-height:70px;padding:11px 12px;border:1px solid var(--line);border-radius:11px;background:var(--surface);color:var(--text);font:inherit;text-align:left;cursor:pointer}
.cm-row:hover{border-color:var(--primary);background:var(--surface-soft)}.cm-row-body{display:grid;gap:3px;min-width:0;flex:1}.cm-row-title{min-width:0;font-size:13px;font-weight:760;overflow-wrap:anywhere}.cm-row-title small{margin-left:5px;color:var(--text-soft);font-size:11px;font-weight:600}.cm-row-preview{min-width:0;color:var(--text-soft);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cm-row-meta{min-width:0;color:var(--text-faint);font-size:11px;line-height:1.35;overflow-wrap:anywhere}.cm-row-arrow{color:var(--text-faint);font-size:24px;line-height:1}.cm-unread{display:grid;min-width:23px;height:23px;padding:0 5px;place-items:center;border-radius:999px;background:#e1eff8;color:#245a78;font-size:11px;font-weight:800}
.cm-status{max-width:100px;padding:4px 7px;border-radius:999px;background:var(--surface-soft);color:var(--text-soft);font-size:10px;font-weight:750;text-align:center;line-height:1.2;overflow-wrap:anywhere}.cm-status-green{background:#e6f0df;color:#3b6535}.cm-status-amber{background:#fff0d8;color:#8a5618}.cm-status-muted{background:#eceded;color:#687078}
.cm-plan-item,.cm-subscription-row{min-width:0;border-radius:11px}.cm-plan-detail{padding:2px 14px 12px;border:1px solid var(--line);border-top:0;border-radius:0 0 11px 11px;background:var(--surface)}.cm-plan-detail p{margin:5px 0;color:var(--text-soft);font-size:11px}.cm-plan-item:has(.cm-plan-detail)>.cm-row{border-radius:11px 11px 0 0}
.cm-subscription-actions{display:flex;flex-wrap:wrap;gap:7px;padding:0 10px 10px;border:1px solid var(--line);border-top:0;border-radius:0 0 11px 11px;background:var(--surface)}.cm-subscription-actions:empty{display:none}.cm-subscription-row:has(.cm-subscription-actions)>.cm-row{border-radius:11px 11px 0 0}.cm-subscription-actions button{min-height:32px;padding:6px 10px;font-size:11px}
.cm-full-clients{display:grid;gap:10px}.cm-directory-utility{display:flex;justify-content:flex-end}.cm-utilities{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.cm-utilities .secondary-button,.cm-utilities button{font-size:12px}.cm-alert-utility{display:flex;align-items:center;gap:8px;margin-right:auto;color:var(--text-soft);font-size:11px}.cm-other-services details>summary{cursor:pointer;font-weight:750}
@media(max-width:700px){.cm-summary{grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}.cm-summary-card{min-height:100px;padding:12px}.cm-management{gap:14px}.cm-section{padding:14px}.cm-tabs{margin-inline:0}.cm-row{min-height:66px}.cm-status{max-width:75px}}
@media(max-width:600px){.page-content:has(.cm-management){padding-inline:16px}.cm-content{grid-template-columns:minmax(0,1fr)}.cm-section-heading h2{font-size:15px}.cm-row{gap:7px;padding:10px}.cm-row-title{font-size:12px}.cm-row-preview,.cm-row-meta{font-size:11px}.cm-summary-card strong{font-size:24px}}
@media(max-width:800px){.website-chat-workspace{grid-template-columns:1fr}.website-chat-detail-header{display:block}.website-chat-detail-header .form-actions{margin-top:12px}.website-chat-list{max-height:300px}.website-chat-thread{max-height:400px}}
