:root {
  color-scheme: dark;
  --bg: #0b0b0f;
  --surface: rgba(20, 20, 30, 0.72);
  --line: rgba(169, 182, 255, 0.2);
  --line-strong: rgba(169, 182, 255, 0.45);
  --text: #f4f4f6;
  --muted: rgba(244, 244, 246, 0.6);
  --accent: #a9b6ff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(1.5rem, env(safe-area-inset-top)) 1rem
    max(1.5rem, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 30% 20%, rgba(120, 130, 255, 0.16), transparent 55%),
    radial-gradient(circle at 75% 80%, rgba(90, 200, 250, 0.1), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.card {
  width: min(430px, 100%);
  padding: clamp(1.5rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}

/* On the sign-in cards the brand sits in the middle, like the form below it */
.card > .brand {
  display: flex;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.7rem;
}

h1 {
  font-family: "Unbounded", sans-serif;
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
}

.sub {
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

form {
  display: grid;
  gap: 0.9rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

input:focus {
  outline: none;
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.7rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.15s ease, background 0.2s ease;
}

.btn-primary {
  background: linear-gradient(140deg, #a9b6ff, #7a82ff);
  color: #0b0b12;
  box-shadow: 0 8px 26px rgba(122, 130, 255, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 10px 32px rgba(122, 130, 255, 0.4);
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}

.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.msg {
  min-height: 1.25rem;
  font-size: 0.85rem;
}

.msg.error {
  color: #ff8b8b;
}

.msg.ok {
  color: #7ee0a5;
}

.hint {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.hint a {
  color: var(--accent);
  text-decoration: none;
}

.hint a:hover {
  text-decoration: underline;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.stat {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stat strong {
  font-family: "Unbounded", sans-serif;
  font-size: 1.35rem;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.dash-h2 {
  margin: 1.75rem 0 0.85rem;
  font-family: "Unbounded", sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Panels: admin and user areas — full page, not a floating card */

body.panel-page {
  place-items: start stretch;
  align-content: start;
  padding: 0;
}

/* Admin sign-in keeps the same boxed card as the user login; the panel that opens
   after signing in is the full-width layout above. */
body.login-page {
  place-items: center;
  align-content: center;
  padding: max(1.5rem, env(safe-area-inset-top)) 1rem
    max(1.5rem, env(safe-area-inset-bottom));
}

body.login-page .card.panel {
  max-width: 430px;
  margin: auto;
  padding: clamp(1.5rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.login-page .panel-head {
  justify-content: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0;
  border-bottom: 0;
}

.card.panel {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: max(1.1rem, env(safe-area-inset-top)) clamp(1.1rem, 5vw, 2.25rem)
    max(2.5rem, env(safe-area-inset-bottom));
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.panel-head .brand {
  margin-bottom: 0;
}

.who {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.who strong {
  color: var(--text);
  font-family: "Unbounded", sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.details {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.detail {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.85rem;
}

.detail span {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail strong {
  font-weight: 500;
  word-break: break-word;
  text-align: right;
}

.rows {
  display: grid;
  gap: 0.5rem;
  list-style: none;
  margin-bottom: 0.75rem;
}

.row {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
}

.row.empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.row-name {
  font-size: 0.9rem;
  word-break: break-word;
}

.row-meta {
  color: var(--muted);
  font-size: 0.72rem;
}

.row-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.mini {
  min-height: 34px;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.mini:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.mini.danger {
  border-color: rgba(255, 130, 130, 0.4);
  color: #ff9b9b;
}

.mini[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.reset-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.reset-form input {
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
}

/* Left menu: 3-line button + slide-in drawer */

.head-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.menu-btn {
  display: grid;
  place-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.menu-btn span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}

.menu-btn:hover,
.menu-btn:focus-visible {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5, 5, 10, 0.62);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.drawer-backdrop[hidden] {
  display: none;
}

.drawer {
  position: fixed;
  z-index: 50;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(272px, 82vw);
  padding: max(1rem, env(safe-area-inset-top)) 1rem
    max(1.25rem, env(safe-area-inset-bottom));
  border-right: 1px solid var(--line);
  background: rgba(13, 13, 20, 0.98);
  transform: translateX(-102%);
  transition: transform 0.22s ease;
  overflow-y: auto;
}

.drawer.open {
  transform: none;
}

.drawer:not(.open) {
  pointer-events: none;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.drawer-title {
  font-family: "Unbounded", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.drawer-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.drawer-nav {
  display: grid;
  gap: 0.2rem;
  margin-top: 0.9rem;
}

.drawer-nav a,
.drawer-nav button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: 0.6rem;
  background: transparent;
  color: rgba(244, 244, 246, 0.86);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.drawer-nav a:hover,
.drawer-nav button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.drawer-nav .sep {
  margin: 0.45rem 0;
  border-top: 1px solid var(--line);
}
