/* ==========================================================================
   Graphase — single stylesheet (no framework). Tokens → base → components.
   ========================================================================== */

:root {
    color-scheme: light;

    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

    --bg: #f6f5f1;
    --surface: #ffffff;
    --surface-2: #f2f0eb;
    --surface-3: #e9e6df;
    --border: #e3dfd6;
    --border-strong: #cfc9bd;
    --text: #1c1a17;
    --text-2: #4a463f;
    --muted: #726c62;

    --primary: #5b3df5;
    --primary-hover: #4a2ee0;
    --primary-soft: #eeeaff;
    --primary-ink: #ffffff;
    --accent: #ff6a3d;
    --focus: #7c5cff;

    --danger: #c62828;
    --danger-soft: #fdecea;
    --success: #16813d;
    --success-soft: #e3f5e8;
    --warn: #b45309;
    --warn-soft: #fef3c7;

    /* status */
    --st-new: #1d5fd6;
    --st-new-bg: #e6efff;
    --st-ongoing: #a15c00;
    --st-ongoing-bg: #fff1d6;
    --st-needs: #c2410c;
    --st-needs-bg: #ffe8dc;
    --st-done: #13733a;
    --st-done-bg: #def4e5;
    --st-archived: #5d5850;
    --st-archived-bg: #e9e6e0;
    --pay-unpaid: #c62828;
    --pay-paid: #16813d;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    --shadow-sm: 0 1px 2px rgba(28, 26, 23, .06);
    --shadow: 0 1px 2px rgba(28, 26, 23, .05), 0 4px 14px rgba(28, 26, 23, .06);
    --shadow-lg: 0 10px 40px rgba(28, 26, 23, .16), 0 2px 8px rgba(28, 26, 23, .08);

    --topbar-h: 60px;
    --page-max: 1240px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-wrap: anywhere;
}

body:has(.modal-root) { overflow: hidden; }

h1, h2, h3, h4, .h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
h4, .h4 { font-size: .875rem; font-weight: 650; }
p { margin: 0; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }
code { font-family: var(--font-mono); font-size: .85em; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1:focus { outline: none; }

.sr-only, .visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.center { text-align: center; }
.spacer { flex: 1 1 auto; }
.icon { flex: none; vertical-align: middle; }

/* ---------- boot / error ui ---------- */
.boot {
    min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
}
.boot-logo { display: block; object-fit: contain; animation: pulse 1.6s ease-in-out infinite; }
.boot-bar { width: 160px; height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.boot-bar span {
    display: block; height: 100%; width: var(--blazor-load-percentage, 8%);
    background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .15s ease;
}
.loading-progress-text { font-size: .8125rem; color: var(--muted); }
.loading-progress-text::after { content: var(--blazor-load-percentage-text, "Loading"); }

#blazor-error-ui {
    display: none; position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 1000;
    width: min(560px, calc(100% - 24px)); padding: 12px 44px 12px 16px;
    background: #2a1a17; color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
    align-items: center; gap: 12px;
}
#blazor-error-ui .reload { color: #ffb59c; font-weight: 600; margin-left: 8px; }
#blazor-error-ui .dismiss {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: 0; color: #fff; font-size: 22px; width: 36px; height: 36px;
}
.blazor-error-boundary {
    background: var(--danger-soft); color: var(--danger); padding: 1rem; border-radius: var(--radius);
}
.blazor-error-boundary::after { content: "Something went wrong displaying this part of the page."; }

