@font-face {
  font-family: "Figtree";
  src: url("../fonts/Figtree-wght.ttf") format("truetype");
  font-weight: 300 900;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-opsz-wght.ttf") format("truetype");
  font-weight: 300 900;
}

:root {
  --autoit-cyan: #6bdee7;
  --autoit-petrol: #53a0b5;
  --autoit-black: #020617;
  --autoit-lime: #b8f450;
  --autoit-deep-teal: #005f59;
  --surface: #f8f9ff;
  --surface-container: #eff4ff;
  --border: #dbe6f4;
  --muted: #64748b;
  --text: #0b1c30;
  --danger: #ba1a1a;
  color-scheme: light;
  font-family: "Inter", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
}

h1,
h2,
h3,
.brand {
  font-family: "Figtree", "Inter", system-ui, sans-serif;
}

h1 {
  margin: 0;
  color: var(--autoit-black);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.05;
}

h2 {
  margin: 0 0 1rem;
  color: var(--autoit-black);
  font-size: 1.15rem;
  font-weight: 750;
}

a {
  color: var(--autoit-deep-teal);
  text-decoration: none;
}

label {
  display: grid;
  gap: 0.35rem;
  color: #334155;
  font-size: 0.85rem;
  font-weight: 700;
}

input,
select {
  min-height: 44px;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 0.75rem;
}

input:focus,
select:focus {
  border-color: var(--autoit-deep-teal);
  box-shadow: 0 0 0 3px rgba(83, 160, 181, 0.18);
  outline: none;
}

input:disabled,
select:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.app-nav,
.app-shell {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
}

.app-nav {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--autoit-black);
  font-size: 1.15rem;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--autoit-black);
  color: var(--autoit-cyan);
  font-weight: 900;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.nav-links a,
.nav-button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
  padding: 0.55rem 0.8rem;
}

.nav-links a:hover,
.nav-button:hover {
  background: #edf7fb;
  color: var(--autoit-black);
}

.app-shell {
  padding: 2rem 0 4rem;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--autoit-deep-teal);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.muted {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.button,
.nav-button {
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0.65rem 1rem;
  text-align: center;
}

.button:active {
  transform: scale(0.98);
}

.button.primary {
  background: var(--autoit-black);
  color: #fff;
}

.button.primary:hover {
  background: #101826;
}

.button.secondary {
  border-color: rgba(83, 160, 181, 0.35);
  background: #e0f7fb;
  color: var(--autoit-deep-teal);
}

.button.ghost {
  border-color: var(--border);
  background: #fff;
  color: #334155;
}

.button.danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--danger);
}

.week-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.week-actions.inline {
  align-items: end;
}

.week-badge {
  display: grid;
  gap: 0.2rem;
  min-width: 180px;
  border: 1px solid rgba(83, 160, 181, 0.28);
  border-radius: 8px;
  background: #effcff;
  color: var(--autoit-deep-teal);
  padding: 0.75rem 1rem;
}

.week-badge span {
  color: var(--autoit-black);
  font-family: "Figtree", "Inter", system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 900;
}

.week-badge strong {
  font-size: 0.85rem;
}

.toolbar,
.form-footer,
.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.8rem;
  margin-bottom: 1rem;
  padding: 1rem;
}

.toolbar label {
  min-width: min(240px, 100%);
}

.booking-form {
  display: grid;
  gap: 1rem;
}

.booking-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.booking-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.booking-table th,
.booking-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.85rem;
  text-align: center;
  vertical-align: middle;
}

.booking-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 170px;
  background: #fff;
  color: var(--autoit-black);
  text-align: left;
}

.booking-table thead th {
  background: var(--surface-container);
  color: var(--autoit-black);
}

.booking-table thead th:first-child {
  background: var(--surface-container);
}

.booking-table th span,
.booking-table td span {
  display: block;
  font-weight: 850;
}

.booking-table th small,
.booking-table td small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.2rem;
  white-space: nowrap;
}

