@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --ink: #1a1a2e;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --primary: #00b894;
  --primary-deep: #00a383;
  --primary-tint: #e6f9f4;
  --accent: #e84545;
  --accent-tint: #fdecec;
  --line: #e2e6ee;
  --line-soft: #f1f3f7;
  --white: #ffffff;
  --surface: #f8f9fb;
  --surface-2: #f1f3f7;
  --info: #0077b6;
  --info-tint: #e6f2fa;
  --warning: #d98c1f;
  --warning-tint: #fdf2e3;
  --success: #00b894;
  --success-tint: #e6f9f4;
  --danger: #e84545;
  --danger-tint: #fdecec;
  --sale: #e84545;

  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;
  --text-4xl: 48px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(26, 26, 46, 0.04);
  --shadow-sm: 0 1px 3px rgba(26, 26, 46, 0.06), 0 1px 2px rgba(26, 26, 46, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 26, 46, 0.08), 0 2px 4px rgba(26, 26, 46, 0.04);
  --shadow-lg: 0 12px 32px rgba(26, 26, 46, 0.1), 0 4px 8px rgba(26, 26, 46, 0.04);
  --shadow-xl: 0 24px 48px rgba(26, 26, 46, 0.12), 0 8px 16px rgba(26, 26, 46, 0.06);
  --shadow-glow: 0 4px 24px rgba(0, 184, 148, 0.18);
  --shadow-glow-strong: 0 4px 40px rgba(0, 184, 148, 0.28);
  --shadow-focus: 0 0 0 3px rgba(0, 184, 148, 0.2);

  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 0.15s;
  --dur-base: 0.25s;
  --dur-slow: 0.4s;

  --sidebar-width: 248px;
  --sidebar-collapsed: 72px;
  --topbar-height: 68px;

  --z-header: 30;
  --z-dropdown: 35;
  --z-fab: 40;
  --z-tooltip: 50;
  --z-toast: 60;
  --z-modal: 70;
  --z-sidebar: 80;
  --z-mobile: 90;
}

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

html {
  font-family: var(--font);
  color: var(--ink);
  background: var(--white);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body { min-height: 100vh; line-height: 1.6; overflow-x: hidden; background: var(--white); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
img, video { max-width: 100%; display: block; }
svg { display: block; }
input, textarea, select { font: inherit; color: inherit; }
ul, ol { list-style: none; }
::selection { background: rgba(0, 184, 148, 0.2); color: var(--ink); }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(0.96); } 100% { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes pulseGlow { 0%, 100% { box-shadow: 0 4px 24px rgba(0, 184, 148, 0.18); } 50% { box-shadow: 0 4px 40px rgba(0, 184, 148, 0.32); } }
@keyframes barGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes accordionOpen { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tooltipIn { from { opacity: 0; transform: translateY(4px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.dashboard-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--white);
  color: var(--ink);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transition: width var(--dur-base) var(--ease-out);
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.sidebar.expanded { width: var(--sidebar-collapsed); }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 24px;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.sidebar.expanded .sidebar-header {
  padding: 22px 18px;
  justify-content: center;
}

.logo-img { height: 32px; width: auto; flex-shrink: 0; }
.sidebar.expanded .logo-img { height: 28px; }

.sidebar-content {
  flex: 1;
  padding: 16px 14px;
  overflow-y: auto;
}

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

.nav-section-title {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted-2);
  margin: 18px 12px 8px;
  display: block;
  font-weight: 600;
}

.sidebar.expanded .nav-section-title { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 2px;
  transition: background var(--dur-fast), color var(--dur-fast);
  white-space: nowrap;
  overflow: hidden;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
}

.nav-item i {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-text { transition: opacity var(--dur-fast); }

.sidebar.expanded .nav-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

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

.nav-item.active {
  background: var(--primary-tint);
  color: var(--primary);
  font-weight: 600;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.sidebar.expanded .nav-item .badge { display: none; }

.nav-item-parent { margin-bottom: 2px; }
.nav-parent-toggle { cursor: pointer; }

.parent-arrow {
  margin-left: auto;
  font-size: 12px;
  transition: transform var(--dur-fast);
}

.sidebar.expanded .parent-arrow { display: none; }

.nav-children {
  margin-left: 20px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.nav-item-child {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin: 2px 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  transition: all var(--dur-fast);
  font-size: 13px;
}

.nav-item-child i {
  width: 20px;
  font-size: 14px;
  color: var(--muted-2);
}

.nav-item-child:hover {
  background: var(--surface);
  color: var(--ink);
}

.nav-item-child.active {
  background: var(--primary-tint);
  color: var(--primary);
  font-weight: 600;
}

.nav-item-child.active i { color: var(--primary); }

.sidebar.expanded .nav-children { display: none !important; }

.sidebar.expanded .nav-parent-toggle .nav-text,
.sidebar.expanded .nav-parent-toggle .parent-arrow { display: none; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.sidebar-footer .upgrade-card {
  background: linear-gradient(135deg, #00b894 0%, #0077b6 100%);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-glow);
}

.sidebar-footer .upgrade-card h4 {
  margin: 0 0 4px;
  font-size: 14px;
  color: #fff;
}

.sidebar-footer .upgrade-card p {
  margin: 0 0 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
}

.sidebar-footer .upgrade-card .btn {
  background: var(--white);
  color: var(--ink);
  border-color: transparent;
  width: 100%;
  justify-content: center;
}

.sidebar-footer .upgrade-card .btn:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.sidebar.expanded .sidebar-footer .upgrade-card { display: none; }

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 4px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00b894 0%, #0077b6 100%);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-details { overflow: hidden; }

.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink);
}

.user-email {
  font-size: 10px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.expanded .user-details { display: none; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #00b894 0%, #0077b6 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
}

.brand__name { font-size: 22px; color: var(--ink); }

.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.4);
  backdrop-filter: blur(4px);
  z-index: var(--z-mobile);
  display: none;
  opacity: 0;
  transition: opacity var(--dur-base);
}

.mobile-nav-overlay.active {
  display: block;
  opacity: 1;
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  background: var(--white);
  color: var(--ink);
  z-index: calc(var(--z-mobile) + 1);
  transform: translateX(-100%);
  transition: transform var(--dur-base) var(--ease-out);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  border-right: 1px solid var(--line);
}

.mobile-sidebar.active { transform: translateX(0); }

.mobile-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  height: var(--topbar-height);
}

.mobile-logo-img { height: 32px; width: auto; }

.mobile-close-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  transition: all var(--dur-fast);
}

.mobile-close-btn:hover {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--primary);
}

.mobile-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
}

.mobile-sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--line);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin var(--dur-base) var(--ease-out);
  background: var(--white);
}

