/* ===========================================================================
   WE Hub prototype — shared stylesheet
   No build step, no dependencies, no external fonts, no CDN references.
   Mobile-first. Everything below 640px is the primary target: 155 of 185
   users are field electricians on a phone.
   =========================================================================== */

:root {
  --ink:        #12161c;
  --ink-2:      #3d4654;
  --ink-3:      #6b7688;
  --line:       #e2e6ec;
  --line-2:     #eef1f5;
  --bg:         #f6f7f9;
  --surface:    #ffffff;
  --brand:      #103a6b;
  --brand-2:    #1b5aa8;
  --brand-ink:  #ffffff;
  --accent:     #d97706;
  --ok-bg:      #e7f5ec;   --ok-ink:   #17643a;   --ok-line: #b9e0c8;
  --warn-bg:    #fdf3e0;   --warn-ink: #8a5200;   --warn-line: #f0d5a4;
  --danger-bg:  #fdeceb;   --danger-ink:#a01f1a;  --danger-line: #f3c4c1;
  --info-bg:    #e9eff8;   --info-ink: #1b4b8f;   --info-line: #c3d5ee;
  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 1px 2px rgba(16,24,40,.05), 0 6px 20px rgba(16,24,40,.06);
  --tap:        48px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-2); }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.011em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.125rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p  { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }

/* --- Persistent honesty banner ------------------------------------------- */
.banner {
  background: #1d2432;
  color: #d8dee9;
  font-size: .74rem;
  line-height: 1.35;
  letter-spacing: .01em;
  padding: .5rem .9rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 40;
}
.banner strong { color: #ffd79a; font-weight: 600; }

/* --- App bar -------------------------------------------------------------- */
.appbar {
  background: var(--brand);
  color: var(--brand-ink);
  padding: .7rem .9rem;
  display: flex;
  align-items: center;
  gap: .7rem;
}
.appbar a { color: rgba(255,255,255,.85); text-decoration: none; }
.appbar .back {
  min-width: 40px; min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: -.35rem;
  border-radius: 8px;
  font-size: 1.15rem;
}
.appbar .back:hover { background: rgba(255,255,255,.12); }
.appbar-title { font-size: 1.02rem; font-weight: 650; letter-spacing: -.01em; }
.appbar-sub {
  font-size: .74rem; color: rgba(255,255,255,.72); font-weight: 400;
  display: block; letter-spacing: .02em;
}

/* --- Brand mark (text only — no image assets anywhere in this prototype) --- */
.mark { display: inline-flex; flex-direction: column; line-height: 1.05; }
.mark-name {
  font-weight: 750; letter-spacing: -.02em; font-size: 1.35rem;
}
.mark-rule {
  display: block; height: 3px; width: 34px; margin: .4rem 0 .35rem;
  background: var(--accent); border-radius: 2px;
}
.mark-sub {
  font-size: .7rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}

/* --- Layout --------------------------------------------------------------- */
.wrap { max-width: 720px; margin: 0 auto; padding: 1rem .9rem 4rem; }
.wrap-wide { max-width: 980px; }
.stack > * + * { margin-top: .85rem; }

/* --- Tabs ----------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: .3rem;
  background: var(--brand);
  padding: 0 .5rem .45rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto;
  padding: .5rem .8rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 550;
  color: rgba(255,255,255,.78);
  text-decoration: none;
  white-space: nowrap;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
}
.tabs a[aria-current="page"] {
  background: rgba(255,255,255,.16);
  color: #fff;
}

/* --- Cards ---------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .6rem; margin-bottom: .7rem;
}
.card-head h2 { flex: 1 1 auto; }
.card-note { font-size: .82rem; color: var(--ink-3); }

.big-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.big-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: var(--brand-2);
}
.big-card.alt::before { background: var(--accent); }
.big-card:hover { border-color: #cbd4e0; }
.big-card h2 { font-size: 1.25rem; margin-bottom: .25rem; }
.big-card p { color: var(--ink-2); font-size: .92rem; }
.big-card .go {
  font-size: .82rem; font-weight: 650; color: var(--brand-2);
  display: inline-flex; align-items: center; gap: .3rem; margin-top: .5rem;
}

/* --- Chips ---------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .74rem; font-weight: 600; letter-spacing: .01em;
  padding: .22rem .55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--line-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.ok     { background: var(--ok-bg);     color: var(--ok-ink);     border-color: var(--ok-line); }
.chip.warn   { background: var(--warn-bg);   color: var(--warn-ink);   border-color: var(--warn-line); }
.chip.danger { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger-line); }
.chip.info   { background: var(--info-bg);   color: var(--info-ink);   border-color: var(--info-line); }
.chip.brand  { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }

/* --- Notices -------------------------------------------------------------- */
.notice {
  border-radius: var(--radius-sm);
  padding: .7rem .8rem;
  font-size: .84rem;
  border: 1px solid var(--info-line);
  background: var(--info-bg);
  color: var(--info-ink);
}
.notice.warn   { border-color: var(--warn-line);   background: var(--warn-bg);   color: var(--warn-ink); }
.notice.ok     { border-color: var(--ok-line);     background: var(--ok-bg);     color: var(--ok-ink); }
.notice.danger { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger-ink); }
.notice.plain  { border-color: var(--line); background: var(--line-2); color: var(--ink-2); }
.notice strong { font-weight: 650; }
.notice-title { display: block; font-weight: 650; margin-bottom: .15rem; }

