/* ============================================================
   Heartwood — Zevyon shared design system
   ------------------------------------------------------------
   Single source of truth for tokens + base components.
   Link with: <link rel="stylesheet" href="/css/heartwood.css" />
   Pages must still load the Google Fonts <link> in their <head>
   (Bricolage Grotesque / Instrument Sans / Spline Sans Mono).

   Palette: charred oak #1B1712 · linen #F5EEDF · amber #E0A14D ·
   copper #A8501F. Mirrors the inline Heartwood styles used on
   index.html and the contractor funnel — keep in sync if those
   tokens ever change.
   ============================================================ */

:root{
  --char:#1B1712;        /* charred oak — warm near-black */
  --char-2:#2A241C;
  --linen:#F5EEDF;       /* light section ground */
  --linen-2:#EFE5D0;
  --card:#FBF6EA;        /* warm card white */
  --amber:#E0A14D;       /* finish-coat amber — primary accent */
  --amber-deep:#C4842E;
  --copper:#A8501F;      /* hot accent: LIVE, totals, deltas */
  --ash:#6E6353;         /* muted text on light */
  --smoke:#B9AD97;       /* muted text on dark */
  --ok:#3E7A46;          /* success green */
  --bad:#A8341B;         /* error / destructive */
  --seam:rgba(27,23,18,.14);
  --seam-strong:rgba(27,23,18,.26);
  --shadow-soft:0 12px 30px rgba(27,23,18,.09);
}

/* ---------- Base ---------- */
*{ box-sizing:border-box; }

body{
  margin:0;
  font-family:"Instrument Sans", system-ui, sans-serif;
  background:var(--linen);
  color:var(--char);
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
}

