:root {
  --font-heading: 'Inter'; --font-body: 'Lato';
  --navy: #12253D; --navy-600: #1E3A5C; --navy-900: #0B1828;
  --ivory: #F2F4F6; --silver: #BEBEBE;
  --wood: #8B6B47; --wood-dark: #6C5235; --wood-light: #C9A77C;
  --text: #4A5563; --success: #1F6B43; --danger: #9B2F25; --warning: #73500F;
  --hair: rgba(18, 37, 61, 0.08);
  --shadow: 0 24px 48px -28px rgba(18, 37, 61, 0.28);
  --ease: cubic-bezier(.2, .6, .2, 1);
}
* { box-sizing: border-box; border-radius: 0; }
html { overflow-x: hidden; }
html, body { margin: 0; max-width: 100%; background: var(--ivory); color: var(--navy); font-family: var(--font-body), Lato, sans-serif; font-size: 15px; }
body { overflow-x: clip; }
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--wood-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--wood); outline-offset: 2px; }
h1, h2, h3, .h { font-family: var(--font-heading), Inter, sans-serif; }
b.h { font-weight: 600; }

.header { position: sticky; top: 0; z-index: 20; height: 72px; display: flex; align-items: center; gap: 24px; padding: 0 40px; background: var(--ivory); border-bottom: 1px solid var(--hair); }
.logo img { height: 28px; width: auto; display: block; }
.nav { display: flex; gap: 4px; flex: 1; justify-content: center; min-width: 0; }
.nav a, .more-btn { height: 44px; padding: 0 16px; display: flex; align-items: center; gap: 6px; font-family: var(--font-heading); font-size: 14px; font-weight: 600; color: var(--navy); white-space: nowrap; border: 0; background: transparent; cursor: pointer; transition: background .2s var(--ease), color .2s var(--ease); }
.nav a:hover, .more-btn:hover { background: var(--hair); color: var(--navy); }
.nav a.on { background: var(--navy); color: #fff; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; cursor: pointer; color: var(--navy); flex: none; }
.avatar { background: var(--wood); color: #fff; font-family: var(--font-heading); font-weight: 700; font-size: 14px; }
.menu { position: absolute; top: 52px; min-width: 240px; background: #fff; border: 1px solid var(--hair); box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; z-index: 30; }
.menu a, .menu button { height: 44px; padding: 0 14px; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; text-align: left; cursor: pointer; font-size: 14px; color: var(--navy); width: 100%; }
.menu a:hover, .menu button:hover { background: var(--hair); }
.menu .who { padding: 10px 14px 12px; border-bottom: 1px solid var(--hair); margin-bottom: 4px; }

.main { max-width: 1440px; margin: 0 auto; padding: 40px; display: flex; flex-direction: column; gap: 32px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.page-head > div:first-child { flex: 1 1 320px; min-width: 0; }
.eyebrow { font-family: var(--font-heading); font-size: 12px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: var(--wood-dark); }
.page-head h1 { margin: 10px 0 6px; font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.sub { color: var(--text); line-height: 1.5; text-wrap: pretty; }
.muted { font-size: 13px; color: var(--text); }
.tools { display: flex; gap: 12px; flex-wrap: wrap; flex: 0 1 700px; align-items: center; }
.field { height: 48px; padding: 0 16px; border: 1px solid var(--hair); background: rgba(255, 255, 255, .78); min-width: 0; }
.period-wrap { display: flex; align-items: center; gap: 10px; flex: 1 1 180px; }
.period-wrap select { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; outline: 0; cursor: pointer; font-family: var(--font-heading); font-weight: 600; font-size: 14px; }
.search-form { flex: 2 1 200px; display: flex; min-width: 0; }
.search { display: flex; align-items: center; gap: 10px; width: 100%; }
.search input { flex: 1; min-width: 0; height: 44px; border: 0; outline: 0; background: transparent; }

.btn { height: 48px; padding: 0 24px; border: 0; background: var(--navy); color: #fff; font-family: var(--font-heading); font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; transition: background .2s var(--ease), color .2s var(--ease); }
.btn:hover { background: var(--navy-600); color: #fff; }
.btn:active { background: var(--navy-900); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid rgba(18, 37, 61, .2); }
.btn.ghost:hover { background: var(--navy); color: #fff; }
.btn.sm { height: 44px; padding: 0 14px; font-size: 13px; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs a { height: 44px; padding: 0 20px; display: flex; align-items: center; font-family: var(--font-heading); font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, .72); border: 1px solid var(--hair); }
.tabs a.on { background: var(--navy); color: #fff; border-color: var(--navy); }

.card { background: rgba(255, 255, 255, .72); border: 1px solid rgba(255, 255, 255, .9); box-shadow: var(--shadow); min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.kpi { padding: 24px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.kpi .l { font-family: var(--font-heading); font-size: 13px; font-weight: 500; color: var(--text); }
.kpi .v { font-family: var(--font-heading); font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v .short { display: none; }
.kpi .n { font-size: 13px; line-height: 1.4; color: var(--text); }
.up { color: var(--success) !important; }
.down { color: var(--danger) !important; }

.row { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.row > .grow { flex: 2 1 560px; min-width: 0; }
.row > .side { flex: 1 1 300px; min-width: 0; }
.panel-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 24px 24px 12px; }
.panel-title h2 { margin: 0; font-size: 18px; font-weight: 700; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; padding: 12px 24px; font-family: var(--font-heading); font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--text); border-bottom: 1px solid var(--hair); }
.t td { padding: 14px 24px; border-bottom: 1px solid rgba(18, 37, 61, .06); vertical-align: middle; overflow-wrap: anywhere; }
.t .s { font-size: 12px; color: var(--text); margin-top: 2px; }
.t tr.total td { font-weight: 700; font-family: var(--font-heading); }
.t .num { text-align: right; white-space: nowrap; }
.badge { display: inline-block; padding: 5px 12px; font-family: var(--font-heading); font-size: 12px; font-weight: 600; background: var(--hair); color: var(--navy); white-space: nowrap; }
.badge.success { background: rgba(31, 107, 67, .1); color: var(--success); }
.badge.danger { background: rgba(155, 47, 37, .1); color: var(--danger); }
.badge.warning { background: rgba(115, 80, 15, .1); color: var(--warning); }
.badge.navy { background: var(--navy); color: #fff; }
.empty { padding: 40px 24px; text-align: center; color: var(--text); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.side-list { padding: 4px 24px 24px; display: flex; flex-direction: column; }
.side-item { padding: 14px 0; border-top: 1px solid var(--hair); display: flex; flex-direction: column; gap: 8px; }
.side-item .top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.side-item .top b { font-family: var(--font-heading); white-space: nowrap; }
.bar { height: 6px; background: var(--hair); }
.bar > i { display: block; height: 100%; background: var(--navy); }

.hero { background: var(--navy); color: #fff; padding: 28px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.hero .big { font-family: var(--font-heading); font-size: 40px; font-weight: 700; letter-spacing: -.02em; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--silver); flex-wrap: wrap; }
.legend i { display: inline-block; width: 16px; height: 2px; margin-right: 8px; vertical-align: middle; }
.chart { width: 100%; height: 240px; display: block; }
.chart-x { display: flex; justify-content: space-between; gap: 4px; font-size: 12px; color: var(--silver); margin-top: 8px; }
.donut-card { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.donut { width: 168px; height: 168px; border-radius: 50%; position: relative; align-self: center; flex: none; }
.donut::after { content: ''; position: absolute; inset: 26px; border-radius: 50%; background: #fff; }
.donut span { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; font-family: var(--font-heading); font-weight: 700; font-size: 16px; line-height: 1.3; text-align: center; padding: 0 30px; }
.key { display: flex; flex-direction: column; gap: 10px; }
.key div { display: flex; align-items: center; gap: 10px; font-size: 13px; min-width: 0; }
.key div span:nth-child(2) { flex: 1; min-width: 0; }
.dot { width: 10px; height: 10px; flex: none; }

.kanban { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; align-items: start; }
.stage { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stage-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 4px 4px; }
.lead { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 20px; }
.listing { display: flex; flex-direction: column; }
.ph { height: 168px; margin: 8px 8px 0; background: repeating-linear-gradient(135deg, #DADDE1 0 10px, #E9ECEF 10px 20px); position: relative; }
.ph .badge { position: absolute; top: 12px; left: 12px; }
.listing .body { padding: 20px 24px 16px; display: flex; flex-direction: column; gap: 6px; }
.listing .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 24px 20px; border-top: 1px solid var(--hair); }
.task { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 8px 24px; border-top: 1px solid var(--hair); }
.task .txt { flex: 1; min-width: 0; }
.task.done .txt div:first-child { text-decoration: line-through; color: var(--text); }
.notice { padding: 20px 24px; }

.users { display: flex; flex-direction: column; }
.user-row { padding: 16px 24px; border-top: 1px solid var(--hair); display: flex; flex-direction: column; gap: 10px; }
.user-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.user-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 8px; }
.perm { display: flex; align-items: center; gap: 12px; padding: 0 12px; min-height: 48px; border: 1px solid var(--hair); background: #fff; }
.perm span { flex: 1; font-family: var(--font-heading); font-weight: 600; font-size: 14px; }
.perm label { display: flex; align-items: center; gap: 6px; font-size: 13px; min-height: 44px; cursor: pointer; }

.scrim { position: fixed; inset: 0; background: rgba(18, 37, 61, .56); display: grid; place-items: center; padding: 16px; z-index: 50; }
.dialog { background: #fff; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.dialog.wide { max-width: 760px; }
.dialog h2 { margin: 0; font-size: 22px; }
.form-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-family: var(--font-heading); font-weight: 500; border: 0; padding: 0; margin: 0; }
.form-field input, .form-field select, .form-field textarea { height: 48px; padding: 0 14px; border: 1px solid var(--silver); background: #fff; font-family: var(--font-body); font-size: 15px; font-weight: 400; width: 100%; }
.form-field textarea { height: auto; padding: 12px 14px; }
.form-field input[type=file] { padding: 10px 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border: 1px solid var(--hair); font-family: var(--font-body); font-weight: 400; font-size: 14px; cursor: pointer; }
.dialog-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.error { color: var(--danger); font-size: 14px; }
.ok { color: var(--success); font-size: 14px; }
.mobile-sheet { display: flex; flex-direction: column; }
.mobile-sheet a { height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 8px; border-bottom: 1px solid var(--hair); font-family: var(--font-heading); font-weight: 600; }
.bottom-bar { display: none; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; background: #fff; padding: 48px 40px; display: flex; flex-direction: column; gap: 28px; box-shadow: var(--shadow); }
.login-card img { width: 140px; height: auto; }
.login-card h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.login-card .btn { width: 100%; }
.loading { padding: 40px 0; color: var(--text); }
[data-lucide], svg.lucide { flex: none; }
.chart-svg { width: 100%; height: 240px; display: block; }
@media (max-width: 699px) { .chart-svg { height: 180px; } }

@media (max-width: 1199px) {
  .header { padding: 0 28px; }
  .main { padding: 28px; gap: 24px; }
  .page-head h1 { font-size: 32px; }
  .tools { flex: 1 1 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .v { font-size: 26px; }
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 899px) {
  .nav { display: none; }
  .header { justify-content: space-between; }
  .main { padding-bottom: 104px; }
  .bottom-bar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; height: 68px; background: #fff; border-top: 1px solid var(--hair); }
  .bottom-bar a, .bottom-bar button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-family: var(--font-heading); font-weight: 600; border: 0; background: transparent; color: var(--text); cursor: pointer; }
  .bottom-bar .on { color: var(--navy); box-shadow: inset 0 2px 0 var(--navy); }
}
@media (max-width: 699px) {
  .header { padding: 0 16px; height: 64px; }
  .main { padding: 16px 16px 104px; gap: 16px; }
  .page-head h1 { font-size: 26px; }
  .tools .btn { flex: 1 1 100%; }
  .kpis { gap: 12px; }
  .kpi { padding: 16px 14px; }
  .kpi .v { font-size: 18px; }
  .kpi .v .full { display: none; }
  .kpi .v .short { display: inline; }
  .kanban { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 20px; }
  .hero .big { font-size: 28px; }
  .chart { height: 180px; }
  .panel-title { padding: 16px; }
  .side-list { padding: 4px 16px 16px; }
  .user-row, .task { padding-left: 16px; padding-right: 16px; }
  table.t thead { display: none; }
  table.t, .t tbody, .t tr, .t td { display: block; width: 100%; }
  .t tr { padding: 12px 16px; border-bottom: 1px solid var(--hair); }
  .t td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border: 0; text-align: right; }
  .t td::before { content: attr(data-label); flex: none; text-align: left; font-family: var(--font-heading); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text); }
  .t td > * { min-width: 0; }
  .t .num { white-space: normal; }
  .dialog { padding: 20px; }
  .login-card { padding: 36px 24px; }
}


/* ---------- motion and loading ---------- */
@keyframes hq-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes hq-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hq-pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes hq-shimmer { from { background-position: -600px 0; } to { background-position: 600px 0; } }
.main:not(.settled) > * { animation: hq-in .36s var(--ease) both; }
.main:not(.settled) > *:nth-child(2) { animation-delay: .04s; }
.main:not(.settled) > *:nth-child(3) { animation-delay: .08s; }
.main:not(.settled) > *:nth-child(4) { animation-delay: .12s; }
.main:not(.settled) > *:nth-child(n+5) { animation-delay: .16s; }
.main:not(.settled) .kpis > .kpi { animation: hq-in .36s var(--ease) both; }
.main:not(.settled) .kpis > .kpi:nth-child(2) { animation-delay: .06s; }
.main:not(.settled) .kpis > .kpi:nth-child(3) { animation-delay: .1s; }
.main:not(.settled) .kpis > .kpi:nth-child(4) { animation-delay: .14s; }
.scrim { animation: hq-fade .18s ease both; }
.dialog { animation: hq-in .24s var(--ease) both; }
.menu { animation: hq-in .16s var(--ease) both; }
.sk { display: block; background: linear-gradient(90deg, rgba(18,37,61,.06) 0, rgba(18,37,61,.12) 50%, rgba(18,37,61,.06) 100%); background-size: 1200px 100%; animation: hq-shimmer 1.3s linear infinite; }
.sk-line { height: 12px; margin: 6px 0; }
.sk-title { height: 36px; width: min(420px, 80%); margin: 12px 0 10px; }
.sk-row { height: 44px; margin: 0 24px; border-bottom: 1px solid var(--hair); display: flex; align-items: center; gap: 24px; }
.sk-row .sk { height: 12px; flex: 1; }
.reveal { clip-path: inset(0 100% 0 0); transition: clip-path .9s var(--ease); }
.reveal.in { clip-path: inset(0 0 0 0); }
.donut.lazy { opacity: 0; }
.donut.in { animation: hq-pop .5s var(--ease) both; }
.bar > i { transition: width .7s var(--ease); }
.t tbody tr { transition: background .15s var(--ease); }
.t tbody tr:hover { background: rgba(18, 37, 61, .03); }
.card.listing, .card.lead { transition: border-color .2s var(--ease); }
.card.listing:hover, .card.lead:hover { border-color: var(--navy); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 70; max-width: min(420px, calc(100vw - 32px)); background: #fff; border-left: 4px solid var(--silver); box-shadow: var(--shadow); padding: 14px 18px; font-size: 14px; color: var(--navy); animation: hq-in .22s var(--ease) both; }
.toast.err { border-left-color: var(--danger); }
.topbar { position: sticky; top: 0; z-index: 20; }
.topbar .header { position: relative; }
.viewas { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 40px; background: var(--wood); color: #fff; font-size: 14px; }
.viewas b { font-family: var(--font-heading); }
.viewas .btn { background: #fff; color: var(--navy); }
.viewas .btn:hover { background: var(--ivory); color: var(--navy); }
@media (max-width: 1199px) { .viewas { padding: 8px 28px; } }
@media (max-width: 899px) { .toast { bottom: 84px; } }
@media (max-width: 699px) { .viewas { padding: 8px 16px; } .toast { left: 16px; right: 16px; max-width: none; } .sk-row { margin: 0 16px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { clip-path: none; }
  .donut.lazy { opacity: 1; }
}

.gbtn { width: 100%; height: 52px; display: flex; align-items: center; justify-content: center; gap: 12px; background: #fff; color: #1F1F1F; border: 1px solid #747775; font-family: var(--font-heading); font-size: 15px; font-weight: 500; cursor: pointer; transition: background .2s var(--ease), border-color .2s var(--ease); }
.gbtn:hover { background: #F8F9FA; border-color: var(--navy); }
.gbtn:active { background: #F1F3F4; }
.gbtn:disabled { opacity: .7; cursor: default; }

.error:empty, .ok:empty { display: none; }

/* ---------- charts v2 ---------- */
.kpi .v, .t .num, .hero .big, .donut-center .dv, .key2 .ka, .key2 .kp, .side-item .top b, .hero-stats b { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.chart2 { position: relative; width: 100%; min-height: 200px; }
.chart2-svg { display: block; overflow: visible; }
.chart2 .ax { font-family: var(--font-heading); font-size: 11px; font-weight: 500; fill: rgba(255,255,255,0.5); }
.chart2 .area.fade { animation: hq-fade 1.2s ease .3s both; }
.chart-tip { position: absolute; top: 0; left: 0; min-width: 200px; padding: 12px 14px; background: #fff; color: var(--navy); box-shadow: 0 18px 40px -18px rgba(0,0,0,.45); pointer-events: none; opacity: 0; transition: opacity .15s var(--ease), left .12s var(--ease); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.chart-tip .tt { font-family: var(--font-heading); font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.chart-tip .tr { display: flex; align-items: center; gap: 8px; }
.chart-tip .tr span:nth-child(2) { flex: 1; color: var(--text); }
.chart-tip .tr b { font-family: var(--font-heading); font-variant-numeric: tabular-nums; }
.chart-tip .net { border-top: 1px solid var(--hair); padding-top: 6px; margin-top: 2px; }
.donut2 { position: relative; width: 200px; height: 200px; align-self: center; flex: none; }
.donut-svg { display: block; }
.donut-svg .arc { transition: stroke-dasharray .8s cubic-bezier(.2,.6,.2,1), opacity .2s var(--ease); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; pointer-events: none; }
.donut-center .dv { font-family: var(--font-heading); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; color: var(--navy); }
.donut-center .dl { font-size: 12px; color: var(--text); }
.key2 { display: flex; flex-direction: column; }
.key-row { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 4px; border-top: 1px solid var(--hair); font-size: 13px; cursor: default; transition: background .15s var(--ease); }
.key-row:first-child { border-top: 0; }
.key-row:hover { background: rgba(18,37,61,.03); }
.key-row .kl { flex: 1; min-width: 0; }
.key-row .ka { color: var(--text); white-space: nowrap; }
.key-row .kp { font-family: var(--font-heading); width: 44px; text-align: right; }
.hero-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.hero .lbl { font-family: var(--font-heading); font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: #BEBEBE; }
.hero .big { font-size: 44px; line-height: 1.05; margin-top: 10px; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.hero .tag { font-family: var(--font-heading); font-size: 12px; font-weight: 600; letter-spacing: .02em; padding: 5px 10px; background: rgba(255,255,255,.1); color: #fff; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); }
.hero-stats > div { padding: 14px 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hero-stats > div + div { padding-left: 20px; border-left: 1px solid rgba(255,255,255,.1); }
.hero-stats span { font-size: 12px; color: #BEBEBE; }
.hero-stats b { font-family: var(--font-heading); font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend i { width: 10px; height: 10px; }
@media (max-width: 699px) { .hero .big { font-size: 30px; } .hero-stats b { font-size: 14px; } .hero-stats > div + div { padding-left: 12px; } .chart-tip { min-width: 170px; } }

/* ---------- v2: drawer, threads, calendar, teams, leads ---------- */
@keyframes hq-slide { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.drawer-scrim { place-items: stretch end; padding: 0; }
.drawer { width: min(600px, 100vw); height: 100vh; height: 100dvh; background: #fff; overflow-y: auto; display: flex; flex-direction: column; animation: hq-slide .28s var(--ease) both; }
.drawer-head { position: sticky; top: 0; z-index: 2; background: #fff; padding: 20px 24px 16px; border-bottom: 1px solid var(--hair); display: flex; flex-direction: column; gap: 12px; }
.drawer-head .row1 { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-head h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.drawer-body { padding: 20px 24px 32px; display: flex; flex-direction: column; gap: 24px; }
.drawer-sec h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); border-top: 1px solid var(--hair); border-left: 1px solid var(--hair); }
.facts > div { background: #fff; border-right: 1px solid var(--hair); border-bottom: 1px solid var(--hair); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.facts span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text); font-family: var(--font-heading); }
.facts b { font-family: var(--font-heading); font-size: 14px; overflow-wrap: anywhere; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(120px, 100%), 1fr)); gap: 8px; }
.quick button, .quick a { height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid rgba(18,37,61,.18); background: #fff; font-family: var(--font-heading); font-size: 13px; font-weight: 600; color: var(--navy); cursor: pointer; transition: background .2s var(--ease), color .2s var(--ease); }
.quick button:hover, .quick a:hover, .quick .on { background: var(--navy); color: #fff; }
.logform { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--ivory); }
.logform .two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 12px; }
.timeline { display: flex; flex-direction: column; }
.tl { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--hair); }
.tl:first-child { border-top: 0; }
.tl-ic { width: 32px; height: 32px; flex: none; display: grid; place-items: center; background: var(--ivory); color: var(--navy); }
.tl-ic.call { background: rgba(31,107,67,.1); color: var(--success); }
.tl-ic.whatsapp { background: rgba(31,107,67,.1); color: #1F6B43; }
.tl-ic.email { background: rgba(62,92,128,.12); color: #3E5C80; }
.tl-ic.viewing, .tl-ic.meeting { background: rgba(139,107,71,.14); color: var(--wood-dark); }
.tl-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.tl-b .meta { font-size: 12px; color: var(--text); }
.av { width: 32px; height: 32px; flex: none; display: inline-grid; place-items: center; background: var(--navy); color: #fff; font-family: var(--font-heading); font-weight: 700; font-size: 12px; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.thread-list { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg-b { flex: 1; min-width: 0; }
.msg-h { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.msg-h b { font-family: var(--font-heading); }
.msg-h span { color: var(--text); font-size: 12px; }
.msg-t { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.msg-ref { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 4px 10px; background: var(--ivory); font-size: 12px; font-family: var(--font-heading); font-weight: 600; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--silver); resize: vertical; font-family: var(--font-body); font-size: 14px; background: #fff; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select { height: 44px; padding: 0 12px; border: 1px solid var(--hair); background: rgba(255,255,255,.78); font-family: var(--font-heading); font-size: 13px; font-weight: 600; color: var(--navy); min-width: 0; max-width: 100%; }
.stagebar { display: flex; height: 12px; background: var(--hair); overflow: hidden; }
.stagebar i { display: block; height: 100%; transition: flex-grow .6s var(--ease); }
.stagekey { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.stagekey span { display: inline-flex; align-items: center; gap: 6px; }
.kanban.v2 { grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
.lead { cursor: pointer; }
.lead .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.lead .meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text); }
.lead .due { color: var(--danger); font-weight: 600; }
.pri { display: inline-block; width: 8px; height: 8px; flex: none; margin-top: 6px; }
.pri.hot { background: var(--danger); } .pri.warm { background: var(--wood); } .pri.cold { background: var(--silver); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--hair); border-left: 1px solid var(--hair); }
.day { border-right: 1px solid var(--hair); border-bottom: 1px solid var(--hair); background: rgba(255,255,255,.86); min-height: 220px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.day.today { background: #fff; box-shadow: inset 0 3px 0 var(--navy); }
.day-h { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--font-heading); font-size: 12px; font-weight: 600; color: var(--text); }
.day-h b { font-size: 18px; color: var(--navy); }
.ev { text-align: left; border: 0; border-left: 3px solid var(--navy); background: rgba(18,37,61,.05); padding: 8px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; font-size: 12px; min-width: 0; transition: background .15s var(--ease); }
.ev:hover { background: rgba(18,37,61,.1); }
.ev b { font-family: var(--font-heading); font-size: 13px; overflow-wrap: anywhere; }
.ev .loc { color: var(--text); overflow-wrap: anywhere; }
.ev.viewing, .ev.site_visit { border-left-color: var(--wood); background: rgba(139,107,71,.08); }
.ev.call { border-left-color: #3E5C80; }
.ev.leave, .ev.office { border-left-color: var(--silver); }
.ev.done { opacity: .55; } .ev.cancelled { opacity: .45; text-decoration: line-through; }
.weeknav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.weeknav .btn { white-space: nowrap; }
.chat { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 24px; align-items: start; }
.chat-list { display: flex; flex-direction: column; }
.chat-list a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--hair); min-height: 56px; }
.chat-list a.on { background: var(--navy); color: #fff; }
.chat-list a.on .muted { color: var(--silver); }
.chat-pane { display: flex; flex-direction: column; min-height: 520px; }
.chat-msgs { flex: 1; padding: 16px 24px; display: flex; flex-direction: column; gap: 16px; max-height: 60vh; overflow-y: auto; }
.chat-compose { border-top: 1px solid var(--hair); padding: 16px 24px; display: flex; flex-direction: column; gap: 10px; }
.chat-compose .bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chat-compose .bar select { height: 44px; padding: 0 10px; border: 1px solid var(--hair); background: #fff; font-size: 13px; min-width: 0; flex: 1 1 180px; }
@media (max-width: 1199px) { .week { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 899px) { .chat { grid-template-columns: minmax(0, 1fr); } .chat-msgs { max-height: none; } }
@media (max-width: 699px) { .week { grid-template-columns: minmax(0, 1fr); } .day { min-height: 0; } .drawer-head, .drawer-body { padding-left: 16px; padding-right: 16px; } .chat-msgs, .chat-compose { padding-left: 16px; padding-right: 16px; } }

.linkish { border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.linkish:hover .h { text-decoration: underline; }

.check { width: 28px; height: 28px; flex: none; border: 1.5px solid var(--navy); background: #fff; display: grid; place-items: center; cursor: pointer; color: #fff; padding: 0; transition: background .15s var(--ease); }
.check:hover { background: rgba(18,37,61,.08); }
.check.on { background: var(--navy); }
.task { min-height: 64px; }
