/* ═══════════════════════════════════════════
   ESTEEM ADMIN DASHBOARD — PREMIUM DESIGN SYSTEM
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700;9..40,800;9..40,900&display=swap');

:root {
  --bg: #f3f7fb;
  --bg-soft: #f8fbff;
  --card: rgba(255, 255, 255, 0.92);
  --card-solid: #ffffff;

  --border: rgba(16, 42, 34, 0.075);
  --border-strong: rgba(16, 42, 34, 0.14);

  --green: #0f6a4b;
  --green-light: rgba(15, 106, 75, 0.09);
  --green-dark: #084833;

  --blue: #1e4e8c;
  --blue-light: rgba(30, 78, 140, 0.09);

  --amber: #a16207;
  --amber-light: rgba(161, 98, 7, 0.1);

  --red: #b91c1c;
  --red-light: rgba(185, 28, 28, 0.075);

  --teal: #0e7490;
  --teal-light: rgba(14, 116, 144, 0.09);

  --sidebar-bg: #071f1a;
  --sidebar-bg-2: #102a22;
  --sidebar-hover: rgba(255, 255, 255, 0.075);
  --sidebar-active: #0f6a4b;

  --text: #102a22;
  --text-muted: #66766f;
  --text-soft: #8b9b94;

  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 11px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 26px 80px rgba(15, 23, 42, 0.12);

  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background:
    radial-gradient(circle at top left, rgba(15, 106, 75, 0.06), transparent 34%),
    radial-gradient(circle at top right, rgba(30, 78, 140, 0.055), transparent 32%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 100%);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: var(--font);
}

button {
  -webkit-tap-highlight-color: transparent;
}

/* ═══════ LAYOUT ═══════ */
.admin-page {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 270px;
  background:
    radial-gradient(circle at top left, rgba(15, 106, 75, 0.24), transparent 34%),
    linear-gradient(180deg, var(--sidebar-bg-2) 0%, var(--sidebar-bg) 100%);
  color: white;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  overflow-y: auto;
  scrollbar-width: none;
  border-right: 1px solid rgba(255,255,255,0.06);
  box-shadow: 18px 0 60px rgba(7,31,26,0.18);
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.content {
  flex: 1;
  padding: 28px 32px;
  margin-left: 270px;
  animation: pageFadeIn 0.35s ease both;
}

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

.mobile-header {
  display: none;
}

/* ═══════ SIDEBAR ═══════ */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
  padding: 0 6px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  object-fit: contain;
  background: rgba(255,255,255,0.08);
  padding: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.16);
}

.brand h1 {
  font-size: 17px;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.brand p {
  font-size: 9px;
  opacity: 0.46;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  margin-top: 1px;
  font-weight: 750;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,0.28);
  padding: 12px 13px 7px;
  font-weight: 850;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 13px;
  background: transparent;
  color: rgba(255,255,255,0.58);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
  transition: background .18s ease, color .18s ease, transform .18s ease, border-color .18s ease;
  height: auto;
  width: 100%;
}

.nav-btn svg {
  flex-shrink: 0;
  opacity: 0.68;
  width: 17px;
  height: 17px;
  transition: opacity .18s ease, transform .18s ease;
}

.nav-btn:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,0.92);
  transform: translateX(2px);
}

.nav-btn:hover svg {
  opacity: 1;
  transform: scale(1.04);
}

.nav-btn.active {
  background:
    linear-gradient(135deg, rgba(15,106,75,1), rgba(18,132,91,0.94));
  color: white;
  font-weight: 800;
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 10px 30px rgba(15,106,75,0.28);
}

.nav-btn.active::before {
  content: '';
  position: absolute;
  left: -6px;
  width: 3px;
  height: 22px;
  border-radius: 999px;
  background: #ffffff;
  opacity: 0.9;
}

.nav-btn.active svg {
  opacity: 1;
}

.nav-btn.danger {
  color: rgba(255, 135, 135, 0.72);
}

.nav-btn.danger:hover {
  background: rgba(185,28,28,0.14);
  color: #fecaca;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin-top: 18px;
}

.school-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.42);
  font-weight: 650;
  padding: 0 6px;
}

