:root {
  --ink: #10233a;
  --paper: #f6f1e8;
  --panel: #fffdf8;
  --line: #d9d0c2;
  --teal: #15a39a;
  --teal-dark: #0e7d76;
  --muted: #5d6b7a;
  --danger: #b65b47;
  --ok: #357e72;
  --shadow: 0 18px 50px rgba(16, 35, 58, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  background:
    radial-gradient(circle at top right, rgba(21, 163, 154, 0.12), transparent 28%),
    linear-gradient(180deg, #efe7d8 0%, var(--paper) 40%);
  color: var(--ink);
}

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

.auth-card, .admin-wrap {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 36px 32px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
  text-decoration: none;
  color: inherit;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-family: "Segoe UI", sans-serif;
}
.brand b { display: block; letter-spacing: 0.04em; }
.brand small { color: var(--muted); font-family: "Segoe UI", sans-serif; }

h1 { font-size: 1.7rem; margin: 0 0 8px; }
.lead { margin: 0 0 24px; color: var(--muted); font-family: "Segoe UI", sans-serif; font-size: 0.95rem; }

label { display: block; font-family: "Segoe UI", sans-serif; font-size: 0.82rem; font-weight: 600; margin: 0 0 6px; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: 1rem/1.3 "Segoe UI", sans-serif;
  background: #fff;
  color: var(--ink);
  margin-bottom: 14px;
}
input:focus, select:focus { outline: 2px solid rgba(21, 163, 154, 0.35); border-color: var(--teal); }
input[readonly] {
  background: #f3eee4;
  color: var(--muted);
  cursor: not-allowed;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--teal);
  color: #fff;
  font: 600 0.95rem/1 "Segoe UI", sans-serif;
  cursor: pointer;
  text-decoration: none;
}
.button:hover { background: var(--teal-dark); }
.button.ghost, .button.small {
  width: auto;
  padding: 8px 14px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.button.danger { background: var(--danger); color: #fff; border: 0; }
.button.ok { background: var(--ok); color: #fff; border: 0; }

.links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.88rem;
}
.links a { color: var(--teal-dark); }

.flash {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.9rem;
}
.flash.error { background: #fbecea; color: var(--danger); }
.flash.success { background: #e7f4f1; color: var(--ok); }
html.js .flash { display: none !important; }

html.risei-swal-lock,
html.risei-swal-lock body {
  overflow: hidden !important;
}
html.risei-swal-lock body > *:not(.swal2-container):not(#risei-loading) {
  pointer-events: none !important;
  user-select: none !important;
}
html.risei-swal-lock .swal2-container,
html.risei-swal-lock #risei-loading {
  pointer-events: auto !important;
}
#risei-loading {
  position: fixed;
  inset: 0;
  z-index: 40000;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 24px;
  background: rgba(16, 35, 58, 0.55);
  cursor: default;
}
#risei-loading[hidden] { display: none !important; }
.risei-loading__box {
  display: grid;
  gap: 14px;
  justify-items: center;
  min-width: 160px;
  padding: 28px 32px;
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font: 600 15px/1.3 "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
}
.risei-loading__spin {
  width: 36px;
  height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: risei-spin 0.8s linear infinite;
}
.risei-loading__box p { margin: 0; }
@keyframes risei-spin { to { transform: rotate(360deg); } }
.swal2-container { z-index: 41000 !important; }
.swal2-container.swal2-backdrop-show {
  background: rgba(16, 35, 58, 0.55) !important;
}

.dev-link {
  margin-top: 12px;
  padding: 12px;
  background: #10233a;
  color: #9ee6df;
  border-radius: 10px;
  font: 0.8rem/1.4 ui-monospace, monospace;
  word-break: break-all;
}

.identity {
  background: #f3eee4;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.92rem;
}
.identity b { display: block; margin-bottom: 4px; }

.admin-shell { min-height: 100vh; }
.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  background: var(--ink);
  color: #f6f1e8;
  font-family: "Segoe UI", sans-serif;
}
.admin-top a, .admin-top button { color: #9ee6df; background: none; border: 0; cursor: pointer; font: inherit; text-decoration: none; }
.admin-wrap { width: min(1180px, calc(100% - 32px)); margin: 24px auto 48px; padding: 28px; }
.admin-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 8px;
}
.admin-heading .lead { margin-bottom: 0; }
.admin-heading .button { width: auto; min-width: 180px; }
.table-shell { margin-top: 18px; }
.badge { display: inline-block; border-radius: 999px; padding: 3px 8px; font-size: 0.75rem; background: #eee7d8; }
.badge.active { background: #d7efe9; color: var(--ok); }
.badge.disabled { background: #f7ddd7; color: var(--danger); }
.badge.pending { background: #efe4c8; }
.badge.you { margin-left: 8px; background: #10233a; color: #9ee6df; vertical-align: middle; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions form { margin: 0; }
.muted-action { color: var(--muted); }

.dt-container { font-family: "Segoe UI", sans-serif; }
.dt-container .dt-search input,
.dt-container .dt-length select {
  width: auto;
  margin-bottom: 0;
  display: inline-block;
}
.dt-container table.dataTable {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0;
}
.dt-container table.dataTable thead th {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
.dt-container table.dataTable tbody td {
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.dt-container table.dataTable tbody tr:last-child td {
  border-bottom: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 35, 58, 0.45);
}
.modal-backdrop[hidden] { display: none !important; }
.modal {
  width: min(480px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px 26px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.modal-head h2 { margin: 0; font-size: 1.35rem; }
.modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #ece7dc;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}
.modal-actions .button { width: auto; min-width: 140px; }
.field-error {
  color: var(--danger);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.82rem;
  margin: -8px 0 12px;
}

table { width: 100%; border-collapse: collapse; font-family: "Segoe UI", sans-serif; font-size: 0.88rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; }

@media (max-width: 720px) {
  .admin-heading { flex-direction: column; align-items: stretch; }
  .admin-heading .button { width: 100%; }
}
