/* ============================================================
   Hours → Invoice — brand tokens (from MacInnes Events brand hub)
   ============================================================ */
:root {
  /* Brand palette */
  --me-red: #C83E3E;
  --me-red-deep: #A02B2B;
  --me-red-bright: #E04848;
  --me-blue: #007DA0;
  --me-blue-deep: #00566F;
  --me-blue-bright: #00A0CC;

  /* Neutrals */
  --me-ink: #0A0E12;
  --me-ink-soft: #1A1F26;
  --me-graphite: #2E353F;
  --me-steel: #5C6470;
  --me-fog: #A8AEB8;
  --me-mist: #DCDFE4;
  --me-paper: #F5F2EC;
  --me-paper-bright: #FAF8F4;
  --me-white: #FFFFFF;

  /* Type */
  --font-display: 'Familjen Grotesk', system-ui, sans-serif;
  --font-sans: 'Geist', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;

  /* App chrome */
  --bg: var(--me-ink);
  --bg-soft: var(--me-ink-soft);
  --bg-card: #0E1318;
  --fg: var(--me-paper);
  --fg-muted: var(--me-fog);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);

  /* Semantic */
  --status-active: var(--me-blue-bright);
  --status-ready: var(--me-red-bright);
  --status-invoiced: #B59A3F;
  --status-paid: #4FAF6E;
  --status-archived: var(--me-steel);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--me-blue-bright); text-decoration: none; }
a:hover { color: var(--me-red-bright); }

/* ============== App shell ============== */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.app--bare { grid-template-columns: 1fr; }

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #06090C;
  border-right: 1px solid var(--border);
  padding: 24px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}
.sidebar__brand img { height: 22px; width: auto; }
.sidebar__brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.sidebar__brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--me-fog);
  margin-top: 2px;
}
.sidebar__group { display: flex; flex-direction: column; gap: 2px; }
.sidebar__heading {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--me-steel);
  margin: 0 0 8px 8px;
}
.sidebar__link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  color: var(--me-mist);
  text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background .15s, color .15s;
  border: none; background: transparent;
  text-align: left; font-family: inherit;
  width: 100%;
}
.sidebar__link:hover { background: rgba(255,255,255,0.04); color: var(--me-white); }
.sidebar__link--active {
  background: rgba(200,62,62,0.12);
  color: var(--me-paper);
  box-shadow: inset 2px 0 0 var(--me-red);
}
.sidebar__num {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--me-steel);
  width: 18px;
}
.sidebar__link--active .sidebar__num { color: var(--me-red-bright); }
.sidebar__footer {
  margin-top: auto; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 9.5px; color: var(--me-steel);
  letter-spacing: 0.05em; line-height: 1.7;
  padding-left: 6px;
}
.sidebar__user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.025);
}
.sidebar__avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--me-red), var(--me-blue));
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: white;
}
.sidebar__user-name { font-size: 12.5px; font-weight: 500; line-height: 1.2; }
.sidebar__user-email { font-family: var(--font-mono); font-size: 9.5px; color: var(--me-steel); margin-top: 2px; }

/* Main canvas */
.main { min-width: 0; }
.page {
  padding: 40px 48px 80px;
  max-width: 1200px;
  margin: 0 auto;
}
.page--narrow { max-width: 880px; }
.page--wide { max-width: none; padding: 40px 48px 80px; }

/* Page head */
.page__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding-bottom: 24px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.page__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 36px;
  letter-spacing: -0.025em;
  line-height: 1;
  margin: 0;
}
.page__kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--me-red-bright);
  margin: 0 0 8px 0;
}
.page__sub {
  font-size: 14px;
  color: var(--me-fog);
  margin: 8px 0 0 0;
}
.page__actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Eyebrow */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--me-steel);
  margin: 0 0 12px 0;
}
.eyebrow--red { color: var(--me-red-bright); }
.eyebrow--blue { color: var(--me-blue-bright); }

