/* ============================================================
   ThinkForever Parent Portal — Global Styles
   Modern, clean, flat design — no gradients
   Font Awesome icons only, fully responsive
   ============================================================ */

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

:root {
  /* Core palette */
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-hover: #f8fafc;
  --color-surface-alt: #f1f5f9;
  --color-surface-raised: #ffffff;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  --color-border-focus: #2563eb;

  /* Text */
  --color-text: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;
  --color-text-inverse: #ffffff;

  /* Brand */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #eff6ff;
  --color-primary-subtle: #dbeafe;
  --color-primary-muted: #93c5fd;

  /* Semantic */
  --color-success: #059669;
  --color-success-light: #ecfdf5;
  --color-success-subtle: #d1fae5;
  --color-warning: #d97706;
  --color-warning-light: #fffbeb;
  --color-warning-subtle: #fef3c7;
  --color-danger: #dc2626;
  --color-danger-light: #fef2f2;
  --color-danger-subtle: #fee2e2;
  --color-info: #0891b2;
  --color-info-light: #ecfeff;
  --color-info-subtle: #cffafe;

  /* Layout */
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Shadows — modern, layered */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  --shadow-ring: 0 0 0 3px rgba(37, 99, 235, 0.15);
  --shadow-ring-error: 0 0 0 3px rgba(220, 38, 38, 0.15);

  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;

  /* Transitions */
  --transition-fast: 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

#app {
  min-height: 100vh;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
}

button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition-fast);
}

input, select, textarea {
  font-family: var(--font-sans);
  font-size: 0.933rem;
  outline: none;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(40px) scale(0.96); }
}

/* ---- Layout: Shell ---- */

.app-shell {
  display: flex;
  min-height: 100vh;
  animation: fadeIn 0.3s ease;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
  overflow: hidden;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 99;
  animation: fadeIn 0.2s ease;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

.app-header {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-content {
  flex: 1;
  padding: 32px;
  width: 100%;
  margin: 0 auto;
  animation: fadeInUp 0.35s ease;
}

/* ---- Sidebar ---- */

.sidebar-brand {
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-brand-icon {
  width: 42px;
  height: 42px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1rem;
  flex-shrink: 0;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.sidebar-brand-logo {
  height: 42px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.sidebar-brand-text {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.04em;
}

.sidebar-brand-sub {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  font-weight: 600;
  display: block;
  margin-top: 2px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 16px;
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 28px;
}

.sidebar-section-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  padding: 0 14px;
  margin-bottom: 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  margin-bottom: 2px;
  position: relative;
}

.sidebar-link:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.sidebar-link.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--color-primary);
  border-radius: 0 3px 3px 0;
}

.sidebar-link-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--color-border-light);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sidebar-user:hover {
  background: var(--color-surface-alt);
}

.sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--color-primary-subtle);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.sidebar-user-email {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 170px;
}

/* ---- Header ---- */

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-text);
}

.header-breadcrumb {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  position: relative;
  transition: all var(--transition-fast);
}

.header-btn:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
  transform: scale(1.05);
}

.header-btn:active {
  transform: scale(0.95);
}

.header-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-danger);
  border: 2px solid var(--color-surface);
  animation: pulse 2s ease infinite;
}

.mobile-menu-btn {
  display: none;
}

/* ---- Cards ---- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 3px;
}

/* ---- Stat Cards ---- */

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

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-border-light);
  transition: background var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary-subtle);
  transform: translateY(-2px);
}

.stat-card:hover::after {
  background: var(--color-primary);
}

.stat-label {
  font-size: 0.76rem;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.stat-change {
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.up { color: var(--color-success); }
.stat-change.down { color: var(--color-danger); }

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--color-primary-light); color: var(--color-primary); }
.stat-icon.green { background: var(--color-success-light); color: var(--color-success); }
.stat-icon.amber { background: var(--color-warning-light); color: var(--color-warning); }
.stat-icon.red { background: var(--color-danger-light); color: var(--color-danger); }
.stat-icon.cyan { background: var(--color-info-light); color: var(--color-info); }

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: 1px solid transparent;
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
}

.btn i {
  font-size: 0.88em;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
  color: #FFF !important;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-text-muted);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  transform: translateY(-1px);
}

.btn-danger:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-ghost:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.btn-sm {
  padding: 7px 16px;
  font-size: 0.8rem;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 14px 32px;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

/* ---- Forms ---- */

.form-group {
  margin-bottom: 22px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.form-input {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  line-height: 1.5;
}

.form-input:hover {
  border-color: var(--color-text-muted);
  background: var(--color-surface-hover);
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-ring);
  background: var(--color-surface);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-input.error {
  border-color: var(--color-danger);
  box-shadow: var(--shadow-ring-error);
}

.form-error {
  font-size: 0.78rem;
  color: var(--color-danger);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

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

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

/* ---- Tables ---- */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}

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

.data-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  padding: 14px 18px;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
  background: var(--color-surface-alt);
}

.data-table th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}

