:root {
  --bg-base: #090d16;
  --bg-card: rgba(17, 24, 39, 0.84);
  --bg-input: rgba(9, 13, 22, 0.75);
  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-focus: #10b981;
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-glow: rgba(16, 185, 129, 0.25);
  --cyan: #06b6d4;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.35);
  --danger-text: #fca5a5;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.35);
  --success-text: #6ee7b7;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Oxygen, Ubuntu, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 18% 15%, rgba(16, 185, 129, 0.14), transparent 42%),
    radial-gradient(circle at 82% 85%, rgba(6, 182, 212, 0.12), transparent 45%),
    linear-gradient(180deg, #090d16 0%, #0d1322 100%);
}

body[data-page="admin"] {
  align-items: flex-start;
  padding: 34px 18px;
}

.is-hidden {
  display: none !important;
}

.shell {
  width: 100%;
  max-width: 430px;
  animation: fadeUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.shell--wide {
  max-width: 540px;
}

.shell--admin {
  max-width: 1040px;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 34px 32px;
  box-shadow:
    0 24px 55px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

.card--admin {
  padding: 28px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.brand--compact {
  margin-bottom: 0;
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid rgba(16, 185, 129, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.18);
}

.brand-logo svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.brand-title {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-sub {
  margin: 3px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.brand-sub strong {
  color: #e2e8f0;
}

.alert {
  border-radius: 11px;
  padding: 11px 14px;
  font-size: 0.875rem;
  line-height: 1.45;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert[hidden] {
  display: none !important;
}

.alert--error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}

.alert--success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 7px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.label-row label {
  margin-bottom: 0;
}

.pass-tools {
  display: inline-flex;
  gap: 10px;
}

.link-btn {
  background: none;
  border: none;
  color: #38bdf8;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  color: #6ee7b7;
  text-decoration: underline;
}

.field-hint {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 13px;
  width: 18px;
  height: 18px;
  color: #64748b;
  pointer-events: none;
  transition: color 0.18s ease;
}

.input-wrap input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 12px 42px 12px 40px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input-wrap input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-wrap:focus-within .input-icon {
  color: var(--accent);
}

.toggle-pass {
  position: absolute;
  right: 9px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 6px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.toggle-pass:hover {
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.1);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 22px;
  font-size: 0.86rem;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox input:disabled + span {
  opacity: 0.55;
}

.checks-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 22px;
  font-size: 0.86rem;
}

.btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: none;
  border-radius: 11px;
  padding: 12.5px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn--auto {
  width: auto;
  padding: 10px 15px;
  font-size: 0.88rem;
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), #059669);
  color: #04130d;
  box-shadow: 0 8px 22px rgba(16, 185, 129, 0.25);
}

.btn--primary:hover {
  background: linear-gradient(135deg, #34d399, #10b981);
  transform: translateY(-1px);
}

.btn--primary:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.btn--ghost {
  background: rgba(148, 163, 184, 0.09);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.btn--ghost:hover {
  background: rgba(148, 163, 184, 0.16);
}

.btn--admin {
  background: rgba(6, 182, 212, 0.13);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: #67e8f9;
}

.btn--admin:hover {
  background: rgba(6, 182, 212, 0.22);
}

.btn--danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.btn--danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.admin-callout {
  margin-top: 16px;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}

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

.meta-box {
  background: rgba(9, 13, 22, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 11px 13px;
}

.meta-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.meta-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e8f0;
  word-break: break-all;
}

.meta-value--lg {
  font-size: 1.25rem;
  font-weight: 700;
}

.meta-value--accent {
  color: #6ee7b7;
}

.meta-value--cyan {
  color: #67e8f9;
}

.strength-bar {
  height: 4px;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width 0.25s ease, background-color 0.25s ease;
}

.actions-bar {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.actions-bar form {
  margin: 0;
  flex: 1;
}

.actions-bar > a {
  flex: 1;
}

/* ── Admin Panel Specifics ──────────────────────────────────────────────── */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-search {
  flex: 1;
  min-width: 220px;
  max-width: 340px;
}

.toolbar-search input {
  padding: 9.5px 14px 9.5px 38px;
  font-size: 0.88rem;
}

.filter-tabs {
  display: inline-flex;
  gap: 6px;
  background: rgba(9, 13, 22, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 4px;
}

.filter-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  color: #f1f5f9;
}

.filter-pill.is-active {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  background: rgba(9, 13, 22, 0.45);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.users-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.75);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.users-table td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  vertical-align: middle;
}

.users-table tbody tr:last-child td {
  border-bottom: none;
}

.users-table tbody tr:hover {
  background: rgba(148, 163, 184, 0.04);
}

.row--inactive {
  opacity: 0.65;
}

.table-empty {
  text-align: center;
  padding: 28px !important;
  color: var(--text-muted);
}

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

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  font-weight: 700;
  font-size: 0.84rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  font-weight: 600;
  color: #f8fafc;
  margin-right: 6px;
}

.path-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.65);
  padding: 3px 7px;
  border-radius: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge--active {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge--inactive {
  background: rgba(239, 68, 68, 0.13);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.badge--admin {
  background: rgba(6, 182, 212, 0.16);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.badge--user {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.badge--bcrypt {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}

.badge--md5 {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
}

.badge--self {
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.col-actions {
  text-align: right;
  white-space: nowrap;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
}

.action-btn {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border-subtle);
  color: #e2e8f0;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.action-btn:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.2);
}

.action-btn--cyan {
  color: #67e8f9;
  border-color: rgba(6, 182, 212, 0.28);
}

.action-btn--cyan:hover:not(:disabled) {
  background: rgba(6, 182, 212, 0.18);
}

.action-btn--danger {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.28);
}

.action-btn--danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.18);
}

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

/* ── Modals ─────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(5, 8, 15, 0.76);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: #111827;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 26px 26px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
  animation: fadeUp 0.2s ease;
}

.modal-card--sm {
  max-width: 420px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 7px;
}

.modal-close:hover {
  color: #ffffff;
  background: rgba(148, 163, 184, 0.12);
}

.modal-body-text {
  font-size: 0.92rem;
  line-height: 1.5;
  color: #cbd5e1;
  margin: 0 0 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.footer-note {
  text-align: center;
  margin-top: 18px;
  font-size: 0.78rem;
  color: #64748b;
}

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

@media (max-width: 480px) {
  .card {
    padding: 24px 18px;
  }
  .meta-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .actions-bar,
  .modal-actions {
    flex-direction: column;
  }
}
