/* ci-crm public pages. Colors and fonts match the cloudinquisitor.cloud brand
   (ci-site/brand/README.md). --copper is the brand's Terracotta and
   --copper-on-dark its Peach; the names predate the rebrand. */

:root {
  --graphite: #1C1917;
  --body: #44403C;
  --muted: #57534E;
  --on-dark-muted: #D6D3D1;
  --border: #E7E5E4;          /* decorative lines only: too faint for form fields */
  --field-border: #78716C;    /* 4.8:1 on white, meets WCAG's 3:1 for controls */
  --surface: #FAFAF9;
  --white: #FFFFFF;
  --copper: #B4532A;
  --copper-on-dark: #E3A684;
  --error: #B42318;
  --radius: 10px;
  --font-heading: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--body);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

h1, h2 {
  font-family: var(--font-heading);
  color: var(--graphite);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 .5rem;
}
h1 { font-size: clamp(1.75rem, 5vw, 2.25rem); }

a { color: var(--copper); }
a:hover { color: var(--graphite); }

:focus-visible { outline: 2px solid var(--graphite); outline-offset: 3px; }

/* --- header ---------------------------------------------------------------- */
.site-header { background: var(--graphite); padding: 1rem clamp(1rem, 4vw, 1.5rem); }
.site-header .inner { max-width: 40rem; margin: 0 auto; }
/* Brand lockup, dark-background version (ci-site brand/README.md). */
.ci-lockup {
  display: inline-flex; align-items: center; gap: .55em;
  font-size: 20px; min-height: 44px; text-decoration: none;
}
.ci-lockup .ci-icon { width: 2.2em; height: 2.2em; flex: none; display: block; }
.ci-wordmark {
  --ink: var(--surface); --link: var(--copper-on-dark);
  display: inline-flex; flex-direction: column; gap: .14em;
  font-family: var(--font-heading); font-weight: 600; line-height: 1;
}
.ci-wordmark__text { color: var(--ink); letter-spacing: -.015em; white-space: nowrap; }
.ci-wordmark__link { display: flex; align-items: center; }
.ci-wordmark__link .ci-l, .ci-wordmark__link .ci-r { height: .075em; border-radius: .075em; background: var(--link); }
.ci-wordmark__link .ci-l { flex: 5 1 0; }
.ci-wordmark__link .ci-r { flex: 10.6 1 0; }
.ci-wordmark__link svg { height: .58em; width: .46em; flex: none; margin: 0 -.01em; overflow: visible; }
.ci-wordmark__link path { fill: none; stroke: var(--link); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.site-header :focus-visible { outline-color: var(--copper-on-dark); }

/* --- page ------------------------------------------------------------------ */
main { max-width: 40rem; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 1.5rem) 3rem; }

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: clamp(1.25rem, 5vw, 2rem);
}

.lead { margin: 0 0 1.5rem; color: var(--muted); }

.site-footer { text-align: center; color: var(--muted); font-size: .95rem; padding: 0 1rem 2.5rem; }
.site-footer a { font-weight: 600; }

/* --- form ------------------------------------------------------------------ */
.field { margin-top: 1.25rem; }
label { display: block; font-weight: 600; color: var(--graphite); margin-bottom: .35rem; }
.req { color: var(--copper); }
.optional { color: var(--muted); font-weight: 400; font-size: .9rem; }

input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--graphite);
  background: var(--white);
  border: 1px solid var(--field-border);
  border-radius: 8px;
  padding: .7rem .8rem;
}
textarea { resize: vertical; min-height: 8rem; }
input:focus, select:focus, textarea:focus { border-color: var(--graphite); }

[aria-invalid="true"] { border-color: var(--error); border-width: 2px; }
.error { color: var(--error); font-size: .95rem; margin: .35rem 0 0; }
.form-alert {
  color: var(--error);
  background: #FEF3F2;
  border-left: 4px solid var(--error);
  border-radius: 6px;
  padding: .75rem 1rem;
  margin: 0 0 1rem;
}

.button {
  display: inline-block;
  margin-top: 1.75rem;
  background: var(--copper);
  color: var(--white);
  border: 0;
  border-radius: var(--radius);
  padding: .875rem 1.5rem;
  font: 600 1.0625rem/1.25 var(--font-body);
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--graphite); color: var(--white); }
.button.full { width: 100%; }

.hint { color: var(--muted); font-size: .9rem; margin: .75rem 0 0; }

/* Honeypot: off-screen, not display:none (some bots skip hidden fields). */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* === admin (CRM) ================================================================ */
.site-header .inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.admin-nav { display: flex; gap: .25rem; }
.admin-nav a {
  color: var(--on-dark-muted); text-decoration: none; font-weight: 600;
  padding: .45rem .8rem; border-radius: 8px;
}
.admin-nav a:hover { color: var(--white); }
.admin-nav a[aria-current="page"] { color: var(--graphite); background: var(--copper-on-dark); }

main.admin { max-width: 46rem; }
main.admin h1 { font-size: clamp(1.5rem, 4.5vw, 1.9rem); }
main.admin h2 { font-size: 1.15rem; margin-top: 0; }
main.admin .card + .card { margin-top: 1rem; }
.subtle { color: var(--muted); font-weight: 600; }
.meta { color: var(--muted); font-size: .92rem; margin: .25rem 0; }
.back { margin: 0 0 .75rem; }
.back a { text-decoration: none; font-weight: 600; }
.empty { color: var(--muted); }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.warn { color: var(--error); font-weight: 600; }