/* ═══════ TOPBAR ═══════ */
.topbar {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.topbar h2 {
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -0.045em;
  color: var(--text);
}

.topbar p {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 13.5px;
}

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

/* ═══════ STAT CARDS ═══════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.stat-card::after {
  content: '';
  position: absolute;
  inset: auto -40px -50px auto;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(15,106,75,0.055);
  pointer-events: none;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: rgba(15,106,75,0.18);
}

.stat-label {
  font-size: 10.5px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.085em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 31px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.045em;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}

/* ═══════ CARDS ═══════ */
.card {
  background: var(--card);
  backdrop-filter: blur(18px);
  border-radius: 22px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}

.card:hover {
  border-color: rgba(15,106,75,0.12);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 18px;
}

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card h3 {
  font-size: 16px;
  font-weight: 850;
  letter-spacing: -0.025em;
  margin: 0;
}

.card-subtitle {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.card-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.card-head-row .card-header {
  margin-bottom: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ═══════ DATA TABLES ═══════ */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  overflow: hidden;
}

.data-table thead th {
  text-align: left;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  background: rgba(244,248,253,0.75);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background .14s ease, transform .14s ease;
}

.data-table tbody tr:hover {
  background: rgba(15,106,75,0.035);
}

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

.user-cell {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.user-avatar {
  width: 35px;
  height: 35px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 850;
  flex-shrink: 0;
}

.user-name {
  font-weight: 750;
  font-size: 13px;
}

.user-email {
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-word;
}

/* ═══════ BADGES ═══════ */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge-student {
  background: var(--green-light);
  color: var(--green);
  border-color: rgba(15,106,75,0.12);
}

.badge-teacher {
  background: var(--blue-light);
  color: var(--blue);
  border-color: rgba(30,78,140,0.12);
}

.badge-admin {
  background: var(--amber-light);
  color: var(--amber);
  border-color: rgba(161,98,7,0.14);
}

.badge-active {
  background: var(--green-light);
  color: var(--green);
  border-color: rgba(15,106,75,0.12);
}

.badge-inactive {
  background: var(--red-light);
  color: var(--red);
  border-color: rgba(185,28,28,0.12);
}

.badge-default {
  background: rgba(244,248,253,0.9);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ═══════ ROLE SELECTOR ═══════ */
.role-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 4px;
}

.role-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 16px 8px;
  border: 1.5px solid var(--border);
  border-radius: 17px;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
  background: rgba(255,255,255,0.72);
}

.role-option:hover {
  transform: translateY(-2px);
  border-color: rgba(15,106,75,0.26);
  background: var(--green-light);
}

.role-option.active {
  border-color: var(--green);
  background: linear-gradient(180deg, rgba(15,106,75,0.1), rgba(15,106,75,0.045));
  box-shadow: 0 10px 26px rgba(15,106,75,0.08);
}

.role-emoji {
  font-size: 23px;
}

.role-label {
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.role-option.active .role-label {
  color: var(--green);
}

/* ═══════ FORMS ═══════ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

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

.full {
  grid-column: span 2;
}

.field {
  display: flex;
  flex-direction: column;
}

label {
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input,
select,
textarea {
  border-radius: 13px;
  border: 1.5px solid var(--border-strong);
  padding: 0 13px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  background: rgba(244,248,253,0.86);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input,
select {
  height: 45px;
}

textarea {
  padding-top: 12px;
  padding-bottom: 12px;
  min-height: 90px;
  resize: vertical;
}

select {
  cursor: pointer;
}

select[multiple] {
  height: auto;
  padding: 9px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(15,106,75,0.09);
}

input[readonly] {
  background: rgba(15,106,75,0.055);
  color: var(--green);
  font-weight: 750;
  cursor: default;
}

.helper {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ═══════ SECTION BOX ═══════ */
.section-box {
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 17px;
  background:
    radial-gradient(circle at top right, rgba(15,106,75,0.045), transparent 36%),
    rgba(244,248,253,0.62);
}

.section-header {
  margin-bottom: 13px;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 850;
  padding: 5px 12px;
  border-radius: 999px;
}

.section-badge.student {
  background: var(--green-light);
  color: var(--green);
}

.section-badge.staff {
  background: var(--blue-light);
  color: var(--blue);
}

/* ═══════ BUTTONS ═══════ */
button[type="submit"],
.actions button,
.primary-btn {
  height: 45px;
  border-radius: 13px;
  border: none;
  background: linear-gradient(135deg, var(--green), #16845f);
  color: white;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: background .16s ease, transform .12s ease, box-shadow .16s ease, opacity .16s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 20px;
  width: 100%;
  box-shadow: 0 10px 26px rgba(15,106,75,0.18);
}

button[type="submit"]:hover,
.actions button:hover,
.primary-btn:hover {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  transform: translateY(-1px);
}

button[type="submit"]:active,
.actions button:active,
.primary-btn:active {
  transform: scale(0.985);
}

button[type="submit"]:disabled,
.actions button:disabled,
.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.secondary-btn {
  background: #fff !important;
  border: 1.5px solid var(--border-strong) !important;
  color: var(--text-muted) !important;
  font-size: 12px !important;
  font-weight: 750 !important;
  box-shadow: none !important;
}

.secondary-btn:hover {
  border-color: var(--green) !important;
  color: var(--green) !important;
  background: var(--green-light) !important;
}

.secondary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.small-btn {
  padding: 0 13px !important;
  white-space: nowrap;
  width: auto !important;
  height: 45px;
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 13px;
  border: 1.5px solid var(--border);
  background: var(--card-solid);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .16s ease, border-color .16s ease, color .16s ease, background .16s ease;
  padding: 0;
  flex-shrink: 0;
}

.icon-btn:hover {
  transform: translateY(-1px) rotate(8deg);
  border-color: var(--green);
  color: var(--green);
  background: var(--green-light);
}

.inline-field {
  display: flex;
  gap: 8px;
}

.inline-field input {
  flex: 1;
}

.actions {
  margin-top: 6px;
}

/* ═══════ LIST ITEMS ═══════ */
.list-wrap {
  margin-top: 4px;
  overflow-x: auto;
}

.list-wrap::-webkit-scrollbar {
  height: 7px;
}

.list-wrap::-webkit-scrollbar-thumb {
  background: rgba(16,42,34,0.14);
  border-radius: 999px;
}

.list-item {
  padding: 13px 15px;
  border-radius: 15px;
  border: 1px solid var(--border);
  margin-bottom: 7px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
  background: rgba(255,255,255,0.74);
}

.list-item:hover {
  transform: translateY(-1px);
  border-color: rgba(15,106,75,0.18);
  box-shadow: var(--shadow-sm);
  background: #fff;
}

.list-item h4 {
  font-size: 13.5px;
  font-weight: 750;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.list-item div {
  font-size: 11px;
  color: var(--text-muted);
}

.list-item .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

/* ═══════ TABS ═══════ */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: tabFade .22s ease both;
}

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

/* ═══════ MESSAGES ═══════ */
.message {
  padding: 13px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
  animation: messageIn .22s ease both;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.success {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid rgba(15,106,75,0.15);
}

.message.error {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid rgba(185,28,28,0.12);
}

.hidden {
  display: none !important;
}

.empty-state {
  text-align: center;
  padding: 34px 18px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

/* ═══════ OVERVIEW SPECIFIC ═══════ */
.recent-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.recent-activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-text {
  font-size: 13px;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.class-breakdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.class-breakdown-item:last-child {
  border-bottom: none;
}

.class-bar-wrap {
  width: 86px;
  height: 7px;
  background: rgba(15,106,75,0.08);
  border-radius: 999px;
  overflow: hidden;
}

.class-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #19a779);
}

/* ═══════ ACCESS CONTROL / TABLE POLISH ═══════ */
.access-toggle-btn {
  min-width: 126px;
  justify-content: center;
}

.data-table td .small-btn {
  min-height: 36px;
  height: 36px;
}

.data-table td .badge {
  white-space: nowrap;
}

.data-table td:last-child {
  white-space: nowrap;
}

#accessControlTableWrap .data-table th:last-child,
#accessControlTableWrap .data-table td:last-child {
  text-align: left;
}

#accessControlTableWrap .data-table {
  min-width: 860px;
}

/* ═══════ LOADING / POLISH HELPERS ═══════ */
.loading-pulse {
  animation: pulseSoft 1.2s ease-in-out infinite;
}

@keyframes pulseSoft {
  0%, 100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

.fade-in {
  animation: tabFade .24s ease both;
}

/* ═══════ MOBILE ═══════ */
@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 280px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background:
      radial-gradient(circle at top left, rgba(15,106,75,0.22), transparent 40%),
      var(--sidebar-bg);
    color: white;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 12px 40px rgba(7,31,26,0.18);
  }

  .mobile-header .brand {
    margin-bottom: 0;
  }

  .hamburger {
    width: 38px;
    height: 38px;
    border: none;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
  }

  .hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: white;
    border-radius: 2px;
  }

  .content {
    margin-left: 0;
    padding: 18px 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 11px;
  }

  .form-grid,
  .inner-grid {
    grid-template-columns: 1fr;
  }

  .full {
    grid-column: span 1;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .card {
    padding: 18px;
    border-radius: 18px;
  }

  .data-table {
    font-size: 12px;
    min-width: 650px;
  }

  .data-table thead th,
  .data-table tbody td {
    padding: 10px 12px;
  }

  .user-cell {
    min-width: 180px;
  }

  .role-selector {
    grid-template-columns: 1fr;
  }
}

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

  .stat-card {
    padding: 15px;
    border-radius: 18px;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .inline-field {
    flex-direction: column;
  }

  .small-btn {
    width: 100% !important;
    justify-content: center;
  }

  .access-toggle-btn {
    min-width: 110px;
  }

  .content {
    padding: 16px 12px;
  }
}
/* ═══════ PREMIUM DASHBOARD UPGRADE ═══════ */

.dashboard-warning-item,
.dashboard-reminder-item {
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(244,248,253,0.75);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.dashboard-warning-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.dashboard-warning-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.dashboard-reminder-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-reminder-item.done {
  opacity: 0.55;
}

.dashboard-reminder-item.done .dashboard-reminder-text {
  text-decoration: line-through;
}

.dashboard-check-btn {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1.5px solid var(--green);
  background: var(--green-light);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  flex-shrink: 0;
}

.dashboard-reminder-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.dashboard-reminder-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.dashboard-delete-btn {
  border: none;
  background: var(--red-light);
  color: var(--red);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.dashboard-notes-input {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border-radius: 16px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg);
  padding: 14px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  outline: none;
}

.dashboard-notes-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15,106,75,0.1);
}

.dashboard-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
  margin-bottom: 18px;
}

.dashboard-action-btn {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
  transition: all .18s;
  font-family: var(--font);
}

.dashboard-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(15,106,75,0.18);
}

