/* ==========================================================================
   SnapHaul design system — "industrial precision"
   Workwear palette, engineered type, ruled surfaces, graph-paper ground.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@100,600;100,700;112,800;125,800;125,900&family=Public+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Martian+Mono:wdth,wght@75,400;75,600;100,300;100,400;100,600&display=swap');

:root {
  /* --- ink & ground --- */
  --paper:        #F4F2ED;   /* blueprint paper */
  --paper-2:      #EAE7E0;
  --paper-3:      #DEDAD1;
  --surface:      #FFFFFF;
  --ink:          #14181C;   /* warm near-black */
  --ink-2:        #3D464E;
  --ink-3:        #6B757E;
  --ink-4:        #98A1A9;
  --rule:         #D4CFC5;
  --rule-soft:    #E4E0D8;

  /* --- dark chrome (app shell, footers) --- */
  --slate:        #0A0C0D;
  --slate-2:      #14181A;
  --slate-3:      #1E2427;
  --slate-4:      #2C3438;
  --slate-ink:    #E9EBEB;
  --slate-ink-2:  #8A959B;
  --slate-rule:   #2C3438;

  /* --- signal colours --- */
  --field:        #0F7C6C;   /* brand: field green */
  --field-dark:   #0A5C50;
  --field-light:  #1A9E8B;
  --field-wash:   #E3F1EE;
  --hivis:        #F5A524;   /* safety amber — CTAs, alerts */
  --hivis-dark:   #C97F0C;
  --hivis-wash:   #FDF0D8;
  --blueprint:    #1E4D8C;
  --blueprint-wash:#E4EBF5;
  --brick:        #C2410C;   /* overdue, danger */
  --brick-wash:   #FBE8DF;

  /* Text and hairline to use ON a -wash background. In a light theme the
     strong variant reads best; in a dark theme a wash is dark, so the strong
     variant would be invisible and each dark theme flips these to a bright
     tint. Components must use these, never --x-dark, on a wash. */
  --field-ink:    #0A5C50;  --field-edge:  #A9D8CF;
  --hivis-ink:    #8A5605;  --hivis-edge:  #F0CE8A;
  --brick-ink:    #A8340E;  --brick-edge:  #EDB79E;
  --violet:       #6D3FA8;
  --violet-wash:  #EEE7F7;

  /* --- type --- */
  --display: 'Archivo', 'Helvetica Neue', sans-serif;
  --body:    'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:    'Martian Mono', 'SFMono-Regular', ui-monospace, monospace;

  /* --- geometry --- */
  --r-sm: 3px;
  --r:    5px;
  --r-lg: 8px;
  --shadow-1: 0 1px 2px rgba(20,24,28,.06), 0 1px 3px rgba(20,24,28,.04);
  --shadow-2: 0 2px 4px rgba(20,24,28,.05), 0 6px 16px rgba(20,24,28,.07);
  --shadow-3: 0 12px 28px rgba(20,24,28,.12), 0 2px 6px rgba(20,24,28,.08);
  --shadow-hivis: 0 3px 0 var(--hivis-dark);
  --shadow-field: 0 3px 0 var(--field-dark);

  --nav-h: 66px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--body);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Graph-paper texture — the blueprint reference, used behind hero sections. */
.graph {
  background-image:
    linear-gradient(var(--rule-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule-soft) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
}
.graph-dark {
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 28px 28px;
}

h1, h2, h3, h4, h5 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -.024em;
  line-height: 1.08;
  margin: 0 0 .5em;
  color: var(--ink);
}
h1 { font-size: clamp(2.5rem, 5.6vw, 4.4rem); font-weight: 900; letter-spacing: -.035em; }
h2 { font-size: clamp(1.85rem, 3.4vw, 2.7rem); letter-spacing: -.03em; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.06rem; font-weight: 700; }
p  { margin: 0 0 1em; }
a  { color: var(--field); text-decoration: none; }
a:hover { color: var(--field-dark); }

