/* ============================================================
   Tough Tyres OS — Design System CSS
   Mobile-first, vanilla CSS, no framework required
   ============================================================ */

/* ── Google Fonts ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=DM+Mono:wght@400;500&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --nav:    #0f2a6b;
  --blue:   #1a4dbf;
  --blm:    #2255cc;
  --gold:   #e8b800;
  --g50:    #f5f5f2;
  --surf:   #ffffff;
  --tx:     #111111;
  --txm:    #6b7280;
  --amber:  #d97b10;
  --red:    #d63e3e;
  --green:  #1a8a4a;

  --radius:   12px;
  --radius-s: 6px;
  --radius-l: 18px;
  --shadow:   0 1px 3px rgba(0,0,0,0.08);
  --shadow-m: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-l: 0 8px 32px rgba(0,0,0,0.13);

  --nav-h:    64px;
  --sidebar-w: 240px;
  --bottom-nav-h: 60px;
  --bdr:      #e8e8e4;

  --transition: 0.18s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--g50);
  color: var(--tx);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--blm);
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ── Typography ────────────────────────────────────────────── */
.heading,
h1, h2, h3, h4 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  line-height: 1.25;
  color: var(--tx);
}

h1, .h1 { font-size: 2rem; }
h2, .h2 { font-size: 1.5rem; }
h3, .h3 { font-size: 1.25rem; }
h4, .h4 { font-size: 1.05rem; }

.page-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--tx);
  letter-spacing: -0.02em;
}

.mono {
  font-family: 'DM Mono', 'Fira Code', monospace;
  font-size: 0.92em;
  letter-spacing: 0.02em;
}

.text-muted {
  color: var(--txm);
}

.text-gold {
  color: var(--gold);
}

.text-blue {
  color: var(--blue);
}

.text-red {
  color: var(--red);
}

.text-sm {
  font-size: 0.85rem;
}

.text-xs {
  font-size: 0.75rem;
}

/* ── Top Navigation ────────────────────────────────────────── */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--nav);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  z-index: 100;
  gap: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.topnav__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex-shrink: 0;
}

.topnav__logo {
  height: 36px;
  width: auto;
}

.topnav__name {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.topnav__name span {
  color: var(--gold);
}

.topnav__links {
  display: none;
  align-items: center;
  gap: 0.1rem;
  margin-left: 2rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.topnav__link {
  display: flex;
  align-items: center;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-s);
  color: rgba(255,255,255,0.78);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.topnav__link:hover {
  background: rgba(255,255,255,0.10);
  color: #ffffff;
}

.topnav__link.active {
  background: rgba(232,184,0,0.18);
  color: var(--gold);
  font-weight: 600;
}

.topnav__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-shrink: 0;
}

.topnav__user {
  display: none;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255,255,255,0.85);
  font-size: 0.88rem;
}

.topnav__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blm);
  border: 2px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  overflow: hidden;
}

.topnav__logout {
  display: flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.85);
  border-radius: var(--radius-s);
  font-size: 0.85rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  min-height: 44px;
}

.topnav__logout:hover {
  background: rgba(214,62,62,0.3);
  color: #fff;
}

/* ── Layout ────────────────────────────────────────────────── */
.page-wrap {
  padding-top: var(--nav-h);
  min-height: 100vh;
}

.content-area {
  padding: 1.5rem 1rem 5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.page-header__left h1 {
  font-size: 1.6rem;
}

.page-header__sub {
  color: var(--txm);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.page-header__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ── Bottom Nav (mobile only) ──────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--surf);
  border-top: 1px solid #e8e8e4;
  display: flex;
  align-items: stretch;
  z-index: 90;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.07);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: var(--txm);
  font-size: 0.7rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition);
  min-height: 44px;
  padding: 0.25rem 0;
}

.bottom-nav__item:hover,
.bottom-nav__item.active {
  color: var(--blue);
}

.bottom-nav__item.active .bottom-nav__icon {
  background: rgba(26,77,191,0.10);
}

