:root {
  --navy: #0F2739; --paper: #FAF7F2; --ink: #0F2739; --muted: #4A5D72; --line: rgba(15,39,57,.08); --line2: rgba(15,39,57,.14);
  --accent: #7A4FD6; --accent-dk: #6340B8; --accent-soft: rgba(122,79,214,.10); --accent-soft2: rgba(122,79,214,.18);
  --green: #1F8A5B; --green-soft: rgba(31,138,91,.12); --red: #C2410C; --red-soft: rgba(194,65,12,.10);
  --amber: #B7791F; --amber-soft: rgba(183,121,31,.13); --blue: #2563A8; --blue-soft: rgba(37,99,168,.11);
  --teal: #0F7C83; --teal-soft: rgba(15,124,131,.11); --gray: #5B6B7C; --gray-soft: rgba(91,107,124,.12);
  --shadow: 0 1px 2px rgba(15,39,57,.05); --shadow-lg: 0 16px 48px rgba(15,39,57,.18);
  --ease: cubic-bezier(.22,1,.36,1); --r: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Manrope', system-ui, sans-serif; font-size: 15px; line-height: 24px; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
.ic { flex: none; display: block; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 20px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.accent { color: var(--accent); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 12px; border: 1px solid var(--line2); background: #fff; font-weight: 600; font-size: 14px; cursor: pointer; transition: transform .15s var(--ease), background-color .15s, border-color .15s, box-shadow .15s; white-space: nowrap; }
.btn:hover { border-color: rgba(15,39,57,.25); background: #fdfcfa; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dk); border-color: var(--accent-dk); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: #a63709; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(15,39,57,.05); color: var(--ink); }
.btn.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--accent-dk); }
.btn.sm { min-height: 32px; padding: 4px 12px; font-size: 13px; border-radius: 10px; }
.btn.danger-text { color: var(--red); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: background-color .15s; }
.icon-btn:hover { background: rgba(15,39,57,.06); color: var(--ink); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line2); border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s; }
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.span2 { grid-column: span 2; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-art { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art .brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; }
.login-art h1 { font-size: 40px; line-height: 48px; max-width: 480px; }
.login-art p { color: rgba(255,255,255,.72); max-width: 440px; font-size: 16px; line-height: 26px; }
.login-art .art { width: 100%; max-width: 440px; height: auto; margin-top: 40px; pointer-events: none; }
.login-art .foot { color: rgba(255,255,255,.55); font-size: 13px; position: relative; }
.login-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login-card { width: 100%; max-width: 420px; }
.login-card h2 { font-size: 24px; line-height: 32px; }
.login-card .sub { color: var(--muted); margin: 4px 0 24px; }
.btn-login { width: 100%; min-height: 56px; font-size: 16px; border-radius: 14px; }
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.role-card { text-align: left; border: 1px solid var(--line2); background: #fff; border-radius: 14px; padding: 12px 16px; cursor: pointer; transition: border-color .15s, transform .15s var(--ease), box-shadow .15s; min-height: 64px; }
.role-card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.role-card:active { transform: scale(.98); }
.role-card b { display: block; font-size: 14px; }
.role-card span { color: var(--muted); font-size: 13px; line-height: 18px; display: block; }
.toggle-link { margin-top: 24px; background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; padding: 8px 0; min-height: 44px; }
.signin-form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.login-err { color: var(--red); font-size: 13px; min-height: 20px; }
.logo-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); display: grid; place-items: center; color: #fff; }

/* App shell */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #fff; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 16px; z-index: 30; }
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
.sidebar .brand b { display: block; font-size: 15px; line-height: 20px; }
.sidebar .brand span { font-size: 12px; color: rgba(255,255,255,.6); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: rgba(255,255,255,.78); font-weight: 600; font-size: 14px; transition: background-color .15s, color .15s; min-height: 44px; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: var(--accent); color: #fff; }
.nav .badge { margin-left: auto; background: rgba(255,255,255,.16); color: #fff; border-radius: 999px; font-size: 12px; line-height: 20px; padding: 0 8px; }
.nav a.active .badge { background: rgba(255,255,255,.25); }
.side-foot { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; color: rgba(255,255,255,.55); }
.main { min-width: 0; display: flex; flex-direction: column; }
.strip { background: #fff3d6; color: #6b4a0e; font-size: 13px; line-height: 20px; padding: 8px 24px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(183,121,31,.2); }
.strip button { white-space: nowrap; background: none; border: 0; color: #6b4a0e; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }
.strip .x { margin-left: auto; text-decoration: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; }
.strip .x:hover { background: rgba(183,121,31,.15); }
.topbar { display: flex; align-items: center; gap: 16px; padding: 16px 32px; background: rgba(250,247,242,.92); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 24px; line-height: 32px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .hamb { display: none; }
.top-search { margin-left: auto; position: relative; width: 300px; }
.top-search .input { padding-left: 40px; background: #fff; }
.top-search .ic { position: absolute; left: 12px; top: 10px; color: var(--muted); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 4px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }
.user-chip .who { line-height: 18px; padding-right: 4px; }
.user-chip .who b { font-size: 13px; display: block; }
.user-chip .who span { font-size: 12px; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--accent-soft2); color: var(--accent-dk); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.c1 { background: rgba(122,79,214,.16); color: #5b37b0; }
.avatar.c2 { background: rgba(15,124,131,.14); color: #0b6067; }
.avatar.c3 { background: rgba(183,121,31,.16); color: #8a5a12; }
.avatar.c4 { background: rgba(37,99,168,.14); color: #1d4f88; }
.content { padding: 32px; max-width: 1360px; width: 100%; }
.scrim { display: none; }

/* Cards and layout */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-pad { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 12px; }
.card-head h3 { font-size: 16px; line-height: 24px; }
.stack { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { padding: 20px 24px; display: flex; flex-direction: column; gap: 4px; }
.kpi .lbl { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi .lbl .ic { color: var(--accent); }
.kpi .val { font-size: 30px; line-height: 40px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 13px; color: var(--muted); line-height: 20px; }
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 280px; }
.tbl td[data-label="Phone"], .tbl td[data-label="City"], .tbl td[data-label="Date"] { white-space: nowrap; }
.toolbar .search .input { padding-left: 40px; }
.toolbar .search .ic { position: absolute; left: 12px; top: 10px; color: var(--muted); }
.toolbar select.input { width: auto; min-width: 128px; }
.count-note { color: var(--muted); font-size: 13px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.teal { background: var(--teal-soft); color: var(--teal); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.violet { background: var(--accent-soft); color: var(--accent-dk); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.gray { background: var(--gray-soft); color: var(--gray); }
.pill.red { background: var(--red-soft); color: var(--red); }
.tag { display: inline-flex; border-radius: 8px; padding: 0 8px; font-size: 12px; font-weight: 600; line-height: 22px; background: rgba(15,39,57,.06); color: var(--muted); }

/* Tables */
.table-wrap { overflow: auto; max-height: none; border-radius: var(--r); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { position: sticky; top: 0; background: #fff; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; border-bottom: 1px solid var(--line2); z-index: 1; white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color .12s; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr:hover { background: rgba(122,79,214,.04); }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl .lead-name b { display: block; }
.tbl .lead-name span { font-size: 13px; color: var(--muted); }
.who-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

/* Empty */
.empty { padding: 48px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty .ic { color: rgba(15,39,57,.3); }

/* Chart */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: 'Manrope', sans-serif; font-size: 11px; fill: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.chart-tip { position: absolute; pointer-events: none; background: var(--navy); color: #fff; font-size: 12px; line-height: 18px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; opacity: 0; transform: translate(-50%, -110%); transition: opacity .12s; }
.chart-box { position: relative; padding: 0 16px 16px; }

/* Leaderboard rows */
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-top: 1px solid var(--line); }
.rank-row .pos { width: 24px; color: var(--muted); font-weight: 700; font-size: 13px; }
.rank-row .nm { flex: 1; min-width: 0; }
.rank-row .nm b { display: block; font-size: 14px; line-height: 20px; }
.rank-row .nm span { font-size: 12px; color: var(--muted); }
.rank-row .amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-row .amt span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.rank-row.first .amt { color: var(--accent); }
.mini-row { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-top: 1px solid var(--line); cursor: pointer; transition: background-color .12s; }
.mini-row:hover { background: rgba(122,79,214,.04); }
.mini-row .nm { flex: 1; min-width: 0; }
.mini-row .nm b { display: block; font-size: 14px; line-height: 20px; }
.mini-row .nm span { font-size: 12px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pipeline */
.board { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(172px, 1fr)); gap: 16px; overflow-x: auto; padding-bottom: 16px; align-items: start; }
.col { background: rgba(15,39,57,.035); border-radius: var(--r); padding: 12px; min-height: 240px; display: flex; flex-direction: column; gap: 8px; transition: background-color .15s, box-shadow .15s; }
.col.over { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 8px; }
.col-head b { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.col-head .cnt { font-size: 12px; color: var(--muted); font-weight: 600; background: #fff; border-radius: 999px; padding: 0 8px; }
.col-sum { font-size: 12px; color: var(--muted); padding: 0 4px 4px; margin-top: -8px; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: var(--shadow); cursor: grab; transition: transform .15s var(--ease), box-shadow .15s, opacity .15s; }
.kcard:hover { box-shadow: 0 4px 14px rgba(15,39,57,.08); }
.kcard.dragging { opacity: .4; }
.kcard .t { font-weight: 700; font-size: 14px; line-height: 20px; }
.kcard .s { font-size: 12px; color: var(--muted); line-height: 18px; margin-top: 2px; }
.kcard .b { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; }
.kcard .th { display: flex; align-items: flex-start; gap: 8px; }
.kcard .th .t { flex: 1; min-width: 0; }
.kcard .v { font-weight: 700; font-size: 13px; line-height: 20px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kcard .b .due { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.kcard .b .tag { white-space: nowrap; }
.kcard .moves { display: none; gap: 8px; margin-top: 8px; }
.kcard .moves .btn { flex: 1; min-height: 44px; }
.due { font-size: 12px; font-weight: 600; }
.due.late { color: var(--red); }
.due.today { color: var(--amber); }
.col-more { text-align: center; font-size: 12px; color: var(--muted); padding: 4px; }

/* Lead detail */
.detail { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
.info-list { display: flex; flex-direction: column; }
.info-list div { display: flex; gap: 12px; padding: 12px 24px; border-top: 1px solid var(--line); font-size: 14px; }
.info-list div .ic { color: var(--muted); margin-top: 2px; }
.info-list dt { color: var(--muted); font-size: 12px; font-weight: 600; line-height: 18px; }
.info-list dd { margin: 0; overflow-wrap: anywhere; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 14px; margin-bottom: 16px; min-height: 32px; }
.back:hover { color: var(--ink); }
.lead-head { display: flex; align-items: flex-start; gap: 16px; padding: 24px; }
.lead-head h2 { font-size: 20px; line-height: 28px; }
.timeline { padding: 8px 24px 24px; }
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 20px; }
.tl-item:not(:last-child)::after { content: ''; position: absolute; left: 17px; top: 38px; bottom: 2px; width: 2px; background: var(--line2); }
.tl-ic { width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; flex: none; background: rgba(15,39,57,.06); color: var(--muted); }
.tl-ic.call { background: var(--teal-soft); color: var(--teal); }
.tl-ic.message { background: var(--blue-soft); color: var(--blue); }
.tl-ic.visit { background: var(--amber-soft); color: var(--amber); }
.tl-ic.quote { background: var(--accent-soft); color: var(--accent); }
.tl-ic.stage { background: var(--green-soft); color: var(--green); }
.tl-body { flex: 1; min-width: 0; padding-top: 6px; }
.tl-body p { margin: 0; font-size: 14px; line-height: 22px; }
.tl-meta { font-size: 12px; color: var(--muted); line-height: 18px; }
.add-act { padding: 16px 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fcfbf8; }
.seg { display: inline-flex; background: rgba(15,39,57,.05); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; transition: background-color .15s, color .15s; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.seg button .n { background: var(--accent-soft); color: var(--accent-dk); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.seg button .n.late { background: var(--red-soft); color: var(--red); }
.side-box { padding: 20px 24px; border-top: 1px solid var(--line); }
.side-box h4 { font-size: 14px; margin-bottom: 8px; }

/* Follow ups */
.fu-row { display: flex; align-items: center; gap: 16px; padding: 16px 24px; border-top: 1px solid var(--line); }
.fu-row:first-child { border-top: 0; }
.fu-row .nm { flex: 1; min-width: 0; cursor: pointer; }
.fu-row .nm b { display: block; }
.fu-row .nm span { display: block; font-size: 13px; color: var(--muted); }
.fu-meta { display: flex; align-items: center; gap: 16px; }
.fu-row .when { width: 120px; text-align: right; }
.fu-row .when b, .fu-row .when span { display: block; white-space: nowrap; }
.fu-row .when b { display: block; font-size: 14px; }
.fu-actions { display: flex; gap: 8px; position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 4px; z-index: 15; min-width: 160px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 8px; font-size: 14px; cursor: pointer; min-height: 40px; }
.menu button:hover { background: var(--accent-soft); }

/* Quotations */
.items-tbl td { padding: 8px; }
.items-tbl .input { min-height: 38px; }
.totals { margin-left: auto; width: 320px; max-width: 100%; display: flex; flex-direction: column; gap: 8px; padding: 16px 0; }
.totals div { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.totals .grand { font-size: 18px; font-weight: 700; border-top: 1px solid var(--line2); padding-top: 12px; }
.doc { background: #fff; max-width: 820px; margin: 0 auto; padding: 48px; border-radius: var(--r); border: 1px solid var(--line); box-shadow: var(--shadow); }
.doc-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 2px solid var(--accent); }
.doc-head h2 { font-size: 22px; }
.doc table { width: 100%; border-collapse: collapse; margin-top: 24px; }
.doc th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line2); }
.doc td { padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
.doc .num { text-align: right; white-space: nowrap; }
.doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; font-size: 14px; }
.doc-meta dt { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.doc-meta dd { margin: 0 0 8px; }
.sign { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 56px; font-size: 13px; color: var(--muted); }
.sign div { border-top: 1px solid var(--ink); padding-top: 8px; }

/* Settings */
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-top: 1px solid var(--line); }
.set-row .input { max-width: 320px; }
.swatch { width: 12px; height: 12px; border-radius: 99px; flex: none; }

/* Modal and toast */
.modal-wrap { position: fixed; inset: 0; background: rgba(15,39,57,.42); display: grid; place-items: center; padding: 16px; z-index: 100; opacity: 0; transition: opacity .2s var(--ease); }
.modal-wrap.in { opacity: 1; }
.modal { background: #fff; border-radius: 20px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateY(12px) scale(.98); transition: transform .25s var(--ease); }
.modal.wide { max-width: 720px; }
.modal-wrap.in .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 8px; }
.modal-head h2 { font-size: 18px; line-height: 28px; }
.modal-body { padding: 8px 24px 16px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; border-top: 1px solid var(--line); }
.confirm-text { margin: 0; color: var(--muted); }
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; }
.toast { display: flex; align-items: center; gap: 8px; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: opacity .25s var(--ease), transform .25s var(--ease); }
.toast.in { opacity: 1; transform: none; }
.toast .ic { color: #b9a2f0; }

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

/* Tablet */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; }
  .top-search { width: 220px; }
}

/* Mobile */
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 24px; min-height: auto; gap: 16px; }
  .login-art h1 { font-size: 26px; line-height: 34px; }
  .login-art p { font-size: 15px; line-height: 24px; margin: 0; }
  .login-art .art, .login-art .foot { display: none; }
  .login-main { padding: 24px 16px 48px; align-items: flex-start; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .28s var(--ease); }
  .app.drawer .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(15,39,57,.4); z-index: 25; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.drawer .scrim { opacity: 1; pointer-events: auto; }
  .topbar { padding: 12px 16px; gap: 8px; }
  .topbar h1 { font-size: 20px; line-height: 28px; }
  .topbar .hamb { display: inline-grid; width: 44px; height: 44px; }
  .top-search { display: none; }
  .user-chip .who { display: none; }
  .user-chip { margin-left: auto; }
  .strip { padding: 8px 16px; }
  .content { padding: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi { padding: 16px; }
  .kpi .val { font-size: 22px; line-height: 32px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .card-head { padding: 16px 16px 8px; flex-wrap: wrap; }
  .rank-row, .mini-row { padding: 12px 16px; }
  .toolbar .search { max-width: none; min-width: 100%; }
  .toolbar select.input { flex: 1; min-width: calc(50% - 6px); min-height: 44px; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 40px; }
  .input { min-height: 44px; font-size: 16px; }
  .icon-btn { width: 44px; height: 44px; }
  /* tables to stacked cards */
  .table-wrap { overflow: visible; }
  table.tbl.stackable thead { display: none; }
  table.tbl.stackable, .tbl.stackable tbody, .tbl.stackable tr, .tbl.stackable td { display: block; width: 100%; }
  .tbl.stackable tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .tbl.stackable tr:last-child { border-bottom: 0; }
  .tbl.stackable td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl.stackable td::before { content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 600; text-align: left; flex: none; }
  .tbl.stackable td.first { display: block; text-align: left; padding-bottom: 8px; }
  .tbl.stackable td.first::before { display: none; }
  .tbl.stackable td.num { text-align: right; }
  /* board */
  .board { grid-template-columns: repeat(var(--cols, 6), 84vw); scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 16px; }
  .col { scroll-snap-align: center; }
  .kcard { cursor: default; }
  .kcard .moves { display: flex; }
  .detail { gap: 16px; }
  .lead-head { padding: 16px; flex-wrap: wrap; }
  .info-list div, .side-box, .add-act, .timeline { padding-left: 16px; padding-right: 16px; }
  .fu-row { flex-wrap: wrap; padding: 16px; gap: 8px 12px; }
  .fu-row .nm { flex-basis: calc(100% - 56px); }
  .fu-meta { width: 100%; padding-left: 52px; justify-content: space-between; }
  .fu-row .when { width: auto; display: flex; gap: 8px; align-items: baseline; }
  .mini-row .pill { display: none; }
  .strip { font-size: 12px; line-height: 18px; }
  .fu-actions { width: 100%; }
  .fu-actions .btn { flex: 1; }
  .doc { padding: 24px 16px; }
  .doc-head { flex-direction: column; }
  .doc-meta { grid-template-columns: 1fr; gap: 8px; }
  .doc table th:nth-child(2), .doc table td:nth-child(2) { display: none; }
  .items-tbl thead { display: none; }
  .items-tbl, .items-tbl tbody, .items-tbl tr, .items-tbl td { display: block; width: 100%; }
  .items-tbl tr { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .items-tbl td { padding: 0; }
  .items-tbl td.desc { grid-column: 1 / -1; }
  .items-tbl td.ltot { display: none; }
  .set-row { padding: 12px 16px; flex-wrap: wrap; }
  .set-row .input { flex: 1 1 200px; min-width: 0; }
  .modal-wrap { align-items: end; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92vh; }
  .modal-foot .btn { flex: 1; }
  .role-cards { grid-template-columns: 1fr; }
  .seg { width: 100%; }
  .seg button { flex: 1; justify-content: center; min-height: 40px; }
}

@media print {
  .sidebar, .topbar, .strip, .no-print, #toasts, .scrim { display: none !important; }
  .app { display: block; }
  body, .content { background: #fff; padding: 0; }
  .doc { border: 0; box-shadow: none; padding: 0; max-width: none; }
}

/* Shared demo strip colours: identical on every EulClavie demo */
.strip { background: #FFF6E5; color: #6B4A00; border-bottom: 1px solid rgba(183, 121, 31, .22); font-size: 13px; line-height: 20px; font-weight: 500; }
.strip .ic, .strip > svg { color: #6B4A00; }
.strip #stripReset { color: #6B4A00; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; background: none; }
.strip #stripReset:hover { background: rgba(183, 121, 31, .12); }
.strip .x { color: #6B4A00; text-decoration: none; background: none; }
.strip .x:hover { background: rgba(183, 121, 31, .14); color: #6B4A00; }
