/* BERGER Sales v2 — white mode only. Tokens follow the v1 dashboard. */
:root {
  --ink: #14161A; --sub: #6B7280; --faint: #9CA3AF;
  --line: #E8E6E0; --line-2: #F1EFEA; --paper: #FBFAF7; --card: #FFFFFF; --hover: #F5F3EE;
  --brand: #C8102E; --brand-dark: #A50D26; --brand-soft: #FCE8EB; --brand-ink: #8E0B21;
  --green: #2A9D5C; --green-soft: #DDF3E6; --green-ink: #1C6E40;
  --red: #C0483F; --red-soft: #F8E1DF;
  --blue: #2563EB; --blue-soft: #DDEEFA; --blue-ink: #1D4ED8;
  --amber: #B7791F; --amber-soft: #FCEFD6; --amber-ink: #8A5A12;
  --violet: #7C6FE0; --violet-soft: #ECEAFC; --violet-ink: #5A4DC4;
  --slate-soft: #EFEEEA;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20,22,26,.04), 0 2px 8px rgba(20,22,26,.04);
  --shadow-lg: 0 12px 40px rgba(20,22,26,.18);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sidebar: 292px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a.link { color: var(--blue); } a.link:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 26px; } h2 { font-size: 17px; } h3 { font-size: 14px; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: 13px; }