/* Stamped section label — mono, tracked out, with a leading rule. */
.stamp {
  font-family: var(--mono);
  font-size: .688rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
}
.stamp::before {
  content: '';
  width: 26px; height: 2px;
  background: var(--hivis);
}
.stamp.on-dark { color: var(--slate-ink-2); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-variation-settings: 'wdth' 75; letter-spacing: 0; }
.num  { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.muted { color: var(--ink-3); }
.small { font-size: .82rem; }
.tiny  { font-size: .74rem; }
.center { text-align: center; }
.right  { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.lead { font-size: 1.14rem; line-height: 1.62; color: var(--ink-2); }

.wrap { width: min(1220px, 92vw); margin-inline: auto; }
.wrap-narrow { width: min(820px, 92vw); margin-inline: auto; }

/* ---------------------------------------------------------------- buttons */

.btn {
  font-family: var(--display);
  font-weight: 700;
  font-size: .94rem;
  letter-spacing: -.01em;
  padding: .72em 1.35em;
  border: 2px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), background .15s;
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
}
.btn:active { transform: translateY(2px); }

.btn-primary {
  background: var(--hivis); color: #23180A;
  box-shadow: var(--shadow-hivis);
  border-color: var(--hivis-dark);
}
.btn-primary:hover { background: #FFB43E; color: #23180A; }
.btn-primary:active { box-shadow: 0 1px 0 var(--hivis-dark); }

.btn-field {
  background: var(--field); color: #fff;
  box-shadow: var(--shadow-field);
  border-color: var(--field-dark);
}
.btn-field:hover { background: var(--field-light); color: #fff; }
.btn-field:active { box-shadow: 0 1px 0 var(--field-dark); }

.btn-ghost {
  background: transparent; color: var(--ink);
  border-color: var(--ink); box-shadow: 0 3px 0 var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-ghost:active { box-shadow: 0 1px 0 var(--ink); }

.btn-quiet {
  background: var(--surface); color: var(--ink-2);
  border-color: var(--rule);
}
.btn-quiet:hover { border-color: var(--ink-3); color: var(--ink); }

.btn-danger { background: var(--brick); color: #fff; border-color: #94300A; box-shadow: 0 3px 0 #94300A; }
.btn-danger:hover { background: #D8500F; color: #fff; }

.btn-sm { font-size: .8rem; padding: .48em .9em; box-shadow: none !important; border-width: 1.5px; }
.btn-lg { font-size: 1.06rem; padding: .85em 1.7em; }
.btn-block { width: 100%; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; transform: none !important; }

/* ---------------------------------------------------------------- status pills */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono);
  font-size: .688rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: .28em .6em;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill-none::before { display: none; }

.pill-grey    { background: var(--paper-2);        color: var(--ink-3);    border-color: var(--rule); }
.pill-green   { background: var(--field-wash);     color: var(--field-ink); border-color: var(--field-edge); }
.pill-amber   { background: var(--hivis-wash);     color: var(--hivis-ink); border-color: var(--hivis-edge); }
.pill-blue    { background: var(--blueprint-wash); color: var(--blueprint); border-color: #B6C8E2; }
.pill-red     { background: var(--brick-wash);     color: var(--brick-ink); border-color: var(--brick-edge); }
.pill-violet  { background: var(--violet-wash);    color: var(--violet);   border-color: #C9B3E4; }

/* ---------------------------------------------------------------- cards & rules */

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: 1.35rem 1.5rem; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .95rem 1.25rem;
  border-bottom: 1px solid var(--rule-soft);
}
.card-head h3, .card-head h4 { margin: 0; }

/* A ruled surface: the "form" feel that runs through the whole product. */
.ruled > * + * { border-top: 1px solid var(--rule-soft); }

hr.rule { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }

/* ---------------------------------------------------------------- forms */

label, .label {
  display: block;
  font-family: var(--mono);
  font-size: .7rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .4rem;
}
/* `input:not([type])` matters: an <input> with no type attribute does NOT match
   input[type=text], so 111 fields across the app were missing these styles. */
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=date], input[type=time], input[type=datetime-local],
input[type=search], input[type=url], select, textarea {
  width: 100%;
  font-family: var(--body);
  font-size: .95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--rule);
  border-radius: var(--r-sm);
  padding: .62em .78em;
  transition: border-color .14s, box-shadow .14s;
}
input:not([type]):focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--field);
  box-shadow: 0 0 0 3px rgba(15,124,108,.14);
}
input::placeholder, textarea::placeholder { color: var(--ink-4); }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B757E' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7em center;
  padding-right: 2.1em;
}
.field { margin-bottom: 1.05rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.hint { font-size: .78rem; color: var(--ink-3); margin-top: .35rem; }
.err  { font-size: .8rem; color: var(--brick); margin-top: .35rem; font-weight: 500; }

.check {
  display: flex; align-items: flex-start; gap: .6rem;
  font-family: var(--body); font-size: .93rem;
  text-transform: none; letter-spacing: 0; color: var(--ink);
  font-weight: 400; cursor: pointer; margin-bottom: .5rem;
}
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--field); flex: none; cursor: pointer; }

