:root {
  --paper: #fff9ed;
  --paper-strong: #fff4dc;
  --ink: #332a28;
  --ink-muted: #73635d;
  --ink-soft: #9d8b84;
  --brand: #51121a;
  --brand-soft: #f6d7d9;
  --line: rgba(81, 18, 26, 0.12);
  --card: rgba(255, 255, 255, 0.74);
  --shadow: 0 24px 48px rgba(81, 18, 26, 0.1);
  --danger: #8b2f2f;
  --danger-soft: #ffe3df;
  --success: #2d694a;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(247, 205, 216, 0.6), transparent 26%),
    radial-gradient(circle at bottom right, rgba(255, 225, 141, 0.55), transparent 24%),
    linear-gradient(180deg, #fffaf1 0%, var(--paper) 100%);
  color: var(--ink);
  font-family: "Instrument Sans", system-ui, sans-serif;
}

body {
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.loading-shell,
.center-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-shell,
.admin-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 24px auto;
}

.card {
  background: var(--card);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.login-card {
  max-width: 880px;
  margin: 10vh auto 0;
  padding: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--paper-strong);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hero-title,
.panel-title {
  font-family: "EB Garamond", serif;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.hero-title {
  margin: 18px 0 12px;
  font-size: clamp(36px, 6vw, 54px);
  line-height: 0.96;
}

.hero-copy,
.muted {
  color: var(--ink-muted);
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 420px);
}

.login-intro {
  padding: 38px 38px 34px;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(circle at top left, rgba(247, 205, 216, 0.34), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0.4));
}

.login-panel {
  padding: 38px 32px 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-kicker,
.section-label,
.login-divider {
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
}

.login-kicker {
  margin: 20px 0 0;
}

.auth-block + .auth-block {
  margin-top: 20px;
}

.section-label {
  margin: 0 0 10px;
}

.oauth-button {
  width: 100%;
  min-height: 54px;
  justify-content: center;
  gap: 12px;
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(81, 18, 26, 0.18);
}

.oauth-mark {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-weight: 700;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.passcode-block {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.passcode-stack {
  display: grid;
  gap: 12px;
}

.form-row,
.toolbar,
.detail-actions,
.danger-actions,
.pagination {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-row {
  margin-top: 24px;
}

.input,
.search-input,
.confirm-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  padding: 14px 16px;
  outline: none;
}

.input:focus,
.search-input:focus,
.confirm-input:focus {
  border-color: rgba(81, 18, 26, 0.4);
  box-shadow: 0 0 0 4px rgba(81, 18, 26, 0.08);
}

.button,
.ghost-button,
.danger-button {
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  font-weight: 600;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button {
  color: white;
  background: var(--brand);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger-button {
  background: var(--danger);
  color: white;
}

.button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.strong-ghost {
  background: rgba(81, 18, 26, 0.08);
  color: var(--brand);
  border: 1px solid rgba(81, 18, 26, 0.18);
}

.button:disabled,
.ghost-button:disabled,
.danger-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status-line {
  min-height: 24px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--ink-muted);
}

.status-line.error {
  color: var(--danger);
}

.status-line.success {
  color: var(--success);
}

.admin-shell {
  display: grid;
  gap: 18px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 28px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 18px;
}

.sidebar,
.detail-panel {
  padding: 24px;
}

.toolbar {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-title {
  margin: 0;
  font-size: 34px;
}

.user-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.user-row {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.66);
  border-radius: 18px;
  padding: 16px;
}

.user-row.active {
  border-color: rgba(81, 18, 26, 0.28);
  background: rgba(255, 244, 220, 0.92);
}

.user-row-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.user-row-subtitle,
.tiny-label,
.empty-state {
  color: var(--ink-muted);
  font-size: 14px;
}

.usage-inline,
.section-copy {
  color: var(--ink-muted);
  font-size: 13px;
}

.usage-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
}

.section-copy {
  margin: 0 0 12px;
}

.count-grid,
.event-grid {
  display: grid;
  gap: 12px;
}

.count-grid {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  margin-top: 20px;
}

.stat-card,
.event-card,
.danger-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
}

.stat-card {
  padding: 16px;
}

.stat-label {
  color: var(--ink-muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
}

.detail-section {
  margin-top: 24px;
}

.detail-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.usage-grid {
  margin-top: 12px;
}

.metadata-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
}

.metadata-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 500;
}

.event-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.compact-grid {
  grid-template-columns: 1fr;
}

.event-card {
  padding: 14px;
}

.event-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--ink-muted);
}

.event-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.event-meta {
  font-size: 13px;
  color: var(--ink-muted);
}

.danger-card {
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 227, 223, 0.95), rgba(255, 255, 255, 0.88));
}

.danger-title {
  margin: 0 0 8px;
  font-size: 18px;
}

.danger-copy {
  color: var(--ink-muted);
  margin-bottom: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
}

.pill.good {
  color: var(--success);
}

.pill.warn {
  color: var(--brand);
}

@media (max-width: 980px) {
  .login-layout {
    grid-template-columns: 1fr;
  }

  .login-intro {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 30px 28px 24px;
  }

  .login-panel {
    padding: 24px 28px 28px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-header {
    padding: 22px;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .login-card {
    margin-top: 4vh;
  }

  .login-intro,
  .login-panel {
    padding-left: 22px;
    padding-right: 22px;
  }

  .hero-title {
    font-size: clamp(34px, 12vw, 48px);
  }
}
