/* ======================================================
   UKIPO Clearance Platform — full design system v2
   ====================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: 'Inter Tight', system-ui, sans-serif; font-size: 13px; line-height: 1.5; color: #1a1815; background: #faf9f6; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: #c8102e; text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea { font-family: inherit; }

.app { display: grid; grid-template-rows: auto 1fr; height: 100vh; overflow: hidden; }
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 0; overflow: hidden; }
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: #1a1815; color: #cfc8bb; padding: 14px 12px; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding-bottom: 16px; margin-bottom: 14px; border-bottom: 1px solid #2a2722; }
.brand-logo { width: 36px; height: 36px; border-radius: 8px; background: #c8102e; display: flex; align-items: center; justify-content: center; font-family: 'Fraunces', serif; font-size: 20px; font-weight: 600; color: #fff; flex-shrink: 0; }
.brand-text { font-family: 'Fraunces', serif; font-size: 14px; font-weight: 500; line-height: 1.15; color: #fff; }
.brand-text em { display: block; font-style: italic; color: #a89f8e; font-size: 10.5px; margin-top: 2px; }

.nav-section-title { font-size: 9.5px; color: #6b6660; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; margin: 12px 0 6px; padding: 0 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px; color: #d8d3c5; font-size: 12.5px; font-weight: 500; margin-bottom: 1px; border: none; background: transparent; width: 100%; text-align: left; transition: background 0.15s, color 0.15s; }
.nav-item:hover { background: #2a2722; color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(200,16,46,.16), rgba(200,16,46,.04)); color: #fff; position: relative; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: #c8102e; }
.nav-item .ic { width: 15px; height: 15px; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: #c8102e; color: #fff; font-size: 9.5px; font-weight: 600; padding: 1px 6px; border-radius: 999px; min-width: 18px; text-align: center; }
.nav-item.active .nav-badge { background: rgba(255,255,255,0.25); }

.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid #2a2722; font-size: 12px; color: #6b6660; }
.sidebar-user { padding: 8px 12px; }
.sidebar-user-name { color: #d8d3c5; font-weight: 500; font-size: 12.5px; }
.sidebar-user-email { color: #6b6660; font-size: 10.5px; margin-top: 2px; word-break: break-all; }
.logout-btn { background: transparent; border: 1px solid #2a2722; color: #a89f8e; padding: 6px 10px; border-radius: 5px; font-size: 11px; font-weight: 500; margin-top: 8px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.logout-btn:hover { color: #fff; border-color: #6b6660; }

.main { padding: 24px 30px 64px; max-width: 1480px; min-width: 0; overflow-y: auto; height: 100%; }
.page-title { font-family: 'Fraunces', serif; font-size: 26px; font-weight: 500; line-height: 1.15; margin: 0 0 3px; letter-spacing: -0.015em; }
.page-subtitle { color: #6b6660; font-size: 12.5px; margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px; font-size: 12.5px; font-weight: 500; border: 1px solid transparent; transition: all 0.15s; line-height: 1.2; white-space: nowrap; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #1a1815; color: #fff; border-color: #1a1815; }
.btn-primary:hover:not(:disabled) { background: #2a2722; }
.btn-danger { background: #c8102e; color: #fff; border-color: #c8102e; }
.btn-danger:hover:not(:disabled) { background: #a30d24; }
.btn-ghost { background: #fff; color: #1a1815; border-color: #d8d3c5; }
.btn-ghost:hover { border-color: #1a1815; }
.btn-link { background: transparent; color: #c8102e; border: none; padding: 7px 4px; text-decoration: underline; }
.btn-sm { padding: 4px 10px; font-size: 11.5px; }
.btn-lg { padding: 11px 20px; font-size: 13.5px; font-weight: 600; }

.card { background: #fff; border: 1px solid #e8e3d8; border-radius: 13px; padding: 17px 19px; margin-bottom: 13px; box-shadow: 0 1px 2px rgba(26,24,21,.04), 0 1px 3px rgba(26,24,21,.06); transition: box-shadow .18s, border-color .18s; }
.card:hover { box-shadow: 0 1px 3px rgba(26,24,21,.05), 0 4px 12px rgba(26,24,21,.06); }

/* ===== TOP BAR ===== */
.topbar { display: flex; align-items: center; gap: 14px; height: 56px; padding: 0 18px 0 16px; background: rgba(253,252,248,.85); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid #e8e3d8; position: relative; z-index: 40; }
.tb-brand { display: flex; align-items: center; gap: 10px; width: 220px; flex-shrink: 0; }
.tb-logo { width: 30px; height: 30px; border-radius: 8px; background: #c8102e; display: flex; align-items: center; justify-content: center; font-family: 'Fraunces', serif; font-size: 17px; font-weight: 600; color: #fff; box-shadow: 0 2px 6px rgba(200,16,46,.3); }
.tb-name { font-family: 'Fraunces', serif; font-size: 14px; font-weight: 600; color: #1a1815; letter-spacing: -.01em; line-height: 1; }
.tb-name em { display: block; font-style: normal; color: #a89f8e; font-size: 9.5px; font-weight: 500; margin-top: 2px; letter-spacing: .02em; }
.tb-search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 12px; background: #fff; border: 1px solid #e8e3d8; border-radius: 9px; color: #a89f8e; font-size: 12.5px; transition: .15s; cursor: text; }
.tb-search:hover { border-color: #d2ccbe; }
.tb-search .ic { width: 15px; height: 15px; flex-shrink: 0; }
.tb-kbd { margin-left: auto; display: flex; gap: 3px; }
.kbd { font-family: 'JetBrains Mono', monospace; font-size: 10px; background: #faf9f6; border: 1px solid #e8e3d8; border-radius: 4px; padding: 1px 5px; color: #6b6660; line-height: 1.4; }
.tb-spacer { flex: 1; }
.tb-actions { display: flex; align-items: center; gap: 4px; }
.tb-ico { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #6b6660; transition: .15s; position: relative; background: transparent; border: none; }
.tb-ico:hover { background: #faf9f6; color: #1a1815; }
.tb-ico .ic { width: 17px; height: 17px; }
.tb-dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: #c8102e; border: 1.5px solid #fdfcf8; }
.tb-user { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 9px; transition: .15s; margin-left: 4px; background: transparent; border: none; cursor: pointer; }
.tb-user:hover { background: #faf9f6; }
.tb-ua { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #c8102e, #7a0a1c); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; }
.tb-un { font-size: 12px; font-weight: 600; line-height: 1.1; color: #1a1815; }
.tb-ur { font-size: 10px; color: #a89f8e; }

.menu { position: absolute; top: 50px; right: 14px; width: 300px; background: #fff; border: 1px solid #e8e3d8; border-radius: 12px; box-shadow: 0 4px 16px rgba(26,24,21,.08), 0 12px 32px rgba(26,24,21,.10); z-index: 60; overflow: hidden; animation: pop .14s ease; }
.menu.user { width: 240px; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.menu-h { padding: 12px 15px; border-bottom: 1px solid #efece4; display: flex; align-items: center; justify-content: space-between; }
.menu-h b { font-size: 12.5px; }
.menu-h a { font-size: 11px; color: #c8102e; }
.menu-i { display: flex; gap: 11px; padding: 11px 15px; border-bottom: 1px solid #efece4; transition: .12s; cursor: pointer; width: 100%; text-align: left; align-items: flex-start; background: transparent; border-left: none; border-right: none; border-top: none; }
.menu-i:last-child { border-bottom: 0; }
.menu-i:hover { background: #fdfcf8; }
.menu-i .mdot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.menu-row { display: flex; align-items: center; gap: 10px; padding: 10px 15px; width: 100%; text-align: left; font-size: 12.5px; transition: .12s; background: transparent; border: none; cursor: pointer; }
.menu-row:hover { background: #fdfcf8; }
.menu-row .ic { width: 15px; height: 15px; color: #6b6660; }

/* ===== COMMAND PALETTE ===== */
.cmd-bg { position: fixed; inset: 0; background: rgba(26,24,21,.34); backdrop-filter: blur(3px); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; animation: fade .12s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.cmd { width: 100%; max-width: 580px; background: #fff; border-radius: 15px; box-shadow: 0 4px 16px rgba(26,24,21,.08), 0 12px 32px rgba(26,24,21,.10); overflow: hidden; animation: pop .16s ease; }
.cmd-in { display: flex; align-items: center; gap: 11px; padding: 16px 18px; border-bottom: 1px solid #efece4; }
.cmd-in .ic { width: 18px; height: 18px; color: #a89f8e; flex-shrink: 0; }
.cmd-in input { flex: 1; border: 0; outline: 0; font-size: 15px; background: transparent; }
.cmd-in input::placeholder { color: #a89f8e; }
.cmd-list { max-height: 52vh; overflow-y: auto; padding: 7px; }
.cmd-sec { font-size: 9.5px; color: #a89f8e; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; padding: 9px 11px 4px; }
.cmd-i { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; cursor: pointer; font-size: 13px; color: #1a1815; }
.cmd-i .ci-ic { width: 28px; height: 28px; border-radius: 7px; background: #faf9f6; display: flex; align-items: center; justify-content: center; color: #6b6660; flex-shrink: 0; }
.cmd-i .ci-ic .ic { width: 15px; height: 15px; }
.cmd-i.sel { background: #1a1815; color: #fff; }
.cmd-i.sel .ci-ic { background: rgba(255,255,255,.16); color: #fff; }
.cmd-i .ci-sub { margin-left: auto; font-size: 10.5px; color: #a89f8e; }
.cmd-i.sel .ci-sub { color: #cfc8bb; }
.cmd-f { display: flex; gap: 14px; padding: 8px 16px; border-top: 1px solid #efece4; font-size: 10.5px; color: #a89f8e; }
.cmd-f span { display: flex; align-items: center; gap: 4px; }
@media (max-width: 1100px) { .shell { grid-template-columns: 1fr; } .sidebar { display: none; } .tb-search { max-width: none; } .tb-un, .tb-ur { display: none; } }
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.card-title { font-family: 'Fraunces', serif; font-size: 15px; font-weight: 500; margin: 0; }
.card-tag { font-size: 10px; color: #c8102e; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }

.field { margin-bottom: 12px; }
.field-row { display: grid; gap: 12px; margin-bottom: 12px; }
.field-row.cols-2 { grid-template-columns: 1fr 1fr; }
.field-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.field-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
@media (max-width: 700px) { .field-row.cols-2, .field-row.cols-3, .field-row.cols-4 { grid-template-columns: 1fr; } }
.field label { display: block; font-size: 10.5px; color: #6b6660; margin-bottom: 4px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; padding: 8px 11px; border: 1px solid #d8d3c5; border-radius: 6px; background: #fdfcf8; font-family: inherit; font-size: 13px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: #1a1815; }
.field textarea { resize: vertical; min-height: 60px; }
.field-hint { font-size: 10.5px; color: #a89f8e; margin-top: 3px; }

.alert { padding: 11px 14px; border-radius: 6px; font-size: 12.5px; margin-bottom: 12px; line-height: 1.5; }
.alert-info { background: #f0ede2; color: #4a4338; border-left: 3px solid #8b7c5a; }
.alert-warn { background: #faedd0; color: #5a3a08; border-left: 3px solid #c98a2a; }
.alert-error { background: #f9ebe6; color: #6b1f1f; border-left: 3px solid #c8102e; }
.alert-success { background: #e8f0db; color: #2d4a14; border-left: 3px solid #5b8c3e; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 500; }
.class-pill { background: #efece4; color: #4a4338; padding: 3px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 500; margin-right: 3px; display: inline-block; }
.risk-pill { display: inline-block; padding: 3px 9px; border-radius: 5px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; }
.risk-Low { background: #e8f0db; color: #2d4a14; }
.risk-Medium { background: #faedd0; color: #5a3a08; }
.risk-High { background: #f5d9d9; color: #c8102e; }
.status-pill { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 10px; font-weight: 500; }
.status-draft { background: #efece4; color: #6b6660; }
.status-completed, .status-paid { background: #e8f0db; color: #2d4a14; }
.status-sent { background: #faedd0; color: #5a3a08; }
.status-overdue { background: #fae1d6; color: #8b3a1f; }

.stage-pill { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 10px; font-weight: 500; }
.stage-Pre { background: #f5f1e6; color: #4a4338; }
.stage-Filed { background: #e8f0db; color: #2d4a14; }
.stage-Exam { background: #faedd0; color: #5a3a08; }
.stage-Opposition { background: #fae1d6; color: #8b3a1f; }
.stage-Registered { background: #e8f0db; color: #2d4a14; }
.stage-Closed { background: #efece4; color: #6b6660; }

.alert-new { background: #fae1d6; color: #8b3a1f; }
.alert-reviewing { background: #faedd0; color: #5a3a08; }
.alert-cleared { background: #e8f0db; color: #2d4a14; }
.alert-dismissed { background: #efece4; color: #6b6660; }

.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; }
.spinner-lg { width: 24px; height: 24px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 800px) { .login-shell { grid-template-columns: 1fr; } }
.login-art { background: linear-gradient(135deg, #1a1815 0%, #2a2722 100%); padding: 60px 50px; display: flex; flex-direction: column; justify-content: space-between; color: #d8d3c5; }
.login-art-brand { display: flex; align-items: center; gap: 12px; }
.login-art-brand .brand-logo { width: 48px; height: 48px; font-size: 28px; }
.login-art-brand-text { font-family: 'Fraunces', serif; font-size: 18px; color: #fff; }
.login-art-headline { font-family: 'Fraunces', serif; font-size: 34px; line-height: 1.15; color: #fff; max-width: 460px; margin: 50px 0 14px; }
.login-art-sub { font-size: 14px; color: #a89f8e; max-width: 460px; line-height: 1.6; }
.login-art-feature { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; font-size: 12.5px; color: #d8d3c5; }
.login-art-feature::before { content: "▸"; color: #c8102e; font-weight: 600; flex-shrink: 0; }
.login-art-footer { font-size: 11px; color: #6b6660; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-form { width: 100%; max-width: 380px; }
.login-form-title { font-family: 'Fraunces', serif; font-size: 28px; margin: 0 0 5px; }
.login-form-sub { color: #6b6660; font-size: 12.5px; margin: 0 0 22px; }
.tab-toggle { display: inline-flex; background: #efece4; padding: 3px; border-radius: 7px; margin-bottom: 18px; }
.tab-toggle button { border: 0; background: transparent; padding: 6px 14px; font-size: 11.5px; font-weight: 500; color: #6b6660; border-radius: 5px; }
.tab-toggle button.active { background: #1a1815; color: #fff; }

.kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 18px; }
@media (max-width: 1200px) { .kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: #fff; border: 1px solid #e8e3d8; border-radius: 8px; padding: 13px 14px; min-height: 86px; display: flex; flex-direction: column; justify-content: space-between; }
.kpi.accent { background: linear-gradient(135deg, #1a1815 0%, #2a2722 100%); color: #fff; border-color: #1a1815; }
.kpi.accent .kpi-label { color: #a89f8e; }
.kpi.accent .kpi-val { color: #fff; }
.kpi-label { font-size: 10px; color: #6b6660; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; margin-bottom: 6px; line-height: 1.3; }
.kpi-val { font-family: 'Fraunces', serif; font-size: 24px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-val small { font-size: 13px; color: #6b6660; font-family: 'Inter Tight', sans-serif; font-weight: 500; }
.kpi.accent .kpi-val small { color: #a89f8e; }
.kpi-trend { font-size: 10.5px; margin-top: 6px; }
.kpi-up { color: #2d6e2d; }
.kpi-down { color: #c8102e; }

.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
@media (max-width: 1200px) { .dash-grid { grid-template-columns: 1fr; } }
.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1000px) { .section-grid { grid-template-columns: 1fr; } }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card { background: #fff; border: 1px solid #e8e3d8; border-radius: 10px; padding: 18px 20px; position: relative; }
.stat-card.accent::before { content: ""; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: #c8102e; border-radius: 4px 0 0 4px; }
.stat-card-label { font-size: 11px; color: #6b6660; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; margin-bottom: 8px; }
.stat-card-value { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-card-delta { font-size: 11px; color: #6b6660; margin-top: 6px; }

.deadline-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid #efece4; }
.deadline-row:last-child { border-bottom: 0; }
.deadline-date { background: #fdfcf8; border: 1px solid #e8e3d8; border-radius: 6px; padding: 5px 4px; text-align: center; font-family: 'Fraunces', serif; }
.deadline-date.urgent { background: #fdf3f4; border-color: #f5d9d9; }
.deadline-date.overdue { background: #f5d9d9; border-color: #c8102e; }
.deadline-day { font-size: 16px; font-weight: 500; line-height: 1; }
.deadline-date.urgent .deadline-day, .deadline-date.overdue .deadline-day { color: #c8102e; }
.deadline-mon { font-size: 9px; color: #6b6660; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }
.deadline-title { font-size: 12.5px; font-weight: 500; line-height: 1.3; }
.deadline-meta { font-size: 10.5px; color: #6b6660; margin-top: 2px; }
.dt-pill { font-size: 9.5px; padding: 2px 7px; border-radius: 3px; font-weight: 500; letter-spacing: 0.02em; }
.dt-Opposition { background: #fae1d6; color: #8b3a1f; }
.dt-Renewal { background: #faedd0; color: #5a3a08; }
.dt-Response { background: #f5d9d9; color: #c8102e; }
.dt-Filing { background: #e8f0db; color: #2d4a14; }
.dt-Other { background: #efece4; color: #6b6660; }
.dt-Meeting { background: #f0ede2; color: #4a4338; }

.activity-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid #efece4; }
.activity-item:last-child { border-bottom: 0; }
.activity-avatar { width: 26px; height: 26px; border-radius: 50%; background: #c8102e; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; flex-shrink: 0; }
.activity-text { font-size: 11.5px; line-height: 1.45; }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 10px; color: #a89f8e; margin-top: 2px; }

.heatmap { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; }
.heat-cell { aspect-ratio: 1; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 9.5px; font-weight: 500; cursor: pointer; }
.heat-0 { background: #f5f1e6; color: #a89f8e; }
.heat-1 { background: #f8dfd3; color: #1a1815; }
.heat-2 { background: #f0bba9; color: #1a1815; }
.heat-3 { background: #e08770; color: #fff; }
.heat-4 { background: #c8102e; color: #fff; }
.heat-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 10px; color: #6b6660; }
.heat-legend-cell { width: 14px; height: 14px; border-radius: 2px; }

.status-bar { display: flex; margin: 8px 0 14px; border-radius: 6px; overflow: hidden; height: 8px; }
.sb-Pre { background: #4a4338; }
.sb-Filed { background: #5b8c3e; }
.sb-Exam { background: #c98a2a; }
.sb-Opposition { background: #c8102e; }
.sb-Registered { background: #1a1815; }
.sb-Closed { background: #a89f8e; }
.status-legend { display: grid; grid-template-columns: repeat(2,1fr); gap: 4px 16px; font-size: 11px; }
.status-leg-row { display: flex; align-items: center; gap: 6px; }
.status-leg-dot { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.status-leg-count { margin-left: auto; font-weight: 500; color: #6b6660; font-variant-numeric: tabular-nums; }

.avatar { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: #fff; flex-shrink: 0; }
.client-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #efece4; font-size: 12px; }
.client-row:last-child { border-bottom: 0; }
.client-name { font-weight: 500; }
.client-meta { font-size: 10.5px; color: #6b6660; }
.client-rev { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #4a4338; }

.watch-alert-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid #efece4; font-size: 12px; }
.watch-alert-row:last-child { border-bottom: 0; }
.watch-alert-mark { font-weight: 500; }
.watch-alert-meta { font-size: 10.5px; color: #6b6660; margin-top: 1px; }

.fee-row { display: grid; grid-template-columns: 1fr 100px 70px; gap: 10px; align-items: center; font-size: 11.5px; padding: 5px 0; }
.fee-bar { height: 6px; background: #efece4; border-radius: 3px; overflow: hidden; }
.fee-fill { height: 100%; background: #c8102e; border-radius: 3px; }
.fee-val { font-variant-numeric: tabular-nums; color: #6b6660; text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 11px; }

.hbar-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 12px; }
.hbar-label { width: 70px; flex-shrink: 0; font-weight: 500; }
.hbar-track { flex: 1; height: 8px; background: #efece4; border-radius: 4px; overflow: hidden; }
.hbar-fill { height: 100%; background: #c8102e; border-radius: 4px; }
.hbar-value { width: 30px; text-align: right; font-variant-numeric: tabular-nums; color: #6b6660; }

.tabs { display: inline-flex; background: #efece4; padding: 2px; border-radius: 6px; gap: 1px; }
.tabs button { border: 0; background: transparent; padding: 4px 11px; font-size: 11px; font-weight: 500; color: #6b6660; border-radius: 4px; }
.tabs button.active { background: #fff; color: #1a1815; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }

.search-pill { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #d8d3c5; border-radius: 999px; padding: 7px 14px; font-size: 12px; color: #6b6660; min-width: 240px; }
.search-pill input { border: none; background: transparent; padding: 0; flex: 1; min-width: 0; font-size: 12px; }
.search-pill input:focus { outline: 0; }

.urgent-alert { background: #fdf3f4; border-left: 3px solid #c8102e; padding: 11px 14px; border-radius: 0 6px 6px 0; font-size: 12.5px; margin-bottom: 8px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.urgent-alert.warn { background: #fdf6e8; border-color: #c98a2a; }
.urgent-alert strong { font-weight: 600; }

.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font-weight: 500; padding: 10px 10px 10px 0; border-bottom: 2px solid #1a1815; color: #1a1815; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.tbl td { padding: 11px 10px 11px 0; border-bottom: 1px solid #efece4; vertical-align: top; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: #fdfcf8; }
.tbl-empty { padding: 40px; text-align: center; color: #a89f8e; font-style: italic; }
.tm-num { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #4a4338; }

.builder-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.builder-section { background: #fff; border: 1px solid #e8e3d8; border-radius: 10px; padding: 20px 22px; margin-bottom: 14px; }
.builder-section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.builder-section-title { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 500; margin: 0; }
.builder-section-num { font-size: 10.5px; color: #a89f8e; letter-spacing: 0.1em; text-transform: uppercase; }
.conflict-row { background: #fdfcf8; border: 1px solid #e8e3d8; border-radius: 8px; padding: 14px; margin-bottom: 10px; position: relative; }
.conflict-row .remove-btn { position: absolute; top: 8px; right: 8px; background: transparent; border: 0; color: #a89f8e; padding: 4px 6px; font-size: 18px; line-height: 1; border-radius: 4px; }
.conflict-row .remove-btn:hover { background: #f9ebe6; color: #c8102e; }
.empty-state { text-align: center; color: #a89f8e; font-style: italic; padding: 24px; font-size: 12.5px; }

.line-item { display: grid; grid-template-columns: 1fr 70px 90px 90px 30px; gap: 8px; padding: 5px 0; border-bottom: 1px solid #efece4; font-size: 12px; align-items: center; }
.line-item input { padding: 6px 8px; font-size: 12px; border: 1px solid transparent; background: transparent; border-radius: 4px; }
.line-item input:focus { background: #fdfcf8; border-color: #d8d3c5; }
.line-item .lin-rm { background: transparent; border: 0; color: #a89f8e; padding: 2px 6px; font-size: 16px; border-radius: 3px; }
.line-item .lin-rm:hover { background: #f9ebe6; color: #c8102e; }
.invoice-total-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.invoice-total-row.grand { border-top: 2px solid #1a1815; padding-top: 10px; margin-top: 8px; font-weight: 600; font-family: 'Fraunces', serif; font-size: 17px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.42); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 12px; max-width: 640px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 24px 26px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.modal-title { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 500; margin: 0; }
.modal-close { background: transparent; border: 0; font-size: 22px; color: #a89f8e; cursor: pointer; padding: 0 6px; line-height: 1; }
.modal-close:hover { color: #1a1815; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding-top: 14px; margin-top: 18px; border-top: 1px solid #efece4; }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.doc-card { background: #fff; border: 1px solid #e8e3d8; border-radius: 8px; padding: 14px; cursor: pointer; transition: border-color 0.15s; }
.doc-card:hover { border-color: #1a1815; }
.doc-icon { width: 36px; height: 44px; background: #fdf3f4; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #c8102e; font-size: 10px; font-weight: 600; margin-bottom: 8px; }
.doc-title { font-size: 12.5px; font-weight: 500; line-height: 1.3; margin-bottom: 3px; }
.doc-meta { font-size: 10.5px; color: #6b6660; }

.comment-item { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid #efece4; }
.comment-item:last-child { border-bottom: 0; }
.comment-head { font-size: 11px; color: #6b6660; margin-bottom: 3px; }
.comment-head strong { color: #1a1815; font-weight: 600; }
.comment-body { font-size: 12.5px; line-height: 1.5; }

.template-chip { display: inline-block; padding: 5px 11px; border-radius: 6px; font-size: 11px; font-weight: 500; border: 1px solid #d8d3c5; background: #fff; color: #6b6660; cursor: pointer; margin-right: 6px; transition: all 0.15s; }
.template-chip:hover { border-color: #1a1815; color: #1a1815; }
.template-chip.active { background: #1a1815; color: #fff; border-color: #1a1815; }

.signature-block { background: #fdfcf8; border: 1px dashed #c8102e; border-radius: 8px; padding: 16px 18px; margin-top: 10px; }
.signature-block.signed { background: #f0ede2; border-style: solid; border-color: #5b8c3e; }
.signature-name { font-family: 'Fraunces', serif; font-size: 22px; font-style: italic; color: #1a1815; }
.signature-meta { font-size: 11px; color: #6b6660; margin-top: 6px; }

/* ===== SURFACE CHOOSER ===== */
.surface-card{text-align:left;background:#fff;border:1px solid #e8e3d8;border-radius:15px;padding:22px;cursor:pointer;transition:transform .16s,box-shadow .16s,border-color .16s;box-shadow:0 1px 2px rgba(26,24,21,.04),0 1px 3px rgba(26,24,21,.06);display:flex;flex-direction:column}
.surface-card:hover{transform:translateY(-3px);box-shadow:0 4px 16px rgba(26,24,21,.08),0 12px 32px rgba(26,24,21,.10);border-color:#d8d0c0}
.surface-ic{width:44px;height:44px;border-radius:11px;color:#fff;display:flex;align-items:center;justify-content:center;margin-bottom:14px}
.surface-ic .ic{width:22px;height:22px}
.surface-go{margin-top:14px;color:#c8102e;font-weight:600;font-size:12.5px}

/* ===== CLIENT PORTAL ===== */
.cp-shell{min-height:100vh;background:#faf9f6;display:flex;flex-direction:column}
.cp-top{height:60px;background:#fff;border-bottom:1px solid #e8e3d8;display:flex;align-items:center;gap:16px;padding:0 26px;position:sticky;top:0;z-index:30}
.cp-logo{width:32px;height:32px;border-radius:8px;background:#c8102e;color:#fff;display:flex;align-items:center;justify-content:center;font-family:'Fraunces',serif;font-size:18px;font-weight:600}
.cp-brand{font-family:'Fraunces',serif;font-size:15px;font-weight:600;letter-spacing:-.01em}
.cp-brand em{display:block;font-style:normal;font-size:10px;color:#a89f8e;font-weight:500;margin-top:1px}
.cp-nav{display:flex;gap:2px;margin-left:18px}
.cp-nav button{padding:8px 14px;border-radius:8px;font-size:12.5px;font-weight:500;color:#6b6660;transition:.15s;background:transparent;border:none;cursor:pointer}
.cp-nav button:hover{background:#faf9f6;color:#1a1815}
.cp-nav button.on{background:#1a1815;color:#fff;font-weight:600}
.cp-user{margin-left:auto;display:flex;align-items:center;gap:12px}
.cp-uava{width:34px;height:34px;border-radius:50%;background:linear-gradient(135deg,#c8102e,#7a0a1c);color:#fff;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:600}
.cp-main{flex:1;max-width:1080px;width:100%;margin:0 auto;padding:30px 26px 70px}
.cp-h1{font-family:'Fraunces',serif;font-size:28px;font-weight:600;letter-spacing:-.02em;margin:0 0 4px}
.cp-sub{color:#6b6660;font-size:13.5px;margin:0 0 24px}
.cp-grid{display:grid;gap:14px}
.cp-stat{background:#fff;border:1px solid #e8e3d8;border-radius:13px;padding:17px 18px;box-shadow:0 1px 2px rgba(26,24,21,.04);transition:transform .15s,box-shadow .15s}
.cp-stat:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(26,24,21,.06)}
.cp-stat .l{font-size:10px;color:#6b6660;text-transform:uppercase;letter-spacing:.07em;font-weight:600;margin-bottom:8px}
.cp-stat .v{font-family:'Fraunces',serif;font-size:26px;font-weight:600;line-height:1;font-variant-numeric:tabular-nums}
.cp-stat .t{font-size:11px;color:#6b6660;margin-top:6px}
.cp-card{background:#fff;border:1px solid #e8e3d8;border-radius:14px;padding:20px 22px;box-shadow:0 1px 2px rgba(26,24,21,.04);margin-bottom:16px}
.cp-card-h{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;gap:12px}
.cp-card-t{font-family:'Fraunces',serif;font-size:16px;font-weight:600;margin:0}
.cp-row{display:flex;align-items:center;gap:13px;padding:13px 0;border-bottom:1px solid #efece4}
.cp-row:last-child{border-bottom:0}
.cp-pill{display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:999px;font-size:10.5px;font-weight:600}
.cp-prog{height:6px;background:#efece4;border-radius:3px;overflow:hidden;margin-top:7px}
.cp-prog span{display:block;height:100%;border-radius:3px;background:#c8102e}
.cp-empty{text-align:center;color:#a89f8e;padding:34px 18px;font-size:13px}
.cp-empty b{display:block;color:#1a1815;font-weight:600;margin-bottom:4px}
.cp-btn{display:inline-flex;align-items:center;gap:6px;padding:8px 15px;border-radius:9px;font-size:12.5px;font-weight:600;border:1px solid transparent;transition:.15s;cursor:pointer}
.cp-btn-p{background:#c8102e;color:#fff;box-shadow:0 1px 3px rgba(200,16,46,.25)}
.cp-btn-p:hover{background:#a30d25}
.cp-btn-g{background:#fff;color:#1a1815;border-color:#e8e3d8}
.cp-btn-g:hover{border-color:#c8c0b0}
.cp-login{min-height:100vh;display:grid;grid-template-columns:1fr 1fr}
.cp-login-art{background:linear-gradient(150deg,#1a1815,#2a1418);color:#fff;padding:54px 50px;display:flex;flex-direction:column;justify-content:center}
.cp-login-form{display:flex;align-items:center;justify-content:center;padding:40px}
@media (max-width:860px){.cp-login{grid-template-columns:1fr}.cp-login-art{display:none}.cp-nav{display:none}}

/* ===== PORTAL: notifications bell ===== */
.cp-bell { position: relative; width: 38px; height: 38px; border-radius: 9px; border: 1px solid #e8e3d8; background: #fff; color: #4a4338; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: .15s; }
.cp-bell:hover { background: #faf9f6; border-color: #d2ccbe; }
.cp-bell .ic { width: 17px; height: 17px; }
.cp-bell-dot { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: #c8102e; color: #fff; font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.cp-notif { position: absolute; top: 46px; right: 0; width: 320px; max-height: 420px; overflow-y: auto; background: #fff; border: 1px solid #e8e3d8; border-radius: 12px; box-shadow: 0 4px 16px rgba(26,24,21,.10), 0 12px 32px rgba(26,24,21,.12); z-index: 60; animation: pop .14s ease; }
.cp-notif-h { padding: 12px 15px; border-bottom: 1px solid #efece4; font-size: 12.5px; font-weight: 700; position: sticky; top: 0; background: #fff; }
.cp-notif-i { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 11px 15px; border: none; border-bottom: 1px solid #efece4; background: transparent; cursor: pointer; transition: .12s; }
.cp-notif-i:last-child { border-bottom: 0; }
.cp-notif-i:hover { background: #fdfcf8; }
