/* Baird CRM: app styles on top of brand/tokens.css */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--bf-font-body); font-size: 15px; color: var(--bf-text); background: var(--bf-bg-subtle); line-height: 1.45; }
a { color: var(--bf-link); text-decoration: none; }
a:hover { color: var(--bf-link-hover); text-decoration: underline; }
h1, h2, h3 { font-family: var(--bf-font-display); font-weight: 500; margin: 0; }
h1 { font-size: 1.75rem; color: var(--bf-heading); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; margin: 16px 0 8px; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--bf-text-muted); }
.small { font-size: .85rem; }
.n, td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.demo-bar { background: #FDF1E0; color: #7A4500; font-size: .8rem; text-align: center; padding: 4px 12px; border-bottom: 1px solid #F0D9B5; }

/* shell */
.shell { display: flex; min-height: calc(100vh - 27px); }
.side { width: 240px; flex: none; background: var(--bf-blue-800); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: block; padding: 20px 20px 12px; }
.side .brand img { width: 168px; display: block; }
.side nav { display: flex; flex-direction: column; padding: 8px; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; color: #D9D9F0; padding: 8px 12px; border-radius: var(--bf-radius-md); font-size: .92rem; }
.side nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.side nav a.active { background: #fff; color: var(--bf-blue); font-weight: 600; }
.side-foot { margin-top: auto; padding: 16px 20px; font-size: .75rem; color: #9C9CD0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 16px; padding: 10px 24px; background: var(--bf-surface); border-bottom: 1px solid var(--bf-border); position: sticky; top: 0; z-index: 5; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; color: var(--bf-text); cursor: pointer; }
.search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--bf-bg-subtle); border: 1px solid var(--bf-border); border-radius: var(--bf-radius-md); padding: 0 10px; color: var(--bf-text-muted); }
.search input { border: 0; background: transparent; padding: 9px 0; width: 100%; font: inherit; color: var(--bf-text); outline: none; }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .85rem; }
.who b { display: block; font-weight: 600; }
.who small { color: var(--bf-text-muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--bf-blue-50); color: var(--bf-blue); display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.link { background: none; border: 0; color: var(--bf-link); font: inherit; cursor: pointer; padding: 0; }
.content { padding: 24px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { margin: 4px 0 0; color: var(--bf-text-muted); }
.crumb { font-size: .85rem; color: var(--bf-text-muted); margin-bottom: 4px; display: block; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* cards & grids */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.card { background: var(--bf-surface); border: 1px solid var(--bf-border); border-radius: var(--bf-radius-lg); padding: 18px 20px; box-shadow: var(--bf-shadow-sm); min-width: 0; }
.card + .card { margin-top: 0; }
.stack > * + * { margin-top: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-h h2 { font-size: 1.05rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--bf-surface); border: 1px solid var(--bf-border); border-radius: var(--bf-radius-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: inherit; }
a.stat:hover { border-color: var(--bf-blue-300); text-decoration: none; }
.stat-l { font-size: .8rem; color: var(--bf-text-muted); }
.stat-v { font-family: var(--bf-font-display); font-size: 1.6rem; color: var(--bf-heading); font-variant-numeric: tabular-nums; }
.stat-n { font-size: .78rem; color: var(--bf-text-muted); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: .9rem; margin: 0; }
.kv dt { color: var(--bf-text-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.empty { text-align: center; padding: 40px 16px; color: var(--bf-text-muted); }
.empty.small { padding: 14px; font-size: .9rem; }
.note { background: var(--bf-blue-50); border-left: 3px solid var(--bf-blue); padding: 10px 14px; border-radius: var(--bf-radius-sm); font-size: .88rem; margin-bottom: 16px; }
.note.warn { background: var(--bf-warning-bg); border-color: var(--bf-warning); }
.flash { padding: 10px 14px; border-radius: var(--bf-radius-md); margin-bottom: 16px; font-size: .9rem; }
.flash.success { background: var(--bf-success-bg); color: var(--bf-success); }
.flash.warning { background: var(--bf-warning-bg); color: var(--bf-warning); }
.flash.error { background: var(--bf-danger-bg); color: var(--bf-danger); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; font-weight: 600; color: var(--bf-text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--bf-grey-300); padding: 8px; white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--bf-border); vertical-align: top; }
tr:hover td { background: var(--bf-bg-subtle); }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: var(--bf-radius-sm); white-space: nowrap; }
.tag.ok { background: var(--bf-success-bg); color: var(--bf-success); }
.tag.warn { background: var(--bf-warning-bg); color: var(--bf-warning); }
.tag.err { background: var(--bf-danger-bg); color: var(--bf-danger); }
.tag.info { background: var(--bf-info-bg); color: var(--bf-primary); }
.tag.muted { background: var(--bf-grey-100); color: var(--bf-grey-700); }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; font: 600 .85rem/1 var(--bf-font-body); padding: 9px 14px; border-radius: var(--bf-radius-md); border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.btn.p { background: var(--bf-primary); color: #fff; }
.btn.p:hover { background: var(--bf-primary-hover); text-decoration: none; color: #fff; }
.btn.s { background: var(--bf-surface); color: var(--bf-link); border-color: var(--bf-blue-200); }
.btn.s:hover { border-color: var(--bf-link); text-decoration: none; }
.btn.d { background: var(--bf-danger); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: .78rem; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--bf-focus); outline-offset: 2px; }
form.inline { display: inline; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.form .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; }
.field > span { font-weight: 600; }
.field small { color: var(--bf-text-muted); font-size: .78rem; }
input, select, textarea { font: inherit; font-size: .9rem; padding: 8px 10px; border: 1px solid var(--bf-grey-300); border-radius: var(--bf-radius-md); background: var(--bf-surface); color: var(--bf-text); width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: end; }
.filters select, .filters input { width: auto; min-width: 150px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--bf-border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--bf-text-muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: .9rem; }
.tabs a:hover { color: var(--bf-text); text-decoration: none; }
.tabs a.active { color: var(--bf-blue); border-color: var(--bf-blue); font-weight: 600; }

/* client header */
.client-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.client-head .avatar { width: 56px; height: 56px; font-size: 1.1rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* bars */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 90px; gap: 10px; align-items: center; font-size: .85rem; }
.bt { background: var(--bf-grey-100); border-radius: 3px; height: 12px; overflow: hidden; }
.bt i { display: block; height: 100%; border-radius: 3px; }
.bv { text-align: right; font-variant-numeric: tabular-nums; }
.progress { background: var(--bf-grey-100); border-radius: 999px; height: 8px; overflow: hidden; min-width: 80px; }
.progress i { display: block; height: 100%; background: var(--bf-blue); }

/* kanban */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--bf-grey-100); border-radius: var(--bf-radius-lg); padding: 10px; min-width: 220px; }
.col h3 { margin: 2px 4px 10px; font-family: var(--bf-font-body); font-size: .85rem; font-weight: 700; display: flex; justify-content: space-between; }
.kcard { display: block; background: var(--bf-surface); border: 1px solid var(--bf-border); border-radius: var(--bf-radius-md); padding: 10px; margin-bottom: 8px; color: inherit; font-size: .85rem; }
.kcard:hover { border-color: var(--bf-blue-300); text-decoration: none; }
.kcard b { display: block; }
.kcard .muted { font-size: .78rem; }

/* steps */
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--bf-border); align-items: start; }
.steps .num { width: 26px; height: 26px; border-radius: 50%; background: var(--bf-grey-100); display: grid; place-items: center; font-size: .75rem; font-weight: 700; }
.steps li.done .num { background: var(--bf-success); color: #fff; }
.steps li.done .t { color: var(--bf-text-muted); text-decoration: line-through; }
.steps li.na .t { color: var(--bf-text-muted); font-style: italic; }
.steps .meta { font-size: .78rem; color: var(--bf-text-muted); }
.stage { margin: 18px 0 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--bf-blue); font-weight: 700; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 10px 0 10px 18px; border-left: 2px solid var(--bf-blue-100); position: relative; font-size: .88rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--bf-blue-300); }
.timeline .when { font-size: .75rem; color: var(--bf-text-muted); }
.brief { white-space: pre-wrap; font-size: .92rem; }
.compare td.up { color: var(--bf-danger); font-weight: 600; }
.compare td.down { color: var(--bf-success); font-weight: 600; }

/* auth */
body.auth { background: var(--bf-grey-100); }
.auth-main { min-height: calc(100vh - 27px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { background: #fff; width: 100%; max-width: 400px; padding: 32px; border-radius: var(--bf-radius-lg); box-shadow: var(--bf-shadow-md); }
.auth-logo { display: block; width: 150px; margin: 0 auto 24px; }
.auth-card .field { margin-bottom: 12px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 12px; }
.auth-foot { font-size: .78rem; color: var(--bf-text-muted); margin-top: 16px; }

@media (max-width: 900px) {
  .side { position: fixed; z-index: 20; left: -260px; transition: left .2s; }
  .side.open { left: 0; box-shadow: var(--bf-shadow-md); }
  .menu-btn { display: block; }
  .content { padding: 16px; }
  .top { padding: 8px 16px; }
  .who div, .who a { display: none; }
  .g-main, .g2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 120px 1fr; }
  .bar { grid-template-columns: 90px 1fr 70px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-v { font-size: 1.3rem; }
}
@media print { .side, .top, .page-actions, .demo-bar, .tabs { display: none; } .content { padding: 0; } .card { box-shadow: none; } }