/* Selectable tile — used for industries, services, plans, pay types. */
.tile {
  position: relative;
  border: 1.5px solid var(--rule);
  border-radius: var(--r);
  background: var(--surface);
  padding: 1rem 1.05rem;
  cursor: pointer;
  transition: border-color .14s, box-shadow .14s, transform .14s var(--ease);
  text-align: left;
  font-family: var(--body);
  width: 100%;
}
.tile:hover { border-color: var(--field-light); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.tile.sel { border-color: var(--field); background: var(--field-wash); box-shadow: 0 0 0 1px var(--field); }
.tile.sel::after {
  content: '✓';
  position: absolute; top: 9px; right: 11px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--field); color: #fff;
  font-size: .68rem; font-weight: 700;
  display: grid; place-items: center;
}
.tile-name { font-family: var(--display); font-weight: 700; font-size: .98rem; display: block; margin-bottom: .15rem; }
.tile-meta { font-size: .78rem; color: var(--ink-3); }

/* ---------------------------------------------------------------- tables */

.table { width: 100%; border-collapse: collapse; font-size: .89rem; }
.table th {
  font-family: var(--mono);
  font-size: .672rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
  padding: .6rem .8rem;
  border-bottom: 1.5px solid var(--rule);
  background: var(--paper);
  position: sticky; top: 0; z-index: 2;
  white-space: nowrap;
}
.table td { padding: .7rem .8rem; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--paper); }
.table tbody tr.clickable { cursor: pointer; }
.table .num, .table .right { text-align: right; }
.table-scroll { overflow-x: auto; }

.empty {
  padding: 3rem 1.5rem; text-align: center; color: var(--ink-3);
}
.empty-icon { font-size: 2rem; opacity: .35; display: block; margin-bottom: .6rem; }

/* ---------------------------------------------------------------- misc */

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: .72rem;
  color: #fff; flex: none; letter-spacing: -.02em;
}
.avatar-lg { width: 44px; height: 44px; font-size: .95rem; }
.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -9px; box-shadow: 0 0 0 2px var(--surface); }

.bar { height: 6px; background: var(--paper-3); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--field); border-radius: 99px; transition: width .5s var(--ease); }
.bar.amber > span { background: var(--hivis); }
.bar.red > span { background: var(--brick); }

