/* ==========================================================================
   MyBookings design system - light theme, blue accent, Plus Jakarta Sans
   headings / IBM Plex Sans body / IBM Plex Mono for voucher & money figures.
   Committed to a single light look by choice - a back-office business tool,
   not a themeable consumer app - so no dark-mode variant.
   ========================================================================== */

:root {
  color-scheme: light;

  --paper: #f7f9fc;
  --surface: #ffffff;
  --surface-sunken: #eef2f8;
  --ink: #1a2233;
  --ink-soft: #5a6578;
  --ink-faint: #8891a3;
  --border: #dde3ed;

  --accent: #2d5bb8;
  --accent-strong: #244b99;
  --accent-ink: #ffffff;
  --accent-soft: #e8eefa;
  --accent-soft-border: #c3d4ee;

  --st-draft-bg: #edf0f4;    --st-draft-fg: #5a6578;
  --st-received-bg: #e7ecf7; --st-received-fg: #3d4e8a;
  --st-quoted-bg: #faf1d6;   --st-quoted-fg: #8a661c;
  --st-auth-bg: #e8eefa;     --st-auth-fg: #2d5bb8;
  --st-invoiced-bg: #ece3f7; --st-invoiced-fg: #5a3fa3;
  --st-paid-bg: #e1f3e5;     --st-paid-fg: #227a3b;
  --st-cancel-bg: #f7e4e0;   --st-cancel-fg: #a3402a;

  --shadow-card: 0 1px 2px rgba(26, 34, 51, .04), 0 1px 1px rgba(26, 34, 51, .03);
  --radius: 10px;
  --radius-sm: 7px;

  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

  /* Bootstrap hooks - keeps components we didn't touch directly in family */
  --bs-body-font-family: var(--font-body);
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--ink);
  --bs-border-color: var(--border);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius);
  --bs-link-color: var(--accent);
  --bs-link-hover-color: var(--accent-strong);
  --bs-primary: var(--accent);
  --bs-primary-rgb: 45, 91, 184;
}

html { font-size: 16px; }

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: .9375rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h3 { font-size: 1.0625rem; margin: 0 0 .75rem; }
h5, h6 { font-size: .9rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; }

.text-muted { color: var(--ink-faint) !important; }

::selection { background: var(--accent-soft-border); }

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

/* ---- layout shells -------------------------------------------------- */

.app-shell { display: flex; align-items: stretch; min-height: 100vh; }

.sidebar {
  width: 234px;
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; color: inherit; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px; flex: none;
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--ink-faint); margin-top: 1px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-faint); padding: 0 10px; margin-bottom: 6px;
}
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--ink-soft); text-decoration: none;
}
.side-nav a svg { flex: none; opacity: .75; }
.side-nav a:hover { background: var(--surface-sunken); color: var(--ink); text-decoration: none; }
.side-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.side-nav a.active svg { opacity: 1; }

.sidebar-foot {
  margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px;
  display: flex; align-items: center; gap: 9px;
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--surface-sunken);
  border: 1px solid var(--border); flex: none; display: flex; align-items: center;
  justify-content: center; font-size: 11px; color: var(--ink-soft); font-weight: 500;
}
.who { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.who-name { display: block; width: 100%; font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot form { flex: none; }
.sidebar-foot .btn-link { padding: 0; font-size: 11.5px; color: var(--ink-faint); }
.sidebar-foot .btn-link:hover { color: var(--accent); }

.main { flex: 1; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.topbar-crumb { font-size: 12px; color: var(--ink-faint); }
.topbar-crumb b { color: var(--ink-soft); font-weight: 500; }

.content { padding: 28px 24px 60px; max-width: 1180px; }

/* anonymous (login/register/public-link) shell */
.auth-shell {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px 16px; gap: 28px;
}
.auth-card {
  width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 32px 30px;
}
.auth-card.auth-card-wide { max-width: 560px; }
.auth-foot { font-size: 13px; color: var(--ink-soft); text-align: center; }

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

.btn {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: .875rem;
  border-radius: var(--radius-sm);
  padding: .5rem .9rem;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.btn-sm { padding: .3rem .6rem; font-size: .8125rem; }

.btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink);
}

.btn-outline-primary, .btn-outline-secondary {
  background: transparent; border-color: var(--border); color: var(--ink);
}
.btn-outline-primary:hover, .btn-outline-secondary:hover,
.btn-outline-primary:focus, .btn-outline-secondary:focus {
  background: var(--surface-sunken); border-color: var(--ink-faint); color: var(--ink);
}

.btn-outline-danger { background: transparent; border-color: var(--st-cancel-fg); color: var(--st-cancel-fg); }
.btn-outline-danger:hover, .btn-outline-danger:focus { background: var(--st-cancel-bg); border-color: var(--st-cancel-fg); color: var(--st-cancel-fg); }

.btn-outline-success { background: transparent; border-color: var(--st-paid-fg); color: var(--st-paid-fg); }
.btn-outline-success:hover, .btn-outline-success:focus { background: var(--st-paid-bg); border-color: var(--st-paid-fg); color: var(--st-paid-fg); }

.btn-secondary { background: var(--surface-sunken); border-color: var(--border); color: var(--ink-faint); }
.btn-secondary:disabled, .btn.disabled { opacity: .7; }

.btn-link { color: var(--ink-soft); text-decoration: none; }
.btn-link:hover { color: var(--ink); text-decoration: none; }

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

.form-label { font-size: .8125rem; font-weight: 500; color: var(--ink-soft); margin-bottom: .3rem; }

.form-control, .form-select {
  font-family: var(--font-body); font-size: .875rem; color: var(--ink);
  background-color: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .55rem .7rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--ink); background-color: var(--surface);
}
.form-control::placeholder { color: var(--ink-faint); }

.form-check-input { border-color: var(--border); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.text-danger { color: var(--st-cancel-fg) !important; font-size: .8125rem; }

.input-group-text {
  background: var(--surface-sunken); border: 1px solid var(--border); color: var(--ink-faint);
  font-size: .875rem; border-radius: var(--radius-sm);
}

/* ---- cards, alerts ------------------------------------------------------ */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: 20px 22px; }
.card-subtitle { color: var(--ink-faint) !important; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }

.alert { border-radius: var(--radius-sm); border: 1px solid transparent; font-size: .875rem; }
.alert-danger { background: var(--st-cancel-bg); color: var(--st-cancel-fg); border-color: var(--st-cancel-bg); }
.alert-success { background: var(--st-paid-bg); color: var(--st-paid-fg); border-color: var(--st-paid-bg); }
.alert-info { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent-soft-border); }

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

