:root {
  color-scheme: dark;
  --page: #0b0b0b;
  --panel: #17130e;
  --surface: #111;
  --border: #3b3020;
  --gold: #d4af37;
  --gold-muted: #c9a96e;
  --text: #f5f0e8;
  --muted: #b8a888;
  --error: #fecaca;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
}

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

.small {
  font-size: 0.82rem;
}

.eyebrow {
  margin-bottom: 0.5rem;
  color: var(--gold-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.13), transparent 48%),
    var(--page);
}

.login-card {
  width: min(100%, 29rem);
  padding: clamp(1.5rem, 5vw, 2.5rem);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  background: var(--panel);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.32);
}

.login-card h1 {
  margin-bottom: 0.6rem;
  font-size: clamp(1.8rem, 5vw, 2.35rem);
}

.brand-mark {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  margin-bottom: 1.2rem;
  place-items: center;
  border-radius: 0.85rem;
  background: var(--gold);
  color: #15110a;
  font-weight: 800;
  text-decoration: none;
}

.stack-form {
  display: grid;
  gap: 0.7rem;
  margin: 1.5rem 0;
}

.stack-form label {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.stack-form input {
  width: 100%;
  min-height: 2.8rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #5d4b2e;
  border-radius: 0.7rem;
  background: #252016;
  color: var(--text);
  font: inherit;
}

.stack-form input:focus {
  border-color: var(--gold);
  outline: 3px solid rgba(212, 175, 55, 0.2);
}

.button {
  display: inline-flex;
  min-height: 2.65rem;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  margin-top: 0.45rem;
  background: var(--gold);
  color: #15110a;
}

.button-primary:hover {
  background: #e2c35b;
}

.button-secondary {
  border-color: #5d4b2e;
  background: transparent;
  color: var(--gold-muted);
}

.button-secondary:hover {
  background: #211b11;
}

.notice {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: #15120d;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.notice-error {
  border-color: #7f1d1d;
  background: #2a1010;
  color: var(--error);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem max(1.25rem, calc((100vw - 76rem) / 2));
  border-bottom: 1px solid #302719;
  background: var(--surface);
}

.topbar h1 {
  margin-bottom: 0.25rem;
  font-size: 1.75rem;
}

.topbar p {
  margin-bottom: 0;
}

.page-shell {
  display: grid;
  max-width: 79rem;
  gap: 1.25rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.panel {
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid #302719;
  border-radius: 1.15rem;
  background: var(--panel);
}

.section-heading,
.record-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.section-heading {
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.4rem;
}

.card-list {
  display: grid;
  gap: 0.75rem;
}

.record-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--surface);
}

.record-card h3 {
  margin-bottom: 0.25rem;
  font-size: 1.05rem;
}

.record-card p {
  margin-bottom: 0;
  font-size: 0.82rem;
}

.pill-row,
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border: 1px solid #5d4b2e;
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.75rem;
  white-space: nowrap;
}

.stat-row {
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.branch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
}

.branch-list li {
  padding: 0.3rem 0.55rem;
  border: 1px solid #3b3020;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.74rem;
}

.support-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.manager-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.manager-row {
  display: grid;
  grid-template-columns: minmax(12rem, 0.7fr) minmax(18rem, 1.3fr);
  gap: 1rem;
  align-items: start;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: #13110d;
}

.manager-identity {
  display: grid;
  justify-items: start;
  gap: 0.45rem;
  overflow-wrap: anywhere;
}

.manager-identity small {
  color: var(--muted);
  font-size: 0.76rem;
}

.manager-controls {
  display: grid;
  gap: 0.75rem;
}

.manager-password-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.manager-password-form .button {
  grid-column: 1 / -1;
}

.support-action {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: #13110d;
}

.support-action h2,
.support-action h4 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
}

.support-form {
  display: grid;
  gap: 0.65rem;
  margin: 0.8rem 0;
}

.support-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.support-form input,
.support-form select {
  width: 100%;
  min-height: 2.55rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #5d4b2e;
  border-radius: 0.65rem;
  background: #252016;
  color: var(--text);
  font: inherit;
}

.support-form input:focus,
.support-form select:focus {
  border-color: var(--gold);
  outline: 3px solid rgba(212, 175, 55, 0.2);
}

.support-form .button {
  justify-self: start;
}

@media (max-width: 680px) {
  .manager-row {
    grid-template-columns: 1fr;
  }

  .manager-password-form {
    grid-template-columns: 1fr;
  }
}

.button-danger {
  border-color: #7f1d1d;
  background: #2a1010;
  color: #fecaca;
}

.button-danger:hover {
  background: #421414;
}

.support-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.support-refund-form {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  align-items: end;
  margin: 0 0 1rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 0.75rem;
  border-bottom: 1px solid #302719;
  vertical-align: top;
  font-size: 0.82rem;
}

th {
  color: var(--gold-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td small {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .topbar,
  .record-heading,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    padding: 1rem;
  }

  .topbar form,
  .topbar .button {
    width: 100%;
  }

  .stat-row {
    flex-direction: column;
  }

  .support-inline {
    align-items: flex-start;
    flex-direction: column;
  }
}
