/* Crepo CRM - Phase 1
   Shell theme: Crepo Media. Brand tabs override --brand / --brand-2. */

:root {
  --ink: #050505;
  --text: #222222;
  --muted: #666a70;
  --faint: #888888;
  --line: #e0e0e0;
  --line-soft: #ececec;
  --canvas: #f6f7f8;
  --card: #ffffff;

  --crepo-blue: #3569a7;
  --crepo-cyan: #00a8c6;
  --crepo-teal: #216b66;
  --crepo-grad: linear-gradient(135deg, #2fb8ad 0%, #2a8fb4 45%, #3553a3 100%);

  --brand: var(--crepo-blue);
  --brand-2: var(--crepo-cyan);
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 9%, white);
  --brand-line: color-mix(in srgb, var(--brand) 28%, white);

  --alert: #c62828;
  --alert-soft: #fdecec;
  --warn: #b26a00;
  --warn-soft: #fff4e0;
  --ok: #1e7a46;
  --ok-soft: #e7f5ec;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(5, 5, 5, .04), 0 4px 14px rgba(5, 5, 5, .05);
  --shadow-lg: 0 10px 40px rgba(5, 5, 5, .16);

  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Archivo', 'Manrope', system-ui, sans-serif;
  --sidebar: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); margin: 0; font-stretch: 108%; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }
.hide { display: none !important; }

