/**
 * TOLA Workspace — Shared Styles (NexaCore Intelligence brand — Production Perfected)
 * Include via <link rel="stylesheet" href="/shared/style.css"> on every page.
 */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,700;1,9..40,400&display=swap');

:root, [data-theme="dark"] {
  --bg: #0A0A0C;
  --surface: #16191F;
  --surface-2: #1B1F27;
  --border: #222730;
  --text: #FFFFFF;
  --text-primary: #FFFFFF;
  --text-secondary: #CDD5E0;
  --text-muted: #8B95A3;
  --accent: #D4AF37;
  --accent-hover: #FFD166;
  --accent-subtle: rgba(212, 175, 55, .12);
  --green: #25D366;
  --green-subtle: rgba(37, 211, 102, .1);
  --yellow: #F59E0B;
  --yellow-subtle: rgba(245, 158, 11, .12);
  --red: #EF4444;
  --red-subtle: rgba(239, 68, 68, .12);
  --transition: .2s cubic-bezier(.4, 0, .2, 1);
  --radius: 14px;
  --radius-sm: 10px;
  --pill: 999px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px -12px rgba(0, 0, 0, .5);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Light Theme Mode Overrides */
[data-theme="light"] {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --border: #E2E8F0;
  --text: #0F172A;
  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --accent: #B45309;
  --accent-hover: #D97706;
  --accent-subtle: rgba(180, 83, 9, 0.1);
  --green: #15803D;
  --green-subtle: rgba(21, 128, 61, 0.1);
  --yellow: #D97706;
  --yellow-subtle: rgba(217, 119, 6, 0.12);
  --red: #DC2626;
  --red-subtle: rgba(220, 38, 38, 0.1);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.08), 0 10px 15px -3px rgba(15, 23, 42, 0.04);
  --focus-ring: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg) !important;
  color: var(--text) !important;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

/* ── Shell / Sidebar (desktop) ── */
#tola-shell { display: flex; min-height: 100vh; }

#tola-sidebar {
  width: 264px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.tola-sidebar-header { padding: 4px 8px 28px; }
.tola-logo { display: flex; align-items: center; gap: 10px; }
.tola-brand { display: flex; flex-direction: column; line-height: 1.2; }
.tola-brand-name { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 800; color: var(--text-primary); letter-spacing: -.02em; }
.tola-brand-sub { font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }

.tola-account-business {
  margin: 2px 12px 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--accent-subtle); border: 1px solid rgba(212, 175, 55, .25);
  font-size: 12.5px; font-weight: 700; color: var(--accent-hover);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tola-logout-btn {
  width: 100%; background: none; border: none; cursor: pointer; font-family: inherit;
  text-align: left; color: var(--red);
}
.tola-logout-btn .tola-nav-icon { color: var(--red); }

.tola-nav-group { display: flex; flex-direction: column; gap: 2px; }
.tola-nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 14px; font-weight: 500; text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.tola-nav-item.active { background: var(--accent-subtle); color: var(--accent-hover); }
.tola-nav-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: currentColor; }
.tola-nav-icon svg { width: 18px; height: 18px; }
.tola-nav-label { white-space: nowrap; }

.tola-nav-divider { height: 1px; background: var(--border); margin: 16px 4px; }
.tola-nav-section-label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 0 12px; margin-bottom: 8px;
}

/* ── Main content ── */
#tola-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }

.tola-page-header { padding: 32px 40px 20px; border-bottom: 1px solid var(--border); }
.tola-page-header h1 {
  font-family: 'Syne', sans-serif; font-size: clamp(19px, 4.2vw, 24px); font-weight: 800; color: var(--text-primary);
  letter-spacing: -.02em;
}

.tola-page-content { flex: 1; padding: 28px 40px 48px; }

.tola-stat-value { font-size: clamp(21px, 6vw, 28px); font-weight: 700; line-height: 1.15; font-family: 'Syne', sans-serif; }
.tola-stat-value.accent { color: var(--accent); }
.tola-stat-value.green { color: var(--green); }
.tola-stat-value.yellow { color: var(--yellow); }
.tola-stat-value-lg { font-size: clamp(24px, 7.5vw, 32px); font-weight: 700; line-height: 1.15; font-family: 'Syne', sans-serif; }

/* ── Cards ── */
.tola-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}
.tola-card:last-child { margin-bottom: 0; }
.tola-card-title {
  font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 16px;
}

/* ── Buttons ── */
.tola-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 700;
  padding: 10px 20px; border-radius: var(--pill); border: 1px solid transparent;
  cursor: pointer; transition: background var(--transition), border-color var(--transition), color var(--transition), opacity var(--transition), transform var(--transition);
  background: var(--surface-2); color: var(--text-primary); border-color: var(--border);
}
.tola-btn:active { transform: scale(.98); }
.tola-btn:disabled { opacity: .5; cursor: not-allowed; }