.bottom-nav__icon {
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-s);
  transition: background var(--transition);
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--surf);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  border: 1px solid rgba(0,0,0,0.05);
}

.card + .card {
  margin-top: 1rem;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f0f0ec;
}

.card__title {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--tx);
}

.card__body {
  /* fluid content area */
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surf);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-card__number {
  font-family: 'Syne', sans-serif;
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-card__number.blue {
  color: var(--blue);
}

.stat-card__number.red {
  color: var(--red);
}

.stat-card__number.green {
  color: var(--green);
}

.stat-card__label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--txm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-s);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
  min-height: 44px;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--blue);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--blm);
  color: #ffffff;
  box-shadow: 0 3px 12px rgba(26,77,191,0.28);
}

.btn-gold {
  background: var(--gold);
  color: #0f2a6b;
}

.btn-gold:hover:not(:disabled) {
  background: #d4a800;
  color: #0f2a6b;
  box-shadow: 0 3px 12px rgba(232,184,0,0.32);
}

.btn-danger {
  background: var(--red);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background: #c23030;
  color: #ffffff;
  box-shadow: 0 3px 12px rgba(214,62,62,0.28);
}

.btn-ghost {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--blue);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(26,77,191,0.07);
  color: var(--blm);
}

.btn-ghost-dark {
  background: transparent;
  color: var(--tx);
  border: 1.5px solid #d1d5db;
}

.btn-ghost-dark:hover:not(:disabled) {
  background: rgba(0,0,0,0.04);
}

.btn-sm {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  min-height: 36px;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  min-height: 52px;
  border-radius: var(--radius);
}

.btn-xl {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  min-height: 58px;
  border-radius: var(--radius);
  font-weight: 700;
}

.btn-block {
  width: 100%;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge-blue {
  background: rgba(26,77,191,0.12);
  color: var(--blue);
}

.badge-gold {
  background: rgba(232,184,0,0.15);
  color: #8a6d00;
}

.badge-amber {
  background: rgba(217,123,16,0.12);
  color: var(--amber);
}

.badge-red {
  background: rgba(214,62,62,0.12);
  color: var(--red);
}

.badge-grey {
  background: rgba(107,114,128,0.12);
  color: var(--txm);
}

.badge-green {
  background: rgba(26,138,74,0.12);
  color: var(--green);
}

.badge-navy {
  background: rgba(15,42,107,0.10);
  color: var(--nav);
}

/* ── Status Pills ──────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.75rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-logged    { background: rgba(107,114,128,0.12); color: #4b5563; }
.status-dispatched{ background: rgba(26,77,191,0.12); color: var(--blue); }
.status-en-route  { background: rgba(217,123,16,0.12); color: var(--amber); }
.status-on-site   { background: rgba(232,184,0,0.15); color: #7a5f00; }
.status-completed { background: rgba(26,138,74,0.12); color: var(--green); }
.status-cancelled { background: rgba(214,62,62,0.08); color: var(--red); }
.status-draft     { background: rgba(107,114,128,0.12); color: #4b5563; }
.status-sent      { background: rgba(26,77,191,0.12); color: var(--blue); }
.status-paid      { background: rgba(26,138,74,0.12); color: var(--green); }
.status-overdue   { background: rgba(214,62,62,0.12); color: var(--red); }
.status-available { background: rgba(26,138,74,0.10); color: var(--green); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tx);
  letter-spacing: 0.01em;
}

.form-label.required::after {
  content: ' *';
  color: var(--red);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-s);
  background: var(--surf);
  color: var(--tx);
  font-size: 0.92rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 44px;
  appearance: none;
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,77,191,0.12);
}

.form-input::placeholder {
  color: #b0b5be;
}

.form-select {
  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='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-input--sm,
.form-select--sm {
  padding: 0.4rem 0.65rem;
  font-size: 0.875rem;
  min-height: 36px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--txm);
  margin-top: 0.2rem;
}

.form-error {
  font-size: 0.78rem;
  color: var(--red);
  margin-top: 0.2rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
  flex-wrap: wrap;
}

/* ── Data Table ────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surf);
  border: 1px solid rgba(0,0,0,0.05);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--txm);
  background: #fafaf8;
  border-bottom: 1px solid #f0f0ec;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid #f5f5f2;
  transition: background var(--transition);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: #fafaf8;
}

.data-table td {
  padding: 0.85rem 1rem;
  color: var(--tx);
  vertical-align: middle;
}

.data-table td.mono {
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  color: var(--nav);
  font-weight: 500;
}

/* ── Alert / Flash ─────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-s);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
}

.alert-success {
  background: rgba(26,138,74,0.08);
  border-color: rgba(26,138,74,0.25);
  color: #14532d;
}

.alert-error {
  background: rgba(214,62,62,0.08);
  border-color: rgba(214,62,62,0.25);
  color: #7f1d1d;
}

.alert-warning {
  background: rgba(217,123,16,0.08);
  border-color: rgba(217,123,16,0.25);
  color: #78350f;
}

.alert-info {
  background: rgba(26,77,191,0.06);
  border-color: rgba(26,77,191,0.2);
  color: #1e3a8a;
}

.alert__close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: currentColor;
  opacity: 0.6;
  font-size: 1.1rem;
  padding: 0;
  min-height: unset;
  flex-shrink: 0;
}

.alert__close:hover {
  opacity: 1;
}

/* ── Search Bar ────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-bar .form-input {
  flex: 1;
  min-width: min(100%, 200px);
}

/* ── Filter Tabs ───────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--surf);
  border: 1px solid #e8e8e4;
  border-radius: var(--radius-s);
  padding: 0.25rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  flex-wrap: nowrap;
  width: fit-content;
  max-width: 100%;
}

.filter-tab {
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--txm);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.filter-tab:hover {
  background: var(--g50);
  color: var(--tx);
}

.filter-tab.active {
  background: var(--blue);
  color: #ffffff;
}

/* ── Job Cards (mobile) ────────────────────────────────────── */
.job-card {
  background: var(--surf);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.05);
  display: block;
  text-decoration: none;
  color: var(--tx);
  transition: box-shadow var(--transition), transform var(--transition);
  margin-bottom: 0.75rem;
}