/* ------------------------------------------------ Shell */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sb-brand { padding: 18px 18px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); }
.sb-brand img { height: 30px; width: auto; display: block; }
.wordmark {
  font-family: var(--font-display); font-weight: 800; font-stretch: 125%;
  font-size: 15px; letter-spacing: .04em;
  background: var(--crepo-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1;
}
.sb-brand .sub { display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin-top: 4px; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 600; font-size: 13.5px;
}
.nav a:hover { background: var(--canvas); text-decoration: none; }
.nav a.on { background: color-mix(in srgb, var(--crepo-blue) 9%, white); color: var(--crepo-blue); }
.nav a svg { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--alert); color: #fff; }
.nav-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 4px; }
.sb-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--crepo-grad); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; flex: 0 0 32px; }
.sb-foot .who { min-width: 0; }
.sb-foot .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-foot .who span { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.sb-foot a.out { margin-left: auto; color: var(--faint); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--ink); font-stretch: 108%; }
.topbar .date { font-size: 12px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.topbar .mlogo { display: none; }
.content { padding: 22px 24px 60px; }

/* top accent line in brand colour */
.brandbar { height: 3px; background: var(--crepo-grad); }
body[data-brand]:not([data-brand="crepo"]) .brandbar { background: linear-gradient(90deg, var(--brand), var(--brand-2)); }

/* ------------------------------------------------ Buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff; color: var(--text);
  font: 600 13px var(--font); cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--canvas); text-decoration: none; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 88%, black); }
.btn.accent { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.danger { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 30%, white); }
.btn.danger:hover { background: var(--alert-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--canvas); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

label.f { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); margin: 0 0 5px; letter-spacing: .02em; }
label.f .req { color: var(--alert); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font: 500 14px var(--font);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.input.sm { height: 32px; font-size: 13px; padding: 0 9px; }
select.input { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

/* segmented chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 99px;
  border: 1px solid var(--line); background: #fff;
  font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer;
}
.chip:hover { text-decoration: none; background: var(--canvas); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ------------------------------------------------ Cards, tables, badges */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.card-h .spacer { flex: 1; }
.card-b { padding: 16px; }
.card-b.flush { padding: 0; }
.section-gap { margin-top: 18px; }

.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .spacer { flex: 1; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; }
.stat .k { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.stat .v { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--ink); margin-top: 4px; font-variant-numeric: tabular-nums; font-stretch: 105%; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.alert { border-color: color-mix(in srgb, var(--alert) 35%, white); background: linear-gradient(0deg, #fff, var(--alert-soft)); }
.stat.alert .v { color: var(--alert); }
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--crepo-grad); opacity: .9; }
.stat.alert::before { background: var(--alert); }

table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafafa; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
table.t th a { color: inherit; }
table.t th a.on { color: var(--brand); }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.t tr:hover td { background: #fbfbfc; }
table.t tr.row-alert td:first-child { box-shadow: inset 3px 0 0 var(--alert); }
.table-wrap { overflow-x: auto; }
.t .lead-cell { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.t .lead-cell b { display: block; color: var(--ink); }
.t .lead-cell span { font-size: 12px; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
  background: var(--canvas); color: var(--muted); border: 1px solid var(--line-soft);
}
.badge.alert { background: var(--alert-soft); color: var(--alert); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.brand { background: var(--b-soft, var(--brand-soft)); color: var(--b, var(--brand)); border-color: transparent; }
.badge.high { background: var(--alert-soft); color: var(--alert); border-color: transparent; }
.badge.low { background: var(--canvas); color: var(--faint); }

.stage-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.stage-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--sc, var(--faint)); }
.st-new { --sc: #8a94a3; } .st-contacted { --sc: #00a8c6; } .st-meeting { --sc: #3569a7; }
.st-proposal { --sc: #6b4fbb; } .st-negotiation { --sc: #c77700; } .st-won { --sc: #1e7a46; }
.st-active { --sc: #216b66; } .st-lost { --sc: #b0b0b0; }

/* per-brand colour scoping for mixed views */
.bstrip { box-shadow: inset 4px 0 0 var(--b, var(--brand)); }
.bdot { width: 9px; height: 9px; border-radius: 50%; background: var(--b, var(--brand)); display: inline-block; flex: 0 0 9px; }

.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.empty b { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }

/* flash */
.flash { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 600; font-size: 13px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--alert-soft); color: var(--alert); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px;
  font-weight: 600; font-size: 13px; opacity: 0; transition: .2s; z-index: 200; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--alert); }

/* ------------------------------------------------ Today */
.today-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.list { list-style: none; margin: 0; padding: 0; }
.li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
}
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .ttl { font-weight: 700; color: var(--ink); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .ttl:hover { color: var(--b, var(--brand)); }
.li .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.li .acts { display: flex; gap: 6px; flex: 0 0 auto; }
.li.alert { background: linear-gradient(90deg, var(--alert-soft), #fff 40%); }
.group-h { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: #fafafa; border-bottom: 1px solid var(--line-soft); }
.group-h.alert { color: var(--alert); background: var(--alert-soft); }
.group-h .n { margin-left: auto; font-weight: 800; }

.task-check { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line); background: #fff; cursor: pointer; flex: 0 0 20px; display: grid; place-items: center; padding: 0; }
.task-check:hover { border-color: var(--brand); }
.task-check.done { background: var(--ok); border-color: var(--ok); }
.task-check.done::after { content: ''; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.li.done .ttl { text-decoration: line-through; color: var(--faint); }

.brand-mini { display: flex; flex-direction: column; gap: 10px; }
.brand-mini .row { display: flex; align-items: center; gap: 10px; }
.brand-mini .bar { flex: 1; height: 8px; border-radius: 99px; background: var(--canvas); overflow: hidden; }
.brand-mini .bar i { display: block; height: 100%; background: var(--b); border-radius: 99px; }

/* ------------------------------------------------ Board */
.board-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.board-tools .spacer { flex: 1; }
.btabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.btab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; font-weight: 700; font-size: 13.5px; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.btab:hover { color: var(--text); text-decoration: none; }
.btab.on { color: var(--ink); border-bottom-color: var(--b, var(--brand)); }
.btab .cnt { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--canvas); padding: 1px 7px; border-radius: 99px; }

.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; scroll-snap-type: x proximity; }
.col {
  flex: 0 0 258px; background: #eff1f3; border-radius: var(--radius);
  display: flex; flex-direction: column; max-height: calc(100vh - 230px); scroll-snap-align: start;
}
.col-h { padding: 12px 12px 8px; }
.col-h .r1 { display: flex; align-items: center; gap: 8px; }
.col-h .r1 .stage-pill { font-size: 13px; color: var(--ink); }
.col-h .cnt { font-size: 11.5px; font-weight: 700; color: var(--muted); background: #fff; border-radius: 99px; padding: 1px 8px; }
.col-h .add { margin-left: auto; }
.col-h .sum { font-size: 12px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.col-body { padding: 4px 8px 10px; overflow-y: auto; flex: 1; min-height: 80px; display: flex; flex-direction: column; gap: 8px; }
.col.closed { background: #f3f4f5; }
.col-body:not(:has(.kcard))::after { content: 'Drop a lead here'; display: block; text-align: center; color: var(--faint); font-size: 12px; padding: 18px 6px; border: 1.5px dashed #d6d9dd; border-radius: 9px; }
.kcard {
  background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px 10px;
  cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.04); position: relative;
  box-shadow: inset 3px 0 0 var(--b, var(--brand)), 0 1px 2px rgba(0,0,0,.04);
}
.kcard:hover { border-color: #cfd3d8; }
.kcard.alert { border-color: color-mix(in srgb, var(--alert) 55%, white); background: linear-gradient(180deg, #fff 60%, var(--alert-soft)); }
.kcard .nm { font-weight: 700; color: var(--ink); font-size: 13.5px; display: block; padding-right: 20px; }
.kcard .nm:hover { text-decoration: none; color: var(--b, var(--brand)); }
.kcard .co { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kcard .r2 { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 9px; }
.kcard .val { font-weight: 800; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.kcard .r3 { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--muted); }
.kcard .r3 .fu { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.kcard .r3 .fu.alert { color: var(--alert); }
.kcard .r3 .fu svg { width: 13px; height: 13px; stroke: currentColor; }
.kcard .r3 .own { margin-left: auto; }
.kcard .quick { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity .1s; }
.kcard:hover .quick { opacity: 1; }
.kcard .flags { display: flex; gap: 4px; margin-top: 7px; flex-wrap: wrap; }
.kcard .badge { height: 20px; font-size: 11px; padding: 0 6px; }
.kcard .r2 .badge { max-width: 170px; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 20px; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: var(--shadow-lg); }
.col.drop-hover { outline: 2px dashed var(--brand); outline-offset: -2px; }

/* ------------------------------------------------ Lead page */
.lead-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.lead-head .crumb { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.lead-head h1 { font-size: 26px; }
.lead-head .sub { color: var(--muted); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lead-head .spacer { flex: 1; }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 18px; align-items: start; }
.stagebar { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; }
.stagebar button {
  flex: 1 1 0; min-width: 96px; height: 34px; border: 1px solid var(--line); background: #fff;
  font: 700 12px var(--font); color: var(--muted); cursor: pointer; border-radius: 6px; white-space: nowrap; padding: 0 8px;
}
.stagebar button:hover { border-color: var(--b, var(--brand)); color: var(--text); }
.stagebar button.past { background: color-mix(in srgb, var(--b, var(--brand)) 10%, white); color: var(--b, var(--brand)); border-color: transparent; }
.stagebar button.on { background: var(--b, var(--brand)); color: #fff; border-color: var(--b, var(--brand)); }
.stagebar button.lost.on { background: #8a8f96; border-color: #8a8f96; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; color: var(--ink); word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0 16px 8px; }
.tl { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.tl:last-child { border-bottom: 0; }
.tl .ic { width: 32px; height: 32px; border-radius: 50%; background: var(--canvas); display: grid; place-items: center; flex: 0 0 32px; color: var(--b, var(--brand)); }
.tl .ic svg { width: 16px; height: 16px; stroke: currentColor; }
.tl .ic.sys { background: transparent; color: var(--faint); }
.tl .bd { flex: 1; min-width: 0; }
.tl .hd { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.tl .hd b { color: var(--ink); }
.tl .tx { margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.tl .nx { margin-top: 6px; font-size: 12px; }

/* ------------------------------------------------ Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(5,5,5,.42); z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; }
.modal-bg.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 620px; box-shadow: var(--shadow-lg); }
.modal.sm { max-width: 440px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-h h2 { flex: 1; }
.modal-b { padding: 18px 20px; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.modal-f .spacer { flex: 1; }
.form-err { color: var(--alert); font-weight: 600; font-size: 13px; }
.quick-dates { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.quick-dates button { height: 24px; padding: 0 8px; border: 1px solid var(--line); background: #fff; border-radius: 6px; font: 600 11.5px var(--font); color: var(--muted); cursor: pointer; }
.quick-dates button:hover { border-color: var(--brand); color: var(--brand); }

/* ------------------------------------------------ Filters bar */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.filters .fld { display: flex; flex-direction: column; gap: 4px; }
.filters .fld label { font-size: 11px; font-weight: 700; color: var(--muted); }
.filters .input { width: auto; min-width: 130px; }
.filters .search { min-width: 220px; }
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px; justify-content: flex-end; font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------ Login & install */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.auth-art { background: var(--crepo-grad); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255,255,255,.08); }
.auth-art .wm { font-family: var(--font-display); font-weight: 800; font-stretch: 125%; letter-spacing: .05em; font-size: 20px; }
.auth-art h1 { color: #fff; font-size: 40px; line-height: 1.1; max-width: 460px; font-stretch: 110%; }
.auth-art p { opacity: .85; max-width: 420px; font-size: 15px; }
.auth-art .brands { display: flex; gap: 18px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; opacity: .85; flex-wrap: wrap; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form form { width: 100%; max-width: 360px; }
.auth-form h2 { font-size: 22px; margin-bottom: 6px; }
.auth-form .grid { margin-top: 22px; }
.install { max-width: 720px; margin: 40px auto; padding: 0 16px; }

/* ------------------------------------------------ Mobile */
.bottomnav { display: none; }
@media (max-width: 1100px) {
  .today-grid, .lead-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .topbar { padding: 0 14px; }
  .topbar .mlogo { display: block; }
  .topbar .title { font-size: 15px; }
  .topbar .date { display: none; }
  .content { padding: 16px 14px 90px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .page-head h1 { font-size: 20px; }
  .col { flex-basis: 84vw; max-height: none; }
  .board { margin: 0 -14px; padding: 0 14px 12px; }
  .kcard .quick { opacity: 1; }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 700; color: var(--muted); padding: 4px 0; position: relative; }
  .bottomnav a svg { width: 21px; height: 21px; stroke: currentColor; }
  .bottomnav a.on { color: var(--crepo-blue); }
  .bottomnav a:hover { text-decoration: none; }
  .bottomnav .count { position: absolute; top: 0; left: 55%; font-size: 9.5px; background: var(--alert); color: #fff; border-radius: 99px; padding: 0 5px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { padding: 28px 24px; min-height: auto; }
  .auth-art h1 { font-size: 26px; margin: 24px 0 8px; }
  .auth-art .brands { display: none; }
  .li { flex-wrap: wrap; }
  .li .acts { width: 100%; justify-content: flex-end; }
  .filters .input, .filters .search { min-width: 0; width: 100%; }
  .filters .fld { flex: 1 1 45%; }
  .filter-toggle { display: inline-flex; }
  .filters:not(.open) .fld:not(.always) { display: none; }
  .filters .fld.always { flex: 1 1 100%; }
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { border-radius: 14px 14px 0 0; max-height: 92vh; overflow-y: auto; }
  .kv { grid-template-columns: 100px 1fr; }
  .hide-m { display: none !important; }
}
@media print {
  .sidebar, .topbar, .bottomnav, .btn { display: none !important; }
}

/* inline icons inside small elements */
.badge svg, .tl .nx svg, .meta svg { width: 12px; height: 12px; stroke: currentColor; vertical-align: -1px; }
.btn.xs svg { width: 14px; height: 14px; }
.btn.xs.icon { width: 28px; padding: 0; }
.tl.sys { padding: 8px 0; }
.tl.sys .ic { height: 22px; }
.filter-toggle { display: none; }
.crumb svg { width: 14px; height: 14px; stroke: currentColor; vertical-align: -2px; }
