:root {
      --app-bg: #f6f8fc;
      --app-bg-2: #eef4ff;
      --card-bg: rgba(255,255,255,.88);
      --card-solid: #ffffff;
      --border: rgba(148, 163, 184, .22);
      --text: #0f172a;
      --muted: #64748b;
      --primary: #2563eb;
      --primary-2: #06b6d4;
      --primary-soft: #dbeafe;
      --danger: #dc2626;
      --success: #059669;
      --warning: #d97706;
      --shadow-sm: 0 6px 18px rgba(15, 23, 42, .06);
      --shadow-md: 0 16px 40px rgba(15, 23, 42, .10);
      --bottom-nav-height: 78px;
      --radius-xl: 1.35rem;
    }

    .dark {
      --app-bg: #0b1120;
      --app-bg-2: #111827;
      --card-bg: rgba(30, 41, 59, .82);
      --card-solid: #1f2937;
      --border: rgba(148, 163, 184, .18);
      --text: #f8fafc;
      --muted: #94a3b8;
      --primary: #60a5fa;
      --primary-2: #22d3ee;
      --primary-soft: #172554;
    }

    html,
    body {
      min-height: 100%;
      background:
        radial-gradient(circle at top left, rgba(37,99,235,.14), transparent 28rem),
        linear-gradient(180deg, var(--app-bg-2), var(--app-bg) 34%);
      color: var(--text);
      transition: background-color .25s ease, color .25s ease;
      font-feature-settings: "cv02", "cv03", "cv04", "cv11";
      -webkit-tap-highlight-color: transparent;
      overscroll-behavior-y: none;
      scroll-behavior: smooth;
    }

    html.modal-open,
    body.modal-open {
      overflow: hidden !important;
      height: 100% !important;
    }

    input,
    select,
    textarea,
    button {
      font: inherit;
    }

    button,
    a,
    input,
    select,
    textarea {
      touch-action: manipulation;
    }

    .app-shell {
      background:
        radial-gradient(circle at top left, rgba(37,99,235,.14), transparent 28rem),
        linear-gradient(180deg, var(--app-bg-2), var(--app-bg) 34%);
    }

    .app-card {
      position: relative;
      background: var(--card-bg);
      border: 1px solid var(--border);
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow-sm);
      backdrop-filter: blur(18px);
      overflow: hidden;
    }

    .app-card::before {
      content: "";
      position: absolute;
      inset: 0;
      pointer-events: none;
      background: linear-gradient(180deg, rgba(255,255,255,.35), transparent 34%);
      opacity: .65;
    }

    .app-card > * {
      position: relative;
      z-index: 1;
    }

    .app-surface {
      background: var(--card-solid);
      border: 1px solid var(--border);
      border-radius: 1.1rem;
      box-shadow: 0 4px 14px rgba(15, 23, 42, .045);
    }

    .app-hero {
      background:
        radial-gradient(circle at top right, rgba(255,255,255,.33), transparent 16rem),
        linear-gradient(135deg, #2563eb, #0ea5e9 56%, #14b8a6);
      color: white;
      border: 0;
      box-shadow: var(--shadow-md);
    }

    .app-pill {
      display: inline-flex;
      align-items: center;
      gap: .35rem;
      min-height: 32px;
      border-radius: 999px;
      padding: .35rem .7rem;
      background: rgba(255,255,255,.16);
      border: 1px solid rgba(255,255,255,.22);
      color: inherit;
      backdrop-filter: blur(10px);
    }

    .app-btn {
      min-height: 44px;
      border-radius: .95rem;
      font-weight: 700;
      transition: transform .12s ease, background-color .12s ease, opacity .12s ease, box-shadow .12s ease;
      user-select: none;
    }

    .app-btn-primary {
      background: linear-gradient(135deg, var(--primary), var(--primary-2));
      color: white;
      box-shadow: 0 10px 22px rgba(37, 99, 235, .22);
    }

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

    .app-btn:active {
      transform: scale(.97);
    }

    .app-input {
      width: 100%;
      border: 1px solid var(--border);
      background: rgba(255,255,255,.72);
      color: var(--text);
      border-radius: 1rem;
      padding: .82rem .95rem;
      outline: none;
      box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
    }

    .app-input:focus {
      box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
      border-color: var(--primary);
    }

    .page-section {
      animation: pageFade .22s cubic-bezier(.2,.8,.2,1);
    }

    .mobile-section-title {
      display: flex;
      align-items: end;
      justify-content: space-between;
      gap: .75rem;
      margin: .25rem 0 .75rem;
    }

    .quick-action {
      min-height: 76px;
      border-radius: 1.25rem;
      padding: .85rem;
      background: rgba(255,255,255,.78);
      border: 1px solid var(--border);
      box-shadow: 0 8px 20px rgba(15,23,42,.055);
      transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease;
    }

    .quick-action:active {
      transform: scale(.97);
    }

    .stat-tile {
      min-height: 92px;
      border-radius: 1.3rem;
      padding: 1rem;
      box-shadow: var(--shadow-sm);
      overflow: hidden;
      position: relative;
    }

    .stat-tile::after {
      content: "";
      position: absolute;
      right: -1.8rem;
      top: -1.8rem;
      width: 5.4rem;
      height: 5.4rem;
      border-radius: 999px;
      background: rgba(255,255,255,.20);
    }

    .skeleton {
      background: linear-gradient(90deg, rgba(148,163,184,.12), rgba(148,163,184,.26), rgba(148,163,184,.12));
      background-size: 200% 100%;
      animation: shimmer 1.15s infinite;
    }

    @keyframes shimmer {
      to { background-position-x: -200%; }
    }

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

    .sidebar-collapsed .sidebar-label { display: none; }
    .sidebar-collapsed aside { width: 4rem; }

    .tooltip { position: relative; }
    .tooltip::after {
      content: attr(data-tooltip);
      position: absolute;
      left: 100%;
      top: 50%;
      transform: translateY(-50%);
      background-color: rgba(0,0,0,.78);
      color:#fff;
      padding:4px 8px;
      border-radius:6px;
      font-size:.75rem;
      white-space:nowrap;
      display:none;
      margin-left:8px;
      z-index:100;
    }
    .sidebar-collapsed .tooltip:hover::after { display:block; }

    .dark body,
    .dark .app-shell {
      background:
        radial-gradient(circle at top left, rgba(96,165,250,.10), transparent 28rem),
        linear-gradient(180deg, var(--app-bg-2), var(--app-bg) 34%);
      color: var(--text);
    }

    .dark .bg-white,
    .dark .app-card {
      background-color: var(--card-bg) !important;
      color: var(--text);
    }

    .dark .text-gray-700 { color: #d1d5db !important; }
    .dark .text-gray-600 { color: #cbd5e1 !important; }
    .dark .text-gray-500 { color: #9ca3af !important; }
    .dark .border,
    .dark .border-gray-100,
    .dark .border-gray-200 { border-color: var(--border) !important; }
    .dark .hover\:bg-blue-100:hover,
    .dark .hover\:bg-gray-100:hover,
    .dark .hover\:bg-gray-50:hover { background-color: #374151 !important; }
    .dark input,
    .dark select,
    .dark textarea {
      background: #111827;
      color: #f9fafb;
      border-color: #374151;
    }

    .modal-panel {
      background: var(--card-bg);
      color: var(--text);
      border: 1px solid var(--border);
      border-radius: 1.25rem;
      box-shadow: 0 24px 70px rgba(0,0,0,.22);
      backdrop-filter: blur(18px);
    }

    #bottomNav {
      padding-bottom: env(safe-area-inset-bottom, 0);
      backdrop-filter: blur(20px) saturate(1.45);
      background: rgba(255,255,255,.82);
      box-shadow: 0 -12px 30px rgba(15, 23, 42, .10);
    }

    #bottomNav .nav-btn {
      min-height: 58px;
      border-radius: 1rem;
      margin: .35rem .15rem;
      transition: transform .12s ease, background-color .12s ease, color .12s ease;
    }

    #bottomNav .nav-btn:active {
      transform: scale(.96);
    }

    #bottomNav .nav-btn.nav-active {
      background: rgba(37, 99, 235, .10);
      color: var(--primary);
    }

    #fabLogo {
      background: linear-gradient(135deg, #ffffff, #eff6ff);
      box-shadow: 0 14px 30px rgba(37, 99, 235, .25);
    }

    .dark #bottomNav {
      background: rgba(31,41,55,.94);
      border-color: #374151;
    }

    .dark #fabLogo {
      background-color:#1f2937;
      border-color:#374151;
    }

    @media (max-width: 767px) {
      body.has-bottom-nav main,
      .has-bottom-nav main {
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0) + 18px) !important;
      }

      header {
        position: sticky;
        top: 0;
        z-index: 30;
        margin: .5rem .5rem 0;
        border-radius: 1.35rem;
        border: 1px solid var(--border) !important;
        background: rgba(255,255,255,.78) !important;
        backdrop-filter: blur(20px) saturate(1.35);
        box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
      }

      .dark header {
        background: rgba(15,23,42,.74) !important;
      }

      main {
        padding: .75rem !important;
      }

      input,
      select,
      textarea,
      button {
        font-size: 16px;
      }

      .mobile-hide {
        display: none !important;
      }

      .app-card {
        border-radius: 1.45rem;
      }

      .app-hero {
        margin-top: .15rem;
      }
    }