a{ text-decoration:none; color:inherit; }
::selection{ background:var(--amber); color:var(--char); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible{
  outline:3px solid var(--amber);
  outline-offset:2px;
  border-radius:6px;
}

/* ---------- Header ---------- */
.simple-header{
  background:var(--char);
  color:#fff;
  position:sticky;
  top:0;
  z-index:20;
  border-bottom:1px solid rgba(224,161,77,.18);
}

.simple-header-inner{
  max-width:1180px;
  margin:0 auto;
  padding:14px 24px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}

.logo-link{ text-decoration:none; }

.logo-wrap{
  display:flex;
  align-items:center;
  gap:12px;
}

.logo-img{
  width:72px; height:72px; object-fit:contain;
  background:#fff; border-radius:10px; padding:0;
  flex:0 0 72px;
}

.logo{
  font-family:"Bricolage Grotesque", sans-serif;
  font-weight:800;
  font-size:27px;
  letter-spacing:-.02em;
  color:#fff;
  white-space:nowrap;
  line-height:1;
}
.logo span{ color:var(--amber); }

.tagline{
  font-size:12px;
  line-height:1.3;
  color:var(--smoke);
  max-width:160px;
}

.back-home-btn{
  color:#E8DFCE;
  text-decoration:none;
  font-size:.88rem;
  font-weight:600;
  border:1px solid rgba(255,255,255,.22);
  padding:9px 14px;
  border-radius:9px;
  transition:all .15s ease;
  white-space:nowrap;
}
.back-home-btn:hover{
  border-color:var(--amber);
  color:#fff;
}

/* ---------- Typography helpers ---------- */
.eyebrow{
  font-family:"Spline Sans Mono", monospace;
  font-size:.68rem;
  letter-spacing:.22em;
  text-transform:uppercase;
  font-weight:700;
  color:var(--copper);
  display:inline-flex;
  align-items:center;
  gap:10px;
  margin-bottom:14px;
}
.eyebrow::before{
  content:"";
  width:26px; height:3px;
  background:var(--amber);
  display:inline-block;
}

.display{
  font-family:"Bricolage Grotesque", sans-serif;
  font-weight:700;
  letter-spacing:-.02em;
  line-height:1.08;
}

.subtitle{
  color:var(--ash);
  font-size:.98rem;
  line-height:1.5;
}

.back-link{
  color:var(--copper);
  font-weight:700;
}
.back-link:hover{ text-decoration:underline; }

/* ---------- Buttons ----------
   Base look shared by <button> and .link-btn. Semantic variants
   map the legacy blue/green/red palette onto Heartwood. */
button, .link-btn, .btn{
  border:none;
  padding:10px 15px;
  border-radius:10px;
  cursor:pointer;
  font-family:"Instrument Sans", sans-serif;
  font-weight:700;
  font-size:.9rem;
  line-height:1.1;
  text-decoration:none;
  display:inline-block;
  transition:background .15s ease, transform .15s ease, border-color .15s ease;
}
button:hover, .link-btn:hover, .btn:hover{ transform:translateY(-1px); }

.btn-primary{ background:var(--amber); color:var(--char); }
.btn-primary:hover{ background:#EBB161; }

.btn-dark{ background:var(--char); color:var(--amber); }
.btn-dark:hover{ background:var(--char-2); }

.btn-green{ background:var(--ok); color:#fff; }
.btn-green:hover{ background:#356B3C; }

.btn-orange{ background:var(--amber-deep); color:#fff; }
.btn-orange:hover{ background:#AC7325; }

.btn-red{ background:var(--bad); color:#fff; }
.btn-red:hover{ background:#8E2B16; }

.btn-light{
  background:var(--linen-2);
  color:var(--char);
  border:1px solid var(--seam);
}
.btn-light:hover{ background:#E7DAC0; }

.btn-block{ width:100%; display:block; text-align:center; }

/* ---------- Forms ---------- */
label{
  display:block;
  margin-bottom:7px;
  font-weight:600;
  color:var(--char);
  font-size:.92rem;
}

input, select, textarea{
  width:100%;
  padding:13px 14px;
  border:1.5px solid var(--seam-strong);
  border-radius:11px;
  background:#fff;
  font-family:"Instrument Sans", system-ui, sans-serif;
  font-size:15px;
  color:var(--char);
  outline:none;
  transition:border-color .15s ease;
}
input:focus, select:focus, textarea:focus{ border-color:var(--amber-deep); }

/* ---------- Message banners ---------- */
.message{
  padding:13px 15px;
  border-radius:11px;
  display:none;
  font-size:.9rem;
  line-height:1.45;
  font-weight:600;
}
.message.success, .success{ background:#E8F0E4; color:#2C5530; border:1px solid #C4D8BC; display:block; }
.message.error, .error{ background:#F7E4DC; color:#8A3A1B; border:1px solid #E7C3B2; display:block; }
.message.info, .info{ background:var(--linen-2); color:var(--ash); border:1px solid var(--seam); display:block; }

/* ---------- Auth card ---------- */
.login-box{
  width:100%;
  max-width:440px;
  background:var(--card);
  padding:34px 32px;
  border-radius:18px;
  box-shadow:var(--shadow-soft);
  border:1px solid var(--seam);
  position:relative;
  overflow:hidden;
}
.login-box::before{
  content:"";
  position:absolute; top:0; left:22px; right:22px; height:5px;
  background:linear-gradient(90deg, var(--amber), var(--copper));
  border-radius:0 0 5px 5px;
}

/* ---------- Console: cards + grids ---------- */
.summary-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:16px;
  margin-bottom:22px;
}

.summary-card{
  background:var(--card);
  border-radius:14px;
  padding:20px;
  box-shadow:var(--shadow-soft);
  border:1px solid var(--seam);
  border-left:5px solid var(--amber);
}
.summary-card span{
  color:var(--ash);
  font-size:.82rem;
  font-family:"Spline Sans Mono", monospace;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.summary-card strong{
  display:block;
  font-family:"Bricolage Grotesque", sans-serif;
  font-size:2.1rem;
  font-weight:800;
  letter-spacing:-.02em;
  margin-top:8px;
  color:var(--char);
  line-height:1.1;
}

/* ---------- Console: tabs ---------- */
.tabs{
  display:flex;
  gap:10px;
  margin-bottom:18px;
  flex-wrap:wrap;
}
.tab-btn{
  background:var(--linen-2);
  color:var(--char);
  border:1px solid var(--seam);
}
.tab-btn.active{
  background:var(--char);
  color:var(--amber);
  border-color:var(--char);
}

/* ---------- Console: sections ---------- */
.section{
  display:none;
  background:var(--card);
  border-radius:14px;
  padding:22px;
  box-shadow:var(--shadow-soft);
  border:1px solid var(--seam);
}
.section.active{ display:block; }

.section-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  flex-wrap:wrap;
  margin-bottom:16px;
}
.section-header h2{
  margin:0;
  font-family:"Bricolage Grotesque", sans-serif;
  font-weight:700;
  letter-spacing:-.01em;
  font-size:1.4rem;
}
.section-header p{
  margin:5px 0 0;
  color:var(--ash);
  font-size:.9rem;
}

/* ---------- Console: tables ---------- */
.table-wrap{
  width:100%;
  overflow-x:auto;
  border:1px solid var(--seam);
  border-radius:12px;
  background:#fff;
}

table{
  width:100%;
  border-collapse:collapse;
  min-width:980px;
}

th, td{
  padding:13px 14px;
  border-bottom:1px solid var(--seam);
  text-align:left;
  vertical-align:top;
  font-size:.88rem;
  background:#fff;
}

th{
  background:var(--linen-2);
  color:var(--ash);
  font-family:"Spline Sans Mono", monospace;
  font-size:.68rem;
  font-weight:700;
  letter-spacing:.1em;
  text-transform:uppercase;
}

tr:hover td{ background:var(--linen); }

/* ---------- Status pills ---------- */
.status{
  display:inline-block;
  padding:5px 11px;
  border-radius:999px;
  font-family:"Spline Sans Mono", monospace;
  font-size:.7rem;
  font-weight:700;
  text-transform:capitalize;
  white-space:nowrap;
  background:var(--linen-2);
  color:var(--ash);
}
.status-new, .status-pending, .status-pending_review{ background:rgba(224,161,77,.20); color:var(--copper); }
.status-approved, .status-completed, .status-job_completed{ background:rgba(62,122,70,.16); color:var(--ok); }
.status-in_progress, .status-reviewed, .status-selected{ background:rgba(196,132,46,.18); color:var(--amber-deep); }
.status-rejected, .status-cancelled{ background:rgba(168,52,27,.16); color:var(--bad); }

/* ---------- Empty state ---------- */
.empty{
  padding:26px;
  text-align:center;
  color:var(--ash);
  background:var(--linen-2);
  border-radius:12px;
  border:1px dashed var(--seam-strong);
  font-size:.92rem;
}

/* ---------- Modal ---------- */
.modal-backdrop{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(27,23,18,.55);
  z-index:1000;
  padding:20px;
  overflow-y:auto;
}

.modal{
  background:var(--card);
  max-width:950px;
  margin:30px auto;
  border-radius:16px;
  padding:26px;
  box-shadow:0 24px 70px rgba(27,23,18,.30);
  border:1px solid var(--seam);
}

.modal-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  border-bottom:1px solid var(--seam);
  padding-bottom:14px;
  margin-bottom:18px;
}
.modal-header h2{
  margin:0;
  font-family:"Bricolage Grotesque", sans-serif;
  font-weight:700;
  letter-spacing:-.01em;
}

.detail-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:12px;
}

.detail-item{
  background:var(--linen-2);
  border:1px solid var(--seam);
  border-radius:11px;
  padding:13px;
  font-size:.9rem;
}
.detail-item strong{
  display:block;
  font-family:"Spline Sans Mono", monospace;
  color:var(--ash);
  font-size:.66rem;
  font-weight:700;
  letter-spacing:.1em;
  text-transform:uppercase;
  margin-bottom:5px;
}

.wide{ grid-column:1 / -1; }
.nowrap{ white-space:nowrap; }

/* ---------- Responsive header ---------- */
@media (max-width:650px){
  .simple-header-inner{ padding:12px 16px; }
  .tagline{ display:none; }
  .logo{ font-size:23px; }
  .back-home-btn{ font-size:.8rem; padding:9px 11px; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion:reduce){
  *{ transition-duration:.001ms !important; }
}