/* Two-tone divider — recurring brand motif */
.bar {
  height: 2px;
  background: linear-gradient(90deg, var(--me-red) 0%, var(--me-red) 40%, var(--me-blue) 40%, var(--me-blue) 100%);
}

/* ============== Buttons ============== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  background: var(--me-red); color: white;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  border: 0; border-radius: 4px;
  cursor: pointer; text-decoration: none;
  transition: background .15s;
  font-weight: 500;
}
.btn:hover { background: var(--me-red-deep); color: white; }
.btn--ghost {
  background: transparent;
  color: var(--me-paper);
  border: 1px solid var(--border-strong);
}
.btn--ghost:hover { background: rgba(255,255,255,0.06); color: var(--me-paper); }
.btn--blue { background: var(--me-blue); }
.btn--blue:hover { background: var(--me-blue-deep); }
.btn--sm { padding: 6px 12px; font-size: 10px; }
.btn--lg { padding: 13px 22px; font-size: 12px; }
.btn--block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ============== Form controls ============== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--me-steel);
}
.field__hint {
  font-size: 11px;
  color: var(--me-steel);
  font-style: italic;
  margin-top: 2px;
}
.input, .select, .textarea {
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--me-paper);
  outline: none;
  transition: border-color .15s, background .15s;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--me-red);
  background: #11171D;
}
.input--mono { font-family: var(--font-mono); font-size: 13px; }
.input--sm { padding: 6px 8px; font-size: 12px; }
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23A8AEB8' d='M0 0l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 0; }
.input-group > :first-child { border-radius: 4px 0 0 4px; }
.input-group > :last-child { border-radius: 0 4px 4px 0; }
.input-group__addon {
  background: #060A0E;
  border: 1px solid var(--border);
  border-right: 0;
  padding: 0 10px;
  display: flex; align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--me-fog);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.input-group__addon--right { border-right: 1px solid var(--border); border-left: 0; }

/* Checkbox / toggle */
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track {
  width: 32px; height: 18px;
  background: #1A2128;
  border-radius: 999px;
  border: 1px solid var(--border);
  position: relative;
  transition: background .15s;
}
.toggle__track::after {
  content: "";
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--me-fog);
  top: 2px; left: 2px;
  transition: transform .15s, background .15s;
}
.toggle input:checked + .toggle__track { background: var(--me-red); border-color: var(--me-red); }
.toggle input:checked + .toggle__track::after { transform: translateX(14px); background: white; }
.toggle__label { font-size: 13px; color: var(--me-mist); }

