/* Halcyon Ops portal. Mobile first; no build step. */
:root {
  --brand: #b3261e;
  --brand-dark: #8c1d17;
  --ink: #1d1d1f;
  --muted: #5f6368;
  --line: #dadce0;
  --bg: #f6f7f9;
  --card: #ffffff;
  --ok: #1e7b34;
  --warn: #a15c00;
  --bad: #b3261e;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--brand-dark); }
h1 { font-size: 1.5rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.5rem; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1rem; padding: 0.75rem 1rem; background: var(--brand); color: #fff;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.brand-logo { height: 28px; width: auto; background: #fff; border-radius: 4px; padding: 2px; }
.nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: center; }
.nav a, .nav .link { color: #fff; text-decoration: none; font: inherit; }
.nav a:hover, .nav .link:hover { text-decoration: underline; }

.container { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 1rem; }
.footer { padding: 1rem; color: var(--muted); font-size: 0.85rem; text-align: center; }

.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.card.narrow { max-width: 28rem; margin: 1rem auto; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 0.9rem; }

form.inline { display: inline; margin: 0; }
label { display: block; font-weight: 600; margin: 0.75rem 0 0.25rem; }
input[type=email], input[type=password], input[type=text], input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: 0.7rem; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
button, .button {
  display: inline-block; padding: 0.7rem 1rem; font: inherit; font-weight: 600; border-radius: 8px;
  border: 1px solid var(--brand); background: #fff; color: var(--brand-dark); cursor: pointer; text-align: center;
  text-decoration: none; margin-top: 0.75rem; min-height: 44px;
}
.button.primary, button.primary { background: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-dark); }
.button.wide { width: 100%; }
button.link { background: none; border: 0; padding: 0; margin: 0; min-height: 0; font-weight: normal; }

details.recovery { margin-top: 1.25rem; border-top: 1px solid var(--line); padding-top: 1rem; }
details.recovery summary { cursor: pointer; color: var(--brand-dark); }

.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.message { background: #fff; border-left: 4px solid var(--brand); padding: 0.6rem 0.8rem; margin-bottom: 0.5rem; border-radius: 4px; }
.message.success { border-color: var(--ok); }
.message.warning { border-color: var(--warn); }
.errorlist { color: var(--bad); list-style: none; padding: 0; margin: 0.25rem 0; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* django-allauth's default "elements" (used on pages not overridden here). */
.container form button[type=submit], .container form button[type=button] { min-width: 8rem; }
.container table { width: 100%; border-collapse: collapse; background: #fff; }
.container th, .container td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--line); }

/* --- Stage 2: registers, prompts, readiness ------------------------------ */
.span-2 { grid-column: 1 / -1; }
@media (min-width: 1000px) { .span-2 { grid-column: span 2; } }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 0.25rem 0; }
.crumbs { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.5rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.actions .button { margin-top: 0; }
.page-head .button { margin-top: 0; }
.page-head { justify-content: space-between; }
.card + .card { margin-top: 1rem; }
.grid .card + .card { margin-top: 0; }
.form-card { max-width: 40rem; }
.field { margin-bottom: 0.5rem; }
.field input[type=checkbox] { width: auto; }
.field ul { list-style: none; padding: 0; margin: 0; }
.field ul label { font-weight: normal; display: inline; margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.filters input[type=search] { flex: 1 1 14rem; width: auto; }
.filters select { width: auto; }
input[type=search], input[type=date], input[type=url], input[type=tel], input[type=file] {
  width: 100%; padding: 0.6rem; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 32rem; }
.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.8rem;
  font-weight: 600; background: #eef0f2; color: var(--ink); white-space: nowrap; }
.badge.ok { background: #e3f2e7; color: var(--ok); }
.badge.due { background: #fdf0dc; color: var(--warn); }
.badge.overdue, .badge.blocked { background: #fbe4e2; color: var(--bad); }
.badge.retired { background: #eef0f2; color: var(--muted); }
.badge.info { background: #e6eefb; color: #1f4e9c; }
.button.small { padding: 0.35rem 0.7rem; min-height: 0; font-size: 0.9rem; margin-top: 0; }
.score { font-size: 2.2rem; font-weight: 700; margin: 0; }
.prompt-list { list-style: none; padding: 0; margin: 0; }
.prompt { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem;
  padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.prompt:last-child { border-bottom: 0; }
.prompt-main { flex: 1 1 18rem; }
.prompt-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.prompt-actions select { width: auto; padding: 0.3rem; }
.rag-dot { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-weight: 600; font-size: 0.85rem; }
.rag-dot.green { background: #e3f2e7; color: var(--ok); }
.rag-dot.amber { background: #fdf0dc; color: var(--warn); }
.rag-dot.red { background: #fbe4e2; color: var(--bad); }
.rag-dot.na { background: #eef0f2; color: var(--muted); }
.findings li { font-size: 0.9rem; }
.finding.red::before { content: "● "; color: var(--bad); }
.finding.amber::before { content: "● "; color: var(--warn); }
.finding.green::before { content: "● "; color: var(--ok); }
details.menu { position: relative; }
details.menu summary { cursor: pointer; list-style: none; color: #fff; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu summary::after { content: " ▾"; }
.menu-items { position: absolute; right: 0; top: 1.8rem; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 0.4rem; display: flex; flex-direction: column; min-width: 10rem; z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.nav .menu-items a { color: var(--ink); padding: 0.4rem 0.6rem; }
.nav .menu-items .link { color: var(--ink); }
details.history summary { cursor: pointer; }

/* --- Stage 3: commercial ---------------------------------------------- */
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }
.form-grid .field.check { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 0.5rem; }
.form-grid .field.check label { margin: 0.75rem 0 0.25rem; font-weight: 600; }
.form-grid .field.check .hint { flex-basis: 100%; }
.quick-add .card + .card, .quick-add .card { margin-bottom: 1rem; }
.warn-card .warnings li { margin-bottom: 0.35rem; }
.warning-box { background: #fdf0dc; border-left: 4px solid var(--warn); padding: 0.6rem 0.8rem; border-radius: 4px; margin-bottom: 1rem; }
.warning-box ul { margin: 0.25rem 0 0; padding-left: 1.2rem; }
.locked-note { background: #eef0f2; border-left: 4px solid var(--muted); padding: 0.6rem 0.8rem; border-radius: 4px; margin-bottom: 1rem; }
.num { text-align: right; white-space: nowrap; }
.totals { margin-left: auto; max-width: 22rem; }
.totals td { border: 0; }
.totals tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
.document-text { white-space: normal; }
table.lines input, table.lines select, table.lines textarea { padding: 0.4rem; font-size: 0.95rem; }
table.lines td { vertical-align: top; }
table.lines textarea { min-height: 2.6rem; }
table.lines .narrow { width: 6rem; }
.formset-help { font-size: 0.9rem; }
.sig-pad { border: 1px dashed var(--muted); border-radius: 8px; background: #fff; touch-action: none; width: 100%; max-width: 32rem; height: 160px; display: block; }
.pdf-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.split { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; } }
.split .card + .card { margin-top: 0; }
.split > .card { margin-bottom: 0; }
.split { margin-bottom: 1rem; }
.container th.num, .container td.num { text-align: right; }
.check-inline { display: flex; gap: 0.5rem; align-items: center; font-weight: 600; }
.check-inline input { width: auto; }
button:disabled { opacity: 0.6; cursor: progress; }

/* Jobs: signatures and photos recorded on the phone */
img.signature { max-width: 260px; max-height: 120px; background: #fff; border: 1px solid #ddd; border-radius: 4px; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos img { width: 160px; height: 120px; object-fit: cover; border-radius: 4px; }
