:root {
  --ink: #22252a;
  --muted: #687079;
  --paper: #f5f6f7;
  --card: #ffffff;
  --line: #dfe3e6;
  --line-strong: #cfd5d9;
  --orange: #f15a24;
  --orange-dark: #b83a0d;
  --orange-soft: #fff0e9;
  --blue: #356f91;
  --blue-soft: #eaf3f8;
  --amber: #d46b19;
  --amber-soft: #fff0e4;
  --green: #267a58;
  --green-soft: #e9f5ef;
  --red: #a84035;
  --red-soft: #fbeceb;
  --shadow: 0 14px 36px rgba(28, 34, 38, .07);
  --sans: Aptos, "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
  --display: "Aptos Display", Aptos, "Segoe UI Variable Display", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: radial-gradient(circle at 88% 8%, rgba(241, 90, 36, .07), transparent 24rem), var(--paper);
  font: 14px/1.55 var(--sans);
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--display); }

.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px clamp(20px, 4vw, 56px);
  border-bottom: 2px solid var(--orange);
  background: linear-gradient(90deg, #fff 0%, #fff 68%, var(--orange-soft) 100%);
  box-shadow: 0 2px 12px rgba(30, 34, 38, .06);
}

.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-logo { width: 74px; height: 28px; object-fit: contain; object-position: left center; }
.brand-divider { width: 1px; height: 32px; background: var(--line); }
.brand-copy { display: flex; min-width: 0; flex-direction: column; line-height: 1.25; }
.brand-copy span { color: var(--orange-dark); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.brand-copy strong { margin-top: 3px; font-size: 15px; font-weight: 700; }

.client-mark { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.farfetch-crop { width: 96px; height: 21px; overflow: hidden; display: block; }
.farfetch-crop img { width: 100%; height: auto; display: block; transform: translateY(-39%); }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.logout-form { margin: 0; }
/* Log out plate — mirrors the .client-mark box (Farfetch mark) so they read as siblings */
.logout-btn { display: inline-flex; align-items: center; gap: 9px; min-height: 38px; padding: 6px 14px; font: inherit; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--orange-dark); background: #fff; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.logout-btn svg { width: 16px; height: 16px; }
.logout-btn:hover { border-color: var(--orange-dark); background: var(--orange-soft); }
.logout-btn:focus-visible { outline: 2px solid var(--orange-dark); outline-offset: 2px; }
.footer-org { color: inherit; text-decoration: none; }
.footer-org:hover { color: var(--orange-dark); text-decoration: underline; }
.footer-admin { color: var(--orange-dark); text-decoration: none; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.footer-admin:hover { text-decoration: underline; }

.workspace { width: min(100%, 1360px); flex: 1; margin: 0 auto; padding: clamp(38px, 5vw, 70px) clamp(20px, 4vw, 56px) 64px; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 48px; padding-bottom: clamp(34px, 5vw, 58px); border-bottom: 1px solid var(--line); }
.hero-copy { max-width: 760px; }
.eyebrow { margin-bottom: 8px; color: var(--orange-dark); font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.hero h1 { max-width: 720px; margin-bottom: 16px; font-size: clamp(34px, 4.5vw, 56px); font-weight: 650; letter-spacing: -.037em; line-height: 1.05; }
.hero-summary { max-width: 610px; margin-bottom: 0; color: var(--muted); font-size: clamp(15px, 1.5vw, 18px); line-height: 1.6; }

.hero-meta { display: flex; gap: 12px; }
.hero-meta div { min-width: 135px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .72); }
.hero-meta strong { display: block; color: var(--orange-dark); font: 650 24px/1 var(--display); }
.hero-meta span { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }

.modules { padding-top: clamp(32px, 4vw, 48px); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 20px; }
.section-heading h2 { margin-bottom: 0; font-size: 25px; font-weight: 650; letter-spacing: -.025em; }
.section-heading > p { max-width: 390px; margin-bottom: 2px; color: var(--muted); text-align: right; }

.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.module-card {
  --module-tone: var(--orange);
  --module-soft: var(--orange-soft);
  position: relative;
  min-height: 385px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  box-shadow: 0 5px 20px rgba(24, 33, 38, .04);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.card-topline { position: absolute; inset: 0 0 auto; height: 3px; background: var(--module-tone); }
.module-card.available:hover { border-color: color-mix(in srgb, var(--module-tone) 38%, var(--line)); box-shadow: var(--shadow); transform: translateY(-3px); }
.module-card.available:focus-visible { outline: 3px solid color-mix(in srgb, var(--module-tone) 25%, transparent); outline-offset: 3px; }
.module-card.unavailable { background: rgba(255, 255, 255, .76); }

.card-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.module-number { color: #8a9299; font-size: 10px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; font-size: 9.5px; font-weight: 850; letter-spacing: .055em; text-transform: uppercase; }
.status span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.live { background: var(--green-soft); color: var(--green); }
.status.offline { background: var(--red-soft); color: var(--red); }

.module-icon { width: 52px; height: 52px; display: grid; place-items: center; margin: 24px 0 20px; border: 1px solid color-mix(in srgb, var(--module-tone) 20%, var(--line)); border-radius: 10px; background: var(--module-soft); color: var(--module-tone); }
.module-icon svg { width: 26px; height: 26px; }
.card-copy h3 { margin-bottom: 9px; font-size: 21px; font-weight: 650; letter-spacing: -.018em; }
.card-copy p { margin-bottom: 0; color: var(--muted); font-size: 13.5px; line-height: 1.58; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.tags span { padding: 4px 7px; border: 1px solid var(--line); border-radius: 5px; background: #f8f9f9; color: #596168; font-size: 10.5px; font-weight: 700; }

.card-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); color: var(--module-tone); font-size: 12px; font-weight: 850; }
.card-action svg { width: 18px; height: 18px; transition: transform .2s ease; }
.available:hover .card-action svg { transform: translateX(3px); }
.unavailable .card-action { color: #7c848b; }

.footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px clamp(20px, 4vw, 56px); border-top: 1px solid var(--line); background: rgba(255, 255, 255, .65); color: var(--muted); font-size: 10.5px; font-weight: 700; }
.footer-note { display: flex; align-items: center; gap: 7px; }
.footer-note > span { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.auth-shell {
  width: min(100%, 460px);
  flex: 1;
  display: grid;
  place-items: center;
  margin: 0 auto;
  padding: 36px 20px;
}

.auth-panel {
  width: 100%;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-panel h1,
.admin-heading h1 {
  margin-bottom: 22px;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: 0;
}

.auth-form,
.admin-form {
  display: grid;
  gap: 10px;
}

.auth-form label,
.admin-form label {
  color: #4f575f;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.auth-form input,
.admin-form input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.auth-form input:focus,
.admin-form input:focus {
  border-color: var(--orange);
  outline: 3px solid var(--orange-soft);
}

.primary-action,
.secondary-action {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.primary-action {
  border-color: var(--orange);
  background: var(--orange);
  color: #fff;
}

.primary-action:disabled,
.secondary-action:disabled {
  cursor: not-allowed;
  opacity: .62;
}

.form-error {
  min-height: 19px;
  margin: 12px 0 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

.admin-shell {
  width: min(100%, 1180px);
  flex: 1;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 48px) clamp(16px, 4vw, 44px) 54px;
}

.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.admin-heading h1 {
  margin-bottom: 0;
}

.admin-heading > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-band {
  display: grid;
  gap: 14px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.admin-form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-form label { white-space: nowrap; }
.admin-form input { flex: 1; min-width: 180px; }
.admin-form .primary-action { min-height: 42px; padding-inline: 18px; white-space: nowrap; }

.password-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green-soft);
}

.password-panel[hidden] {
  display: none;
}

.password-panel strong,
.password-panel code {
  display: block;
}

.password-panel strong {
  margin-bottom: 5px;
  font-size: 12px;
}

.password-panel code {
  overflow-wrap: anywhere;
  color: #174d38;
}

.copy-icon-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--green);
  cursor: pointer;
  transition: color .15s ease;
}

.copy-icon-btn svg {
  width: 18px;
  height: 18px;
}

.copy-icon-btn:hover { color: #0f4f37; }
.copy-icon-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.user-table {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.5fr) 110px 112px 140px minmax(150px, .9fr);
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
}

.user-row:first-child,
.user-row-head + .user-row {
  border-top: 0;
}

.user-row-head {
  min-height: 42px;
  background: #f8f9f9;
  color: #667078;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  width: fit-content;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.role-admin {
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.role-user {
  background: #eef1f3;
  color: #586069;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
}

.toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.toggle .track {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: var(--line-strong);
  transition: background .15s ease;
}

.toggle .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: left .15s ease;
}

.toggle .lbl {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
}

.toggle.on .track {
  background: var(--green);
}

.toggle.on .track::after {
  left: 18px;
}

.toggle.on .lbl {
  color: var(--green);
}

.toggle.off .lbl {
  color: var(--muted);
}

.toggle.locked {
  cursor: not-allowed;
  opacity: .55;
}

.toggle:has(input:focus-visible) {
  outline: 2px solid var(--orange-dark);
  outline-offset: 3px;
  border-radius: 6px;
}

.actions-cell {
  display: flex;
  justify-content: flex-end;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 24, 28, .42);
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  width: min(100%, 430px);
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 26px 64px rgba(20, 24, 28, .38);
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 15px;
  font-weight: 750;
}

.check-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
}

.check-icon svg {
  width: 17px;
  height: 17px;
}

.modal-sub {
  margin: 11px 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.modal-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--green);
  border-radius: 9px;
  background: var(--green-soft);
}

.modal-code code {
  overflow-wrap: anywhere;
  color: #174d38;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 15px;
  letter-spacing: .02em;
}

.modal-actions {
  margin-top: 18px;
}

.ghost-action {
  width: 100%;
  min-height: 42px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.ghost-action:hover {
  border-color: var(--ink);
  background: #fafafa;
}

@supports not (color: color-mix(in srgb, red 10%, white)) {
  .module-card.available:hover { border-color: var(--line-strong); }
  .module-card.available:focus-visible { outline-color: var(--module-tone); }
  .module-icon { border-color: var(--line); }
}

@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; align-items: start; gap: 28px; }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .topbar { min-height: 70px; padding-inline: 16px; }
  .brand { gap: 11px; }
  .brand-logo { width: 64px; height: 24px; }
  .brand-copy span { font-size: 8px; }
  .brand-copy strong { font-size: 13px; }
  .client-mark { padding: 5px 8px; }
  .farfetch-crop { width: 74px; height: 18px; }
  .workspace { padding-inline: 16px; }
  .hero-meta { width: 100%; }
  .hero-meta div { flex: 1; min-width: 0; }
  .section-heading { align-items: start; flex-direction: column; gap: 8px; }
  .section-heading > p { text-align: left; }
  .module-grid { grid-template-columns: 1fr; }
  .module-card { min-height: 360px; }
  .footer { align-items: start; flex-direction: column; gap: 8px; padding-inline: 16px; }
  .admin-form,
  .user-row,
  .user-row-head { grid-template-columns: 1fr; }
  .user-row-head { display: none; }
  .user-row { align-items: start; gap: 8px; }
  .admin-heading { align-items: start; flex-direction: column; }
}

@media (max-width: 430px) {
  .brand-divider, .brand-copy span { display: none; }
  .hero-meta { flex-direction: column; }
  .hero-meta div { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .module-card, .card-action svg { transition: none; }
  .module-card.available:hover { transform: none; }
}