.table {
  --bs-table-bg: transparent;
  font-size: .875rem; color: var(--ink);
}
.table > thead th {
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint);
  font-weight: 500; border-bottom: 1px solid var(--border); padding: .65rem 1rem;
}
.table > tbody td { padding: .8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table > tbody tr:hover { background: var(--surface-sunken); }
.table > tbody tr:last-child td { border-bottom: none; }

/* money / reference-number figures - tabular, monospace, like the real documents */
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.code { font-family: var(--font-mono); font-size: .8125em; color: var(--ink-soft); }

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

.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: .71875rem; font-weight: 500;
  padding: 3px 9px; border-radius: 99px; white-space: nowrap; font-family: var(--font-body);
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.pill-draft { background: var(--st-draft-bg); color: var(--st-draft-fg); }
.pill-received { background: var(--st-received-bg); color: var(--st-received-fg); }
.pill-quoted { background: var(--st-quoted-bg); color: var(--st-quoted-fg); }
.pill-voucherauthorised { background: var(--st-auth-bg); color: var(--st-auth-fg); }
.pill-invoiced { background: var(--st-invoiced-bg); color: var(--st-invoiced-fg); }
.pill-paid { background: var(--st-paid-bg); color: var(--st-paid-fg); }
.pill-cancelled { background: var(--st-cancel-bg); color: var(--st-cancel-fg); }

.badge { font-weight: 500; }

/* ---- status pipeline (booking detail) --------------------------------- */

.pipeline { display: flex; align-items: flex-start; gap: 0; margin: 4px 0 2px; }
.pipeline-step { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; min-width: 0; }
.pipeline-step-line { position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.pipeline-step:first-child .pipeline-step-line { display: none; }
.pipeline-step.done .pipeline-step-line, .pipeline-step.current .pipeline-step-line { background: var(--accent); }
.pipeline-dot {
  width: 23px; height: 23px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border);
  z-index: 1; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--ink-faint);
}
.pipeline-step.done .pipeline-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pipeline-step.current .pipeline-dot { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pipeline-step.cancelled .pipeline-dot { border-color: var(--st-cancel-fg); color: var(--st-cancel-fg); }
.pipeline-label { font-size: .71875rem; margin-top: 8px; text-align: center; color: var(--ink-faint); max-width: 92px; }
.pipeline-step.done .pipeline-label { color: var(--ink-soft); }
.pipeline-step.current .pipeline-label { color: var(--ink); font-weight: 600; }
.pipeline-step.cancelled .pipeline-label { color: var(--st-cancel-fg); font-weight: 600; }
.pipeline-note {
  font-size: .71875rem; color: var(--ink-faint); margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border);
}

footer.footer { border-color: var(--border) !important; color: var(--ink-faint); font-size: .8125rem; }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: auto; flex-direction: row; align-items: center; padding: 12px 16px; gap: 16px; }
  .sidebar .side-nav { flex-direction: row; }
  .sidebar-foot { margin-top: 0; border-top: none; padding-top: 0; margin-left: auto; }
  .content { padding: 20px 16px 48px; }
  .pipeline { overflow-x: auto; }
}
