/* Red Sign Recruit CRM. Brand: red #d32228, gray #4a4a4c, black #000.
   Body: Roboto (local install, else system sans). Headers: Helvetica Neue / Arial
   stand in for Nimbus Sans (licensed). Drop webfont files in static/fonts and add
   @font-face rules here to self-host. */
:root {
  --red: #d32228;
  --red-dark: #a8191e;
  --red-tint: #fbe9e9;
  --gray: #4a4a4c;
  --gray-2: #6e6e70;
  --line: #e2e2e4;
  --bg: #f6f6f7;
  --card: #ffffff;
  --ink: #111111;
  --ok: #1f7a3a;
  --ok-tint: #e6f4ea;
  --warn: #8a5a00;
  --warn-tint: #fff4dc;
  --radius: 8px;
  --head: "Nimbus Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --body: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); }
h1, h2, h3 { font-family: var(--head); color: var(--ink); line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--gray-2); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* Header */
.topbar { background: var(--card); border-bottom: 3px solid var(--red); }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand img { height: 30px; display: block; }
.brand-sub { font: 600 .7rem var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--gray); }
nav.main { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav.main a { color: var(--gray); padding: 6px 10px; border-radius: 6px; font-weight: 500; }
nav.main a:hover, nav.main a.active { background: var(--red-tint); color: var(--red); text-decoration: none; }
.userbox { display: flex; align-items: center; gap: 10px; color: var(--gray); font-size: .9rem; }

main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }

/* Cards / grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: var(--radius); padding: 12px 14px; }
.stat .n { font: 700 1.6rem var(--head); }
.stat .l { color: var(--gray-2); font-size: .85rem; }

/* Buttons and forms */
button, .btn { display: inline-block; font: 600 .9rem var(--body); border-radius: 6px; padding: 8px 14px; border: 1px solid var(--red); background: var(--red); color: #fff; cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { background: var(--red-dark); text-decoration: none; }
.btn.secondary, button.secondary { background: #fff; color: var(--gray); border-color: var(--line); }
.btn.secondary:hover, button.secondary:hover { border-color: var(--gray); }
button.link { background: none; border: 0; color: var(--red); padding: 0; font-weight: 500; }
button.danger { background: #fff; color: var(--red); border-color: var(--red); }
label { display: block; font-weight: 600; font-size: .85rem; color: var(--gray); margin-bottom: 4px; }
label.check { display: flex; align-items: center; gap: 6px; font-weight: 400; color: var(--ink); font-size: .95rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=number],
input[type=search], input[type=file], select, textarea {
  width: 100%; font: inherit; padding: 8px 10px; border: 1px solid #cfcfd2; border-radius: 6px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: 0; border-color: var(--red); }
textarea { min-height: 120px; }
select[multiple] { min-height: 110px; }
.form-grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { margin-bottom: 12px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 0 0 12px; }
legend { font-weight: 700; padding: 0 6px; }

/* Flash */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 10px; background: var(--ok-tint); color: var(--ok); border: 1px solid #bfe3c9; }
.flash.error { background: var(--red-tint); color: var(--red-dark); border-color: #f2c2c3; }
.callout { padding: 10px 14px; border-radius: 6px; background: var(--warn-tint); color: var(--warn); border: 1px solid #f1dca8; margin-bottom: 12px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-2); font-weight: 700; background: #fafafa; }
tr:hover td { background: #fcfcfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Pills */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eee; color: var(--gray); white-space: nowrap; }
.pill.Hot { background: var(--red); color: #fff; }
.pill.Warm { background: #f6d6c4; color: #8a3a12; }
.pill.Cold { background: #e3e8ef; color: #34495e; }
.pill.tag { background: #f1f1f2; color: var(--gray); font-weight: 500; }
.pill.down { background: var(--red-tint); color: var(--red-dark); }
.pill.up { background: var(--ok-tint); color: var(--ok); }
.pill.ok { background: var(--ok-tint); color: var(--ok); }
.pill.no { background: #f1f1f2; color: var(--gray-2); }

/* Bars */
.bar { height: 8px; background: var(--red); border-radius: 4px; min-width: 2px; }
.bar-track { background: #f0f0f1; border-radius: 4px; width: 100%; }

/* Filters */
.filters { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
details.filter-box > summary { cursor: pointer; font-weight: 700; color: var(--gray); margin-bottom: 8px; }
.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px; background: #fafafa; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.bulkbar input[type=text] { width: 200px; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 14px; }

/* Charts */
svg.chart { width: 100%; height: auto; max-width: 720px; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .axis { fill: var(--gray-2); font: 11px var(--body); }
svg.chart .line { fill: none; stroke: var(--red); stroke-width: 2.5; }
svg.chart .dot { fill: #fff; stroke: var(--red); stroke-width: 2.5; }

/* Contact detail */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
dl.kv dt { color: var(--gray-2); font-size: .85rem; }
dl.kv dd { margin: 0; }
dl.kv dd:empty::after { content: "–"; color: var(--gray-2); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline .meta { color: var(--gray-2); font-size: .8rem; }

/* Message preview */
.preview-box { white-space: pre-wrap; border: 1px dashed #cfcfd2; border-radius: 6px; padding: 12px; background: #fff; font-family: var(--body); }
.confirm-box { border: 2px solid var(--red); border-radius: var(--radius); padding: 16px; background: var(--red-tint); }
.progress { height: 14px; background: #eee; border-radius: 7px; overflow: hidden; }
.progress > div { height: 100%; background: var(--red); }

/* Login */
.login-wrap { max-width: 380px; margin: 8vh auto; }
.login-wrap .logo { width: 100%; max-width: 300px; display: block; margin: 0 auto 18px; }

/* Mobile: tables collapse into cards */
@media (max-width: 720px) {
  .topbar-inner { gap: 8px; }
  nav.main { order: 3; flex: 0 0 100%; overflow-x: auto; flex-wrap: nowrap; }
  .userbox { margin-left: auto; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; background: var(--card); padding: 6px 4px; }
  table.stack td { border: 0; padding: 4px 10px; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--gray-2); font-size: .8rem; }
  table.stack td.num { text-align: left; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { margin-top: 6px; }
}