.dashboard-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.dashboard-action-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.dashboard-action-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 900px) {
  .dashboard-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .dashboard-actions-grid {
    grid-template-columns: 1fr;
  }
}.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin: 22px 0;
}

.quick-action {
  border: 1px solid var(--border);
  background: white;
  border-radius: 16px;
  padding: 14px 12px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all .2s ease;
}

.quick-action:hover {
  transform: translateY(-2px);
  border-color: rgba(15,106,75,.25);
  box-shadow: var(--shadow-md);
  background: var(--green-light);
  color: var(--green);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-mini-form {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
  margin-bottom: 18px;
}

.dashboard-note-preview {
  min-height: 190px;
  border-radius: 18px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.7), rgba(255,255,255,.2)),
    #fff8d6;
  border: 1px solid #f3df91;
  box-shadow: 0 16px 35px rgba(161, 98, 7, .12);
  cursor: pointer;
  transform: rotate(-1deg);
  transition: all .25s ease;
  position: relative;
}

.dashboard-note-preview:hover {
  transform: rotate(0deg) translateY(-3px);
  box-shadow: 0 22px 45px rgba(161, 98, 7, .18);
}

.dashboard-note-preview::before {
  content: '';
  position: absolute;
  top: 0;
  left: 28px;
  right: 28px;
  height: 14px;
  background: rgba(255,255,255,.45);
  border-radius: 0 0 12px 12px;
}