/* --- The "one true thing" teaching strip --------------------------------- */
.teach {
  border-left: 4px solid var(--accent);
  background: #fffaf1;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .75rem .85rem;
  font-size: .86rem;
  color: #5c4110;
}
.teach b { color: #3d2b08; }

/* --- Forms and controls --------------------------------------------------- */
label { display: block; font-size: .8rem; font-weight: 650; color: var(--ink-2); margin-bottom: .3rem; }

select, input[type="text"], input[type="date"], textarea {
  width: 100%;
  min-height: var(--tap);
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #c9d0da;
  border-radius: var(--radius-sm);
  padding: .6rem .7rem;
}
textarea { min-height: 88px; resize: vertical; }
select:focus-visible, input:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 3px solid #9dbdf0;
  outline-offset: 1px;
}

.field + .field { margin-top: .8rem; }

.seg {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .4rem;
}
@media (min-width: 520px) { .seg { grid-template-columns: repeat(4, 1fr); } }
.seg button {
  min-height: var(--tap);
  font: inherit;
  font-size: .86rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid #c9d0da;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: .4rem .3rem;
}
.seg button[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* Quarter-hour stepper */
.stepper {
  display: flex; align-items: stretch; gap: .5rem;
}
.stepper button {
  flex: 0 0 auto;
  width: 62px; min-height: 62px;
  font-size: 1.6rem; font-weight: 400; line-height: 1;
  color: var(--brand);
  background: var(--surface);
  border: 1px solid #c9d0da;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.stepper button:active { background: var(--info-bg); }
.stepper button[disabled] { opacity: .35; cursor: not-allowed; }
.stepper-value {
  flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--line-2);
}
.stepper-value .num {
  font-size: 2rem; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stepper-value .unit { font-size: .72rem; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }
#pto-hours { text-transform: none; letter-spacing: 0; font-size: .8rem; }
.quick { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.quick button {
  font: inherit; font-size: .82rem; font-weight: 600;
  min-height: 38px; padding: .3rem .7rem;
  border-radius: 999px; border: 1px solid #c9d0da;
  background: var(--surface); color: var(--ink-2); cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap);
  padding: .6rem 1.1rem;
  font: inherit; font-size: .95rem; font-weight: 650;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #0c2e56; }
.btn-primary[disabled] { background: #9aa5b4; cursor: not-allowed; }
.btn-secondary { background: var(--surface); border-color: #c9d0da; color: var(--ink); }
.btn-ghost { background: transparent; color: var(--brand-2); padding-left: 0; padding-right: 0; }
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }

/* --- Lists and rows ------------------------------------------------------- */
.rows { border-top: 1px solid var(--line-2); }
.row {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--line-2);
}
.row-main { flex: 1 1 auto; min-width: 0; }
.row-title { font-size: .93rem; font-weight: 600; }
.row-sub { font-size: .8rem; color: var(--ink-3); margin-top: .12rem; }
.row-value {
  flex: 0 0 auto; text-align: right;
  font-variant-numeric: tabular-nums; font-weight: 650; font-size: .95rem;
}
.row-value small { display: block; font-weight: 400; font-size: .72rem; color: var(--ink-3); }

.total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: .8rem; margin-top: .2rem;
  font-weight: 700;
}
.total .num { font-size: 1.35rem; font-variant-numeric: tabular-nums; }

/* Checkable approver rows */
.check-row {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: .8rem .2rem;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
}
.check-row input { width: 22px; height: 22px; margin: .2rem 0 0; flex: 0 0 auto; accent-color: var(--brand); }
/* Rows built from <span> need explicit block flow inside .row-main. */
.check-row .row-main > span:not(.chip-row) { display: block; }
.check-row.exception { background: #fffdf7; margin: 0 -.4rem; padding-left: .6rem; padding-right: .6rem; border-radius: 6px; }

/* --- Stats ---------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .7rem .6rem; text-align: center;
}
.stat .num { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .lbl { font-size: .7rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-top: .1rem; }
.stat.hero { grid-column: 1 / -1; padding: 1.1rem; }
.stat.hero .num { font-size: 2.6rem; color: var(--brand); }

/* --- Tables --------------------------------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { text-align: left; padding: .6rem .55rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 650; white-space: nowrap;
}
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- Monospace / file preview -------------------------------------------- */
.filebox {
  position: relative;
  background: #10151d;
  color: #cdd6e4;
  border-radius: var(--radius-sm);
  padding: .8rem .85rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.filebox pre {
  margin: 0;
  font-family: var(--mono);
  font-size: .74rem;
  line-height: 1.65;
  white-space: pre;
}
.filebox .stamp {
  color: #ffb454; font-weight: 700;
}
.filebox .cmt { color: #6f7d92; }

/* --- Lifecycle chips ------------------------------------------------------ */
.lifecycle { display: flex; align-items: center; gap: .3rem; overflow-x: auto; padding-bottom: .3rem; }
.lifecycle .step {
  flex: 0 0 auto;
  font-size: .74rem; font-weight: 650;
  padding: .32rem .6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--line-2);
  color: var(--ink-3);
  white-space: nowrap;
}
.lifecycle .step.done { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.lifecycle .step.now  { background: var(--brand); color: #fff; border-color: var(--brand); }
.lifecycle .arrow { flex: 0 0 auto; color: #b8c0cc; font-size: .78rem; }

/* --- Checklist ------------------------------------------------------------ */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: .8rem 0; border-bottom: 1px solid var(--line-2);
}
.steps li:last-child { border-bottom: 0; }
.steps .n {
  flex: 0 0 auto;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--line-2); color: var(--ink-2);
  font-size: .8rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.steps li.gate .n { background: var(--brand); color: #fff; }
.steps .body { flex: 1 1 auto; min-width: 0; }
.steps .body .t { display: block; font-weight: 650; font-size: .93rem; }
.steps .body .d { display: block; font-size: .82rem; color: var(--ink-3); margin-top: .15rem; }

/* --- Misc ----------------------------------------------------------------- */
.muted { color: var(--ink-3); font-size: .84rem; }
.divider { height: 1px; background: var(--line); border: 0; margin: 1.1rem 0; }
.hidden { display: none !important; }
.center { text-align: center; }
.footer {
  text-align: center; font-size: .78rem; color: var(--ink-3);
  padding: 1.6rem .9rem 2.4rem;
}
.footer a { color: var(--ink-3); }

.kv { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .45rem .8rem; font-size: .88rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }

.badge-division {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--brand-2);
  padding: .22rem .6rem; border-radius: 999px;
}

.profile-head { display: flex; gap: .9rem; align-items: center; }
.avatar {
  flex: 0 0 auto;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em;
}

@media (prefers-reduced-motion: no-preference) {
  .flash { animation: flash .9s ease-out; }
  @keyframes flash { from { background: #fff6e3; } to { background: transparent; } }
}