/* tabs */
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 1.25rem; }
.tabs a {
  text-decoration: none; color: var(--body); font-weight: 600; font-size: .95rem;
  padding: .4rem .8rem; border: 1px solid var(--field-border); border-radius: 999px; background: var(--white);
}
.tabs a[aria-current="page"] { background: var(--graphite); border-color: var(--graphite); color: var(--white); }
.count { display: inline-block; min-width: 1.4em; text-align: center; font-size: .8rem;
  background: var(--copper); color: var(--white); border-radius: 999px; padding: 0 .35em; margin-left: .2rem; }

/* list cards */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.item { padding: 1rem 1.1rem; }
.item-link { display: flex; justify-content: space-between; gap: 1rem; text-decoration: none; color: var(--graphite); }
.item-link:hover .item-title { color: var(--copper); }
.item-title { font-weight: 600; }
.item-meta { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.item-text { margin: .3rem 0; color: var(--body); overflow-wrap: anywhere; }
.item-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: .3rem 0 0; }
.item-foot a { font-weight: 600; text-decoration: none; }
.group-heading { font-size: 1rem; margin: 1.5rem 0 .6rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* badges */
.badge { display: inline-block; font-size: .8rem; font-weight: 600; padding: .15rem .6rem;
  border-radius: 999px; background: var(--border); color: var(--graphite); }
.status-new, .status-scheduled { background: #FBEADF; color: #7A3A1B; }
.status-done { background: #FEF0C7; color: #7A4B00; }
.status-paid, .status-completed { background: #DCFCE7; color: #14532D; }
.status-closed, .status-cancelled { background: var(--border); color: var(--muted); }
.status-line { display: flex; align-items: center; gap: .6rem; margin: .5rem 0; }

/* buttons and actions */
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; align-items: center; }
.actions form { margin: 0; }
.actions .button, .contact .button { margin-top: 0; }
.button.small { padding: .55rem 1rem; font-size: .95rem; margin-top: .75rem; }
.button.secondary { background: var(--white); color: var(--graphite); box-shadow: inset 0 0 0 1px var(--field-border); }
.button.secondary:hover { background: var(--graphite); color: var(--white); }
.contact { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.link-button { background: none; border: 0; padding: 0; color: var(--copper); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }

/* flash messages */
.flash { border-radius: 8px; padding: .7rem 1rem; margin: 0 0 1rem; border-left: 4px solid; }
.flash-success { background: #F0FDF4; border-color: #15803D; color: #14532D; }
.flash-error { background: #FEF3F2; border-color: var(--error); color: var(--error); }
.flash-warning { background: #FFFAEB; border-color: #B54708; color: #7A2E0E; margin-top: 1rem; }

/* forms in the admin */
fieldset { border: 0; padding: 0; margin: 1rem 0 0; }
legend { font-weight: 600; color: var(--graphite); margin-bottom: .4rem; }
label.choice { display: flex; align-items: center; gap: .6rem; font-weight: 400; margin: .35rem 0; }
label.choice input { width: auto; }
.field.two, .field.three { display: grid; gap: .75rem; }
.field.two { grid-template-columns: 1fr 1fr; }
.field.three { grid-template-columns: 1fr 2fr 1fr; }
.field.two label, .field.three label { white-space: nowrap; }
details.inline-form { margin-top: .75rem; }
details.inline-form summary { cursor: pointer; font-weight: 600; color: var(--copper); }

/* lists, totals, equipment, timeline */
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.plain-list li { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: .3rem 1rem; margin: 0; }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.totals .total { font-weight: 700; color: var(--graphite); border-top: 1px solid var(--border); padding-top: .4rem; }
.equipment { width: 100%; border-collapse: collapse; font-size: .95rem; font-variant-numeric: tabular-nums; }
.equipment th, .equipment td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--border); }
.equipment th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.timeline .meta { display: block; margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 30rem) {
  .equipment thead { display: none; }
  .equipment tr { display: grid; grid-template-columns: 1fr auto; padding: .4rem 0; border-bottom: 1px solid var(--border); }
  .equipment td { border: 0; padding: .1rem 0; }
  .equipment td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .field.three { grid-template-columns: 1fr 1fr; }
  .field.three > div:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
}

/* === printable handoff sheet ======================================================= */
.handoff-page { background: var(--white); padding: 1.5rem; }
.handoff { max-width: 40rem; margin: 0 auto; color: var(--graphite); }
.handoff-brand { font-family: var(--font-heading); font-weight: 700; color: var(--copper); letter-spacing: .08em; text-transform: uppercase; margin: 0; }
.handoff-meta { display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; padding: 1rem 0; border-block: 1px solid var(--border); }
.handoff-meta dt { font-weight: 600; }
.handoff-meta dd { margin: 0; }
.handoff footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; }
@media print {
  .no-print { display: none; }
  .handoff-page { padding: 0; }
}

/* login and logout */
.login-card { max-width: 24rem; margin: 2rem auto 0; }
.admin-nav form { margin: 0; }
.nav-button {
  background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600;
  color: var(--on-dark-muted); padding: .45rem .8rem; border-radius: 8px;
}
.nav-button:hover { color: var(--white); }
code { font-size: .9em; background: var(--border); padding: .1em .35em; border-radius: 4px; }