@keyframes pulse { 50% { transform: scale(.94); opacity: .85; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
@keyframes flash { from { background: var(--primary-soft); } }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.logo-mark { display: block; flex: none; object-fit: contain; }
.logo-word { font-weight: 750; font-size: 1.1rem; letter-spacing: -0.02em; }
.brand-link { display: inline-flex; border-radius: var(--radius); }
.brand-link:hover { text-decoration: none; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 16px; border-radius: var(--radius);
    border: 1px solid transparent; background: var(--surface); color: var(--text);
    font-weight: 600; font-size: .9rem; line-height: 1; white-space: nowrap;
    text-decoration: none; transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn.is-disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 1px 2px rgba(91, 61, 245, .3); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-link { background: none; color: var(--primary); padding: 0 6px; min-height: 36px; }
.btn-link:hover { background: var(--primary-soft); }
.btn-link.danger { color: var(--danger); }
.btn-link.danger:hover { background: var(--danger-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a91f1f; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: #f1c6c2; }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .85rem; border-radius: 8px; }
.btn-xs { min-height: 36px; padding: 0 10px; font-size: .8rem; border-radius: 8px; gap: 6px; }
.btn-lg { min-height: 46px; padding: 0 22px; font-size: .95rem; }
.btn-block { width: 100%; }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; }
.btn-primary .spinner, .btn-danger .spinner { border-color: rgba(255,255,255,.35); border-top-color: #fff; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; position: relative;
    width: 40px; height: 40px; border-radius: var(--radius); border: 0; background: transparent; color: var(--text-2);
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .45; }
.icon-btn-sm { width: 36px; height: 36px; border-radius: 8px; }

.avatar-btn { border: 0; padding: 2px; background: transparent; border-radius: 99px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.field:last-child { margin-bottom: 0; }
.field-label { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.field-label-row { display: flex; align-items: center; justify-content: space-between; }
.field-hint { font-size: .78rem; color: var(--muted); }
.field-error { font-size: .8rem; color: var(--danger); font-weight: 500; }
.req { color: var(--danger); }

.input {
    width: 100%; min-height: 42px; padding: 9px 12px;
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    background: var(--surface); color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #a39d92; }
.input:hover { border-color: #b8b1a3; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 61, 245, .18); }
.input:disabled { background: var(--surface-2); color: var(--muted); }
.input.is-invalid { border-color: var(--danger); }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.5; }
.input-sm { min-height: 36px; padding: 6px 10px; font-size: .875rem; border-radius: 8px; }
.select {
    appearance: none; padding-right: 32px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23726c62' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}

.input-with-button { position: relative; display: block; }
.input-with-button .input { padding-right: 44px; }
.input-with-button .icon-btn { position: absolute; right: 3px; top: 3px; }

.inline-form { display: flex; gap: var(--space-2); align-items: center; }
.inline-form .input { flex: 1; }
.form-grid { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-4); }
.form-grid .field { margin-bottom: 0; }
.form-card { padding: var(--space-5); margin-bottom: var(--space-4); }
.form-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-3); }

.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; cursor: pointer; min-height: 36px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track {
    width: 34px; height: 20px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .15s;
}
.toggle-track::after {
    content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 99px;
    background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s;
}
.toggle input:checked + .toggle-track { background: var(--primary); }
.toggle input:checked + .toggle-track::after { transform: translateX(14px); }
.toggle input:focus-visible + .toggle-track { outline: 3px solid var(--focus); outline-offset: 2px; }

.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 32px; width: 200px; }

/* ---------- badges & chips ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
    border-radius: 99px; font-size: .75rem; font-weight: 650; white-space: nowrap; border: 1px solid transparent;
}
.badge-dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.badge-new { color: var(--st-new); background: var(--st-new-bg); }
.badge-ongoing { color: var(--st-ongoing); background: var(--st-ongoing-bg); }
.badge-needs-info { color: var(--st-needs); background: var(--st-needs-bg); }
.badge-completed { color: var(--st-done); background: var(--st-done-bg); }
.badge-unknown { color: var(--muted); background: var(--surface-2); }
.badge-pay-unpaid { color: var(--pay-unpaid); background: transparent; border-color: var(--pay-unpaid); }
.badge-pay-paid { color: #fff; background: var(--pay-paid); }
.badge-archived { color: var(--st-archived); background: var(--st-archived-bg); }
.badge-invite-active { color: var(--st-done); background: var(--st-done-bg); }
.badge-invite-expired { color: var(--st-archived); background: var(--st-archived-bg); }
.badge-invite-revoked { color: var(--danger); background: var(--danger-soft); }

.chip {
    display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 2px 9px;
    border-radius: 99px; background: var(--surface-2); color: var(--text-2); font-size: .78rem; font-weight: 600;
    border: 1px solid transparent; white-space: nowrap;
}
.chip-sm { min-height: 22px; font-size: .72rem; padding: 0 7px; }
.chip-btn { cursor: pointer; border-color: var(--border); background: var(--surface); min-height: 32px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip-btn:hover { background: var(--primary-soft); border-color: #cfc4ff; color: var(--primary); }
.chip-deadline.is-soon { color: var(--warn); background: var(--warn-soft); }
.chip-deadline.is-overdue { color: #fff; background: var(--danger); }
.chip-deadline.is-done { color: var(--muted); }

.role-chip {
    display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 99px;
    background: var(--primary-soft); color: var(--primary); font-size: .7rem; font-weight: 700; letter-spacing: .02em;
}
.kind-chip {
    display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 99px;
    background: #fff0ea; color: #c2410c; font-size: .7rem; font-weight: 700;
}
.count {
    display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 700; vertical-align: middle;
}
.count-badge {
    position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
    background: var(--accent); color: #fff; font-size: .68rem; font-weight: 750; line-height: 18px; text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- avatars ---------- */
.avatar {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 36px; height: 36px; border-radius: 99px; font-size: .78rem; font-weight: 700; letter-spacing: .02em;
    color: hsl(var(--avatar-hue, 250) 45% 30%); background: hsl(var(--avatar-hue, 250) 70% 90%);
}
.avatar-designer { color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.avatar-sm { width: 28px; height: 28px; font-size: .68rem; }
.avatar-lg { width: 44px; height: 44px; font-size: .9rem; }

/* ---------- layout ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1; }
.page { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: var(--space-5) var(--space-5) var(--space-7); }
.page-narrow { max-width: 880px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin-bottom: var(--space-2); color: var(--muted); font-weight: 600; font-size: .875rem; }
.back-link:hover { color: var(--text); text-decoration: none; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.section { margin-bottom: var(--space-6); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); min-height: 36px; }
.section-head h2 { display: flex; align-items: center; gap: 8px; }
.subhead { font-size: 1rem; margin-bottom: var(--space-3); }

.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-4); }
.splash { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
.splash .logo-mark { animation: pulse 1.6s ease-in-out infinite; }

/* auth */
.auth-shell {
    min-height: 100vh; display: flex; flex-direction: column;
    background:
        radial-gradient(900px 500px at 110% -10%, rgba(255, 106, 61, .12), transparent 60%),
        radial-gradient(800px 500px at -10% 110%, rgba(91, 61, 245, .12), transparent 60%),
        var(--bg);
}
.auth-top { padding: var(--space-4) var(--space-5); }
.auth-main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: var(--space-5) var(--space-4) var(--space-7); }
.auth-foot { text-align: center; padding: var(--space-4); color: var(--muted); font-size: .8rem; }
.auth-card {
    width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-xl); box-shadow: var(--shadow); padding: var(--space-6);
    display: flex; flex-direction: column; gap: var(--space-3);
}
.center-screen .auth-card { text-align: left; }
.auth-card > h1 { font-size: 1.5rem; }
.auth-logo { margin-bottom: var(--space-2); }
.auth-form { display: flex; flex-direction: column; gap: 0; margin-top: var(--space-2); }
.auth-form .btn-block { margin-top: var(--space-2); }
.auth-form .alert { margin-top: var(--space-2); }
.auth-hint { display: flex; gap: 8px; align-items: flex-start; font-size: .82rem; color: var(--muted); padding-top: var(--space-3); border-top: 1px solid var(--border); margin-top: var(--space-2); }
.auth-hint .icon { margin-top: 2px; }
.auth-divider { display: flex; align-items: center; gap: var(--space-3); color: var(--muted); font-size: .8rem; margin: var(--space-1) 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-google { gap: 10px; }
.btn-google .google-mark { flex: none; }
.state-icon {
    width: 52px; height: 52px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-soft); color: var(--primary);
}
.state-icon.is-error { background: var(--danger-soft); color: var(--danger); }
.stack-actions { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.signed-in-as { padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); font-size: .9rem; }
.confirm-message { color: var(--text-2); }

/* ---------- top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
    background: rgba(255, 255, 255, .88); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner { height: 100%; max-width: var(--page-max); margin: 0 auto; padding: 0 var(--space-5); display: flex; align-items: center; gap: var(--space-5); }
.topnav { display: flex; gap: 2px; }
.topnav-link {
    display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px; border-radius: var(--radius);
    color: var(--text-2); font-weight: 600; font-size: .9rem;
}
.topnav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topnav-link.active { background: var(--primary-soft); color: var(--primary); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

/* ---------- menus / popovers ---------- */
.menu-wrap { position: relative; }
.menu-backdrop { position: fixed; inset: 0; z-index: 60; }
.menu-panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 61; min-width: 220px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    padding: 6px; animation: pop .12s ease-out;
}
.menu-left { left: 0; right: auto; }
.menu-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 8px; }
.menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0;
    background: transparent; border-radius: 8px; text-align: left; font-weight: 550; color: var(--text-2);
}
.menu-item:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.menu-item:disabled { cursor: default; }
.menu-check { margin-left: auto; color: var(--primary); }

