/* ==========================================================================
   Taqreeb 360 — design system (plain CSS, no build step)
   ========================================================================== */

:root {
    /* Brand palette, taken from the Taqreeb 360 logo: ink, cream and amber. */
    --brand-ink: #1f1b17;
    --brand-cream: #f6f3eb;
    --brand-amber: #c1741a;
    --brand-amber-light: #e2a24a;

    --bg: #f7f3ed;
    --surface: #ffffff;
    --surface-2: #fbf8f3;
    --text: #1f1b17;
    --muted: #6f665c;
    --border: #e9e2d7;
    --border-strong: #d9cfc0;
    --primary: #a65f12;
    --primary-strong: #8a4e0e;
    --primary-soft: #f8ecdc;
    --on-primary: #ffffff;
    --accent: var(--primary);
    --gold: #b06a14;
    --red: #c2410c;
    --red-soft: #fbe9e1;
    --green: #2f7d5b;
    --green-soft: #e3f2ea;
    --amber: #b8700f;
    --amber-soft: #fbf0dc;
    --teal: #1f7a70;
    --violet: #6d4fc2;

    /* The sidebar stays ink-dark in both themes, like the app icon. */
    --side-bg: #1f1b17;
    --side-border: #2c2621;
    --side-text: #d9d1c5;
    --side-muted: #8f857a;
    --side-hover: rgba(246, 243, 235, 0.06);
    --side-active: rgba(226, 162, 74, 0.16);
    --side-accent: #e2a24a;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(31, 27, 23, 0.05), 0 4px 16px rgba(31, 27, 23, 0.06);
    --shadow-lg: 0 12px 40px rgba(31, 27, 23, 0.14);
    --ring: 0 0 0 3px rgba(193, 116, 26, 0.28);
    --guest-glow-1: rgba(193, 116, 26, 0.12);
    --guest-glow-2: rgba(31, 27, 23, 0.05);

    font-family: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    font-size: 15px;
    color-scheme: light;
}

/* Dark theme: chosen explicitly (data-theme="dark"), or by the system when the user chose "Auto". */
:root[data-theme="dark"] {
        --bg: #1a1613;
        --surface: #221e1a;
        --surface-2: #2a2520;
        --text: #f6f3eb;
        --muted: #a99f93;
        --border: #352f29;
        --border-strong: #463e36;
        --primary: #e2a24a;
        --primary-strong: #efb969;
        --primary-soft: rgba(226, 162, 74, 0.14);
        --on-primary: #1a1613;
        --gold: #e2a24a;
        --red: #f2867a;
        --red-soft: rgba(242, 134, 122, 0.14);
        --green: #5ec79a;
        --green-soft: rgba(94, 199, 154, 0.14);
        --amber: #f0b85a;
        --amber-soft: rgba(240, 184, 90, 0.14);
        --teal: #4fc1b5;
        --violet: #b59cf0;
        --side-bg: #13100e;
        --side-border: #2a2520;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
        --ring: 0 0 0 3px rgba(226, 162, 74, 0.35);
        --guest-glow-1: rgba(226, 162, 74, 0.10);
        --guest-glow-2: rgba(246, 243, 235, 0.04);
        color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --bg: #1a1613;
        --surface: #221e1a;
        --surface-2: #2a2520;
        --text: #f6f3eb;
        --muted: #a99f93;
        --border: #352f29;
        --border-strong: #463e36;
        --primary: #e2a24a;
        --primary-strong: #efb969;
        --primary-soft: rgba(226, 162, 74, 0.14);
        --on-primary: #1a1613;
        --gold: #e2a24a;
        --red: #f2867a;
        --red-soft: rgba(242, 134, 122, 0.14);
        --green: #5ec79a;
        --green-soft: rgba(94, 199, 154, 0.14);
        --amber: #f0b85a;
        --amber-soft: rgba(240, 184, 90, 0.14);
        --teal: #4fc1b5;
        --violet: #b59cf0;
        --side-bg: #13100e;
        --side-border: #2a2520;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
        --ring: 0 0 0 3px rgba(226, 162, 74, 0.35);
        --guest-glow-1: rgba(226, 162, 74, 0.10);
        --guest-glow-2: rgba(246, 243, 235, 0.04);
        color-scheme: dark;
    }
}

