/* Love Lock admin console — internal tool, dark theme.
   No external fonts or assets: the page must load on a locked-down network and
   under the CSP in index.html. */

:root {
  color-scheme: dark;
  --bg: #17112b;
  --surface: #221a3c;
  --surface-2: #2a2148;
  --surface-3: #342b57;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.20);
  --text: #f7f3ff;
  --muted: #c3b9e0;
  --muted-2: #9a90ba;
  --rose: #c2335a;
  --rose-strong: #d94b70;
  --rose-text: #ffa3ba;
  --pink-soft: rgba(249, 168, 192, 0.14);
  --green: #5ee08b;
  --green-soft: rgba(94, 224, 139, 0.14);
  --amber: #f7c15c;
  --amber-soft: rgba(247, 193, 92, 0.14);
  --red: #ff8b9b;
  --red-soft: rgba(255, 139, 155, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 45px rgba(8, 4, 18, 0.35);
  --font: "Segoe UI", "Nunito", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.5 var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 560px at 12% -12%, rgba(194, 51, 90, 0.22), transparent 62%),
    radial-gradient(900px 520px at 105% 4%, rgba(107, 88, 180, 0.26), transparent 60%),
    radial-gradient(800px 480px at 50% 110%, rgba(94, 224, 139, 0.05), transparent 60%);
  background-attachment: fixed;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 19px;
}

p {
  margin: 0;
}

code {
  font: 0.9em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}

a {
  color: var(--rose-text);
}

:focus-visible {
  outline: 2px solid #ffb7c9;
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 20;
  padding: 10px 14px;
  background: var(--surface-3);
  color: var(--text);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 150ms ease;
}

.skip-link:focus {
  top: 12px;
}

/* ------------------------------------------------------------------ header */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: rgba(23, 17, 43, 0.82);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(140deg, #d94b70, #8e1f3f);
  box-shadow: 0 6px 16px rgba(194, 51, 90, 0.35);
  flex: none;
}

.brand-mark-lg {
  width: 48px;
  height: 48px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 15px;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.who {
  font-size: 13px;
  color: var(--muted);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.view-center {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand p {
  margin-top: 2px;
}

.hint {
  font-size: 13px;
  color: var(--muted-2);
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-card .btn-quiet {
  align-self: flex-start;
}

/* --------------------------------------------------------------- controls */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.field-inline {
  flex: 1 1 260px;
  min-width: 0;
}

input[type="email"],
input[type="search"] {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 150ms ease, background-color 150ms ease;
}

input[type="email"]::placeholder,
input[type="search"]::placeholder {
  color: var(--muted-2);
}

input[type="email"]:hover,
input[type="search"]:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

input[type="email"]:focus,
input[type="search"]:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--rose-text);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 163, 186, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
  white-space: nowrap;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.32);
}

.btn:active {
  background: rgba(255, 255, 255, 0.1);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  color: #fff;
  background: var(--rose);
  border-color: transparent;
}

.btn-primary:hover {
  background: var(--rose-strong);
  border-color: transparent;
}

.btn-primary:active {
  background: #a92a4d;
}

.btn-danger {
  color: var(--red);
  border-color: rgba(255, 139, 155, 0.45);
  background: var(--red-soft);
}

.btn-danger:hover {
  background: rgba(255, 139, 155, 0.2);
  border-color: rgba(255, 139, 155, 0.7);
}

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

.btn-block {
  width: 100%;
}

.btn-small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.status {
  font-size: 13px;
  color: var(--rose-text);
  min-height: 20px;
}

.status.is-error {
  color: var(--red);
}

/* ------------------------------------------------------------------- tabs */

.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(34, 26, 60, 0.7);
  overflow-x: auto;
}

.tab {
  flex: none;
  min-height: 40px;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.tab[aria-selected="true"] {
  color: #fff;
  background: var(--pink-soft);
  border-color: rgba(255, 163, 186, 0.32);
}

/* ----------------------------------------------------------------- panels */

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-head p {
  margin-top: 3px;
  font-size: 13px;
}

.banner {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}

.banner-error {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(255, 139, 155, 0.35);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.stat-value {
  margin-top: 8px;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-list {
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.stat-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stat-list dt {
  color: var(--muted-2);
}

.stat-list dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

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

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  min-height: 38px;
  padding: 0 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.chip:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.chip[aria-pressed="true"] {
  color: #fff;
  background: var(--pink-soft);
  border-color: rgba(255, 163, 186, 0.45);
}

.table-wrap {
  position: relative; /* keeps absolutely positioned .sr-only text inside the scroller */
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 13px 16px;
  vertical-align: top;
  border-top: 1px solid var(--border);
}

tbody tr:first-child td {
  border-top: 0;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.col-actions {
  text-align: right;
}

.action-group {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.person {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
}

.person-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.person-email {
  font-size: 12.5px;
  color: var(--muted-2);
  overflow-wrap: anywhere;
}

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

.mono {
  font-variant-numeric: tabular-nums;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  border: 1px solid transparent;
}

.pill-active {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(94, 224, 139, 0.3);
}

.pill-pending {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(247, 193, 92, 0.3);
}

.pill-ended {
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}

.pill-vip {
  color: var(--rose-text);
  background: var(--pink-soft);
  border-color: rgba(255, 163, 186, 0.32);
}

.pill-admin {
  color: #cfc4f5;
  background: rgba(173, 156, 240, 0.16);
  border-color: rgba(173, 156, 240, 0.35);
}

.cell-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.cell-stack .sub {
  font-size: 12.5px;
  color: var(--muted-2);
}

.empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted-2);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
}

.pager-actions {
  display: flex;
  gap: 8px;
}

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 30;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-3);
  box-shadow: var(--shadow);
  font-size: 14px;
  text-align: center;
}

.toast.is-error {
  color: var(--red);
  border-color: rgba(255, 139, 155, 0.45);
}

/* ----------------------------------------------------------------- dialog */

dialog {
  width: calc(100vw - 32px);
  max-width: 440px;
  padding: 24px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(9, 5, 20, 0.7);
  backdrop-filter: blur(3px);
}

dialog p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .container {
    padding: 16px;
  }

  .topbar-inner {
    padding: 10px 16px;
  }

  .who {
    display: none;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  /* Four fixed tabs read better than a half-visible scroll strip. */
  .tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border-radius: 16px;
    overflow: visible;
  }

  .tab {
    min-height: 44px;
    padding: 0 4px;
    font-size: 12.5px;
  }

  /* Icon-sized controls stay tappable on a phone. */
  .btn-small {
    min-height: 44px;
  }

  .chip {
    min-height: 44px;
  }

  /* Tables become one card per row so no column is hidden off-screen. */
  .table-wrap {
    overflow-x: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  table,
  thead,
  tbody,
  tr,
  td,
  caption {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  tbody tr + tr {
    margin-top: 10px;
  }

  tbody tr:hover {
    background: var(--surface);
  }

  td {
    padding: 5px 0;
    border: 0;
  }

  td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-2);
  }

  .person {
    min-width: 0;
  }

  .col-actions {
    padding-top: 10px;
    text-align: left;
  }

  .action-group {
    justify-content: flex-start;
  }

  .empty {
    padding: 16px 0;
    text-align: left;
  }
}

@media (max-width: 520px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 22px;
  }

  .topbar-actions {
    gap: 4px;
  }

  .topbar-actions .btn {
    padding: 0 10px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