.data-table th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

.data-table td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 0.87rem;
}

.data-table tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover td {
  background: var(--color-surface-hover);
}

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

/* ---- Badges ---- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.badge i {
  font-size: 0.62rem;
}

.badge-success { background: var(--color-success-light); color: var(--color-success); }
.badge-warning { background: var(--color-warning-light); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-light); color: var(--color-danger); }
.badge-info { background: var(--color-info-light); color: var(--color-info); }
.badge-neutral { background: #f1f5f9; color: var(--color-text-secondary); }
.badge-primary { background: var(--color-primary-light); color: var(--color-primary); }

/* ---- Progress bar ---- */

.progress-bar {
  height: 8px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.warning { background: var(--color-warning); }
.progress-fill.danger { background: var(--color-danger); }

/* ---- Tabs ---- */

.tabs {
  display: flex;
  gap: 2px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 28px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  background: transparent;
  white-space: nowrap;
  border: none;
}

.tab:hover {
  color: var(--color-text);
}

.tab.active {
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

/* ---- Empty state ---- */

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 18px;
  color: var(--color-text-muted);
  opacity: 0.4;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.empty-state-text {
  font-size: 0.87rem;
  margin-bottom: 22px;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* ---- Notifications dropdown ---- */

.notif-dropdown {
  position: absolute;
  top: 52px;
  right: 0;
  width: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2xl);
  z-index: 200;
  max-height: 480px;
  overflow-y: auto;
  animation: slideDown 0.2s ease;
}

.notif-dropdown-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.notif-item:hover {
  background: var(--color-surface-hover);
}

.notif-item.unread {
  background: var(--color-primary-light);
}

.notif-title {
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.notif-msg {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.notif-time {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-top: 6px;
}

/* ---- Auth pages (login/register) ---- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: 24px;
  position: relative;
}

.auth-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50vh;
  background: var(--color-primary-light);
  z-index: 0;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: 48px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.4s ease;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.auth-logo-icon {
  width: 46px;
  height: 46px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.auth-logo-text {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.04em;
  color: var(--color-text);
}

.auth-subtitle {
  font-size: 0.93rem;
  color: var(--color-text-muted);
  margin-bottom: 36px;
  line-height: 1.5;
}

.auth-footer {
  text-align: center;
  margin-top: 32px;
  font-size: 0.87rem;
  color: var(--color-text-secondary);
  padding-top: 24px;
  border-top: 1px solid var(--color-border-light);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ---- Toast ---- */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-size: 0.87rem;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  line-height: 1.5;
  backdrop-filter: blur(8px);
}

.toast i {
  font-size: 1rem;
}

.toast-success { background: var(--color-success); color: #fff; }
.toast-error { background: var(--color-danger); color: #fff; }
.toast-warning { background: var(--color-warning); color: #fff; }
.toast-info { background: var(--color-primary); color: #fff; }

/* ---- Loading spinner ---- */

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  flex-direction: column;
  gap: 16px;
}

/* ---- Modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
  padding: 24px;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.modal-body {
  padding: 28px;
}

.modal-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--color-border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- Grid helpers ---- */

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

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.73rem; }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }

/* ---- Responsive ---- */

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

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: none;
  }

  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-2xl);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .app-main {
    margin-left: 0;
  }

  .app-header {
    padding: 0 16px;
    height: 60px;
  }

  .mobile-menu-btn {
    display: flex !important;
  }

  .app-content {
    padding: 20px 16px;
  }

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

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

  .auth-page::before {
    height: 40vh;
  }

  .auth-card {
    padding: 36px 28px;
    border-radius: var(--radius-xl);
  }

  .header-title {
    font-size: 1rem;
  }

  .notif-dropdown {
    width: calc(100vw - 32px);
    right: -8px;
  }

  .modal-overlay {
    padding: 16px;
  }

  .modal {
    max-width: 100%;
  }

  .modal-body {
    padding: 20px;
  }

  .modal-header {
    padding: 18px 20px;
  }

  .modal-footer {
    padding: 16px 20px;
  }

  .tabs {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

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

  .tab {
    padding: 9px 16px;
    font-size: 0.82rem;
  }

  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }

  .toast {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 28px 22px;
  }

  .auth-title {
    font-size: 1.3rem;
  }

  .stats-grid {
    gap: 12px;
  }

  .stat-card {
    padding: 20px 22px;
  }

  .stat-value {
    font-size: 1.4rem;
  }

  .stat-icon {
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }

  .card {
    padding: 22px;
    border-radius: var(--radius-md);
  }

  .data-table td,
  .data-table th {
    padding: 10px 12px;
    font-size: 0.8rem;
  }
}