/* Logos: the right artwork for the active theme. */
img.brand-logo.logo-on-dark { display: none; }
:root[data-theme="dark"] img.brand-logo.logo-on-light { display: none; }
:root[data-theme="dark"] img.brand-logo.logo-on-dark { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) img.brand-logo.logo-on-light { display: none; }
    :root:not([data-theme="light"]):not([data-theme="dark"]) img.brand-logo.logo-on-dark { display: block; }
}
.brand-logo { display: block; height: 2rem; width: auto; }
.sidebar .brand-logo { height: 1.9rem; }
.guest-bar .brand-logo { height: 2.1rem; }
.hero-logo { display: block; width: min(280px, 70vw); height: auto; margin: 0 auto 1.5rem; }
.error-logo { display: block; height: 2rem; width: auto; margin-bottom: 1.25rem; }

/* Theme switch: show the icon for the current choice. */
.theme-toggle > span { display: none; line-height: 0; }
:root[data-theme="light"] .theme-toggle .i-light,
:root[data-theme="dark"] .theme-toggle .i-dark,
:root[data-theme="auto"] .theme-toggle .i-auto { display: block; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.015em; }
h1 { font-size: 1.6rem; margin: 0 0 0.25rem; font-weight: 700; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; font-weight: 650; }
code { font-family: ui-monospace, "Cascadia Code", SFMono-Regular, Menlo, monospace; font-size: 0.85em; background: var(--surface-2); border: 1px solid var(--border); padding: 0.05rem 0.35rem; border-radius: 6px; }
small { font-size: 0.8em; }
.icon { width: 1.15rem; height: 1.15rem; flex: none; vertical-align: -0.2em; }
.muted { color: var(--muted); }
.text-red { color: var(--red); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* --- Workspace shell ---------------------------------------------------- */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--side-bg); color: var(--side-text);
    padding: 1.1rem 0.85rem 1.5rem; display: flex; flex-direction: column; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; color: inherit; text-decoration: none; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.sidebar .brand { color: #fff; padding: 0.2rem 0.5rem; font-size: 1.05rem; }
.brand-mark {
    display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 10px;
    background: var(--brand-ink); color: var(--brand-cream); font-weight: 800;
}
.tenant-switch {
    display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.6rem; border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.07); color: #fff;
}
.tenant-switch:hover { background: rgba(255, 255, 255, 0.09); text-decoration: none; }
.tenant-avatar { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 8px; background: rgba(226, 162, 74, 0.18); color: var(--side-accent); font-weight: 700; font-size: 0.85rem; }
.tenant-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; font-weight: 600; }
.tenant-switch .icon { color: var(--side-muted); width: 1rem; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-label { margin: 1rem 0.65rem 0.35rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--side-muted); }
.side-nav a {
    display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.65rem; border-radius: var(--radius-sm);
    color: var(--side-text); font-size: 0.92rem; font-weight: 500; position: relative;
}
.side-nav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.side-nav a.active { background: var(--side-active); color: #fff; }
.side-nav a.active::before { content: ""; position: absolute; left: -0.85rem; top: 0.45rem; bottom: 0.45rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--side-accent); }
.side-nav a.active .icon { color: var(--side-accent); }

.main { min-width: 0; display: flex; flex-direction: column; }
.appbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 0.75rem;
    padding: 0.7rem 1.75rem; background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border);
}
.appbar-title { flex: 1; margin: 0; font-weight: 600; color: var(--muted); font-size: 0.92rem; }
.user-chip { display: flex; align-items: center; gap: 0.55rem; padding: 0.25rem 0.7rem 0.25rem 0.25rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.9rem; font-weight: 500; }
.user-chip:hover { text-decoration: none; border-color: var(--border-strong); }
.avatar { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 0.75rem; }
.icon-btn {
    display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; margin: 0; padding: 0;
    border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.menu-toggle { display: none; }
.content { width: 100%; max-width: 1280px; padding: 1.75rem; margin: 0 auto; }
.sidebar-backdrop { display: none; }

@media (max-width: 960px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 50; left: 0; width: 270px; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(20, 16, 13, 0.5); }
    .menu-toggle { display: inline-grid; }
    .appbar { padding: 0.6rem 1rem; }
    .content { padding: 1.1rem 1rem 2rem; }
    .user-name { display: none; }
    .user-chip { padding-right: 0.25rem; }
}

/* --- Guest / auth pages ------------------------------------------------- */
body.guest {
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 10% -10%, var(--guest-glow-1), transparent 60%),
        radial-gradient(900px 500px at 110% 10%, var(--guest-glow-2), transparent 60%),
        var(--bg);
}
.guest-bar { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.5rem; }
.guest-bar .brand { color: var(--text); }
.container { max-width: 1040px; margin: 2rem auto; padding: 0 1rem; }
.container.narrow { max-width: 560px; margin-top: 12vh; }
body.guest .container { margin-top: 6vh; }
.narrow-card { max-width: 440px; margin: 0 auto; padding: 2rem; box-shadow: var(--shadow-lg); }
.narrow-card h1 { font-size: 1.45rem; }