.note-preview-title {
  font-size: 13px;
  font-weight: 900;
  color: #7c5208;
  margin-bottom: 10px;
}

.note-preview-text {
  font-size: 14px;
  line-height: 1.7;
  color: #4b3a10;
  white-space: pre-wrap;
}

.note-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 15, .45);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.note-modal-backdrop.show {
  display: flex;
  animation: fadeIn .2s ease both;
}

.note-paper {
  width: min(560px, 100%);
  min-height: 520px;
  background:
    repeating-linear-gradient(
      #fff9d9,
      #fff9d9 33px,
      #f1dfa5 34px
    );
  border-radius: 24px;
  border: 1px solid #efd98d;
  box-shadow: 0 30px 90px rgba(0,0,0,.28);
  padding: 28px;
  transform: rotate(-1deg) scale(.96);
  animation: paperPop .25s ease forwards;
}

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

.note-paper-title {
  font-size: 18px;
  font-weight: 900;
  color: #6b4b08;
}

.note-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: none;
  background: rgba(124,82,8,.12);
  color: #6b4b08;
  font-weight: 900;
  cursor: pointer;
}

.note-paper textarea {
  width: 100%;
  min-height: 390px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-family: var(--font);
  font-size: 15px;
  line-height: 34px;
  color: #3f300b;
}

.note-save-hint {
  font-size: 12px;
  color: #7c5208;
  font-weight: 700;
  margin-top: 10px;
}
.tab-count-badge,
.nav-count-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: scale(1);
  transition: transform .2s ease, opacity .2s ease, background .2s ease;
}

.tab-count-badge:hover,
.nav-count-badge:hover {
  transform: scale(1.08);
}

.tab-count-badge.hidden,
.nav-count-badge.hidden {
  display: none;
}
@keyframes paperPop {
  to {
    transform: rotate(-1deg) scale(1);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 1000px) {
  .quick-actions-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

@media (max-width: 560px) {
  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-mini-form {
    grid-template-columns: 1fr;
  }
}