/* Crystal Shield Hub — navy & white, amber accent (from the brochure) */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --hover: #f2f5fa;
  --line: rgba(20, 28, 47, 0.08);
  --line-2: rgba(20, 28, 47, 0.15);
  --text: #141c2f;
  --muted: #5b6478;
  --faint: #8b93a5;
  --navy: #00386b;
  --navy-2: #002a52;
  --navy-3: #001c38;
  --blue: #0069b7;
  --sky: #3da4e4;
  --amber: #fdb13e;
  --accent: #00386b;
  --accent-soft: rgba(0, 105, 183, 0.09);
  --green: #17703f; --green-bg: #e3f5ea;
  --orange: #a35400; --orange-bg: #fff2df;
  --red: #b42318; --red-bg: #fdecec;
  --blue-t: #0b5aa6; --blue-bg: #e6f0fb;
  --violet: #5b3fc4; --violet-bg: #efebfd;
  --grey: #4c5466; --grey-bg: #edf0f5;
  --amber-bg: #fff6e6;
  --shadow-sm: 0 1px 2px rgba(0, 28, 56, 0.06);
  --shadow: 0 24px 60px -28px rgba(0, 28, 56, 0.32);
  --radius: 14px;
  --font-display: "Poppins", system-ui, sans-serif;
  --font-sans: "Inter", system-ui, sans-serif;
  --sidebar: 252px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font-sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 25px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--text); width: 100%; padding: 9px 12px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--navy); }