.job-card:hover {
  box-shadow: var(--shadow-m);
  transform: translateY(-1px);
  color: var(--tx);
}

.job-card__ref {
  font-family: 'DM Mono', monospace;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--nav);
  margin-bottom: 0.25rem;
}

.job-card__customer {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.job-card__location {
  font-size: 0.85rem;
  color: var(--txm);
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Timeline ──────────────────────────────────────────────── */
.timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding: 0.5rem 0;
  margin: 1rem 0;
}

.timeline__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 80px;
  position: relative;
}

.timeline__step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: #e8e8e4;
  z-index: 0;
}

.timeline__step.done::after {
  background: var(--blue);
}

.timeline__dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8e8e4;
  border: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition);
}

.timeline__step.done .timeline__dot {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.timeline__step.current .timeline__dot {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--nav);
  box-shadow: 0 0 0 4px rgba(232,184,0,0.2);
}

.timeline__label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--txm);
  margin-top: 0.4rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.timeline__step.done .timeline__label,
.timeline__step.current .timeline__label {
  color: var(--tx);
}

/* ── Info Grid ─────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.info-item__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--txm);
  margin-bottom: 0.2rem;
}

.info-item__value {
  font-size: 0.95rem;
  color: var(--tx);
  font-weight: 500;
}

/* ── CSS-only Tabs ─────────────────────────────────────────── */
.tabs-wrap {
  margin-bottom: 1.25rem;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #f0f0ec;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.65rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--txm);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
  min-height: 44px;
  display: flex;
  align-items: center;
}

.tab-btn:hover {
  color: var(--tx);
}

.tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-s);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--txm);
  text-decoration: none;
  border: 1px solid #e8e8e4;
  transition: background var(--transition), color var(--transition);
}

.pagination__btn:hover {
  background: var(--g50);
  color: var(--tx);
}

