:root {
  --bg: #eef3f9;
  --bg-soft: #f7f9fc;
  --ink: #132238;
  --muted: #708197;
  --line: rgba(85, 106, 135, 0.14);
  --line-strong: rgba(85, 106, 135, 0.22);
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --accent: #3178f6;
  --accent-soft: rgba(49, 120, 246, 0.12);
  --success: #1f9c64;
  --warning: #f4b63d;
  --danger: #d95a68;
  --shadow: 0 34px 80px rgba(73, 96, 130, 0.18);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  padding: 28px;
  background:
    radial-gradient(circle at top left, rgba(49, 120, 246, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(164, 197, 255, 0.26), transparent 24%),
    linear-gradient(180deg, #f7f9fc 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "SF Pro Text", "Inter", "Helvetica Neue", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.ambient {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(19, 34, 56, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 34, 56, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 42%, transparent 100%);
  pointer-events: none;
}

.app-window {
  position: relative;
  z-index: 1;
  max-width: 1480px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.window-chrome {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 46px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(85, 106, 135, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 248, 253, 0.7));
}

.traffic-lights {
  display: flex;
  gap: 8px;
}

.light {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.light-red { background: #ff5f57; }
.light-yellow { background: #febc2e; }
.light-green { background: #28c840; }

.window-title {
  font-size: 0.88rem;
  color: var(--muted);
}

.app-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: calc(100vh - 120px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(246,249,252,0.62));
  border-right: 1px solid rgba(85, 106, 135, 0.08);
}

.sidebar-brand h1 {
  margin: 0;
  font-family: "SF Pro Display", "Inter", "Helvetica Neue", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.sidebar-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 16px;
  color: var(--muted);
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.sidebar-link:hover {
  background: rgba(49, 120, 246, 0.08);
  color: var(--ink);
  transform: translateX(1px);
}

.sidebar-link-active {
  background: rgba(49, 120, 246, 0.12);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(49, 120, 246, 0.10);
}

.sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(85, 106, 135, 0.12);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sidebar-footer-label {
  margin: 0 0 2px;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar-footer-user {
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.content-shell {
  min-width: 0;
}

.shell-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 22px 26px 10px;
}

.shell-page-title {
  margin: 0;
  font-family: "SF Pro Display", "Inter", "Helvetica Neue", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.shell-header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shell-main {
  padding: 16px 26px 28px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px 5px 10px;
  font-size: 12px;
}
.user-chip-name {
  font-weight: 600;
  color: var(--ink);
}
.user-chip-role {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.page-stack {
  display: grid;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(82, 103, 130, 0.08);
  border-radius: var(--radius-xl);
  padding: 18px;
  margin-bottom: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.panel-heading h2,
.panel-heading h3 {
  margin: 0;
  font-family: "SF Pro Display", "Inter", "Helvetica Neue", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}

/* ── Stat / metric grid ── */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.metric-box {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
}

.metric-box span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.metric-box strong {
  display: block;
  margin-top: 8px;
  font-size: 1.35rem;
}

/* ── Table / list ── */

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 11px 10px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

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

.data-table tr:hover td {
  background: rgba(49,120,246,0.03);
}

/* ── Badges / pills ── */

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-admin {
  background: rgba(49,120,246,0.1);
  border: 1px solid rgba(49,120,246,0.2);
  color: var(--accent);
}

.badge-editor {
  background: rgba(244,182,61,0.12);
  border: 1px solid rgba(244,182,61,0.24);
  color: #b8870a;
}

.badge-viewer {
  background: rgba(112,129,151,0.1);
  border: 1px solid rgba(112,129,151,0.2);
  color: var(--muted);
}

.badge-active {
  background: rgba(31,156,100,0.1);
  border: 1px solid rgba(31,156,100,0.22);
  color: var(--success);
}

.badge-inactive {
  background: rgba(217,90,104,0.08);
  border: 1px solid rgba(217,90,104,0.18);
  color: var(--danger);
}

/* ── Buttons ── */

.button,
button {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--accent);
  color: #f8fbff;
  box-shadow: 0 10px 24px rgba(49, 120, 246, 0.16);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

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

.button-small {
  padding: 8px 11px;
  font-size: 0.82rem;
}

.button-full {
  width: 100%;
  justify-content: center;
}

.button-ghost {
  background: rgba(19, 34, 56, 0.06);
  color: var(--ink);
  box-shadow: none;
}

.button-danger {
  background: var(--danger);
  box-shadow: 0 10px 24px rgba(217, 90, 104, 0.16);
}

/* ── Forms ── */

.form-stack {
  display: grid;
  gap: 16px;
  max-width: 480px;
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field label {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.form-field input,
.form-field select {
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.9);
  color: var(--ink);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-field input:focus,
.form-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49,120,246,0.08);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.form-error {
  background: rgba(217,90,104,0.1);
  border: 1px solid rgba(217,90,104,0.3);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.84rem;
  padding: 10px 14px;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 4px;
}

/* ── Toggle switch ── */

.toggle-field {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-label {
  font-size: 0.9rem;
  color: var(--ink);
}

.toggle-wrap {
  position: relative;
  width: 42px;
  height: 24px;
}

.toggle-wrap input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(112,129,151,0.24);
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  transition: transform 0.2s;
}

.toggle-wrap input:checked + .toggle-track {
  background: var(--success);
}

.toggle-wrap input:checked + .toggle-track::after {
  transform: translateX(18px);
}

/* ── Recent users table ── */

.users-table-wrap {
  overflow-x: auto;
}

/* ── Responsive ── */

@media (max-width: 920px) {
  body {
    padding: 12px;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(85, 106, 135, 0.08);
    padding-bottom: 16px;
  }

  .shell-header,
  .shell-main {
    padding-left: 18px;
    padding-right: 18px;
  }

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

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