.tola-btn-primary { background: var(--accent); color: #0A0A0C; border-color: transparent; }
.tola-btn-outline { background: transparent; color: var(--text-muted); border-color: rgba(255, 255, 255, .14); }
[data-theme="light"] .tola-btn-outline { border-color: rgba(0, 0, 0, .14); }
.tola-btn-outline.active { background: var(--accent-subtle); color: var(--accent-hover); border-color: rgba(212, 175, 55, .4); }

/* ── Badges ── */
.tola-badge {
  display: inline-flex; align-items: center; padding: 3px 12px;
  border-radius: var(--pill); font-size: 11px; font-weight: 700; line-height: 1.6;
  letter-spacing: .02em;
}
.tola-badge.green { background: var(--green-subtle); border: 1px solid rgba(37, 211, 102, .25); color: var(--green); }
.tola-badge.yellow { background: var(--yellow-subtle); border: 1px solid rgba(245, 158, 11, .3); color: var(--yellow); }
.tola-badge.gray { background: rgba(255, 255, 255, .05); border: 1px solid var(--border); color: var(--text-muted); }
[data-theme="light"] .tola-badge.gray { background: rgba(0, 0, 0, .04); }

/* ── Quicklinks Grid ── */
.tola-quicklinks-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-top: 8px; }
.tola-quicklink {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 12px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-secondary); text-decoration: none;
  text-align: center; font-size: 13px; font-weight: 600;
  transition: border-color .2s ease, color .2s ease, transform .2s ease;
}
.tola-quicklink svg { color: var(--accent); }
.tola-quicklink:active { transform: scale(.97); }

/* ── Table ── */
.tola-table { width: 100%; border-collapse: collapse; }
.tola-table th {
  text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.tola-table td { padding: 13px 12px; font-size: 13.5px; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.tola-table tr:last-child td { border-bottom: none; }

/* ── Precision Hover Isolation ── */
@media (hover: hover) and (pointer: fine) {
  .tola-nav-item:hover { background: rgba(255, 255, 255, .04); color: var(--text-secondary); }
  [data-theme="light"] .tola-nav-item:hover { background: rgba(0, 0, 0, .04); }
  
  .tola-logout-btn:hover { background: var(--red-subtle); }
  
  .tola-btn:hover { background: var(--border); }
  .tola-btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
  .tola-btn-outline:hover { border-color: rgba(255, 255, 255, .35); color: var(--text-secondary); }
  [data-theme="light"] .tola-btn-outline:hover { border-color: rgba(0, 0, 0, .35); }
  
  .tola-quicklink:hover { border-color: rgba(212, 175, 55, .4); color: var(--text-primary); }
  
  .tola-table tbody tr:hover { background: rgba(255, 255, 255, .02); }
  [data-theme="light"] .tola-table tbody tr:hover { background: rgba(0, 0, 0, .015); }
}

/* ── Mobile Navigation ── */
.tola-mobile-topbar { display: none; }
.tola-bottom-tabs { display: none; }
.tola-more-sheet, .tola-more-sheet-backdrop { display: none; }

@media (max-width: 900px) {
  #tola-sidebar { display: none; }

  .tola-mobile-topbar {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 40;
  }
  .tola-mobile-topbar .tola-brand-name { font-size: 17px; }

  .tola-page-header { display: none; }
  .tola-page-header, .tola-page-content { padding-left: 20px; padding-right: 20px; }
  .tola-page-content { padding-bottom: calc(96px + var(--safe-bottom)); background: var(--bg); }

  /* Bottom Tab Bar */
  .tola-bottom-tabs {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + var(--safe-bottom));
  }
  .tola-tab-item {
    flex: 1; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 4px 2px; border-radius: var(--radius-sm); color: var(--text-muted);
    text-decoration: none; background: none; border: none; font-family: 'DM Sans', sans-serif;
    cursor: pointer; transition: color var(--transition);
  }
  .tola-tab-item svg { width: 22px; height: 22px; }
  .tola-tab-item span { font-size: 10.5px; font-weight: 600; letter-spacing: .01em; }
  .tola-tab-item.active { color: var(--accent); }
  .tola-tab-item:active { transform: scale(.94); }

  /* "More" Bottom Sheet */
  .tola-more-sheet-backdrop.open {
    display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 75;
    backdrop-filter: blur(4px);
  }
  .tola-more-sheet {
    display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    background: var(--surface); border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0; padding: 10px 16px calc(20px + var(--safe-bottom));
    transform: translateY(100%); transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  }
  .tola-more-sheet.open { transform: translateY(0); }
  .tola-more-sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border); margin: 6px auto 14px; }
  .tola-more-sheet .tola-nav-item { padding: 14px 12px; font-size: 15px; }
}

@media (max-width: 576px) {
  .tola-quicklinks-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .tola-page-content { padding-left: 16px; padding-right: 16px; }
  .tola-card { padding: 18px 16px; }
}