.pagination__btn.active {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--txm);
}

.empty-state__icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}

.empty-state__title {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--tx);
  margin-bottom: 0.35rem;
}

.empty-state__sub {
  font-size: 0.88rem;
}

/* ── Login Page ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--nav);
}

.login-split {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.login-brand {
  background: var(--nav);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 200px;
}

.login-brand__logo {
  height: 64px;
  width: auto;
  margin-bottom: 1.25rem;
}

.login-brand__name {
  font-family: 'Syne', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.login-brand__name span {
  color: var(--gold);
}

.login-brand__tagline {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.55);
  font-weight: 400;
}

.login-form-wrap {
  flex: 1;
  background: var(--surf);
  border-radius: 24px 24px 0 0;
  padding: 2rem 1.5rem 2.5rem;
  display: flex;
  flex-direction: column;
}

.login-form-wrap h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  color: var(--tx);
}

.login-form-wrap p {
  color: var(--txm);
  font-size: 0.88rem;
  margin-bottom: 1.75rem;
}

/* ── Comms / Chat ──────────────────────────────────────────── */
.channel-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--surf);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.05);
  text-decoration: none;
  color: var(--tx);
  transition: box-shadow var(--transition), transform var(--transition);
}

.channel-item:hover {
  box-shadow: var(--shadow-m);
  transform: translateY(-1px);
  color: var(--tx);
}

.channel-item__icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(26,77,191,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.channel-item__name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
}

.channel-item__desc {
  font-size: 0.8rem;
  color: var(--txm);
  margin-top: 0.1rem;
}

.chat-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-h) - var(--bottom-nav-h) - 80px);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-msg {
  display: flex;
  gap: 0.6rem;
  max-width: 85%;
}

.chat-msg.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blm);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-msg__bubble {
  background: var(--surf);
  border: 1px solid #e8e8e4;
  border-radius: 12px 12px 12px 4px;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
}

.chat-msg.own .chat-msg__bubble {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 12px 12px 4px 12px;
}

.chat-msg__meta {
  font-size: 0.72rem;
  color: var(--txm);
  margin-top: 0.25rem;
}

.chat-msg.own .chat-msg__meta {
  text-align: right;
}

.chat-input-wrap {
  border-top: 1px solid #f0f0ec;
  padding-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
}

/* ── Dividers & Utilities ──────────────────────────────────── */
.divider {
  height: 1px;
  background: #f0f0ec;
  margin: 1.25rem 0;
}

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 0.75rem; }
.gap-3 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 0.75rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 0.75rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.w-full { width: 100%; }

/* ── Mobile nav padding ────────────────────────────────────── */
.has-bottom-nav .content-area {
  padding-bottom: calc(var(--bottom-nav-h) + 1.5rem);
}

/* ── Responsive: tablet 640px ──────────────────────────────── */
@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .info-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .login-brand {
    min-height: 260px;
  }

  .login-brand__logo {
    height: 80px;
  }

  .login-brand__name {
    font-size: 2.2rem;
  }
}