.ico { flex: none; vertical-align: -4px; }
.muted { color: var(--sub); } .faint { color: var(--faint); }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-0 { margin-top: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ------------------------------------------------ shell */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 700; font-size: 15px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.upload-cta { margin: 4px 14px 6px; display: flex; align-items: center; gap: 12px; width: calc(100% - 28px); padding: 14px; border: 0; border-radius: 12px; cursor: pointer; text-align: left;
  background: linear-gradient(135deg, var(--brand) 0%, #E0354F 100%); color: #fff; font: inherit; box-shadow: 0 6px 18px rgba(200,16,46,.28); transition: transform .15s, box-shadow .15s; }
.upload-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(200,16,46,.34); }
.upload-cta .uc-ic { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; }
.upload-cta strong { display: block; font-size: 14.5px; }
.upload-cta small { opacity: .85; font-size: 12.5px; }
.upload-status { margin: 0 16px 10px; font-size: 12.5px; color: var(--sub); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; flex: none; }
.dot.warn { background: var(--amber); } .dot.bad { background: var(--brand); }
.nav { padding: 6px 10px; }
.nav-h { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #374151; font-weight: 500; }
.nav a:hover { background: var(--hover); }
.nav a.active { background: var(--ink); color: #fff; }
.nav a .count { margin-left: auto; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.nav a.active .count { background: #fff; color: var(--ink); }
.side-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--slate-soft); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.side-foot .who { line-height: 1.25; min-width: 0; } .side-foot .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who small { color: var(--sub); }
.side-foot a.out { margin-left: auto; color: var(--sub); padding: 6px; border-radius: 8px; } .side-foot a.out:hover { background: var(--hover); color: var(--ink); }
.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--sub); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mobile-bar { display: none; }

/* ------------------------------------------------ controls */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn-primary:hover { background: var(--brand-dark); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; } .btn-dark:hover { background: #2a2d33; }
.btn-ghost { border-color: transparent; background: transparent; } .btn-ghost:hover { background: var(--hover); }
.btn-danger { color: var(--brand); } .btn-danger:hover { background: var(--brand-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 11px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; min-height: 36px; width: 100%; transition: border-color .12s, box-shadow .12s; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(200,16,46,.12); }
label.lbl { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { color: var(--sub); font-size: 13px; margin-top: 5px; }
.field { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.check { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #D6D3CC; border-radius: 22px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(16px); }

/* ------------------------------------------------ cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.card-head .eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.card-head h2 { margin-top: 2px; }
.card-head .tools { margin-left: auto; display: flex; gap: 4px; }
.card-body { padding: 16px 20px 20px; }
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.span-2 { grid-column: span 2; }

.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .k-label { color: var(--sub); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi .k-val { font-size: 30px; font-weight: 750; letter-spacing: -.02em; margin-top: 6px; line-height: 1.1; }
.kpi .k-foot { margin-top: 8px; display: flex; gap: 8px; align-items: center; color: var(--sub); font-size: 13px; }
.kpi .k-ic { position: absolute; right: 16px; top: 16px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--slate-soft); color: var(--sub); }
.kpi.accent { background: linear-gradient(160deg, #fff 40%, var(--brand-soft) 140%); }
.kpi.accent .k-ic { background: var(--brand); color: #fff; }
.delta { font-weight: 700; font-size: 12.5px; padding: 1px 7px; border-radius: 999px; }
.delta.up { color: var(--green-ink); background: var(--green-soft); }
.delta.down { color: var(--brand-ink); background: var(--brand-soft); }
.delta.flat { color: var(--sub); background: var(--slate-soft); }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; } .chart-box.lg { height: 330px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--sub); margin-top: 10px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }

.funnel { display: grid; gap: 10px; }
.funnel .f-row { display: grid; grid-template-columns: 150px 1fr 60px; gap: 12px; align-items: center; }
.funnel .f-bar { height: 28px; border-radius: 7px; background: var(--line-2); overflow: hidden; }
.funnel .f-bar span { display: block; height: 100%; background: var(--brand); border-radius: 7px; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.funnel .f-row:nth-child(2) .f-bar span { background: #E0566C; } .funnel .f-row:nth-child(3) .f-bar span { background: var(--green); }
.funnel .f-n { font-weight: 700; text-align: right; }
.funnel .f-pct { color: var(--sub); font-size: 12.5px; font-weight: 500; }

.heat { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 3px; font-size: 11px; color: var(--faint); }
.heat .c { aspect-ratio: 1; border-radius: 3px; background: var(--line-2); }
.heat .hl { display: flex; align-items: center; }

/* ------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-weight: 600; color: var(--sub); font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FCFBF9; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #FCFBF8; }
table.t tr.click { cursor: pointer; }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card > .table-wrap > table.t th:first-child, .card > .table-wrap > table.t td:first-child { padding-left: 20px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge-green { background: var(--green-soft); color: var(--green-ink); }
.badge-amber { background: var(--amber-soft); color: var(--amber-ink); }
.badge-red { background: var(--brand-soft); color: var(--brand-ink); }
.badge-slate { background: var(--slate-soft); color: #4B5563; }
.badge-blue { background: var(--blue-soft); color: var(--blue-ink); }
.badge-violet { background: var(--violet-soft); color: var(--violet-ink); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.bar-inline { height: 6px; background: var(--line-2); border-radius: 6px; overflow: hidden; min-width: 60px; }
.bar-inline span { display: block; height: 100%; background: var(--green); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.filters input, .filters select { width: auto; min-width: 140px; }
.filters input[type=search] { min-width: 240px; }
.pager { display: flex; gap: 6px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line-2); color: var(--sub); }
.pager .spacer { flex: 1; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg a { padding: 5px 11px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--sub); }
.seg a.on { background: var(--ink); color: #fff; }
.range-bar { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.range-custom { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.range-custom label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--sub); }
.range-custom input[type=date] { width: auto; min-width: 0; padding: 6px 9px; font-size: 13px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--sub); border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 7px; align-items: center; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--brand); }

/* ------------------------------------------------ alerts */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid; }
.alert-success { background: var(--green-soft); border-color: #BFE5CD; color: var(--green-ink); }
.alert-error { background: var(--brand-soft); border-color: #F5C2CB; color: var(--brand-ink); }
.alert-warn { background: var(--amber-soft); border-color: #F2D9A6; color: var(--amber-ink); }
.alert-info { background: var(--blue-soft); border-color: #BFD8F2; color: var(--blue-ink); }
.empty { padding: 48px 20px; text-align: center; color: var(--sub); }
.empty .ico { color: var(--faint); margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; }
.kv dt { color: var(--sub); } .kv dd { margin: 0; font-weight: 500; word-break: break-word; }
pre.msg { white-space: pre-wrap; font-family: var(--font); background: #FCFBF9; border: 1px solid var(--line-2); border-radius: 10px; padding: 14px; max-height: 420px; overflow: auto; margin: 0; }
.codebox { position: relative; }
.codebox pre { background: #16181D; color: #E5E7EB; border-radius: 10px; padding: 14px; overflow: auto; font-family: var(--mono); font-size: 12.5px; margin: 0; max-height: 360px; }
.codebox .btn { position: absolute; right: 8px; top: 8px; }

/* ------------------------------------------------ upload modal */
.modal-bg { position: fixed; inset: 0; background: rgba(20,22,26,.45); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 90; padding: 16px; }
.modal-bg.open { display: flex; animation: fade .18s ease; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 620px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .22s cubic-bezier(.2,.9,.3,1.2); }
.modal-head { padding: 20px 24px 0; display: flex; align-items: flex-start; gap: 12px; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 18px 24px 24px; }
@keyframes fade { from { opacity: 0 } } @keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0 } }
.steps { display: flex; gap: 6px; margin: 4px 0 18px; }
.steps .s { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--faint); }
.steps .s::before { content: ""; height: 4px; border-radius: 4px; background: var(--line); transition: background .3s; }
.steps .s.on { color: var(--ink); } .steps .s.on::before { background: var(--brand); }
.steps .s.done { color: var(--green-ink); } .steps .s.done::before { background: var(--green); }
.drop { display: block; border: 2px dashed #D9D5CC; border-radius: 14px; padding: 36px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; background: #FCFBF9; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop .big-ic { width: 60px; height: 60px; border-radius: 16px; margin: 0 auto 12px; display: grid; place-items: center; background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.drop b { font-size: 16px; display: block; margin-bottom: 4px; }
.file-pill { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.file-pill .fi { width: 40px; height: 40px; border-radius: 10px; background: var(--green-soft); color: var(--green-ink); display: grid; place-items: center; flex: none; }
.file-pill .meta { min-width: 0; flex: 1; } .file-pill .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { height: 10px; background: var(--line-2); border-radius: 10px; overflow: hidden; margin-top: 14px; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #E85A70); border-radius: 10px; transition: width .2s; }
.progress.indet span { width: 35% !important; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: -35% } 100% { margin-left: 100% } }
.progress-label { display: flex; justify-content: space-between; margin-top: 8px; color: var(--sub); font-size: 13px; }
.success-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; margin: 4px auto 14px; animation: pop .35s cubic-bezier(.2,.9,.3,1.4); }

/* mapping review */
.sheet-card { margin-bottom: 16px; }
.sheet-card.ignored { opacity: .6; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.map-item { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; background: #FCFBF9; }
.map-item.ok { border-color: #BFE5CD; background: #F6FBF8; }
.map-item.miss { border-color: #F5C2CB; background: #FFF7F8; }
.map-item label { font-weight: 600; display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.map-item .sample { color: var(--sub); font-size: 12.5px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req { color: var(--brand); }
.stat-big { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-big > div { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; }
.stat-big b { display: block; font-size: 24px; font-weight: 750; }
.stat-big span { color: var(--sub); }

/* workflow */
.pipeline { display: grid; gap: 12px; }
.job { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 16px 18px; }
.job .jic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.job.off .jic { background: var(--slate-soft); color: var(--faint); }
.job .jmeta { color: var(--sub); font-size: 13px; margin-top: 3px; }
.job .jlast { font-size: 12.5px; margin-top: 6px; }
.job .jact { display: flex; gap: 10px; align-items: center; }
.pipe-arrow { text-align: center; color: var(--faint); margin: -6px 0; }

/* auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 10% -10%, var(--brand-soft), transparent 60%), var(--paper); }
.auth-card { width: 100%; max-width: 400px; padding: 32px; }
.auth-card .brand { padding: 0 0 22px; font-size: 17px; }

.lang-row { padding: 0 14px 10px; }
.lang-seg a { padding: 4px 12px; }

/* entrance animations */
.card.anim { transition: box-shadow .2s; }
.card.anim:hover { box-shadow: 0 2px 4px rgba(20,22,26,.05), 0 10px 26px rgba(20,22,26,.07); }
[data-w] { width: 0; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.kpi .k-val { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { [data-w] { transition: none; } }

/* tooltip (tippy theme tweak) */
.tippy-box[data-theme~='light-border'] { font-size: 13px; }

@media (max-width: 1200px) { .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g-21, .g-12 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .app { flex-direction: column; }
  .main { padding: 18px 16px 50px; }
  .g-3, .g-2, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .kv { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .g-4 { grid-template-columns: 1fr; } .filters input[type=search] { min-width: 0; width: 100%; } }
@media print { .sidebar, .mobile-bar, .page-head .actions, .tools { display: none !important; } .main { padding: 0; } .card { box-shadow: none; break-inside: avoid; } }

/* Lead journey */
.tabs .count { background: var(--line-2); color: var(--ink); font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.journey { display: flex; align-items: stretch; gap: 0; background: var(--card, #fff); border: 1px solid var(--line-2); border-radius: 14px; padding: 16px 18px; flex-wrap: wrap; }
.j-step { display: flex; gap: 10px; align-items: flex-start; flex: 1 1 180px; min-width: 160px; }
.j-dot { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--line-2); color: var(--sub); }
.j-done .j-dot { background: #dbeafe; color: #1d4ed8; }
.j-won .j-dot { background: #dcfce7; color: #15803d; }
.j-lost .j-dot { background: #f1f5f9; color: #64748b; }
.j-now .j-dot { background: #fef3c7; color: #b45309; }
.j-gap { flex: 0 1 90px; display: flex; align-items: center; justify-content: center; position: relative; min-width: 50px; font-size: 12.5px; color: var(--sub); }
.j-gap::before { content: ""; position: absolute; left: 6px; right: 6px; top: 50%; border-top: 2px dashed var(--line-2); z-index: 0; }
.j-gap b { position: relative; background: var(--card, #fff); padding: 0 6px; z-index: 1; }
@media (max-width: 700px) { .j-gap { flex-basis: 100%; height: 22px; } .j-gap::before { display: none; } }

/* ------------------------------------------------ Inboxes (settings) */
.mbx-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 1px solid var(--line-2); }
.mbx-head .badge { vertical-align: 2px; margin-left: 4px; }
.mbx-list:empty { display: none; }
.mbx { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); transition: background .15s, opacity .25s, transform .25s; }
.mbx:last-child { border-bottom: 0; }
.mbx:hover { background: #FCFBF9; }
.mbx.is-off .mbx-main, .mbx.is-off .mbx-nums { opacity: .55; }
.mbx.is-busy { pointer-events: none; }
.mbx.is-busy .mbx-ic::after { content: ""; position: absolute; inset: -3px; border-radius: 14px; border: 2px solid transparent; border-top-color: var(--brand); animation: spin .8s linear infinite; }
.mbx.flash-ok { animation: flashOk 1.4s ease; } .mbx.flash-err { animation: flashErr 1.4s ease; }
.mbx.is-new { animation: rowIn .35s cubic-bezier(.2,.9,.3,1.1), flashOk 1.6s ease; }
.mbx.is-leaving { opacity: 0; transform: translateX(16px); }
@keyframes flashOk { 0% { background: var(--green-soft); } 100% { background: transparent; } }
@keyframes flashErr { 0% { background: var(--brand-soft); } 100% { background: transparent; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(-6px); } }
@keyframes spin { to { transform: rotate(360deg); } }
.mbx-ic { position: relative; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.mbx-ic.is-ms, .sc-ic.is-ms { background: var(--blue-soft); color: var(--blue-ink); }
.dot { position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid #fff; background: var(--faint); }
.dot-ok { background: var(--green); } .dot-err { background: var(--brand); } .dot-warn { background: var(--amber); } .dot-new { background: var(--blue); }
.mbx-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 15px; }
.mbx-meta { color: var(--sub); font-size: 13px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 0 6px; }
.mbx-meta .sep { color: var(--faint); }
.mbx-err { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; font-size: 12.5px; color: var(--brand-ink); background: var(--brand-soft); padding: 5px 9px; border-radius: 8px; width: fit-content; max-width: 100%; }
.mbx-err .ico { vertical-align: 0; margin-top: 1px; }
.mbx-nums { display: flex; gap: 22px; }
.mbx-nums div { display: flex; flex-direction: column; align-items: flex-end; min-width: 56px; }
.mbx-nums b { font-size: 16px; font-variant-numeric: tabular-nums; } .mbx-nums b.sm { font-size: 13px; font-weight: 600; white-space: nowrap; }
.mbx-nums span { font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.mbx-act { display: flex; gap: 2px; justify-content: flex-end; flex-wrap: wrap; }
.mbx-act .btn-sm { padding: 0 8px; }
.mbx-empty { text-align: center; padding: 40px 20px 44px; }
.mbx-empty .big-ic { width: 60px; height: 60px; border-radius: 16px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.mbx-empty b { font-size: 16px; display: block; margin-bottom: 4px; }
.mbx-empty p { max-width: 420px; margin: 0 auto 16px; }
@media (max-width: 1100px) { .mbx { grid-template-columns: 44px minmax(0, 1fr) auto; } .mbx-act { grid-column: 2 / -1; justify-content: flex-start; margin-left: -8px; } }
@media (max-width: 640px) { .mbx-nums { display: none; } .mbx-head { flex-direction: column; } }

/* drawer */
.drawer-bg { position: fixed; inset: 0; z-index: 60; background: rgba(20,22,26,0); pointer-events: none; transition: background .25s; }
.drawer-bg.open { background: rgba(20,22,26,.38); pointer-events: auto; backdrop-filter: blur(2px); }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: #fff; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .32s cubic-bezier(.2,.9,.25,1); }
.drawer-bg.open .drawer { transform: none; }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 24px 16px; border-bottom: 1px solid var(--line-2); }
.drawer-head .x { margin-left: auto; }
.drawer-head .eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); margin-bottom: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 28px; }
.drawer-foot { display: flex; gap: 8px; align-items: center; padding: 14px 24px; border-top: 1px solid var(--line-2); background: #FCFBF9; }
.drawer-sec { animation: fade .2s ease; }
.sec-t { font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); margin: 18px 0 10px; display: flex; align-items: center; gap: 10px; }
.sec-t::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.seg-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-card { position: relative; display: flex; gap: 10px; align-items: center; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.seg-card:hover { border-color: #D9D5CC; }
.seg-card input { position: absolute; opacity: 0; pointer-events: none; }
.seg-card:has(input:checked) { border-color: var(--brand); background: #FFFBFB; box-shadow: 0 0 0 3px var(--brand-soft); }
.seg-card:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.seg-card b { display: block; font-size: 14px; } .seg-card small { color: var(--sub); font-size: 12px; }
.sc-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.pw { position: relative; } .pw input { padding-right: 64px; } .pw .btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); height: 28px; font-size: 12px; }
.howto { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; background: #FCFBF9; }
.howto summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--blue-ink); }
.howto .hint { margin-top: 8px; }
.field.invalid input { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field.invalid .lbl { color: var(--brand-ink); }
.shake { animation: shake .35s; } @keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.mb-result { margin-top: 16px; padding: 12px 14px; border-radius: 10px; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; animation: rowIn .25s ease; }
.mb-result.ok { background: var(--green-soft); color: var(--green-ink); } .mb-result.err { background: var(--brand-soft); color: var(--brand-ink); }
.mb-result.busy { background: var(--hover); color: var(--sub); }
.spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; flex: none; }
.switch { position: relative; display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch:has(.sw) { width: auto; height: auto; }
.switch input { position: absolute; opacity: 0; }
.switch .sw { width: 36px; height: 20px; border-radius: 20px; background: #D9D5CC; position: relative; transition: background .2s; flex: none; }
.switch .sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .sw { background: var(--green); } .switch input:checked + .sw::after { transform: translateX(16px); }
.switch input:focus-visible + .sw { outline: 2px solid var(--brand); outline-offset: 2px; }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; max-width: 420px; padding: 12px 14px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2); transition: opacity .25s, transform .25s; }
.toast.err { background: var(--brand-dark); }
.toast .ti { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.16); flex: none; font-size: 12px; font-weight: 700; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }

/* mail page: quoted history, conversation, attachments */
pre.msg.tall { max-height: 640px; }
pre.msg.small { max-height: 220px; font-size: 13px; }
pre.msg.quoted { color: var(--muted, #6B7280); background: #F6F4F0; margin-top: 8px; max-height: 360px; }
details.quote { margin-top: 8px; }
details.quote summary { cursor: pointer; font-size: 12.5px; }
.thread-item { border-top: 1px solid var(--line-2); padding: 10px 0; }
.thread-item.is-cur { background: var(--hover, #F7F6F3); margin: 0 -10px; padding: 10px; border-radius: 8px; border-top-color: transparent; }
.att-box { border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; background: #FCFBF9; }
.att-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line-2); }
.att-row:first-of-type { border-top: 0; }
.att-text { flex-basis: 100%; }

/* setup guide */
.setup-list { padding: 0 20px 10px; }
.setup-step { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line-2); }
.setup-step:first-child { border-top: 0; }
.setup-n { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--hover, #F2F0EB); color: var(--muted, #6B7280); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.setup-step.is-ok .setup-n { background: var(--green-soft); color: var(--green-ink, #166534); }
.setup-step.is-todo .setup-n { background: var(--amber-soft); color: var(--amber-ink); }
.setup-main { flex: 1; min-width: 0; }
ol.guide { margin: 0; padding-left: 20px; line-height: 1.7; }
ol.guide li { margin-bottom: 4px; }

/* ---- shared UI (ui.js): dialogs, selection bar, run results ---- */
.modal-sm { max-width: 460px; } .modal-wide { max-width: 860px; }
.modal-head h2 { font-size: 18px; padding-top: 2px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--line-2); background: #FCFBF9; }
.dlg-text { white-space: pre-line; margin: 0 0 4px; } .dlg-list { margin: 8px 0 0; padding-left: 20px; color: var(--sub); }
.bad { color: var(--brand-ink); }
.btn.is-busy { opacity: .75; cursor: progress; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 11px; margin-bottom: 8px; cursor: pointer; transition: border-color .15s, background .15s; }
.opt:hover { background: var(--hover); } .opt:has(input:checked) { border-color: var(--ink); background: #fff; box-shadow: 0 0 0 3px rgba(20,22,26,.06); }
.opt input { margin-top: 3px; width: auto; flex: none; } .opt small { display: block; color: var(--sub); font-size: 12.5px; margin-top: 2px; }
.opt.off, .check.off { opacity: .5; cursor: not-allowed; }
/* floating action bar of a selectable table: sticks to the bottom of the screen while the table is in view */
.selbar { position: sticky; bottom: 16px; z-index: 20; margin: 0 auto 14px; width: max-content; max-width: calc(100% - 28px); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 9px 12px 9px 16px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); animation: toastIn .25s cubic-bezier(.2,.9,.3,1.2); }
.selbar b { font-weight: 700; } .selbar .btn { height: 32px; } .selbar .btn-ghost { color: #fff; } .selbar .btn-ghost:hover { background: rgba(255,255,255,.14); }
table.t td.selcell, table.t th.selcell { width: 40px; padding-right: 0; cursor: pointer; } .selcell input { width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: var(--brand); }
table.t tr.is-sel td { background: #FDF3F4; }
.pager-size { padding: 2px; } .pager-size a { padding: 3px 9px; font-size: 12.5px; }
/* run results */
.run-status { font-weight: 600; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; min-height: 22px; }
.run-bar { margin-bottom: 8px; height: 8px; } .run-sum { font-size: 13px; margin-bottom: 10px; }
.run-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--line-2); border-radius: 10px; }
.run-row { display: grid; grid-template-columns: 22px minmax(0,1.3fr) minmax(0,1fr) minmax(0,1.2fr); gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.run-row:last-child { border-bottom: 0; } .run-row b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-row small, .run-row .rn { color: var(--sub); font-size: 12px; overflow: hidden; text-overflow: ellipsis; } .run-row small { display: block; }
.run-row .ri { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--slate-soft); color: var(--sub); }
.run-row.st-ok .ri { background: var(--green-soft); color: var(--green-ink); } .run-row.st-changed .ri { background: var(--blue-soft); color: var(--blue-ink); }
.run-row.st-error, .run-row.st-ai_failed { background: var(--brand-soft); } .run-row.st-error .ri, .run-row.st-ai_failed .ri { background: var(--brand); color: #fff; }
.run-row .arr { color: var(--faint); }
@media (max-width: 640px) { .run-row { grid-template-columns: 22px 1fr; } .run-row .rc, .run-row .rn { grid-column: 2; } .modal-foot { padding: 12px 16px; } }

/* accordion card (native details) */
details.accordion > summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 2px; }
details.accordion > summary::-webkit-details-marker { display: none; }
details.accordion > summary::after { content: "+"; position: absolute; right: 18px; top: 14px; font-size: 20px; color: var(--muted, #64748b); }
details.accordion[open] > summary::after { content: "–"; }
details.accordion { position: relative; }
details.accordion > summary h2 { margin: 0; }

/* users: permissions in the drawer */
.perm-h { margin: 22px 0 8px; font-size: 14px; }
.perm-grid { display: grid; gap: 10px; margin: 10px 0 8px; padding: 12px 14px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; }
.perm-grid .check:has(input:disabled) { opacity: .6; cursor: default; }
.perm-note { font-size: 12.5px; margin-bottom: 4px; }
.perm-reps { display: grid; gap: 6px; max-height: 190px; overflow: auto; padding: 8px 10px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; }
.perm-admin { padding: 14px 0; }