.kpi-value {
  font-family: var(--display); font-weight: 900;
  font-size: 1.95rem; letter-spacing: -.035em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi-label {
  font-family: var(--mono); font-size: .672rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
  margin-top: .45rem;
}
.delta { font-family: var(--mono); font-size: .75rem; font-weight: 600; }
.delta.up { color: var(--field); }
.delta.down { color: var(--brick); }

/* Toasts */
#toasts {
  position: fixed; bottom: 22px; right: 22px; z-index: 900;
  display: flex; flex-direction: column; gap: .55rem; pointer-events: none;
}
.toast {
  background: var(--slate); color: var(--slate-ink);
  border-left: 4px solid var(--field);
  padding: .8rem 1.1rem; border-radius: var(--r);
  font-size: .89rem; font-weight: 500;
  box-shadow: var(--shadow-3);
  max-width: 380px;
  animation: toast-in .32s var(--ease);
}
.toast.err { border-left-color: var(--brick); }
.toast.warn { border-left-color: var(--hivis); }
@keyframes toast-in { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal-bg {
  position: fixed; inset: 0; z-index: 800;
  background: rgba(18,22,26,.55);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 1.5rem;
  animation: fade .18s var(--ease);
}
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  width: min(620px, 100%);
  max-height: 88vh;
  display: flex; flex-direction: column;
  animation: modal-in .24s var(--ease);
  border: 1px solid var(--rule);
}
.modal-wide { width: min(940px, 100%); }
.modal-head {
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--rule-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.modal-head h3 { margin: 0; }
.modal-body { padding: 1.4rem; overflow-y: auto; }
.modal-foot {
  padding: 1rem 1.4rem; border-top: 1px solid var(--rule-soft);
  display: flex; justify-content: flex-end; gap: .6rem;
  background: var(--paper);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.x-btn {
  background: none; border: 0; cursor: pointer;
  font-size: 1.3rem; color: var(--ink-3); line-height: 1;
  padding: .2rem .4rem; border-radius: var(--r-sm);
}
.x-btn:hover { background: var(--paper-2); color: var(--ink); }
@keyframes fade { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }

/* Reveal-on-load stagger for marketing sections */
.rise { animation: rise .62s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.spinner {
  width: 17px; height: 17px;
  border: 2.2px solid rgba(255,255,255,.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .62s linear infinite;
  display: inline-block;
}
.spinner-dark { border-color: rgba(20,24,28,.16); border-top-color: var(--field); }
@keyframes spin { to { transform: rotate(360deg); } }

.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.items { display: flex; align-items: center; gap: .6rem; }
.stack { display: flex; flex-direction: column; gap: .5rem; }
.grow { flex: 1; min-width: 0; }
.gap-sm { gap: .4rem; } .gap-lg { gap: 1.2rem; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: .6rem; } .mt-2 { margin-top: 1.2rem; } .mt-3 { margin-top: 2rem; }
.mb-1 { margin-bottom: .6rem; } .mb-2 { margin-bottom: 1.2rem; } .mb-3 { margin-bottom: 2rem; }

@media (max-width: 720px) {
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- tabs
   Ruled tab strip. Panels all render into the DOM and inactive ones are
   hidden, so listeners bound after render still find their elements. */
.tabs {
  display: flex; gap: 0; align-items: stretch;
  border-bottom: 1.5px solid var(--rule);
  margin-bottom: 1.4rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  font-family: var(--display); font-weight: 700; font-size: .92rem;
  letter-spacing: -.01em; color: var(--ink-3);
  padding: .7rem 1.05rem .65rem;
  border-bottom: 3px solid transparent;
  margin-bottom: -1.5px;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: .45rem;
  transition: color .14s, border-color .14s, background .14s;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.tab:hover { color: var(--ink); background: var(--paper-2); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--field); }
.tab:focus-visible { outline: 2px solid var(--field); outline-offset: -3px; }

.tab .tab-count {
  font-family: var(--mono); font-size: .66rem; font-weight: 600;
  background: var(--paper-3); color: var(--ink-3);
  padding: .1rem .38rem; border-radius: 99px; min-width: 17px; text-align: center;
}
.tab[aria-selected="true"] .tab-count { background: var(--field); color: #fff; }
.tab .tab-count.alert { background: var(--brick); color: #fff; }
.tab .tab-count.warn { background: var(--hivis); color: #23180A; }

.tab-panel[hidden] { display: none !important; }

/* Inside a modal the strip sits flush with the body padding. */
.modal-body > .tabs { margin: -1.4rem -1.4rem 1.2rem; padding: 0 1.4rem; }
.sheet-body > .tabs { margin: -1.1rem -1.1rem 1rem; padding: 0 1.1rem; }

/* Dark surfaces (crew app) */
.tabs.on-dark { border-bottom-color: var(--slate-rule); }
.tabs.on-dark .tab { color: var(--slate-ink-2); }
.tabs.on-dark .tab:hover { color: #fff; background: var(--slate-3); }
.tabs.on-dark .tab[aria-selected="true"] { color: #fff; border-bottom-color: var(--hivis); }
.tabs.on-dark .tab .tab-count { background: var(--slate-3); color: var(--slate-ink-2); }
.tabs.on-dark .tab[aria-selected="true"] .tab-count { background: var(--hivis); color: #23180A; }

@media (max-width: 720px) {
  .tab { padding: .65rem .8rem .6rem; font-size: .86rem; }
}

/* ---- Attribution ------------------------------------------------------
   Quiet by design: present on every surface, never competing with the
   tenant's own brand. */
.powered-by {
  font-family: var(--mono);
  font-size: .68rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-4);
}
.powered-by strong { font-weight: 700; color: var(--ink-3); letter-spacing: .06em; }

/* On an app shell there is no footer to join, so it sits under the content. */
.powered-by.app-credit {
  display: block; text-align: center;
  padding: 1rem 1rem 1.3rem;
  border-top: 1px solid var(--rule-soft);
  background: var(--paper);
}