/* ── Responsive: desktop 768px ─────────────────────────────── */
@media (min-width: 768px) {
  :root {
    --nav-h: 64px;
  }

  .topnav__links {
    display: flex;
  }

  .topnav__user {
    display: flex;
  }

  .bottom-nav {
    display: none;
  }

  .has-bottom-nav .content-area {
    padding-bottom: 1.5rem;
  }

  .content-area {
    padding: 2rem 2rem 2.5rem;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .info-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .login-page {
    flex-direction: row;
  }

  .login-split {
    flex-direction: row;
  }

  .login-brand {
    width: 42%;
    min-height: 100vh;
    border-radius: 0;
    padding: 3rem;
    align-items: flex-start;
    text-align: left;
  }

  .login-brand__logo {
    height: 72px;
    margin-bottom: 2rem;
  }

  .login-brand__name {
    font-size: 2.5rem;
  }

  .login-brand__tagline {
    font-size: 1rem;
    max-width: 320px;
  }

  .login-form-wrap {
    flex: 1;
    border-radius: 0;
    padding: 3rem;
    justify-content: center;
    max-width: 480px;
    margin: 0 auto;
  }

  .login-form-wrap h2 {
    font-size: 1.75rem;
  }

  .chat-wrap {
    height: calc(100vh - var(--nav-h) - 180px);
  }

  .form-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* ── Responsive: large desktop 1024px ──────────────────────── */
@media (min-width: 1024px) {
  .content-area {
    padding: 2rem 2.5rem 2.5rem;
  }
}

/* ── Hamburger Button ──────────────────────────────────────── */
.topnav__hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-s);
  margin-left: 0.5rem;
  flex-shrink: 0;
  transition: background var(--transition);
}
.topnav__hamburger:hover {
  background: rgba(255,255,255,0.12);
}
.topnav__hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.85);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.topnav__hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.topnav__hamburger.is-open span:nth-child(2) { opacity: 0; }
.topnav__hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile Slide Menu ─────────────────────────────────────── */
.mobile-menu {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--nav);
  z-index: 98;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.mobile-menu.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.mobile-menu__link {
  display: flex;
  align-items: center;
  padding: 0.75rem 0.85rem;
  color: rgba(255,255,255,0.82);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-s);
  transition: background var(--transition), color var(--transition);
  min-height: 48px;
}
.mobile-menu__link:hover,
.mobile-menu__link.active {
  background: rgba(255,255,255,0.10);
  color: var(--gold);
}
.mobile-menu__divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 0.4rem 0;
}
.mobile-menu__signout {
  color: rgba(255,255,255,0.55);
  font-size: 0.88rem;
  margin-top: 0.25rem;
}

/* ── Responsive Grid Utilities ─────────────────────────────── */
.r2col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 640px) {
  .r2col { grid-template-columns: 1fr 1fr; }
}

.r3col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 640px) {
  .r3col { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) {
  .r3col { grid-template-columns: 1fr 1fr 1fr; }
}

.r4col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (min-width: 768px) {
  .r4col { grid-template-columns: repeat(4, 1fr); }
}

/* ── Mobile-only / Desktop-only helpers ────────────────────── */
.hide-mobile { display: none; }
.show-mobile { display: block; }
@media (min-width: 768px) {
  .hide-mobile { display: block; }
  .show-mobile { display: none; }
}

/* ── Sidebar Navigation ─────────────────────────────────────── */
.sidebar {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surf);
  border-right: 1.5px solid var(--bdr);
  overflow-y: auto;
  padding: 0.75rem 0 3rem;
  flex-direction: column;
  z-index: 50;
  scrollbar-width: thin;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 1.1rem;
  color: var(--txm);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
  white-space: nowrap;
}
.sidebar__link:hover {
  background: rgba(26,77,191,0.05);
  color: var(--tx);
  border-left-color: rgba(26,77,191,0.25);
}
.sidebar__link.active {
  background: rgba(26,77,191,0.08);
  color: var(--blue);
  font-weight: 600;
  border-left-color: var(--blue);
}
.sidebar__icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.75;
}
.sidebar__link.active .sidebar__icon {
  opacity: 1;
}
.sidebar__section {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--txm);
  padding: 1rem 1.1rem 0.3rem;
  opacity: 0.5;
}
.sidebar__divider {
  height: 1px;
  background: var(--bdr);
  margin: 0.4rem 0;
}
@media (min-width: 768px) {
  .sidebar { display: flex; }
  .has-sidebar .content-area {
    margin-left: var(--sidebar-w);
    margin-right: 0;
    max-width: none;
  }
  .has-sidebar .topnav__hamburger { display: none !important; }
  .has-sidebar .mobile-menu      { display: none !important; }
}

/* ── Print ──────────────────────────────────────────────────── */
@media print {
  .topnav,
  .bottom-nav,
  .btn,
  .filter-tabs,
  .alert {
    display: none !important;
  }

  .page-wrap {
    padding-top: 0;
  }

  body {
    background: white;
    font-size: 12pt;
  }
}