/* ============== Cards ============== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 24px;
}
.card--paper { background: var(--me-paper); color: var(--me-ink); }
.card__head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: -4px 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card--paper .card__head { border-bottom-color: var(--me-mist); }
.card__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.015em;
  margin: 0;
}

/* ============== Status pills ============== */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  background: rgba(255,255,255,0.05);
  color: var(--me-fog);
  font-weight: 500;
}
.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill--booked { color: #B59A3F; background: rgba(181,154,63,0.08); }
.pill--active { color: var(--status-active); background: rgba(0,160,204,0.1); }
.pill--complete { color: var(--status-ready); background: rgba(224,72,72,0.1); }
.pill--ready { color: var(--status-ready); background: rgba(224,72,72,0.1); }
.pill--invoiced { color: var(--status-invoiced); background: rgba(181,154,63,0.12); }
.pill--paid { color: var(--status-paid); background: rgba(79,175,110,0.12); }
.pill--cancelled { color: var(--status-archived); background: rgba(92,100,112,0.15); text-decoration: line-through; }
.pill--archived { color: var(--status-archived); background: rgba(92,100,112,0.15); }

/* Invoice status pills */
.pill--draft { color: var(--status-archived); background: rgba(92,100,112,0.12); }
.pill--sent  { color: var(--status-active); background: rgba(0,160,204,0.10); }

/* Expense categories — subtle per-category tint, same family as status pills. */
.pill--travel    { color: var(--status-active);   background: rgba(0,160,204,0.10); }
.pill--meals     { color: #C97A3F;                background: rgba(201,122,63,0.10); }
.pill--lodging   { color: #9D7BC4;                background: rgba(157,123,196,0.10); }
.pill--equipment { color: var(--status-paid);     background: rgba(79,175,110,0.10); }
.pill--other     { color: var(--status-archived); background: rgba(92,100,112,0.12); }

/* ============== Filter dropdown (native <details>) ============== */
.filter-menu { position: relative; display: inline-block; }
.filter-menu > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--me-mist); font-size: 12px;
}
.filter-menu > summary::-webkit-details-marker { display: none; }
.filter-menu > summary::after {
  content: "▾"; font-size: 10px; color: var(--me-steel);
}
.filter-menu[open] > summary { border-color: var(--me-red); color: var(--me-paper); }
.filter-menu__panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  min-width: 220px; padding: 6px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  display: flex; flex-direction: column; gap: 1px;
}
.filter-menu__item {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 8px 12px; border-radius: 3px;
  color: var(--me-mist); text-decoration: none; font-size: 13px;
}
.filter-menu__item:hover { background: rgba(255,255,255,0.04); color: var(--me-paper); }
.filter-menu__item--active { background: rgba(200,62,62,0.12); color: var(--me-paper); }
.filter-menu__item .muted { font-family: var(--font-mono); font-size: 10.5px; }
.filter-menu__sep {
  height: 1px; background: var(--border); margin: 4px 6px;
  border: 0;
}

/* ============== Tables ============== */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.tbl th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--me-steel);
  font-weight: 500;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.015);
}
.tbl td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: rgba(255,255,255,0.025); cursor: pointer; }
.tbl tbody tr.tbl__row--no-hover { cursor: default; }
.tbl tbody tr.tbl__row--no-hover:hover { background: transparent; }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tbl td.center, .tbl th.center { text-align: center; }
.tbl td.muted { color: var(--me-fog); }
.tbl td.mono { font-family: var(--font-mono); font-size: 12px; color: var(--me-mist); }

/* ============== Layout helpers ============== */
.row { display: flex; gap: 12px; align-items: center; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack--md { gap: 20px; }
.stack--lg { gap: 32px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.spacer { flex: 1; }
.muted { color: var(--me-fog); }
.mono { font-family: var(--font-mono); }
.tnum { font-variant-numeric: tabular-nums; }

/* ============== Empty state ============== */
.empty {
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  padding: 48px 32px;
  text-align: center;
  color: var(--me-fog);
}
.empty__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--me-paper);
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
}
.empty__body { font-size: 13px; max-width: 40ch; margin: 0 auto 20px; }

/* ============== Modal ============== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(6, 9, 12, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: grid; place-items: center;
  padding: 40px 20px;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  width: 100%; max-width: 640px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  box-shadow: 0 30px 60px -10px rgba(0,0,0,0.5);
}
.modal--lg { max-width: 880px; }
.modal__head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.015em;
  margin: 0;
}
.modal__close {
  background: transparent; border: 0;
  color: var(--me-fog); cursor: pointer;
  font-size: 20px; line-height: 1;
  padding: 4px 8px;
}
.modal__close:hover { color: var(--me-paper); }
.modal__body { padding: 24px; }
.modal__foot {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* Tabs */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab {
  background: transparent; border: 0;
  padding: 12px 18px;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--me-fog);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--me-paper); }
.tab--active { color: var(--me-red-bright); border-bottom-color: var(--me-red); }

/* Spec rows */
.spec-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.spec-row:last-child { border-bottom: 0; }
.spec-row dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--me-steel);
  align-self: center;
}
.spec-row dd { margin: 0; color: var(--me-mist); }