input[type="color"] { padding: 2px; height: 38px; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 105, 183, .14); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.spacer { flex: 1; }
.icon { flex-shrink: 0; }
.nowrap { white-space: nowrap; }
.num, .r { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.strong { font-weight: 600; }
.green { color: var(--green); } .red { color: var(--red); } .orange { color: var(--orange); } .blue { color: var(--blue); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.hidden { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px;
  border-radius: 10px; border: 1px solid transparent; font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--navy); color: #fff; box-shadow: 0 6px 16px -10px rgba(0, 56, 107, .9); }
.btn.primary:hover:not(:disabled) { background: var(--navy-2); }
.btn.amber { background: var(--amber); color: #2b1a00; }
.btn.amber:hover:not(:disabled) { filter: brightness(1.04); }
.btn.ghost { background: var(--surface); border-color: var(--line-2); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); }
.btn.success { background: #1f9d55; color: #fff; }
.btn.success:hover:not(:disabled) { background: #188a49; }
.btn.wa { background: #25d366; color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--red); }
.btn.danger-ghost:hover { background: var(--red-bg); }
.btn.small { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.big { height: 50px; font-size: 16px; border-radius: 13px; padding: 0 22px; }
.btn.block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); flex-shrink: 0; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.small { width: 28px; height: 28px; }
.link { color: var(--blue); font-weight: 500; }
.link:hover { text-decoration: underline; }
.link-btn { all: unset; cursor: pointer; color: var(--blue); font-weight: 500; }
.link-btn:hover { text-decoration: underline; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.tone-grey { background: var(--grey-bg); color: var(--grey); }
.tone-blue { background: var(--blue-bg); color: var(--blue-t); }
.tone-violet { background: var(--violet-bg); color: var(--violet); }
.tone-orange { background: var(--orange-bg); color: var(--orange); }
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-amber { background: var(--amber-bg); color: #8a5300; }
.tone-navy { background: var(--navy); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; background: var(--surface-2); color: var(--navy); font-size: 11.5px; font-weight: 500; }
.tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* ---------- avatar ---------- */
.avatar { position: relative; flex-shrink: 0; display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 600; font-family: var(--font-display); overflow: visible; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar.empty { background: var(--grey-bg); color: var(--faint); border: 1px dashed var(--line-2); }
.presence { position: absolute; right: -1px; bottom: -1px; width: 30%; height: 30%; min-width: 8px; min-height: 8px; border-radius: 50%; background: #c3c7d1; border: 2px solid var(--surface); }
.presence.on { background: #22c55e; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -7px; }
.person { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.person > span:not(.avatar) { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.person small { color: var(--muted); font-size: 12px; }

/* ---------- shell ---------- */
.boot { display: grid; place-items: center; height: 100vh; }
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-3) 100%); color: rgba(255, 255, 255, .78); padding: 18px 12px 12px;
}
.sidebar-brand { display: flex; align-items: center; gap: 8px; padding: 2px 10px 18px; }
.sidebar-brand img { height: 26px; }
.sidebar-brand span { font: 600 10.5px var(--font-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--amber); border: 1px solid rgba(253, 177, 62, .5); padding: 1px 6px; border-radius: 5px; }
.sidebar nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 12px; border-radius: 10px; border: 0; background: none; color: rgba(255, 255, 255, .74); font-weight: 500; text-align: left; font-size: 13.5px; }
.nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: inset 3px 0 0 var(--amber); }
.nav-item span:first-of-type { flex: 1; }
.nav-group { all: unset; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 14px 12px 5px; font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .42); }
.nav-group:hover { color: rgba(255, 255, 255, .7); }
.nav-group .chev { margin-left: auto; font-size: 10px; }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--amber); color: #2b1a00; font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
.sidebar-foot { margin-top: 8px; position: relative; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 10px; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; color: #fff; }
.me-card:hover { background: rgba(255, 255, 255, .08); }
.me-card > span:not(.avatar) { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.me-card strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.me-card small { color: rgba(255, 255, 255, .6); font-size: 12px; }
.me-card .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.search-trigger { all: unset; cursor: pointer; display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .62); font-size: 13px; }
.search-trigger:hover { background: rgba(255, 255, 255, .13); color: #fff; }
.search-trigger kbd { font: 11px var(--font-sans); padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, .12); }
.clock-card { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: rgba(255, 255, 255, .07); color: #fff; }
.clock-card .grow { flex: 1; min-width: 0; line-height: 1.25; }
.clock-card small { display: block; color: rgba(255, 255, 255, .6); font-size: 11.5px; }
.clock-card .btn { height: 30px; font-size: 12.5px; padding: 0 10px; }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; }
.mobile-bar { display: none; }
.scrim { display: none; }

/* ---------- notifications, toast ---------- */
.notif-panel { position: absolute; left: calc(100% + 18px); bottom: 0; z-index: 60; width: 390px; max-height: 72vh; display: flex; flex-direction: column; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.notif-panel.from-top { position: fixed; left: auto; right: 16px; top: 62px; bottom: auto; }
.notif-panel > header { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notif-panel ul { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.notif-panel li button { display: flex; gap: 11px; width: 100%; text-align: left; padding: 10px; border: 0; background: none; border-radius: 10px; }
.notif-panel li button:hover { background: var(--hover); }
.notif-panel li.unread button { background: var(--accent-soft); }
.notif-icon { width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center; background: var(--grey-bg); font-size: 14px; }
.notif-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-text strong { font-size: 13.5px; font-weight: 600; }
.notif-text span { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-text small { font-size: 11.5px; color: var(--faint); }
.notif-empty { padding: 30px; text-align: center; color: var(--muted); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; align-items: center; gap: 9px; max-width: calc(100vw - 32px); padding: 11px 18px; border: 0; border-radius: 12px; background: var(--navy-3); color: #fff; box-shadow: var(--shadow); animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }
.update-bar, .notify-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 32px 0; padding: 10px 14px; border-radius: 12px; background: var(--amber-bg); border: 1px solid #f5d39b; font-size: 13.5px; }
.notify-banner .nb-text { flex: 1; min-width: 200px; }

/* ---------- pages ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 30px 32px 64px; }
.page.narrow { max-width: 820px; }
.page.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.eyebrow { margin: 0 0 4px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--blue); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 .muted { font-weight: 400; margin-left: 4px; }
.section-title { font: 600 11px var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 0 0 8px; }
.tabs { display: flex; gap: 2px; margin-bottom: 18px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 9px 13px; border: 0; background: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--navy); border-bottom-color: var(--navy); }
.tab .n { font-size: 11.5px; color: var(--faint); font-weight: 600; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.back-link:hover { color: var(--text); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar select { width: auto; min-width: 140px; }
.search-box { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--faint); flex: 1; min-width: 200px; max-width: 360px; }
.search-box input { border: 0; box-shadow: none !important; padding: 8px 0; background: transparent; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 500; }
.chip .n { opacity: .7; font-size: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 7px 12px; font-size: 13px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--navy); color: #fff; font-weight: 500; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 36px 16px; }
.empty-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--blue); margin-bottom: 6px; }
.empty p { margin: 0; color: var(--muted); max-width: 380px; }
.spinner { width: 26px; height: 26px; margin: 40px auto; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--navy); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.callout { padding: 12px 14px; border-radius: 12px; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.callout.info { background: var(--blue-bg); color: #0b3c70; }
.callout.warn { background: var(--orange-bg); color: #6b3600; }
.callout.ok { background: var(--green-bg); color: #0f4d2b; }
.callout.amber { background: var(--amber-bg); color: #6b4200; border: 1px solid #f5d39b; }
.callout .grow { flex: 1; }

/* ---------- KPI tiles & charts ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); font-size: 13px; position: relative; overflow: hidden; }
a.kpi:hover { border-color: var(--line-2); }
.kpi b { font-family: var(--font-display); font-size: 26px; font-weight: 600; color: var(--text); line-height: 1.25; letter-spacing: -0.01em; }
.kpi small { font-size: 12px; color: var(--faint); }
.kpi.navy { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-3) 100%); color: rgba(255, 255, 255, .78); border: 0; }
.kpi.navy b { color: #fff; } .kpi.navy small { color: rgba(255, 255, 255, .6); }
.kpi.warn b { color: var(--orange); }
.kpi.bad b { color: var(--red); }
.kpi .trend { font-size: 12px; font-weight: 600; }
.kpi .trend.up { color: var(--green); } .kpi .trend.down { color: var(--red); }
.kpi.navy .trend.up { color: #7ee2a8; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.funnel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.funnel-step { padding: 14px 16px; position: relative; }
.funnel-step + .funnel-step { border-left: 1px dashed var(--line-2); }
.funnel-step .lbl { font: 600 11px var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.funnel-step b { display: block; font: 600 28px var(--font-display); color: var(--text); }
.funnel-step .val { font-size: 12.5px; color: var(--muted); }
.funnel-step .lbl em { font-style: normal; letter-spacing: 0; margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--navy); }
.funnel-step .conv { display: none; position: absolute; top: 14px; right: -36px; z-index: 2; background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; color: var(--navy); }
.funnel-bar { height: 8px; border-radius: 99px; background: var(--surface-2); margin-top: 10px; overflow: hidden; }
.funnel-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--navy), var(--sky)); }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.hbar .track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbar .track span { display: block; height: 100%; border-radius: 99px; background: var(--blue); }
.hbar .v { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 64px; text-align: right; }
.vchart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 8px 0 0; border-bottom: 1px solid var(--line-2); }
.vchart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.vchart .bars { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.vchart .bar { width: 100%; max-width: 34px; border-radius: 6px 6px 2px 2px; background: var(--navy); min-height: 2px; position: relative; }
.vchart .bar.alt { background: var(--sky); }
.vchart .bar.amber { background: var(--amber); }
.vchart .bar:hover::after { content: attr(data-v); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: var(--navy-3); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.vchart-labels { display: flex; gap: 10px; margin-top: 6px; }
.vchart-labels span { flex: 1; text-align: center; font-size: 11.5px; color: var(--faint); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--faint); font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; z-index: 1; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--hover); }
.table td.title { font-weight: 500; }
.table td .sub { display: block; font-size: 12px; color: var(--faint); font-weight: 400; }
.table tfoot td { font-weight: 600; border-top: 2px solid var(--line-2); border-bottom: 0; background: var(--surface-2); }
.table th.r, .table td.r { text-align: right; }
.table.compact td, .table.compact th { padding: 7px 10px; }
.table .group-row td { background: var(--surface-2); font-weight: 600; font-size: 12px; color: var(--navy); letter-spacing: .04em; text-transform: uppercase; }

/* ---------- kanban ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.column { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 160px; display: flex; flex-direction: column; gap: 8px; transition: background .15s; }
.column.droppable { background: #e2ebf6; outline: 2px dashed rgba(0, 105, 183, .35); outline-offset: -4px; }
.column > header { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; font-weight: 600; font-size: 13px; }
.column > header .muted { font-weight: 500; margin-left: auto; font-size: 12px; }
.board-card { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 11px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); cursor: grab; }
.board-card:hover { border-color: var(--line-2); }
.board-card.dragging { opacity: .45; }
.board-card .t { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.board-card .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.board-card .val { font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }

/* ---------- record pages ---------- */
.record-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.record-head h1 { line-height: 1.25; }
.record-head .sub { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: 13px; }
.stagebar { display: flex; gap: 4px; margin: 0 0 18px; overflow-x: auto; }
.stagebar button { flex: 1; min-width: 104px; border: 0; padding: 9px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); white-space: nowrap; }
.stagebar button:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 8px 0 0 8px; }
.stagebar button.done { background: #cfe1f3; color: var(--navy); }
.stagebar button.on { background: var(--navy); color: #fff; }
.stagebar button.won { background: #1f9d55; color: #fff; }
.stagebar button.lost { background: var(--red); color: #fff; }
.stagebar button:hover:not(.on) { filter: brightness(.97); }
.info-list { display: flex; flex-direction: column; gap: 11px; font-size: 13.5px; margin: 0; }
.info-list > div { display: flex; flex-direction: column; gap: 1px; }
.info-list dt { font-size: 11.5px; color: var(--faint); font-weight: 500; }
.info-list dd { margin: 0; overflow-wrap: anywhere; }
.info-list a { color: var(--blue); }
.contact-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.contact-actions a, .contact-actions button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 500; }
.contact-actions a:hover, .contact-actions button:hover { background: var(--hover); }
.contact-actions .wa { color: #128c4b; border-color: #b7e8cb; background: #f1fbf5; }
.money-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 16px; overflow: hidden; }
.money-strip > div { padding: 12px 16px; display: flex; flex-direction: column; gap: 1px; }
.money-strip > div + div { border-left: 1px solid var(--line); }
.money-strip span { font-size: 11.5px; color: var(--faint); font-weight: 500; }
.money-strip b { font: 600 17px var(--font-display); font-variant-numeric: tabular-nums; }
.list-rows { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
a.list-row:hover, button.list-row:hover { background: var(--hover); }
button.list-row { all: unset; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 10px 8px; margin: 0 -8px; border-radius: 10px; border-top: 1px solid var(--line); box-sizing: border-box; width: calc(100% + 16px); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow b { font-weight: 600; display: block; }
.list-row .grow small { color: var(--muted); font-size: 12.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ico-sq { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); font-size: 16px; }

/* ---------- timeline ---------- */
.composer-box { border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); padding: 8px; margin-bottom: 14px; }
.composer-box textarea { border: 0; box-shadow: none !important; padding: 6px 8px; min-height: 56px; }
.composer-box .bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 4px 4px 0; }
.composer-box .kinds button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; color: var(--muted); }
.composer-box .kinds button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl li { display: flex; gap: 12px; padding: 7px 0; position: relative; }
.tl .tl-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line); flex-shrink: 0; font-size: 14px; z-index: 1; }
.tl .tl-body { flex: 1; min-width: 0; padding-top: 5px; }
.tl .tl-body .who { font-size: 12px; color: var(--faint); }
.tl .tl-body p { margin: 1px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.tl li.k-note .tl-body p, .tl li.k-call .tl-body p, .tl li.k-whatsapp .tl-body p, .tl li.k-meeting .tl-body p, .tl li.k-site_visit .tl-body p, .tl li.k-email .tl-body p { background: var(--surface-2); padding: 8px 11px; border-radius: 0 10px 10px 10px; margin-top: 4px; }
.tl li.k-stage .tl-body p { font-weight: 500; color: var(--navy); }
.tl li.k-payment .tl-ico { border-color: #9fd8b5; }
.tl .form-rows { margin-top: 6px; font-size: 12.5px; }

/* ---------- forms & modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(0, 20, 40, .42); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 580px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); animation: pop .2s ease-out; }
.modal.wide { max-width: 860px; }
.modal.xwide { max-width: 1100px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; gap: 10px; }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 16px 22px 22px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 0 22px 20px; flex-wrap: wrap; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 500; color: #2c3446; }
.field-hint { font-size: 12px; color: var(--faint); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.error-text { margin: 0; color: var(--red); font-size: 13px; background: var(--red-bg); padding: 8px 12px; border-radius: 9px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check input { margin-top: 3px; }
.inline-input { display: flex; gap: 8px; align-items: center; }
.inline-input input, .inline-input select { flex: 1; }
.prefix-input { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
.prefix-input span { padding: 0 0 0 12px; color: var(--faint); font-size: 13px; }
.prefix-input input { border: 0; box-shadow: none !important; }
.picker { position: relative; }
.picker-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; padding: 5px; }
.picker-menu button { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: flex; flex-direction: column; padding: 7px 10px; border-radius: 8px; font-size: 13.5px; }
.picker-menu button small { color: var(--faint); font-size: 12px; }
.picker-menu button:hover, .picker-menu button.on { background: var(--accent-soft); }
.picked { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); }
.picked .grow { flex: 1; min-width: 0; }
.drawer-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(0, 20, 40, .28); animation: fade .15s; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: var(--bg); box-shadow: var(--shadow); display: flex; flex-direction: column; animation: slide .22s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 30px; }

/* ---------- line items editor ---------- */
.lines { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.lines th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--navy); padding: 8px 8px; white-space: nowrap; }
.lines th:first-child { border-radius: 10px 0 0 0; } .lines th:last-child { border-radius: 0 10px 0 0; }
.lines td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; background: var(--surface); }
.lines td input, .lines td select, .lines td textarea { padding: 6px 8px; border-radius: 8px; font-size: 13px; }
.lines td textarea { min-height: 32px; resize: vertical; }
.lines .w-qty { width: 82px; } .lines .w-unit { width: 74px; } .lines .w-money { width: 104px; } .lines .w-pct { width: 72px; } .lines .w-vendor { width: 150px; } .lines .w-act { width: 64px; }
.lines tr.hd td { background: #eef3f9; }
.lines tr.hd input { font-weight: 600; color: var(--navy); background: transparent; }
.lines .calc { padding: 7px 8px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.lines .calc.profit { color: var(--green); }
.lines .calc.loss { color: var(--red); }
.lines-foot { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; margin-top: 12px; }
.totals-box { min-width: 280px; margin-left: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; }
.totals-box > div { display: flex; justify-content: space-between; gap: 18px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.totals-box .grand { border-top: 2px solid var(--navy); margin-top: 4px; padding-top: 8px; font: 600 17px var(--font-display); color: var(--navy); }
.totals-box .profit { color: var(--green); font-weight: 600; }
.profit-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--green-bg); color: var(--green); font-weight: 600; font-size: 13px; }
.profit-pill.neg { background: var(--red-bg); color: var(--red); }
.drag-handle { cursor: grab; color: var(--faint); padding: 7px 2px; }
.prod-thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); flex-shrink: 0; }
.prod-thumb.big { width: 64px; height: 64px; border-radius: 12px; }

/* ---------- files ---------- */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.file { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.file .thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; color: var(--navy); font: 600 13px var(--font-display); }
.file .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file .meta { padding: 7px 9px; font-size: 12px; line-height: 1.35; }
.file .meta b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.file .meta span { color: var(--faint); }
.file .x { position: absolute; top: 6px; right: 6px; background: rgba(255, 255, 255, .92); }
.file .kind { position: absolute; top: 6px; left: 6px; font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: rgba(0, 28, 56, .78); color: #fff; text-transform: capitalize; }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 14px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 13.5px; cursor: pointer; text-align: center; flex-wrap: wrap; }
.dropzone:hover, .dropzone.over { border-color: var(--blue); background: var(--accent-soft); color: var(--navy); }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(0, 10, 20, .88); display: grid; place-items: center; padding: 20px; }
.lightbox img, .lightbox iframe { max-width: 96vw; max-height: 88vh; border-radius: 8px; background: #fff; }
.lightbox iframe { width: 92vw; height: 88vh; border: 0; }
.lightbox .icon-btn { position: absolute; top: 14px; right: 14px; color: #fff; background: rgba(255, 255, 255, .12); }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-head h2 { font-size: 18px; min-width: 170px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .dow { padding: 8px 10px; font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--faint); background: var(--surface-2); text-transform: uppercase; }
.cal .day { min-height: 118px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal .day:nth-child(7n + 1) { border-left: 0; }
.cal .day.other { background: #fafbfd; }
.cal .day.other .dn { color: var(--faint); }
.cal .day.today .dn { background: var(--navy); color: #fff; }
.cal .dn { font-size: 12px; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal .day button.add { all: unset; cursor: pointer; margin-left: auto; color: var(--faint); font-size: 16px; line-height: 1; padding: 0 4px; visibility: hidden; }
.cal .day:hover button.add { visibility: visible; }
.ev { all: unset; cursor: pointer; box-sizing: border-box; display: block; width: 100%; font-size: 11.5px; line-height: 1.3; padding: 3px 6px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid; }
.ev.done { opacity: .55; text-decoration: line-through; }
.ev-call { background: #e6f0fb; border-color: #0069b7; color: #0b3c70; }
.ev-meeting { background: #efebfd; border-color: #5b3fc4; color: #3a2690; }
.ev-site_visit, .ev-measurement { background: #fff2df; border-color: #e08a00; color: #6b3d00; }
.ev-install { background: var(--navy); border-color: var(--amber); color: #fff; }
.ev-follow_up, .ev-task, .ev-payment_follow_up { background: #edf0f5; border-color: #8b93a5; color: #33394a; }
.ev-review, .ev-check_in, .ev-inspection, .ev-warranty_expiry, .ev-quote, .ev-payment, .ev-custom { background: #e3f5ea; border-color: #1f9d55; color: #0f4d2b; }
.agenda .ag-day { font: 600 12px var(--font-sans); color: var(--navy); letter-spacing: .06em; text-transform: uppercase; margin: 14px 0 6px; }

/* ---------- installer (phone) ---------- */
.job-hero { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-3) 100%); color: #fff; border-radius: 18px; padding: 18px 18px 16px; margin-bottom: 14px; }
.job-hero h1 { color: #fff; font-size: 21px; margin: 6px 0 4px; }
.job-hero .sub { color: rgba(255, 255, 255, .75); font-size: 13.5px; }
.job-hero .badge { background: rgba(255, 255, 255, .16); color: #fff; }
.job-hero .contact-actions a, .job-hero .contact-actions button { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .2); color: #fff; }
.job-hero .contact-actions .wa { background: #25d366; border-color: #25d366; color: #fff; }
.next-step { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.checklist li label { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; font-size: 14px; }
.checklist li label.done { background: var(--green-bg); border-color: #b5e2c6; }
.checklist input { width: 22px; height: 22px; }
.photo-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.photo-strip .ph { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); position: relative; border: 1px solid var(--line); }
.photo-strip .ph img { width: 100%; height: 100%; object-fit: cover; }
.photo-strip .ph span { position: absolute; left: 6px; bottom: 6px; font-size: 10.5px; padding: 1px 6px; border-radius: 5px; background: rgba(0, 28, 56, .78); color: #fff; text-transform: capitalize; }
.photo-add { aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--line-2); display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12px; cursor: pointer; background: var(--surface); }
.photo-add:hover { border-color: var(--blue); color: var(--navy); }
.sigpad { width: 100%; height: 200px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: #fff; touch-action: none; display: block; }
.stars { font-size: 32px; display: flex; gap: 4px; }
.stars button { all: unset; cursor: pointer; color: #cfd4de; }
.stars button.on { color: var(--amber); }
.job-card { display: flex; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; align-items: flex-start; }
.job-card + .job-card { margin-top: 10px; }
.job-card .time { min-width: 58px; text-align: center; padding: 6px 4px; border-radius: 10px; background: var(--surface-2); font: 600 14px var(--font-display); color: var(--navy); line-height: 1.2; }
.job-card .time small { display: block; font: 500 10.5px var(--font-sans); color: var(--faint); }

/* ---------- roles grid ---------- */
.perm-grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.perm-grid th { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 600; padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.perm-grid th:first-child { text-align: left; }
.perm-grid td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: center; }
.perm-grid td:first-child { text-align: left; }
.perm-grid select { width: auto; padding: 4px 8px; font-size: 12.5px; }
.perm-grid input { width: 18px; height: 18px; }

/* ---------- chat ---------- */
.chat { display: grid; grid-template-columns: 290px 1fr; height: 100vh; }
.channel-list { border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 16px 10px; }
.channel-list h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin: 18px 10px 6px; font-family: var(--font-sans); font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.channel { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--text); }
.channel:hover { background: var(--hover); }
.channel.active { background: var(--accent-soft); }
.channel-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; line-height: 1.3; }
.channel-name, .channel-name small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-name small { color: var(--faint); font-size: 12px; }
.channel .count { background: var(--navy); color: #fff; }
.hash { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); flex-shrink: 0; color: var(--navy); font-weight: 600; }
.conversation { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.conv-head { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.conv-head > div { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.messages { flex: 1; overflow-y: auto; padding: 18px 22px 8px; display: flex; flex-direction: column; }
.day-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0 10px; color: var(--faint); font-size: 12px; font-weight: 500; }
.day-divider::before, .day-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { display: flex; gap: 12px; padding: 4px 8px; margin: 6px -8px 0; border-radius: 10px; position: relative; }
.msg.grouped { margin-top: 0; padding-top: 1px; padding-bottom: 1px; }
.msg:hover { background: var(--hover); }
.msg-gutter { width: 34px; flex-shrink: 0; font-size: 10.5px; color: var(--faint); text-align: right; padding-top: 3px; }
.msg.grouped .msg-gutter span { visibility: hidden; }
.msg.grouped:hover .msg-gutter span { visibility: visible; }
.msg-body { flex: 1; min-width: 0; }
.msg-body header { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.msg-body p { margin: 1px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-actions { position: absolute; right: 8px; top: -12px; display: none; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 2px; box-shadow: var(--shadow-sm); }
.msg:hover .msg-actions { display: flex; }
.reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.reaction { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 0 8px; font-size: 12.5px; height: 24px; }
.reaction.mine { background: var(--accent-soft); border-color: rgba(0, 105, 183, .35); }
.msg-files { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.msg-files img { max-width: 240px; max-height: 180px; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.msg-files a.fchip { display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; background: var(--surface-2); }
.thread-link { all: unset; cursor: pointer; margin-top: 4px; font-size: 12.5px; color: var(--blue); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.typing { height: 20px; padding: 0 24px; font-size: 12px; color: var(--faint); font-style: italic; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 4px 22px 18px; }
.composer textarea { resize: none; min-height: 42px; max-height: 180px; }
.pending-files { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 22px 6px; }
.mention-wrap { position: relative; flex: 1; }
.mention-menu { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 10; list-style: none; margin: 0; padding: 5px; min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.mention-menu li { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.mention-menu li.active { background: var(--accent-soft); }
.mention { color: var(--blue); background: var(--accent-soft); padding: 0 3px; border-radius: 4px; font-weight: 500; }
.inline-link { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.thread-pane { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.chat.with-thread { grid-template-columns: 290px 1fr 360px; }
.mobile-only { display: none; }

/* ---------- search palette ---------- */
.palette { width: 100%; max-width: 620px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.palette input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 16px; box-shadow: none !important; }
.palette .results { max-height: 60vh; overflow-y: auto; padding: 6px; }
.search-item { all: unset; cursor: pointer; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.search-item.on { background: var(--accent-soft); }
.si-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); flex-shrink: 0; font-size: 13px; }
.si-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.si-main strong, .si-main small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-main strong { font-weight: 500; }
.si-main small { color: var(--faint); font-size: 12px; }
.si-type { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login-art { background: linear-gradient(160deg, rgba(0, 56, 107, .92), rgba(0, 28, 56, .97)), repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 64px), repeating-linear-gradient(0deg, rgba(255,255,255,.05) 0 1px, transparent 1px 64px); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art img { height: 34px; align-self: flex-start; }
.login-art h2 { font-size: 34px; line-height: 1.15; font-weight: 600; max-width: 460px; }
.login-art h2 span { color: var(--amber); }
.login-art p { color: rgba(255, 255, 255, .72); max-width: 440px; }
.login-art .mark { position: absolute; right: -60px; bottom: -40px; width: 340px; opacity: .08; }
.login-art ul { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 13.5px; color: rgba(255, 255, 255, .82); }
.login-art li::before { content: "✓"; color: var(--amber); margin-right: 8px; font-weight: 700; }
.login-form { display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 26px; }
.pw-wrap { position: relative; display: block; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--blue); font-size: 12.5px; font-weight: 500; padding: 6px 8px; }

/* ---------- phone ---------- */
.bottom-bar { display: none; }
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .chat.with-thread { grid-template-columns: 260px 1fr; }
  .chat.with-thread .thread-pane { position: fixed; inset: 0 0 0 auto; width: min(420px, 100%); z-index: 50; box-shadow: var(--shadow); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 20, 40, .35); }
  .shell { display: block; }
  .main { margin-left: 0; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .mobile-bar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 10px; background: var(--navy); color: #fff; }
  .mobile-bar img { height: 22px; }
  .mobile-bar .icon-btn { color: #fff; }
  .mobile-bar .icon-btn:hover { background: rgba(255, 255, 255, .1); }
  .top-bell { position: relative; }
  .dot-count { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--amber); color: #2b1a00; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
  .notif-panel { position: fixed; left: 12px; right: 12px; top: 62px; bottom: auto; width: auto; max-height: 75vh; }
  .notif-panel.from-top { left: 12px; right: 12px; }
  .page { padding: 18px 14px 40px; }
  .update-bar, .notify-banner { margin: 10px 14px 0; }
  h1 { font-size: 21px; }
  .grid-2, .grid-3, .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .funnel { grid-template-columns: 1fr 1fr; }
  .funnel-step:nth-child(3) { border-left: 0; }
  .funnel-step .conv { display: none; }
  .board { grid-auto-columns: 82vw; scroll-snap-type: x mandatory; }
  .column { scroll-snap-align: start; }
  .chat { grid-template-columns: 1fr; height: calc(100dvh - 56px - 64px - env(safe-area-inset-bottom)); }
  .chat.has-channel .channel-list { display: none; }
  .chat:not(.has-channel) .conversation { display: none; }
  .mobile-only { display: inline-grid; }
  .conv-head { padding: 10px 12px; }
  .messages { padding: 12px 12px 6px; }
  .composer { padding: 4px 10px 10px; }
  .overlay { padding: 10px; }
  .modal-body { padding: 14px 16px 18px; }
  .cal .day { min-height: 74px; padding: 3px; }
  .ev { font-size: 10.5px; padding: 2px 4px; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .table-cards thead { display: none; }
  .table-cards tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); }
  .table-cards td { padding: 0; border: 0; }
  .table-cards td.hide-m { display: none; }
  .table-cards td.title { grid-column: 1; }
  .table-cards td.r { grid-column: 2; grid-row: 1; }
  .money-strip > div + div { border-left: 0; }
  .money-strip { grid-template-columns: 1fr 1fr; }
  .bottom-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .bb-item { all: unset; cursor: pointer; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 10.5px; color: var(--muted); padding: 4px 0; text-align: center; }
  .bb-item.on { color: var(--navy); font-weight: 600; }
  .bb-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; height: 24px; }
  .bb-count { position: absolute; top: -3px; right: -12px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--amber); color: #2b1a00; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .lines { min-width: 760px; }
  .hide-m { display: none !important; }
}
@media (min-width: 901px) { .show-m { display: none !important; } }
@media print {
  .sidebar, .mobile-bar, .bottom-bar, .toolbar, .btn, .icon-btn, .tabs, .update-bar, .notify-banner { display: none !important; }
  .main { margin: 0; } body { background: #fff; } .card { box-shadow: none; }
}

/* iPhone / iPad zoom into any field smaller than 16px — keep fields at 16px on touch screens */
@media (hover: none) and (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
}
