/* ==========================================================================
   XDMicrobotics — CRM portal. Built on the site's Neotix tokens
   (style.css + neotix.css); only layout/components live here.
   ========================================================================== */
body.app-body, body.auth-body { background: var(--bg); color: var(--text); min-height: 100vh; }
.app-body h1, .auth-body h1 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); letter-spacing: -.035em; }
.app-body h2 { font-size: 1.05rem; letter-spacing: -.02em; }
:where(.app-body) a:where(:not(.btn, .row-card, .chip, .stat-tile)) { color: inherit; }
:where(.app-body main) a:where(:not(.btn, .row-card, .chip, .stat-tile)):hover { color: var(--accent); }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.struck { text-decoration: line-through; color: var(--text-subtle); }
.req { color: var(--accent); }

/* ---------- top bar ---------- */
.app-top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  height: 64px; padding: 0 clamp(14px, 2.4vw, 28px);
  background: var(--bg-solid); border-bottom: 1px solid var(--border);
}
.app-logo img { height: 36px; width: auto; display: block; }
.app-top__spacer { flex: 1; }
.app-menu { display: none; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 12px; background: transparent; color: var(--text); cursor: pointer; }
.app-menu svg { width: 20px; height: 20px; margin: auto; display: block; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.app-side {
  position: sticky; top: 64px; align-self: start; height: calc(100vh - 64px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px; padding: 22px 16px;
  border-right: 1px solid var(--border); background: var(--bg-alt);
}
.who { display: flex; align-items: center; gap: 12px; padding: 4px 8px 16px; border-bottom: 1px solid var(--border); }
.who strong { display: block; font-size: .95rem; line-height: 1.2; overflow-wrap: anywhere; }
.who small { color: var(--text-muted); font-size: .78rem; }
.avatar { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; }
.app-side nav { display: grid; gap: 4px; }
.app-side nav a { display: block; padding: .7rem 1rem; border-radius: 999px; font-weight: 600; font-size: .92rem; color: var(--text-muted); }
.app-side nav a:hover { background: var(--bg-solid); color: var(--text); }
.app-side nav a.is-active { background: var(--panel, #0c0806); color: #fff; }
.side-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding: 0 8px; font-size: .88rem; }
.side-foot a, .side-foot button { color: var(--text-muted); background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.side-foot a:hover, .side-foot button:hover { color: var(--accent); }
.app-main { padding: clamp(18px, 3vw, 40px); max-width: 1180px; width: 100%; display: grid; gap: 22px; align-content: start; }

/* ---------- common blocks ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px; }
.page-head .muted { margin-top: .35rem; }
.crumbs { font-size: .85rem; color: var(--text-muted); margin-bottom: -8px; }
.panel { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(16px, 2vw, 26px); box-shadow: var(--shadow-sm); display: grid; gap: 14px; align-content: start; }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.panel__head a { font-size: .85rem; font-weight: 600; color: var(--accent) !important; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.empty { color: var(--text-subtle); font-size: .92rem; padding: .4rem 0; }

.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-tile { display: grid; gap: .2rem; padding: 18px 20px; background: var(--panel, #0c0806); color: #fff; border-radius: var(--radius); transition: transform .2s var(--ease); }
.stat-tile:hover { transform: translateY(-3px); }
.stat-tile b { font-size: 2.2rem; font-weight: 700; letter-spacing: -.04em; color: var(--orange-300, #ffab82); }
.stat-tile span { font-size: .85rem; color: rgb(255 255 255 / .7); }

.row-card { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-top: 1px solid var(--border); color: inherit; }
.row-card:first-of-type { border-top: 0; }
a.row-card:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.row-card__main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-card__main strong { font-size: .97rem; overflow-wrap: anywhere; }
.row-card__main small { color: var(--text-muted); font-size: .8rem; }
.row-card__prog { display: flex; align-items: center; gap: 10px; width: 150px; flex: none; font-size: .82rem; font-weight: 600; }

.progress { flex: 1; height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent-gradient); transition: width .4s var(--ease); }
.big-progress { display: flex; align-items: center; gap: 16px; }
.big-progress .progress { height: 14px; }
.big-progress b { font-size: 1.5rem; letter-spacing: -.03em; }

.badge { display: inline-block; flex: none; padding: .28rem .75rem; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .01em; background: var(--border); color: var(--text); white-space: nowrap; }
.badge--in-progress, .badge--doing, .badge--task-doing { background: #ffe3d2; color: #a53a05; }
.badge--completed, .badge--resolved, .badge--active, .badge--task-done { background: #d9f2e1; color: #17653a; }
.badge--new { background: var(--accent); color: #fff; }
.badge--on-hold, .badge--awaiting-client, .badge--inactive { background: #f1e4b8; color: #6d5400; }
.badge--in-review { background: #dde6fb; color: #223f8f; }
.badge--closed, .badge--planning, .badge--task-todo, .badge--source { background: var(--border); color: var(--text-muted); }
:root[data-theme="dark"] .badge--in-progress, :root[data-theme="dark"] .badge--task-doing { background: #4a2210; color: #ffb48d; }
:root[data-theme="dark"] .badge--completed, :root[data-theme="dark"] .badge--resolved, :root[data-theme="dark"] .badge--active, :root[data-theme="dark"] .badge--task-done { background: #123a24; color: #86e0a8; }
:root[data-theme="dark"] .badge--on-hold, :root[data-theme="dark"] .badge--awaiting-client, :root[data-theme="dark"] .badge--inactive { background: #3f3410; color: #f0d77a; }
:root[data-theme="dark"] .badge--in-review { background: #1d2a52; color: #a9bff5; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: .45rem 1rem; border-radius: 999px; background: var(--bg-solid); border: 1px solid var(--border); font-size: .84rem; font-weight: 600; color: var(--text-muted); }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-on { background: var(--panel, #0c0806); border-color: transparent; color: #fff; }

.feed-item { padding: 12px 0; border-top: 1px solid var(--border); display: grid; gap: 4px; }
.feed-item:first-of-type { border-top: 0; }
.feed-item small { color: var(--text-muted); font-size: .78rem; }
.feed-item.is-system p { color: var(--text-muted); font-size: .9rem; }
.feed-item.is-internal { border-left: 3px solid #d9a400; padding-left: 12px; }

/* tasks */
.task-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.task-row:first-of-type { border-top: 0; }
.task-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.check { flex: none; width: 24px; height: 24px; padding: 0; border: 2px solid var(--border-strong); border-radius: 8px; background: transparent; cursor: pointer; position: relative; display: inline-block; }
button.check:hover { border-color: var(--accent); }
.check.is-done { background: var(--accent); border-color: var(--accent); }
.check.is-done::after { content: ""; position: absolute; left: 6px; top: 1px; width: 6px; height: 12px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--text-muted); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.icon-btn:hover { border-color: #c0392b; color: #c0392b; }
.add-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.add-row input[name="title"], .add-row input[name="name"] { flex: 1 1 220px; }
.add-row input[name="description"] { flex: 2 1 240px; }

/* forms */
.panel select, .panel input:not([type="checkbox"]):not([type="range"]), .panel textarea, .auth-card input {
  width: 100%; padding: .72rem 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font: inherit; font-size: .93rem;
}
.panel .add-row input, .panel .add-row select, .panel .task-controls select { width: auto; }
.panel .add-row input[name="title"], .panel .add-row input[name="name"] { flex: 1 1 220px; }
.panel .add-row input[name="description"] { flex: 2 1 240px; }
.task-controls select { padding: .45rem .8rem; font-size: .84rem; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--text); font-family: inherit; }
.panel textarea { min-height: 110px; resize: vertical; }
.panel input:focus, .panel select:focus, .panel textarea:focus, .auth-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.panel input[type="range"] { accent-color: var(--accent); padding: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field--wide { grid-column: 1 / -1; }
.field label, .field legend { font-size: .82rem; font-weight: 600; margin-bottom: .1rem; }
fieldset.field { border: 0; padding: 0; min-width: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.check-pill { display: inline-flex; align-items: center; gap: 8px; padding: .45rem .9rem; border: 1px solid var(--border); border-radius: 999px; font-size: .85rem; font-weight: 600; cursor: pointer; background: var(--bg); }
.check-pill small { color: var(--text-muted); font-weight: 500; }
.check-pill input { accent-color: var(--accent); }
.post-form { display: grid; gap: 10px; margin-bottom: 8px; }
.post-form__bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.danger, .danger { color: #c0392b; border-color: #c0392b; }
.danger-zone { justify-self: start; }
.btn--ghost { background: transparent; border: 1px solid var(--border-strong); color: var(--text); }
.btn--ghost:hover { background: var(--text); color: var(--bg-solid); }

/* messages */
.msg { padding: 14px 16px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border); display: grid; gap: 6px; max-width: 760px; }
.msg small { color: var(--text-muted); font-size: .78rem; }
.msg--staff { background: color-mix(in srgb, var(--accent) 8%, var(--bg-elevated)); border-color: color-mix(in srgb, var(--accent) 25%, var(--border)); margin-left: clamp(0px, 6vw, 60px); }
.msg--internal { background: #fbf3d6; border-color: #e5cf7b; color: #3b3000; }
.msg--internal small { color: #6d5400; }
:root[data-theme="dark"] .msg--internal { background: #2d2508; border-color: #5c4a10; color: #f1e6b8; }
.attach { font-weight: 600; font-size: .88rem; color: var(--accent) !important; }

/* tables / roles */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--text-subtle); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.role-list { display: grid; gap: 8px; }
.role-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.role-item small { display: block; color: var(--text-muted); font-size: .8rem; }

/* flashes */
.flash { padding: .85rem 1.1rem; border-radius: var(--radius-sm); font-size: .92rem; font-weight: 500; border: 1px solid var(--border); background: var(--bg-solid); overflow-wrap: anywhere; }
.flash--ok { border-color: #8fd1a8; background: #e6f6ec; color: #145a33; }
.flash--err { border-color: #e6a39b; background: #fdeceb; color: #8d1f14; }
.flash--warn { border-color: #e5cf7b; background: #fbf3d6; color: #5c4700; }
.flash--secret { border-color: var(--accent); background: #fff1e8; color: #7a2c04; font-weight: 700; font-family: ui-monospace, Consolas, monospace; }
:root[data-theme="dark"] .flash--ok { background: #0f2c1c; color: #8fe0ad; }
:root[data-theme="dark"] .flash--err { background: #35130f; color: #ffb3aa; }
:root[data-theme="dark"] .flash--warn { background: #2d2508; color: #f1e6b8; }
:root[data-theme="dark"] .flash--secret { background: #3a1a0b; color: #ffc9a8; }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 22px; padding: 28px 18px; }
.auth-logo img { height: 52px; width: auto; }
.auth-card { width: min(440px, 100%); display: grid; gap: 16px; padding: clamp(24px, 4vw, 38px); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); justify-items: start; }
.auth-card > * { max-width: 100%; }
.stack-form { display: grid; gap: 14px; width: 100%; }
.stack-form .btn { justify-content: center; }
.auth-foot { font-size: .88rem; color: var(--text-muted); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .app-menu { display: grid; }
  .app-side { position: fixed; z-index: 40; top: 64px; left: 0; width: min(290px, 86vw); height: calc(100vh - 64px); transform: translateX(-102%); transition: transform .25s var(--ease); box-shadow: var(--shadow-xl); }
  .app-side.is-open { transform: none; }
  .row-card { flex-wrap: wrap; }
  .row-card__prog { width: 100%; order: 5; }
  .form-grid { grid-template-columns: 1fr; }
  .msg--staff { margin-left: 0; }
}

/* ---------- login page (split layout) ---------- */
.login-page { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.login-hero { position: relative; isolation: isolate; overflow: hidden; display: grid; align-content: space-between; padding: clamp(28px, 4vw, 56px); background: #0c0806; color: #fff; }
.login-hero video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .45; z-index: -2; }
.login-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(160deg, rgb(12 8 6 / .55), rgb(12 8 6 / .92)); }
.login-hero__inner { display: grid; gap: 22px; justify-items: start; max-width: 520px; }
.login-hero .auth-logo { padding: 6px 14px; background: #fff; border-radius: 14px; }
.login-hero .auth-logo img { height: 40px; }
.login-hero .eyebrow { background: #fff; color: #0f0b08; }
.login-hero h2 { font-size: clamp(2rem, 3.6vw, 3.1rem); color: #fff; }
.login-points { list-style: none; padding: 0; display: grid; gap: 12px; color: rgb(255 255 255 / .82); }
.login-points li { position: relative; padding-left: 28px; }
.login-points li::before { content: "\2731"; position: absolute; left: 0; color: var(--accent); }
.login-main { position: relative; display: grid; place-items: center; padding: 28px 18px; background: var(--bg); }
.login-theme { position: absolute; top: 18px; right: 18px; color: var(--text); border-color: var(--border-strong); }
.login-card { width: min(440px, 100%); display: grid; gap: 16px; }
.login-card h1 { font-size: clamp(1.7rem, 2.6vw, 2.2rem); }
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 5px; gap: 4px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px; }
.seg a { text-align: center; padding: .7rem 1rem; border-radius: 999px; font-weight: 700; font-size: .92rem; color: var(--text-muted); }
.seg a:hover { color: var(--text); }
.seg a.is-on { background: var(--panel, #0c0806); color: #fff; }
.login-card .field { display: grid; gap: .45rem; }
.login-card .field label { font-size: .82rem; font-weight: 600; }
.login-card input { width: 100%; padding: .9rem 1.1rem; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: 14px; color: var(--text); font: inherit; }
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.pw { position: relative; }
.pw input { padding-right: 4.6rem; }
.pw__show { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); padding: .35rem .8rem; border: 0; border-radius: 999px; background: var(--bg-alt); color: var(--text-muted); font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; }
.login-card .auth-foot { text-align: center; }
.login-card .form__note a { color: var(--accent); font-weight: 600; }
@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero { padding: 22px; }
  .login-hero__inner { gap: 14px; }
  .login-points { display: none; }
  .login-hero h2 { font-size: 1.5rem; }
}
.app-logo { padding: 5px 12px; background: #fff; border-radius: 12px; box-shadow: 0 1px 6px rgb(0 0 0 / .15); }
.app-logo img { height: 30px; }

/* ---------- search, bell, notifications ---------- */
.app-search { position: relative; flex: 1 1 320px; max-width: 420px; }
.app-search svg { position: absolute; left: 14px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--text-subtle); pointer-events: none; }
.app-search input { width: 100%; padding: .62rem 1rem .62rem 2.6rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: .9rem; }
.app-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.bell { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--text); }
.bell:hover { border-color: var(--accent); color: var(--accent); }
.bell svg { width: 19px; height: 19px; }
.bell__dot { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; display: grid; place-items: center; border-radius: 999px; background: var(--accent); color: #fff; font-size: .68rem; font-weight: 800; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 800; text-align: center; line-height: 20px; }
.app-side nav a.is-active .count { background: #fff; color: var(--accent); }
.notif { gap: 12px; }
.notif__dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: transparent; }
.notif.is-unread .notif__dot { background: var(--accent); }
.notif.is-unread strong { font-weight: 800; }

/* ---------- toolbar, segmented small, board ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.filter-search { flex: 1 1 280px; max-width: 460px; }
.filter-search input { width: 100%; padding: .65rem 1.1rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); font: inherit; font-size: .9rem; }
.filter-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.seg--sm { width: 190px; padding: 4px; }
.seg--sm a { padding: .45rem .8rem; font-size: .85rem; }
.board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.board__col { display: grid; gap: 10px; align-content: start; padding: 12px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); min-height: 160px; }
.board__col header { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px; }
.board__col h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.board__col .count { margin: 0; background: var(--panel, #0c0806); }
.board__card { display: grid; gap: 8px; padding: 14px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); }
.board__card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.board__title { font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.board__card small { color: var(--text-muted); }
.board__card .row-card__prog { width: 100%; }
.board__meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .78rem; color: var(--text-muted); }
.board__meta select { width: auto; padding: .3rem .6rem; font-size: .78rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font-family: inherit; }
.board .empty { padding: .6rem .4rem; font-size: .85rem; }

/* ---------- charts, priority, overdue ---------- */
.chart-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.bars { display: grid; gap: 10px; }
.bars__row { display: grid; grid-template-columns: 110px 1fr 28px; gap: 10px; align-items: center; font-size: .84rem; }
.bars__row span { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars__row b { text-align: right; }
.bars__track { height: 10px; border-radius: 999px; background: var(--border); overflow: hidden; }
.bars__track i { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--accent-gradient); transition: width .5s var(--ease); }
.prio { font-weight: 700; }
.prio--high { color: #c0392b; }
.prio--medium { color: #b7791f; }
.prio--low { color: #2f855a; }
.overdue { color: #c0392b !important; font-weight: 700; }
.flash.is-fading { opacity: 0; transform: translateY(-6px); transition: opacity .4s, transform .4s; }
@media (max-width: 980px) { .chart-row { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .app-search { display: none; } }

@media (min-width: 821px) { .side-search { display: none !important; } }
.board { grid-template-columns: repeat(5, minmax(200px, 1fr)); }
.board__col { min-width: 0; }
.board__meta span { white-space: nowrap; }
.board__meta select { max-width: 130px; }

/* ---------- charts, KPIs ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.chart-grid .chart-wide { grid-column: span 2; }
.chart-grid > .panel { min-width: 0; }
.chart-box { position: relative; height: 260px; }
.chart-box--sm { height: 150px; width: 230px; flex: none; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--text-subtle); font-size: .9rem; }
.proj-hero { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: space-between; }
.proj-hero > div:first-child { flex: 1 1 280px; display: grid; gap: 8px; }
.stats-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { display: grid; gap: 4px; padding: 16px 18px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); align-content: start; }
.kpi span { font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-subtle); }
.kpi b { font-size: 1.7rem; letter-spacing: -.03em; line-height: 1.1; }
.kpi b.kpi__text { font-size: 1rem; letter-spacing: 0; line-height: 1.3; }
.kpi small { color: var(--text-muted); font-size: .78rem; }
.kpi--bad b { color: #c0392b; }
.kpi-grid--sm { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.panel select.canned { max-width: 280px; width: auto; padding: .5rem .9rem; border-radius: 999px; font-size: .85rem; }
.badge--proposal-sent { background: #dde6fb; color: #223f8f; }
.badge--won { background: #d9f2e1; color: #17653a; }
.badge--lost { background: #fdeceb; color: #8d1f14; }
:root[data-theme="dark"] .badge--proposal-sent { background: #1d2a52; color: #a9bff5; }
:root[data-theme="dark"] .badge--won { background: #123a24; color: #86e0a8; }
:root[data-theme="dark"] .badge--lost { background: #35130f; color: #ffb3aa; }
@media (max-width: 980px) { .chart-grid { grid-template-columns: 1fr; } .chart-grid .chart-wide { grid-column: auto; } .stats-row--3 { grid-template-columns: 1fr; } }

/* ---------- layout fixes ---------- */
/* Board cards must shrink to their column instead of forcing it wider and overlapping the next one. */
.board__col > * { min-width: 0; }
.board__card { min-width: 0; }
.board__meta { flex-wrap: wrap; }
.board__meta span { white-space: normal; }
.board__meta select { max-width: 100%; }
/* Big stat figures (e.g. currency totals) scale down on narrow screens instead of spilling into the next tile. */
.stat-tile { min-width: 0; container-type: inline-size; }
.stat-tile b { font-size: clamp(1.1rem, 17cqi, 2.2rem); white-space: nowrap; line-height: 1.1; }