.booking-table .closed-day {
  display: inline-flex;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  padding: 0.15rem 0.45rem;
}

.booking-table input {
  width: 74px;
  min-height: 40px;
  padding: 0.5rem;
  text-align: center;
}

.totals-row th,
.totals-row td {
  background: #f0fdfa;
  color: var(--autoit-deep-teal);
  font-weight: 900;
}

.grand-total-row th,
.grand-total-row td {
  background: var(--autoit-black);
  border-bottom-color: var(--autoit-black);
  color: #fff;
  font-weight: 900;
}

.grand-total-row th:first-child {
  background: var(--autoit-black);
  color: #fff;
}

.grand-total-row td small {
  color: #cbd5e1;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.6fr);
  gap: 1rem;
}

.panel {
  padding: 1rem;
}

.form-stack {
  display: grid;
  align-content: start;
  gap: 0.9rem;
}

.list {
  display: grid;
  gap: 0.65rem;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.8rem;
}

.editable-row {
  align-items: stretch;
  flex-direction: column;
}

.inline-edit-form,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.65rem;
}

.inline-edit-form {
  width: 100%;
}

.inline-edit-form label {
  flex: 1 1 180px;
}

.user-edit-form label {
  flex-basis: 160px;
}

.row-actions {
  justify-content: flex-end;
}

.list-row strong {
  display: block;
  color: var(--autoit-black);
}

.invite-box {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.invite-box code {
  display: block;
  overflow-x: auto;
  border-radius: 8px;
  background: #eff4ff;
  color: var(--autoit-black);
  padding: 0.8rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.summary-tile {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0.9rem;
}

.summary-tile span,
.summary-tile small {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.summary-tile strong {
  display: block;
  color: var(--autoit-black);
  font-family: "Figtree", "Inter", system-ui, sans-serif;
  font-size: 2rem;
  line-height: 1.1;
  margin: 0.35rem 0;
}

.export-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  align-items: end;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.export-panel h2 {
  margin: 0;
}

.overview-table td {
  min-width: 140px;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 160px);
  place-items: center;
}

.auth-panel {
  width: min(440px, 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 1.5rem;
}

.first-run,
.login-help,
.form-hint {
  border-radius: 8px;
  background: #f0f9ff;
  color: #075985;
  font-size: 0.9rem;
  font-weight: 650;
  margin: 1rem 0;
  padding: 0.85rem;
}

.first-run {
  display: grid;
  gap: 0.45rem;
}

.first-run p,
.login-help,
.form-hint {
  margin: 0;
}

.first-run a {
  display: inline-flex;
  width: fit-content;
  color: var(--autoit-deep-teal);
  font-weight: 850;
}

.subtle-link {
  display: inline-flex;
  margin-top: 1rem;
  color: var(--autoit-deep-teal);
  font-size: 0.9rem;
  font-weight: 800;
}

.form-hint {
  background: #f8fafc;
  color: var(--muted);
  margin: -0.35rem 0 0;
  padding: 0;
}

.request-badge {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 850;
  margin-top: 0.45rem;
  padding: 0.25rem 0.55rem;
}

.alert {
  border: 1px solid transparent;
  border-radius: 8px;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
}

.alert-success {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #115e59;
}

.alert-info {
  border-color: #bae6fd;
  background: #f0f9ff;
  color: #075985;
}

.alert-warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.alert-danger,
.validation-summary-errors {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--danger);
}

.empty-state {
  border: 1px dashed #bdd2e8;
  border-radius: 8px;
  background: #fff;
  padding: 2rem;
  text-align: center;
}

@media (max-width: 760px) {
  .app-nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.85rem 0;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .app-shell {
    padding-top: 1.25rem;
  }

  .page-heading,
  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .week-actions,
  .form-footer .button {
    width: 100%;
  }

  .week-actions .button {
    flex: 1;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar label,
  .toolbar .button {
    width: 100%;
  }

  .split-layout {
    grid-template-columns: 1fr;
  }

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

  .booking-table {
    min-width: 680px;
  }
}