/* --- Legacy top bar (platform realm) ------------------------------------ */
.topbar { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; padding: 0.9rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .brand { color: var(--text); }
.nav { display: flex; gap: 1.1rem; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--muted); font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; }
.account { display: flex; gap: 1rem; align-items: center; }
.platform-bar { border-bottom: 3px solid var(--primary); }

/* --- Page structure ----------------------------------------------------- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1, .page-head h2 { margin-bottom: 0; }
.page-head p { margin: 0.2rem 0 0; }
.card .page-head { margin-bottom: 0.75rem; }
.hero h1 { font-size: 1.75rem; }
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.4rem; box-shadow: var(--shadow);
}
.card + .card, .card + section, section + .card { margin-top: 1.1rem; }
.card h1 { margin-top: 0; font-size: 1.4rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.75rem; }
.card-head h2 { margin: 0; }
.card-head a { font-size: 0.88rem; font-weight: 500; }
.top-gap { margin-top: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.1rem; margin-bottom: 1.1rem; }
.grid-2 > .card + .card { margin-top: 0; }
.stack > * + * { margin-top: 0.6rem; }
.inline { display: inline; margin: 0; }

/* --- Forms -------------------------------------------------------------- */
label { display: block; margin: 0.95rem 0 0.35rem; font-weight: 550; font-size: 0.9rem; }
label.check { display: flex; gap: 0.5rem; align-items: center; font-weight: 400; margin: 0.45rem 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
input[type=search], input[type=tel], input[type=url], select, textarea {
    width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font: inherit; transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 1rem; height: 1rem; }
textarea.code { font-family: ui-monospace, "Cascadia Code", Menlo, monospace; font-size: 0.85rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 1rem; padding: 0.75rem 1rem 1rem; }
legend { font-weight: 600; padding: 0 0.35rem; }
.field-error { color: var(--red); margin: 0.35rem 0 0; font-size: 0.86rem; }
.hint { color: var(--muted); font-size: 0.84rem; margin: 0.35rem 0 0; }

button, .button {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
    margin-top: 1rem; padding: 0.58rem 1.05rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    font: inherit; font-weight: 550; font-size: 0.92rem; cursor: pointer; text-decoration: none; line-height: 1.2;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
button:hover, .button:hover { background: var(--surface-2); border-color: var(--muted); text-decoration: none; }
button:active, .button:active { transform: translateY(1px); }
button.primary, .button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 1px 2px rgba(31, 27, 23, 0.2); }
button.primary:hover, .button.primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
button.danger { border-color: var(--red); color: var(--red); }
button.danger:hover { background: var(--red-soft); }
button.link { margin: 0; padding: 0; border: 0; background: none; color: var(--primary); font-weight: 500; box-shadow: none; }
button.link:hover { text-decoration: underline; background: none; }
.button.small, button.small { margin-top: 0; padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.page-head .button, .page-head button { margin-top: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.75rem; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 140px; }
.inline-form button { margin-top: 0; }

/* --- Alerts, badges, tags ----------------------------------------------- */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid var(--border); background: var(--surface); font-weight: 500; }
.alert-error { border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--red-soft); color: var(--red); }
.alert-success { border-color: color-mix(in srgb, var(--green) 40%, transparent); background: var(--green-soft); color: var(--green); }
.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.74rem; font-weight: 600; border: 1px solid var(--border); background: var(--surface-2); }
.badge-ok { border-color: transparent; background: var(--green-soft); color: var(--green); }
.badge-warn { border-color: transparent; background: var(--amber-soft); color: var(--amber); }
.tag { display: inline-block; padding: 0.12rem 0.5rem; border-radius: 6px; font-size: 0.72rem; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-inquiry { background: var(--primary-soft); color: var(--primary); }
.tag-confirmed { background: var(--green-soft); color: var(--green); }
.tag-followup { background: var(--amber-soft); color: var(--amber); }

.pill { display: inline-block; padding: 0.14rem 0.6rem; border-radius: 999px; font-size: 0.76rem; font-weight: 600; color: #fff; background: #6b7280; }
.status-dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; margin-right: 0.4rem; background: #999; }
/* After .pill so a status colour wins on "pill status-x". */
.status-blue { background: #2563eb; } .status-green { background: #059669; } .status-amber { background: #d97706; }
.status-red { background: #dc2626; } .status-purple { background: #7c3aed; } .status-gray { background: #6b7280; }

/* --- Tables & lists ----------------------------------------------------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.92rem; }
.table th { text-align: left; padding: 0.6rem 0.75rem; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.table th:first-child { border-top-left-radius: var(--radius-sm); }
.table th:last-child { border-top-right-radius: var(--radius-sm); }
.table td { text-align: left; padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; }
.matrix td, .matrix th { text-align: center; }
.choice-list, .codes, .links { list-style: none; padding: 0; margin: 0; }
.links li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.links li:last-child { border-bottom: 0; }
.choice { width: 100%; text-align: left; justify-content: flex-start; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem; }
.secret code { font-size: 1.1rem; letter-spacing: 0.05em; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.45rem 1.25rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.filters a { padding: 0.3rem 0.7rem; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: 0.88rem; }
.filters a:hover { background: var(--surface-2); text-decoration: none; }
.filters a.current { background: var(--primary-soft); color: var(--primary); }
.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin-top: 1rem; }
.section-list { padding-left: 1.25rem; }
.section-list li { margin: 0.4rem 0; }
.item-row { border-top: 1px dashed var(--border); padding-top: 0.5rem; margin-top: 0.5rem; }
.error-code { margin: 0 0 0.25rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.debug pre { overflow-x: auto; font-size: 0.8rem; padding: 0.75rem; background: var(--bg); border-radius: 6px; }

/* Platform stats (legacy) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.stat { display: flex; flex-direction: column; gap: 0.25rem; }
.stat-label { color: var(--muted); font-size: 0.85rem; }
.stat-value { font-size: 1.8rem; font-weight: 700; }

/* --- Dashboard ---------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: 0.8rem;
    padding: 1.1rem 1.2rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow); color: var(--text); transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.kpi-icon { grid-row: 1 / span 3; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 12px; }
.kpi-icon .icon { width: 1.3rem; height: 1.3rem; }
.kpi-label { font-size: 0.82rem; color: var(--muted); font-weight: 550; }
.kpi-value { font-size: 1.7rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.2; }
.kpi-value small { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.kpi-foot { font-size: 0.8rem; color: var(--muted); }
.tone-indigo { background: var(--primary-soft); color: var(--primary); }
.tone-teal { background: rgba(13, 148, 136, 0.12); color: var(--teal); }
.tone-gold { background: rgba(183, 121, 31, 0.13); color: var(--gold); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-red { background: var(--red-soft); color: var(--red); }
.tone-violet { background: rgba(124, 58, 237, 0.12); color: var(--violet); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.1rem; align-items: start; }
.dash-grid > .card + .card { margin-top: 0; }
@media (max-width: 1180px) { .dash-grid { grid-template-columns: 1fr; } }

.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li a { display: flex; gap: 0.75rem; align-items: center; padding: 0.6rem 0.5rem; margin: 0 -0.5rem; border-radius: var(--radius-sm); color: var(--text); }
.agenda li a:hover { background: var(--surface-2); text-decoration: none; }
.agenda-when { display: grid; place-items: center; min-width: 3.1rem; padding: 0.3rem; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-weight: 700; font-size: 0.85rem; line-height: 1.15; }
.agenda-when small { font-weight: 600; opacity: 0.85; }
.agenda li.is-overdue .agenda-when { background: var(--red-soft); color: var(--red); }
.agenda-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.agenda-body strong { font-size: 0.92rem; }
.agenda-body .muted { font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { display: grid; place-items: center; gap: 0.25rem; padding: 1.5rem 0; color: var(--muted); text-align: center; }
.empty .icon { width: 2rem; height: 2rem; color: var(--green); }
.empty p { margin: 0; }

/* --- Calendar ----------------------------------------------------------- */
.calendar { padding: 1.1rem 1.2rem 1.2rem; }
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.cal-nav { display: flex; align-items: center; gap: 0.4rem; }
.cal-title { margin: 0 0 0 0.4rem; font-size: 1.2rem; min-width: 10rem; }
.cal-tools { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.seg { margin: 0; padding: 0.3rem 0.65rem; border: 0; border-radius: 8px; background: none; font-size: 0.82rem; font-weight: 550; color: var(--muted); gap: 0.4rem; }
.seg:hover { background: var(--surface); }
.seg[aria-pressed=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg[aria-pressed=false] .dot { opacity: 0.3; }
.dot { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--muted); flex: none; }
.dot-inquiry { background: var(--primary); }
.dot-confirmed { background: var(--green); }
.dot-followup { background: var(--amber); }

.cal-body { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 1rem; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekdays span { padding: 0 0.5rem 0.4rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.cal-grid { gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.calendar.is-loading .cal-grid { opacity: 0.55; transition: opacity 0.2s; }
.cal-cell {
    display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0.2rem;
    min-height: 6.4rem; margin: 0; padding: 0.4rem; border: 0; border-radius: 0; background: var(--surface);
    text-align: left; font-weight: 400; cursor: pointer; transition: background 0.12s;
}
.cal-cell:hover { background: var(--surface-2); border: 0; }
.cal-cell:active { transform: none; }
.cal-cell:focus-visible { box-shadow: inset 0 0 0 2px var(--primary); border-radius: 0; }
.cal-cell.is-outside { background: var(--surface-2); }
.cal-cell.is-outside .cal-num { color: var(--muted); opacity: 0.6; }
.cal-num { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; font-size: 0.85rem; font-weight: 600; }
.cal-cell.is-today .cal-num { background: var(--primary); color: var(--on-primary); }
.cal-cell.is-selected { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.cal-chips { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chip {
    display: block; padding: 0.1rem 0.4rem; border-radius: 5px; font-size: 0.72rem; font-weight: 550; line-height: 1.35;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid transparent;
}
.chip b { font-weight: 700; margin-right: 0.25rem; }
.chip-inquiry { background: var(--primary-soft); color: var(--primary); border-left-color: var(--primary); }
.chip-confirmed { background: var(--green-soft); color: var(--green); border-left-color: var(--green); }
.chip-followup { background: var(--amber-soft); color: var(--amber); border-left-color: var(--amber); }
.chip.is-overdue { background: var(--red-soft); color: var(--red); border-left-color: var(--red); }
.chip-more { font-size: 0.7rem; color: var(--muted); font-weight: 600; padding-left: 0.3rem; }
.cal-dots { display: none; gap: 3px; justify-content: center; }
.cal-status { margin: 0.5rem 0 0; min-height: 1.2em; font-size: 0.85rem; }

.cal-day { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.9rem; background: var(--surface-2); align-self: start; }
.cal-day-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.cal-day-date { margin: 0; font-weight: 700; font-size: 0.95rem; }
.cal-day-add[hidden] { display: none; }
.cal-day-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.cal-empty { color: var(--muted); font-size: 0.88rem; padding: 1rem 0; text-align: center; }
.cal-item a {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 0.1rem 0.6rem; align-items: start;
    padding: 0.55rem 0.65rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--primary); color: var(--text);
}
.cal-item a:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); }
.cal-item.kind-confirmed a { border-left-color: var(--green); }
.cal-item.kind-followup a { border-left-color: var(--amber); }
.cal-item.is-overdue a { border-left-color: var(--red); }
.cal-item-time { grid-row: 1 / span 2; font-size: 0.75rem; font-weight: 700; color: var(--muted); padding-top: 0.1rem; min-width: 2.6rem; }
.cal-item-body { display: flex; flex-direction: column; min-width: 0; }
.cal-item-body strong { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item-body .muted { font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item .tag { grid-column: 2; justify-self: start; margin-top: 0.2rem; }

@media (max-width: 1280px) { .cal-body { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
    .cal-cell { min-height: 3.4rem; align-items: center; padding: 0.3rem 0.1rem; }
    .cal-chips { display: none; }
    .cal-dots { display: flex; }
    .cal-weekdays span { text-align: center; padding: 0 0 0.4rem; }
    .cal-title { font-size: 1.05rem; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

/* --- Catalog ------------------------------------------------------------ */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 0.9rem; }
.slot-row { margin-top: 0; flex-wrap: nowrap; }
.slot-row input[type=text] { flex: 1 1 90px; min-width: 0; }
.slot-row input[type=time] { flex: 0 0 auto; width: 7.2rem; }
.agenda li:has(.slot-row) { padding: 0.35rem 0; border-bottom: 1px solid var(--border); }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-big { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.02em; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.25rem 1rem; }
.qty { width: 5rem !important; flex: 0 0 5rem !important; }
.quote-lines td:last-child, .quote-lines th:last-child { text-align: right; }
.quote-total td { font-weight: 750; font-size: 1.05rem; border-top: 2px solid var(--border-strong); }
@media (max-width: 720px) { .slot-row { flex-wrap: wrap; } }
.grow { flex: 1 1 auto; min-width: 0; }
.narrow-form { max-width: 760px; }
.package-card .kpi-label { font-size: 0.95rem; color: var(--text); font-weight: 650; }
.qr { margin: 0.6rem 0; }
.qr img { display: block; padding: 10px; background: #fff; border-radius: 12px; border: 1px solid var(--border); }

/* Platform + audit */
body.platform .sidebar { background: #1a1024; }
.platform-badge { display: flex; align-items: center; gap: 0.45rem; margin: 0; padding: 0.45rem 0.65rem; border-radius: var(--radius-sm); background: rgba(245, 158, 11, 0.14); color: #fbbf24; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.code-block { margin: 0; padding: 0.8rem; max-height: 420px; overflow: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: ui-monospace, "Cascadia Code", Menlo, monospace; font-size: 0.8rem; white-space: pre-wrap; word-break: break-word; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.media-card { margin: 0; padding: 0.6rem; }
.media-card img { display: block; width: 100%; height: 160px; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.media-card figcaption { display: flex; flex-direction: column; gap: 0.2rem; margin-top: 0.5rem; font-size: 0.85rem; word-break: break-word; }
.media-card figcaption button { margin-top: 0.3rem; }
.action-row { margin-top: 0.8rem; }
.action-row > select { margin-bottom: 0.4rem; }
.action-row [data-show-for] > * + * { margin-top: 0.4rem; }
.avail td { text-align: center; min-width: 9rem; }
.avail td:first-child { text-align: left; }
.avail-free { background: color-mix(in srgb, var(--green) 7%, transparent); }
.avail-free a { font-weight: 600; color: var(--green); }
.avail-tentative { background: var(--amber-soft); }
.avail-confirmed { background: var(--primary-soft); }
.dot-booking { background: #0f766e; }
.dot-hold { background: #c2410c; }
.chip-booking { background: rgba(15, 118, 110, 0.14); color: #0f766e; border-left-color: #0f766e; }
.chip-hold { background: rgba(194, 65, 12, 0.12); color: #c2410c; border-left-color: #c2410c; border-left-style: dashed; }
.cal-item.kind-booking a { border-left-color: #0f766e; }
.cal-item.kind-hold a { border-left-color: #c2410c; }
.tag-booking { background: rgba(15, 118, 110, 0.14); color: #0f766e; }
.tag-hold { background: rgba(194, 65, 12, 0.12); color: #c2410c; }

/* Finance: form helpers and printable documents */
.form-end { display: flex; align-items: flex-end; }
.lines-editor input { width: 100%; }
.lines-editor input.qty { max-width: 6rem; }
.print-page { background: #fff; }
.print-actions { max-width: 800px; margin: 1rem auto 0; padding: 0 16px; text-align: right; }
.print-sheet { max-width: 800px; margin: 1rem auto; padding: 2rem 16px; background: #fff; color: #111; }
.print-head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid #111; padding-bottom: 1rem; margin-bottom: 1rem; }
.print-head h1, .print-head h2 { margin: 0 0 .25rem; }
.print-head p, .print-party p { margin: .1rem 0; }
.print-party { margin-bottom: 1.5rem; }
.print-lines { width: 100%; }
.print-notes { margin-top: 1.5rem; white-space: pre-line; }
@media print {
    .no-print { display: none !important; }
    .print-sheet { margin: 0; padding: 0; max-width: none; }
}

/* Notifications */
.bell { position: relative; }
.bell .badge { position: absolute; top: 2px; right: 2px; min-width: 1.1rem; padding: 0 .25rem; border-radius: 999px; background: #c0392b; color: #fff; font-size: .7rem; line-height: 1.1rem; text-align: center; }
.notification-list { list-style: none; margin: 0; padding: 0; }
.notification-list li { border-bottom: 1px solid rgba(127, 127, 127, .2); }
.notification-list li.unread { font-weight: 600; }
.notification-link { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; width: 100%; padding: .6rem 0; text-align: left; }
.secret { word-break: break-all; font-size: 1rem; }

/* Assistant */
.chat { display: flex; flex-direction: column; gap: .6rem; }
.chat-msg { max-width: 85%; padding: .55rem .8rem; border-radius: .7rem; white-space: pre-line; }
.chat-user { align-self: flex-end; background: rgba(46, 125, 109, .15); }
.chat-assistant { align-self: flex-start; background: rgba(127, 127, 127, .12); }
.chat-form { display: flex; gap: .5rem; align-items: flex-end; }
.chat-form textarea { flex: 1; }
.pending-action { display: flex; justify-content: space-between; gap: 1rem; align-items: center; border-bottom: 1px solid rgba(127, 127, 127, .2); padding: .5rem 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Guest bar: logo left, theme switch and sign-in right */
.guest-bar { justify-content: flex-start; gap: 0.75rem; }
.guest-bar .brand { margin-right: auto; }

/* Friendly error pages */
.error-page .container.narrow { margin-top: 10vh; }
.error-card { padding: 2rem; box-shadow: var(--shadow-lg); }
.error-card h1 { font-size: 1.5rem; }
.error-icon { display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 12px; background: var(--primary-soft); color: var(--primary); margin-bottom: 0.75rem; }
.error-actions { margin: 1.25rem 0 0.5rem; }
.debug summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.hero { text-align: center; padding: 3rem 1rem; }
.hero p { max-width: 520px; margin: 0 auto 1.5rem; }

.color-input { width: 100%; height: 2.6rem; padding: 0.2rem; cursor: pointer; }

/* Guided booking screen */
.wizard-steps { display: flex; gap: 0.5rem; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 1rem; }
.wizard-steps li { flex: 1; min-width: 130px; display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); font-weight: 600; cursor: pointer; }
.wizard-steps li.active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.wizard-steps li.done { color: var(--green); }
.wizard-num { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--surface-2); font-size: 0.85rem; }
.wizard-steps li.active .wizard-num { background: var(--primary); color: var(--on-primary); }
.wizard-step h2 .icon { color: var(--primary); }
.wizard-nav { display: flex; justify-content: space-between; gap: 0.75rem; margin: 1rem 0 2rem; }
.wizard-nav [data-wizard-next], .wizard-nav [data-wizard-save] { margin-left: auto; }
.wizard:not(.is-js) [data-wizard-next], .wizard:not(.is-js) [data-wizard-back] { display: none; }
.wizard-mode { margin-bottom: 1rem; }
.wizard-mode .seg { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.wizard-total, .wizard-summary { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.85rem 1rem; }
.row-between { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; }
.wizard-total [data-total], .wizard-balance strong { font-size: 1.25rem; }
.wizard-balance { margin: 1rem 0; padding: 0.6rem 1rem; border-radius: var(--radius-sm); background: var(--primary-soft); }
.opt { font-weight: 400; color: var(--muted); font-size: 0.85em; }
.field-ok { margin: 0.3rem 0 0; color: var(--green); font-size: 0.88rem; }
label.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.settings-tabs { margin-bottom: 1rem; flex-wrap: wrap; }
.settings-tabs .seg.active { background: var(--primary-soft); color: var(--primary); }
.settings-logo { display: block; max-height: 90px; width: auto; margin-bottom: 0.75rem; }
.terms-row { border-top: 1px solid var(--border); padding: 0.85rem 0; }
.terms-meta { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.4rem; }
.terms-meta label { display: flex; align-items: center; gap: 0.4rem; margin: 0; }
.col-order { width: 5.5rem; }
.urdu { font-family: "Jameel Noori Nastaleeq", "Noto Nastaliq Urdu", "Urdu Typesetting", "Alvi Nastaleeq", serif; font-size: 1.15em; line-height: 2; }
.id-photos { display: flex; gap: 1rem; flex-wrap: wrap; }
.id-photos figure { margin: 0; }
.id-photos img, .id-empty { display: block; width: 260px; max-width: 100%; height: 165px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.id-empty { display: grid; place-items: center; color: var(--muted); background: var(--surface-2); }

/* Printed booking form (A4) */
.bf-lang { max-width: 800px; margin: 0.5rem auto; padding: 0 16px; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.bf-head { display: flex; align-items: center; gap: 1.25rem; padding: 1rem 1.25rem; background: #1f1b17; color: #f6f3eb; border-radius: 6px 6px 0 0; }
.bf-logo { max-height: 80px; width: auto; }
.bf-title h1 { margin: 0; font-size: 2rem; letter-spacing: 0.02em; color: #e2a24a; }
.bf-tagline { margin: 0.2rem 0 0; color: #e8d9bf; font-weight: 600; }
.bf-address { margin: 0; padding: 0.5rem 1.25rem; background: #e2a24a; color: #1f1b17; }
.bf-meta { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.9rem 0.25rem; border-bottom: 1px solid #ddd; }
.bf-box { background: #f1eeea; border-radius: 14px; padding: 0.9rem 1.1rem; margin: 0.8rem 0; }
.bf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem 1rem; }
.bf-grid div { display: flex; flex-direction: column; border-bottom: 1px solid #c9c1b6; padding-bottom: 0.2rem; }
.bf-grid span { font-size: 0.75rem; color: #6f665c; text-transform: uppercase; letter-spacing: 0.04em; }
.bf-wide { grid-column: span 3; }
.bf-charges { width: 100%; border-collapse: collapse; }
.bf-charges td { padding: 0.35rem 0.25rem; border-bottom: 1px solid #d6cec3; }
.bf-total td { font-weight: 700; font-size: 1.05rem; }
.bf-remarks { margin: 0.6rem 0 0; }
.bf-terms { margin-top: 1rem; }
.bf-terms-title { display: inline-flex; gap: 0.75rem; align-items: center; background: #c1741a; color: #fff; padding: 0.3rem 1rem; border-radius: 999px; font-size: 1rem; }
.bf-terms ol { padding-left: 1.4rem; margin: 0.6rem 0; }
.bf-terms li { margin: 0.25rem 0; }
.bf-terms li p { margin: 0; }
.bf-terms .urdu { text-align: right; }
.bf-en { color: #444; font-size: 0.92rem; }
.bf-note { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; background: #e2a24a; color: #1f1b17; border-radius: 999px; padding: 0.3rem 1rem; margin: 0.6rem auto; max-width: 560px; text-align: center; }
.bf-system { text-align: center; font-size: 0.85rem; font-style: italic; color: #555; margin: 1.5rem 0 1rem; }
.bf-foot { background: #e2a24a; color: #1f1b17; text-align: center; padding: 0.5rem; border-radius: 0 0 6px 6px; }
@media print { .bf-head, .bf-address, .bf-foot, .bf-terms-title, .bf-note, .bf-box { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
@media (max-width: 640px) { .bf-grid { grid-template-columns: 1fr 1fr; } .bf-wide { grid-column: span 2; } }

/* Reports */
.report-cards .kpi { grid-template-rows: auto auto; align-content: start; }
.report-cards .kpi-label { font-size: 1rem; color: var(--text); font-weight: 650; }
.report-tabs { display: flex; max-width: 100%; overflow-x: auto; margin-bottom: 1rem; }
.report-tabs .seg { white-space: nowrap; }
.report-filters label { font-size: 0.85rem; color: var(--muted); margin: 0; }
.report-presets { margin: 0.75rem 0 0.25rem; }
.report-presets .tag { text-decoration: none; }
.report-presets .tag.active { background: var(--primary); color: #fff; }
.small-print { font-size: 0.82rem; margin: 0.25rem 0 0; }
.report-bars th { font-weight: 550; width: 30%; white-space: nowrap; text-transform: none; letter-spacing: normal; font-size: 0.9rem; color: var(--text); background: none; }
.report-bars td.money { width: 20%; white-space: nowrap; }
.bar-cell { width: 50%; }
.bar-cell progress { display: block; width: 100%; height: 0.8rem; border: 0; border-radius: 999px; background: var(--surface-2); overflow: hidden; appearance: none; -webkit-appearance: none; }
.bar-cell progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
.bar-cell progress::-webkit-progress-value { background: var(--primary); border-radius: 999px; }
.bar-cell progress::-moz-progress-bar { background: var(--primary); border-radius: 999px; }
@media (max-width: 640px) { .report-bars th { width: auto; white-space: normal; } .bar-cell { width: 35%; } }

/* Business profile */
.tenant-logo { object-fit: contain; background: #fff; padding: 2px; }
.brand-card .stack { margin-top: 0.75rem; }
.brand-preview { display: flex; align-items: center; justify-content: center; min-height: 7rem; margin: 0.75rem 0; padding: 1rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.brand-preview-logo { max-width: 100%; max-height: 6rem; object-fit: contain; }
.brand-placeholder { display: grid; place-items: center; width: 4.5rem; height: 4.5rem; border-radius: 16px; background: var(--primary-soft); color: var(--primary); font-size: 2rem; font-weight: 750; }
.brand-placeholder.small { width: 1.25rem; height: 1.25rem; border-radius: 4px; font-size: 0.75rem; }
.tab-preview { display: inline-flex; align-items: center; gap: 0.5rem; max-width: 100%; padding: 0.45rem 0.9rem; border-radius: 10px 10px 0 0; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.tab-preview img { width: 1.25rem; height: 1.25rem; object-fit: contain; }
.tab-title { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12rem; }
.note-card { border-left: 4px solid var(--primary); }