.bell-panel { width: 380px; max-width: calc(100vw - 24px); padding: 6px 6px 8px; }
.bell-list { list-style: none; margin: 0; padding: 0; max-height: min(460px, 65vh); overflow-y: auto; }
.bell-item {
    display: flex; gap: 10px; width: 100%; padding: 10px; border: 0; background: transparent; border-radius: 10px; text-align: left;
}
.bell-item:hover { background: var(--surface-2); }
.bell-dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 99px; background: transparent; }
.bell-item.is-unread .bell-dot { background: var(--accent); }
.bell-item.is-unread { background: #fbf9ff; }
.bell-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bell-title { font-weight: 650; font-size: .875rem; color: var(--text); }
.bell-item:not(.is-unread) .bell-title { font-weight: 550; color: var(--text-2); }
.bell-body { font-size: .82rem; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bell-time { font-size: .75rem; color: var(--muted); }
.bell-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 12px; color: var(--muted); font-size: .875rem; }
.push-cta {
    display: flex; align-items: center; gap: 10px; margin: 0 4px 6px; padding: 10px 12px; border-radius: 10px;
    background: var(--primary-soft); color: var(--text-2); font-size: .82rem;
}
.push-cta .icon { color: var(--primary); }
.push-note { margin: 0 8px 6px; font-size: .78rem; color: var(--muted); }

.user-panel { width: 280px; }
.user-card { display: flex; gap: 12px; align-items: center; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.user-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; align-items: flex-start; }

.push-banner { background: linear-gradient(90deg, var(--primary-soft), #fff1ea); border-bottom: 1px solid var(--border); }
.push-banner-inner {
    max-width: var(--page-max); margin: 0 auto; padding: 8px var(--space-5); display: flex; align-items: center; gap: 12px; font-size: .875rem;
}
.push-banner-inner > span { flex: 1; }
.push-banner-inner > .icon { color: var(--primary); }

/* ---------- alerts, banners, toasts ---------- */
.alert {
    display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius);
    font-size: .875rem; border: 1px solid transparent; margin-bottom: var(--space-3);
}
.alert .icon { margin-top: 1px; }
.alert-body { display: flex; flex-direction: column; gap: 2px; }
.alert-error { background: var(--danger-soft); color: #8e1c1c; border-color: #f5cdc9; }
.alert-info { background: #eef3fb; color: #23456e; border-color: #d6e2f3; }
.alert-success { background: var(--success-soft); color: #0f5a2b; border-color: #c4e8cf; }

.banner {
    display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-lg); margin-bottom: var(--space-5);
    border: 1px solid transparent;
}
.banner > div { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.banner .icon { margin-top: 2px; }
.banner-warn { background: var(--st-needs-bg); border-color: #f8cbb3; color: #7c2d0e; }
.banner-success { background: var(--success-soft); border-color: #c4e8cf; color: #0f5a2b; align-items: center; }
.banner-muted { background: var(--st-archived-bg); border-color: var(--border-strong); color: var(--text-2); }
.banner-note { background: rgba(255, 255, 255, .6); border-radius: 8px; padding: 8px 10px; color: var(--text); margin-top: 4px; }

.toast-region {
    position: fixed; z-index: 200; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px;
    width: min(380px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
    pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 8px 12px 14px;
    background: #1f1c19; color: #f5f3ef; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: pop .18s ease-out;
    font-size: .875rem;
}
.toast > .icon { margin-top: 2px; }
.toast-success > .icon { color: #6ee79a; }
.toast-error > .icon { color: #ff9b8a; }
.toast-info > .icon { color: #c4b5ff; }
.toast-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.toast-link { color: #c4b5ff; font-weight: 650; align-self: flex-start; }
.toast .icon-btn { color: #cfc9bf; }
.toast .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* ---------- modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(28, 24, 20, .45); animation: pop .12s ease-out; }
.modal {
    position: relative; width: 100%; max-height: calc(100vh - 32px); display: flex; flex-direction: column;
    background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); animation: pop .16s ease-out;
}
.modal:focus { outline: none; }
.modal-sm { max-width: 440px; }
.modal-md { max-width: 620px; }
.modal-lg { max-width: 980px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 1.05rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 18px; border-top: 1px solid var(--border); }

/* ---------- misc components ---------- */
.empty-state {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
    padding: var(--space-7) var(--space-4); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: rgba(255,255,255,.5);
}
.empty-state p { color: var(--muted); max-width: 420px; }
.empty-state .btn { margin-top: var(--space-2); }
.empty-icon {
    width: 56px; height: 56px; border-radius: 18px; display: flex; align-items: center; justify-content: center;
    background: var(--surface); color: var(--primary); box-shadow: var(--shadow); margin-bottom: 4px;
}

.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress-xs { height: 3px; margin-top: 4px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #8b6cff); border-radius: 99px; transition: width .2s ease; }
.overall-progress { display: flex; flex-direction: column; gap: 6px; margin: var(--space-3) 0; }

.spinner {
    display: inline-block; width: 22px; height: 22px; border-radius: 99px; flex: none;
    border: 3px solid var(--surface-3); border-top-color: var(--primary); animation: spin .7s linear infinite;
}

.skeleton-card { padding: var(--space-4); display: flex; flex-direction: column; gap: 10px; margin-bottom: var(--space-3); }
.skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 6px; height: 12px; }
.skel::after {
    content: ""; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent); animation: shimmer 1.3s infinite;
}
.skel-pill { width: 80px; height: 22px; border-radius: 99px; }
.skel-title { width: 60%; height: 20px; }
.skel-line { width: 90%; }
.skel-line.short { width: 45%; }
.skel-fill { display: block; width: 100%; height: 100%; border-radius: 0; }
.skel-fill.tall { height: 180px; border-radius: var(--radius); }

/* stepper */
.stepper { list-style: none; margin: var(--space-4) 0 0; padding: 0; display: flex; align-items: flex-start; }
.step { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.step::before {
    content: ""; position: absolute; top: 11px; right: 50%; width: 100%; height: 2px; background: var(--surface-3); z-index: 0;
}
.step:first-child::before { display: none; }
.step.is-done::before, .step.is-current::before { background: var(--primary); }
.step-dot {
    position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 99px; display: flex; align-items: center; justify-content: center;
    background: var(--surface); border: 2px solid var(--surface-3); color: #fff;
}
.step.is-done .step-dot { background: var(--primary); border-color: var(--primary); }
.step.is-current .step-dot { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.step.is-current .step-dot::after { content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--primary); }
.step.is-warn .step-dot { border-color: var(--st-needs); box-shadow: 0 0 0 4px var(--st-needs-bg); }
.step.is-warn .step-dot::after { background: var(--st-needs); }
.step.is-warn::before { background: var(--primary); }
.step.is-skipped .step-dot { width: 14px; height: 14px; margin: 5px 0; border-style: dashed; }
.step.is-skipped::before { background: var(--primary); }
.step.is-skipped .step-label { color: #aaa397; font-weight: 500; }
.step-label { font-size: .78rem; font-weight: 600; color: var(--muted); }
.step.is-done .step-label, .step.is-current .step-label { color: var(--text); }
.step.is-warn .step-label { color: var(--st-needs); }

/* tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 3px; background: var(--surface-2); border-radius: 12px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 0; border-radius: 9px;
    background: transparent; color: var(--text-2); font-weight: 600; font-size: .85rem; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab-count { font-size: .72rem; color: var(--muted); font-weight: 700; }
.tab.is-active .tab-count { color: var(--primary); }
.tabs-block { width: 100%; }
.tabs-block .tab { flex: 1; justify-content: center; }

/* ---------- feed ---------- */
.feed-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.feed-toolbar > * { min-width: 0; max-width: 100%; }
.feed-filters { display: flex; gap: var(--space-2); align-items: center; }
.feed-filters .select { width: 190px; }
.feed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-4); }
.feed-grid .skeleton-card { margin-bottom: 0; }

.inq-card {
    position: relative; display: flex; flex-direction: column; gap: 10px; padding: var(--space-4) var(--space-4) 14px;
    color: var(--text); transition: box-shadow .15s, transform .15s, border-color .15s;
}
.inq-card:hover { text-decoration: none; box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-1px); }
.inq-card.is-unread { border-color: #d7cdff; }
.inq-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.unread-dot { width: 10px; height: 10px; border-radius: 99px; background: var(--accent); box-shadow: 0 0 0 4px #ffe6dd; flex: none; }
.inq-card-title { font-size: 1.1rem; font-weight: 700; }
.inq-card-company { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: .85rem; font-weight: 550; margin-top: -4px; }
.inq-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inq-card-activity { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.activity-text { font-size: .875rem; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- detail ---------- */
.detail-header { padding: var(--space-5); margin-bottom: var(--space-4); }
.detail-header .skel { margin-bottom: 10px; }
.detail-title-row { display: flex; justify-content: space-between; gap: var(--space-4); align-items: flex-start; flex-wrap: wrap; }
.detail-title { min-width: 0; }
.detail-sub { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: .875rem; }
.company { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text-2); }
.detail-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.designer-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border);
}
.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 10px; }
.segmented button {
    min-height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; font-weight: 600; font-size: .82rem; color: var(--text-2);
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented button:last-child[aria-pressed="true"] { background: var(--pay-paid); color: #fff; }
.segmented button:first-child[aria-pressed="true"] { color: var(--pay-unpaid); }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
@media (min-width: 1100px) {
    .detail-layout { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
    .detail-side { position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 32px); overflow-y: auto; overscroll-behavior: contain; border-radius: var(--radius-lg); }
    .detail-side .section { margin-bottom: 0; }
    .detail-side .section-head { position: sticky; top: 0; background: var(--bg); z-index: 2; margin-bottom: 0; padding-bottom: var(--space-3); }
}
.activity-card { padding: var(--space-4); }

/* brief */
.cat-card { padding: var(--space-4) var(--space-5) var(--space-5); margin-bottom: var(--space-4); }
.cat-card.is-new { border-style: dashed; border-color: #cfc4ff; }
.cat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; margin-bottom: 6px; }
.cat-head h3 { font-size: 1.05rem; }
.cat-head-actions { display: flex; gap: 2px; }
.cat-desc { color: var(--text-2); }
.rich { line-height: 1.6; }
.rich a { text-decoration: underline; text-underline-offset: 2px; }
.file-link {
    display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; margin: 0 1px; border: 0; border-radius: 6px;
    background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: .92em; line-height: 1.6; text-decoration: none !important;
}
.file-link:hover { background: #ddd4ff; }
.cat-edit .field { margin-bottom: var(--space-3); }
.insert-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--space-3); }

.attach-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-4); margin-top: var(--space-4); }
.attach-group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; margin-bottom: 6px; }
.attach-group-head h4, .attach-group-head .h4 { display: flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: .04em; font-size: .75rem; color: var(--muted); }

.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 10px; }
.thumb { margin: 0; min-width: 0; }
.thumb-img {
    display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; background: var(--surface-2) repeating-conic-gradient(#ece9e3 0 25%, transparent 0 50%) 0 0 / 16px 16px;
}
.thumb-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.thumb-img:hover img { transform: scale(1.04); }
.thumb figcaption { display: flex; flex-direction: column; gap: 0; margin-top: 4px; }
.thumb-name { font-size: .75rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-actions { display: flex; align-items: center; margin-left: -6px; }

.file-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-row, .invoice-card {
    display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.invoice-card { padding: 12px 12px 12px 16px; }
.file-row.is-deleted { background: var(--surface-2); color: var(--muted); border-style: dashed; }
.file-row.is-deleted .file-row-name { text-decoration: line-through; color: var(--muted); }
.file-row.is-pending, .out-card.is-pending { opacity: .65; }
.file-row-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); display: flex; align-items: center; justify-content: center; flex: none; }
.file-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-row-name {
    display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 0; border: 0; background: none; text-align: left;
    font-weight: 600; font-size: .875rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
button.file-row-name:hover, a.file-row-name:hover { color: var(--primary); text-decoration: underline; }
.file-row-actions { display: flex; align-items: center; flex: none; }
.thread-btn {
    display: inline-flex; align-items: center; gap: 4px; min-height: 36px; min-width: 36px; padding: 0 8px; border: 0; border-radius: 8px;
    background: transparent; color: var(--muted); font-size: .78rem; font-weight: 650;
}
.thread-btn:hover { background: var(--surface-2); color: var(--text); }
.thread-btn.has-comments { color: var(--primary); }

/* outputs */
.out-cat { margin-bottom: var(--space-5); }
.out-cat-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 40px; margin-bottom: 8px; }
.out-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); }
.out-card { display: flex; flex-direction: column; overflow: hidden; }
.out-card:focus { outline: 3px solid var(--focus); }
.out-preview {
    display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; border-bottom: 1px solid var(--border); overflow: hidden;
    background: var(--surface-2) repeating-conic-gradient(#ece9e3 0 25%, transparent 0 50%) 0 0 / 18px 18px;
}
.out-preview img { width: 100%; height: 100%; object-fit: contain; }
.out-icon { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--muted); }
.out-body { padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.out-title-row { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; }
.out-name { flex: 1 1 120px; min-width: 0; font-weight: 650; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.version-select {
    appearance: none; min-height: 28px; padding: 0 24px 0 9px; border: 1px solid var(--border-strong); border-radius: 99px; background-color: var(--surface);
    font-size: .75rem; font-weight: 700; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23726c62' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 7px center;
}
.old-version { color: var(--warn); font-weight: 600; }
.out-actions { display: flex; align-items: center; gap: 4px; margin: 6px -4px 0; flex-wrap: wrap; }

.zip-panel {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 90; width: min(420px, calc(100vw - 32px));
    display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 12px; padding: 12px 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); font-size: .875rem;
}
.zip-panel .progress { grid-column: 1 / -1; }

/* comments */
.thread { display: flex; flex-direction: column; gap: var(--space-3); }
.thread-list { display: flex; flex-direction: column; gap: 4px; }
.thread-empty { font-size: .875rem; padding: 4px 0; }
.comment { display: flex; gap: 10px; padding: 8px; margin: 0 -8px; border-radius: var(--radius); scroll-margin: calc(var(--topbar-h) + 24px); }
.comment.is-target { animation: flash 2.5s ease-out; box-shadow: inset 3px 0 0 var(--primary); }
.comment.is-pending { opacity: .7; }
.comment-main { flex: 1; min-width: 0; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-height: 22px; }
.comment-meta strong { font-size: .875rem; }
.sending { color: var(--primary); font-style: italic; }
.comment-text { font-size: .9rem; color: var(--text); margin-top: 2px; }
.comment.kind-progress > .comment-main > .comment-text {
    background: #fff7f3; border: 1px solid #ffe1d4; border-radius: 10px; padding: 8px 10px; margin-top: 4px;
}
.comment-actions { display: flex; gap: 2px; margin: 2px 0 0 -6px; }
.comment-actions .btn { min-height: 30px; font-size: .75rem; color: var(--muted); }
.comment-actions .btn:hover { color: var(--primary); }
.comment-actions .btn.danger:hover { color: var(--danger); }
.replies { margin-top: 6px; padding-left: 12px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.replies .comment { margin: 0; }
.comment.kind-status { padding: 4px 8px; }
.comment-status { display: flex; gap: 10px; align-items: flex-start; width: 100%; }
.status-icon { width: 26px; height: 26px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); display: flex; align-items: center; justify-content: center; flex: none; margin-left: 5px; }
.comment-status-text { font-size: .82rem; color: var(--text-2); padding-top: 3px; }
.comment-status-text > span:first-child { font-weight: 600; color: var(--text); }

.progress-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.progress-file {
    width: 92px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface);
    display: flex; flex-direction: column; text-align: left;
}
.progress-file:hover { border-color: var(--primary); }
.progress-file img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.progress-file-icon { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; background: var(--surface-2); color: var(--muted); }
.progress-file-name { font-size: .68rem; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }

.composer { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 61, 245, .15); }
.composer-input { border: 0; box-shadow: none !important; min-height: 64px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.composer-input:focus { box-shadow: none; }
.composer.is-compact { margin-top: 6px; }
.composer.is-compact .composer-input { min-height: 52px; }
.composer-foot { display: flex; align-items: center; gap: 8px; padding: 4px 6px 6px 10px; flex-wrap: wrap; }
.composer-hint { font-size: .72rem; color: #a39d92; }

/* file dialog */
.file-dialog-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--space-5); }
.file-dialog-preview img {
    width: 100%; max-height: 60vh; object-fit: contain; border-radius: var(--radius);
    background: var(--surface-2) repeating-conic-gradient(#ece9e3 0 25%, transparent 0 50%) 0 0 / 18px 18px;
}
.file-dialog-icon { display: flex; align-items: center; justify-content: center; height: 220px; border-radius: var(--radius); background: var(--surface-2); color: var(--muted); }
.file-dialog-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: var(--space-3); }
.file-dialog-meta > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* uploads */
.upload-zone {
    display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: var(--space-5) var(--space-4);
    border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text-2); margin-bottom: var(--space-4);
}
.upload-zone:focus-visible { border-color: var(--primary); outline: none; }
.upload-zone > .icon { color: var(--primary); }
.upload-zone-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 8px; }

.file-pick { display: inline-flex; }
.file-pick label { cursor: pointer; }
.file-pick label.is-disabled { opacity: .55; pointer-events: none; }
.file-pick input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }

.add-link { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%; }
.add-link .input { flex: 1 1 160px; }
.add-link-actions { display: flex; gap: 4px; }
.add-link .field-error { width: 100%; }

.att-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.att-chip {
    display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.att-chip.is-failed { border-color: #f1c6c2; background: #fffafa; }
.att-chip.is-done { border-color: #c4e8cf; }
.att-thumb {
    width: 42px; height: 42px; border-radius: 8px; overflow: hidden; flex: none; background: var(--surface-2); color: var(--text-2);
    display: flex; align-items: center; justify-content: center;
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.att-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-meta { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-meta .ok { color: var(--success); display: inline-flex; align-items: center; gap: 3px; }
.att-meta .err { color: var(--danger); }
.att-actions { display: flex; flex: none; }

/* new inquiry */
.cat-drafts { display: flex; flex-direction: column; }
.cat-draft-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: var(--space-2); }
.cat-draft-head .subhead { margin: 0; }
.attach-drop {
    padding: var(--space-3); border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2);
    transition: border-color .15s, background .15s; min-width: 0;
}
.attach-drop.is-target { border-color: #b9a8ff; background: #f7f5ff; }
.attach-drop-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.drop-hint { font-size: .75rem; color: var(--muted); margin-top: 6px; }
.add-category-row { display: flex; justify-content: center; margin: var(--space-2) 0 var(--space-5); }
.submit-bar { position: sticky; bottom: 12px; padding: var(--space-3) var(--space-4); box-shadow: var(--shadow-lg); z-index: 10; }
.submit-bar .overall-progress { margin-top: 0; }
.submit-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* workspaces */
.org-list { display: flex; flex-direction: column; gap: var(--space-3); }
.org-panel { overflow: hidden; }
.org-toggle {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border: 0; background: transparent; text-align: left;
}
.org-toggle:hover { background: #fcfbf9; }
.org-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; }
.org-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chevron { transition: transform .15s; color: var(--muted); }
.org-panel.is-open .chevron { transform: rotate(180deg); }
.org-body { padding: 0 16px 16px; border-top: 1px solid var(--border); }
.org-toolbar { display: flex; gap: 4px; justify-content: flex-end; padding: 8px 0; }
.org-body > .inline-form { padding: 10px 0; }
.org-section { padding: var(--space-3) 0; }
.org-section + .org-section { border-top: 1px solid var(--border); }
.org-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; margin-bottom: 6px; }
.member-list, .invite-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.member-row, .invite-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); flex-wrap: wrap; }
.member-text, .invite-text { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.invite-row.is-expired, .invite-row.is-revoked { background: var(--surface-2); }
.invite-code { font-size: .82rem; color: var(--text-2); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .file-dialog-grid { grid-template-columns: 1fr; }
    .feed-toolbar { flex-direction: column; align-items: stretch; }
    .feed-filters { flex-wrap: wrap; }
    .search { flex: 1; }
    .search .input { width: 100%; }
}

@media (max-width: 640px) {
    body { font-size: 14.5px; }
    h1 { font-size: 1.45rem; }
    .page { padding: var(--space-4) var(--space-3) var(--space-7); }
    .topbar-inner { padding: 0 var(--space-3); gap: var(--space-2); }
    .topnav-label, .hide-sm, .logo-word { display: none; }
    .topnav-link { padding: 0 10px; }
    .topbar-new { padding: 0 10px; }
    .push-banner-inner { padding: 8px var(--space-3); flex-wrap: wrap; }
    .form-grid { grid-template-columns: 1fr; }
    .form-card, .detail-header { padding: var(--space-4); }
    .cat-card { padding: var(--space-3) var(--space-4) var(--space-4); }
    .feed-grid { grid-template-columns: 1fr; }
    .feed-filters .select { width: 100%; flex: 1 1 100%; }
    .out-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); }
    .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
    .attach-groups { grid-template-columns: 1fr; }
    .step-label { font-size: .68rem; }
    .auth-card { padding: var(--space-5) var(--space-4); border-radius: var(--radius-lg); }
    .auth-top { padding: var(--space-3); }
    .modal-root { padding: 0; align-items: flex-end; }
    .modal { max-height: 92vh; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
    .modal-body { padding: 14px 16px; }
    .modal-head { padding: 12px 10px 10px 16px; }
    .modal-foot { padding: 10px 16px 14px; }
    .bell-panel { position: fixed; left: 12px; right: 12px; top: calc(var(--topbar-h) + 4px); width: auto; }
    .inline-form { flex-wrap: wrap; }
    .submit-actions .muted { width: 100%; }
    .submit-bar { position: static; box-shadow: var(--shadow-sm); }
    .toast-region { right: 12px; left: 12px; width: auto; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- workspace switcher ---------- */
.ws-switch { flex: none; }
.ws-btn { max-width: 220px; }
.ws-btn-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-panel { min-width: 260px; max-width: min(320px, calc(100vw - 24px)); }
.ws-item { align-items: center; }
.ws-item-text { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.ws-item-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }
.ws-roles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.ws-roles .role-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- unread indicators ---------- */
.unread-dot-sm { width: 7px; height: 7px; box-shadow: 0 0 0 2px #ffe6dd; }
.inq-card-title.is-unread, .thumb-name.is-unread, .out-name.is-unread { font-weight: 800; color: var(--text); }
.thread-btn.is-unread { position: relative; color: var(--accent); font-weight: 700; }
.thread-btn.is-unread .unread-dot { position: absolute; top: -2px; right: -2px; }
.thumb.is-unread .thumb-img, .out-card.is-unread { border-color: #d7cdff; box-shadow: 0 0 0 2px #efeaff; }
.file-row.is-unread .file-row-name { font-weight: 750; }
.comment.is-unread { background: #fbf9ff; border-radius: 10px; }

.new-separator { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.new-separator::before, .new-separator::after { content: ""; flex: 1; height: 1px; background: #f3c9b8; }
.new-pill {
    display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 99px;
    background: #ffe6dd; color: #9a3412; font-size: .68rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
}

/* ---------- image markup ---------- */
.comment-markup { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.comment-markup-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.comment-markup-thumb { padding: 0; border: 0; background: transparent; display: block; max-width: 320px; cursor: zoom-in; }
.markup-thumb { max-width: 320px; width: 100%; border-radius: 10px; border: 1px solid var(--border); display: block; }
.markup-dialog .modal-body, .markup-view .modal-body { display: flex; flex-direction: column; gap: 10px; }
.center-inline { display: flex; align-items: center; gap: 8px; justify-content: center; padding: var(--space-4); }

/* ---------- danger zone / workspaces ---------- */
.danger-zone .section-head h2 { color: var(--danger); }
.danger-card { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4); border-color: #f1c6c2; flex-wrap: wrap; }
.danger-card > div { flex: 1; min-width: 220px; }
.org-section-block { margin-top: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.org-panel.is-readonly .org-head { padding: var(--space-4); display: flex; align-items: center; gap: 10px; }
.org-panel.is-readonly .org-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }

/* ---------- busy buttons ---------- */
.btn.is-busy { cursor: progress; }
.btn.is-busy:disabled { opacity: .8; }
.btn-ghost .spinner, .btn-secondary .spinner, .btn-link .spinner, .btn-danger-ghost .spinner { border-color: var(--surface-3); border-top-color: currentColor; }
.btn-danger-ghost .spinner { border-top-color: var(--danger); }
.btn-google { position: relative; }
.btn-xs .spinner { width: 14px; height: 14px; }

/* ---------- roles / workspaces ---------- */
.role-owner { background: #fff0ea; color: #b43d12; }
.role-client { background: var(--surface-2); color: var(--text-2); }
.org-chips { display: flex; gap: 4px; flex: none; }
.member-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.invite-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.org-danger { padding-bottom: 0; }
.danger-title { color: var(--danger); }
.org-body .danger-card { box-shadow: none; }
.lose-list { list-style: none; margin: 6px 0 var(--space-4); padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.lose-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-size: .875rem; }
.lose-list li > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.delete-lose { margin-top: var(--space-3); font-weight: 600; }
.delete-progress { justify-content: flex-start; padding: var(--space-3) 0; }

/* ---------- bell: workspace items ---------- */
.bell-kind { flex: none; width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-2); }
.bell-item.is-info { cursor: default; }

/* ---------- country picker ---------- */
.cpick { position: relative; min-width: 0; }
.cpick-btn { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; cursor: pointer; }
.cpick-btn:disabled { cursor: not-allowed; }
.cpick-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpick-chevron { color: var(--muted); }
.cpick-flag { font-size: 1.1rem; line-height: 1; flex: none; }
.cpick-panel {
    position: absolute; left: 0; top: calc(100% + 6px); z-index: 61; width: 320px; max-width: calc(100vw - 32px);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    padding: 8px; animation: pop .12s ease-out;
}
.cpick-search .input { width: 100%; }
.cpick-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: min(300px, 50vh); overflow-y: auto; overscroll-behavior: contain; }
.cpick-opt { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 8px; border-radius: 8px; cursor: pointer; font-size: .875rem; }
.cpick-opt.is-active { background: var(--primary-soft); }
.cpick-opt.is-selected .cpick-name { font-weight: 700; color: var(--primary); }
.cpick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpick-code { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .8rem; }
.cpick-clear .cpick-name { color: var(--muted); font-style: italic; }
.cpick-empty { padding: 12px 8px; color: var(--muted); font-size: .85rem; }
.cpick-dial { flex: 0 0 118px; }

/* ---------- profile form / onboarding ---------- */
.phone-row { display: flex; gap: 8px; align-items: stretch; }
.phone-row > .input { flex: 1 1 auto; min-width: 0; }
.form-grid-2 { grid-template-columns: 1fr 1fr; margin-bottom: var(--space-4); }
.form-intro { margin: -6px 0 var(--space-3); }
.input[readonly] { background: var(--surface-2); color: var(--text-2); }
.profile-actions { flex-wrap: wrap; margin-bottom: var(--space-5); }
.onboarding-screen { min-height: 100vh; display: flex; justify-content: center; padding: var(--space-6) var(--space-4) var(--space-7); }
.onboarding-inner { width: 100%; max-width: 720px; }
.onboarding-head { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-5); }
.onboarding-head h1:focus { outline: none; }

@media (max-width: 640px) {
    .form-grid-2 { grid-template-columns: 1fr; }
    .onboarding-screen { padding: var(--space-4) var(--space-3) var(--space-6); }
    .profile-actions { flex-direction: column-reverse; align-items: stretch; }
    .profile-actions .btn { width: 100%; }
    .cpick-dial { flex-basis: 104px; }
    .org-toggle { padding: 12px; gap: 10px; }
    .invite-actions .btn { flex: 1 1 140px; }
    .danger-card .btn { width: 100%; }
}