.sidebar.expanded ~ .main-content { margin-left: var(--sidebar-collapsed); }

.top-header {
  height: var(--topbar-height);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: var(--z-header);
  flex-shrink: 0;
}

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

.mobile-menu-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: none;
  place-items: center;
  font-size: 18px;
  transition: border-color var(--dur-fast), background var(--dur-fast);
  color: var(--ink);
}

.mobile-menu-btn:hover {
  border-color: var(--primary);
  background: var(--primary-tint);
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--ink);
}

.topbar-search {
  flex: 1;
  max-width: 420px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px 10px 38px;
  font-size: 13px;
  background: var(--white);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  font-family: var(--font);
}

.topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.topbar-search input::placeholder { color: var(--muted-2); }

.topbar-search .search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--muted-2);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.header-icon-link {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 17px;
  position: relative;
  transition: border-color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur-fast);
  color: var(--ink);
}

.header-icon-link:hover {
  border-color: var(--primary);
  background: var(--primary-tint);
  box-shadow: var(--shadow-sm);
}

.header-icon-link .dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--white);
}

.header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00b894 0%, #0077b6 100%);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  transition: transform var(--dur-fast), box-shadow var(--dur-fast);
}

.header-avatar:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-glow);
}

.content-wrapper {
  padding: 28px;
  flex: 1;
}

.page-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 24px;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base);
  box-shadow: var(--shadow-sm);
}

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

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-head__left h1 {
  font-size: 30px;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
  font-weight: 800;
  color: var(--ink);
}

.page-head__left p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.page-head__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.dash-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base);
  box-shadow: var(--shadow-sm);
}

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

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

.dash-card__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.dash-card__link {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--dur-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dash-card__link:hover {
  color: var(--primary-deep);
}

.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: var(--space-6);
  color: var(--muted-2);
}

.empty-state h3 {
  margin-bottom: var(--space-3);
  font-size: 1.25rem;
  color: var(--ink);
  font-weight: 700;
}

.empty-state p {
  margin-bottom: var(--space-2);
  color: var(--muted);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  animation: fadeIn 0.3s ease;
}

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

.dashboard-footer {
  padding: var(--space-5) var(--space-6);
  text-align: center;
  border-top: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  font-size: 0.875rem;
}

.text-gradient {
  background: linear-gradient(135deg, #00b894 0%, #0077b6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.bg-gradient { background: linear-gradient(135deg, #00b894 0%, #0077b6 100%); }
.bg-gradient-light { background: linear-gradient(160deg, var(--primary-tint), var(--white)); }

.text-muted { color: var(--muted); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }

.u-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.u-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.u-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.u-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.avatar {
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
  border: 2px solid var(--white);
  background: var(--surface);
}

.avatar--sm { width: 28px; height: 28px; }
.avatar--md { width: 40px; height: 40px; }
.avatar--lg { width: 56px; height: 56px; }

.avatar__initials {
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-tint);
}

.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -10px; }
.avatar-group .avatar:first-child { margin-left: 0; }

.divider {
  height: 1px;
  background: var(--line);
  margin: 3rem 0;
  border: none;
}

.divider--dashed {
  background: none;
  border-top: 1px dashed var(--line);
}

@media (max-width: 1100px) {
  /* stat-grid removed */
}

@media (max-width: 800px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--dur-base) var(--ease-out);
  }

  .sidebar.expanded {
    width: var(--sidebar-width);
    transform: translateX(-100%);
  }

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

  .sidebar.expanded .sidebar-header,
  .sidebar.expanded .nav-text,
  .sidebar.expanded .nav-section-title,
  .sidebar.expanded .upgrade-card,
  .sidebar.expanded .user-details {
    display: flex;
    opacity: 1;
    width: auto;
  }

  .sidebar.expanded .sidebar-header {
    padding: 22px 24px;
    justify-content: flex-start;
  }

  .sidebar.expanded .nav-text {
    opacity: 1;
    width: auto;
  }

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

  .main-content {
    margin-left: 0 !important;
  }

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

  .topbar-search {
    display: none;
  }

  .top-header {
    padding: 0 18px;
  }

  .content-wrapper {
    padding: 18px;
  }
}

@media (max-width: 500px) {
  .page-head {
    flex-direction: column;
  }

  .page-head__actions {
    width: 100%;
  }

  .page-head__actions .btn {
    flex: 1;
    justify-content: center;
  }

  .page-title {
    font-size: 24px;
  }

  .content-wrapper {
    padding: 14px;
  }

  .page-card,
  .dash-card {
    padding: 16px;
  }
}

@media print {
  .sidebar,
  .top-header,
  .mobile-menu-btn,
  .loading-overlay {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .content-wrapper {
    padding: 0;
  }

  .page-card,
  .dash-card {
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
