/* ProBridge UI — original design (navy + teal). */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #5d6b7e;
  --line: #e2e7ee;
  --nav: #14213d;
  --nav-ink: #c7d0df;
  --nav-active: #24365c;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f4f2;
  --danger: #c0392b;
  --warn: #b7791f;
  --ok: #2f855a;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; color: var(--ink);
  background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.sidebar { background: var(--nav); color: var(--nav-ink); padding: 14px 10px; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 17px;
  padding: 4px 8px 14px; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); display: grid;
  place-items: center; font-size: 15px; }
.firm-switch { margin: 0 4px 12px; }
.firm-switch select { width: 100%; background: var(--nav-active); color: #fff; border: 0; border-radius: 6px;
  padding: 6px; font: inherit; }
.firm-name { padding: 0 8px 12px; font-size: 12px; color: #9fb0c8; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7f90aa;
  padding: 12px 10px 4px; }
.sidebar a { display: flex; align-items: center; gap: 8px; color: var(--nav-ink); padding: 6px 10px;
  border-radius: 6px; font-size: 13.5px; }
.sidebar a:hover { background: var(--nav-active); text-decoration: none; color: #fff; }
.sidebar a.active { background: var(--nav-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar form.search { flex: 1; max-width: 420px; }
.topbar .spacer { flex: 1; }
.timer-pill { display: inline-flex; align-items: center; gap: 6px; background: #fff4e5; color: #8a5300;
  border-radius: 999px; padding: 4px 10px; font-size: 12.5px; }
.timer-pill .dot { width: 8px; height: 8px; background: #e67e22; border-radius: 50%; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.user-menu { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.content { padding: 22px 24px 60px; max-width: 1400px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.subtle { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Components ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 14px 16px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 12.5px; }
.stat.danger .num { color: var(--danger); }
.stat.warn .num { color: var(--warn); }
a.stat { color: inherit; display: block; }
a.stat:hover { text-decoration: none; border-color: var(--accent); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9c3d1; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: #f0c8c3; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; }
form.inline { display: inline; }

.input, select.input, textarea.input { width: 100%; padding: 7px 9px; border: 1px solid #cdd5e0; border-radius: 6px;
  font: inherit; background: #fff; color: var(--ink); }
.input:focus { outline: 2px solid #9fd6cf; border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; color: #344255; }
.field.wide { grid-column: 1 / -1; }
.field .help { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.field .err, .errorlist { color: var(--danger); font-size: 12px; margin: 3px 0 0; padding: 0; list-style: none; }
.field ul:not(.errorlist) { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.field ul label { font-weight: 400; display: inline-flex; gap: 5px; align-items: center; }
.field.check label { display: inline-flex; gap: 6px; align-items: center; }
.form-actions { margin-top: 18px; display: flex; gap: 8px; }

.tabs { display: inline-flex; background: #e8edf3; border-radius: 7px; padding: 3px; gap: 2px; }
.tabs a { padding: 5px 12px; border-radius: 5px; color: var(--muted); font-size: 13px; }
.tabs a.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .input { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; font-size: 12.5px; color: var(--ink); }
.chip .n { font-weight: 700; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); }
.chip:hover { text-decoration: none; border-color: var(--accent); }

table.list { width: 100%; border-collapse: collapse; background: var(--panel); }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow-x: auto; box-shadow: var(--shadow); }
table.list th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 9px 12px;
  border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
table.list td { padding: 9px 12px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: #fafcfd; }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; }
table.list tfoot td { font-weight: 700; background: #fafbfd; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: #e8edf3; color: #3d4b5f; white-space: nowrap; }
.badge.code { border-radius: 5px; background: #dfe9f7; color: #1f3a5f; font-family: Consolas, monospace; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.green, .badge.paid, .badge.completed, .badge.on_track, .badge.done { background: #dcf3e6; color: #22673f; }
.badge.yellow, .badge.at_risk, .badge.in_progress { background: #fdf0c8; color: #7a5a00; }
.badge.red, .badge.overdue { background: #fbdcd8; color: #9b2c22; }
.badge.purple, .badge.stuck { background: #ece0fb; color: #5b2b9a; }
.badge.gray, .badge.draft, .badge.void, .badge.todo { background: #e8edf3; color: #4a5568; }
.badge.sent { background: #dbeafe; color: #1e40af; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: #cfe3f7; color: #1f3a5f; font-size: 11px; font-weight: 700; margin-right: -4px;
  border: 2px solid #fff; }

.messages { list-style: none; margin: 0 0 14px; padding: 0; }
.messages li { padding: 9px 14px; border-radius: 6px; margin-bottom: 6px; background: #e3f4f2; color: #0d4f4a; }
.messages li.error { background: #fbdcd8; color: #8a2017; }
.messages li.info { background: #e3ecfa; color: #1f3a5f; }

.pagination { display: flex; gap: 6px; align-items: center; margin-top: 12px; }

/* Kanban */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.column { flex: 0 0 260px; background: #e9eef4; border-radius: var(--radius); padding: 10px; }
.column h3 { display: flex; justify-content: space-between; font-size: 13px; }
.kcard { background: #fff; border-radius: 6px; padding: 9px 10px; margin-bottom: 8px; box-shadow: var(--shadow);
  border-left: 3px solid var(--accent); }
.kcard.overdue { border-left-color: var(--danger); }
.kcard.stuck { border-left-color: #7c3aed; }
.kcard.at_risk { border-left-color: var(--warn); }
.kcard .t { font-weight: 600; }
.kcard select { font-size: 12px; padding: 2px; margin-top: 6px; width: 100%; }

/* Calendar */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; background: #fff; }
.cal th { padding: 6px; font-size: 12px; color: var(--muted); text-align: left; border-bottom: 1px solid var(--line); }
.cal td { height: 110px; vertical-align: top; border: 1px solid var(--line); padding: 4px 6px; }
.cal td.other { background: #f7f9fb; color: #aab4c2; }
.cal td.today { background: var(--accent-soft); }
.cal .d { font-size: 12px; font-weight: 600; }
.cal .ev { display: block; font-size: 11.5px; padding: 2px 5px; border-radius: 4px; margin-top: 3px;
  background: #eef2f7; color: var(--ink); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal .ev.Job { background: #dbeafe; }
.cal .ev.Task { background: #fdf0c8; }
.cal .ev.done { text-decoration: line-through; opacity: .6; }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--nav); padding: 20px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 12px; padding: 28px; }
.auth-card .brand { color: var(--ink); padding: 0 0 18px; }
.auth-card .field { margin-bottom: 12px; }

dl.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 10px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 12.5px; }
dl.kv dd { margin: 0; }
.totals { margin-left: auto; width: 300px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-weight: 700; border-top: 1px solid var(--ink); margin-top: 4px; padding-top: 6px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .grid.cols-2 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

/* Inputs rendered by Django's built-in auth forms (password change/reset) */
.auth-card input[type=password], .auth-card input[type=email], .auth-card input[type=text] {
  width: 100%; padding: 7px 9px; border: 1px solid #cdd5e0; border-radius: 6px; font: inherit; }
.auth-card .help { margin-bottom: 2px; }

/* Notification bell */
.bell { position: relative; font-size: 18px; padding: 2px 6px; border-radius: 6px; text-decoration: none; }
.bell:hover { background: #eef2f7; text-decoration: none; }
.bell-n { position: absolute; top: -4px; right: -6px; background: var(--danger); color: #fff; font-size: 10.5px;
  font-weight: 700; border-radius: 999px; padding: 1px 5px; line-height: 1.3; }
.sidebar a .badge { padding: 0 6px; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 78%; padding: 9px 12px; border-radius: 10px; background: #eef2f7; }
.bubble.mine { align-self: flex-end; background: var(--accent-soft); }
.bubble .who { color: var(--muted); margin-bottom: 3px; }
