:root {
  --brand: #1f6f5c;
  --brand-soft: rgba(31, 111, 92, 0.12);
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e5e7eb;
  --sidebar-width: 258px;
}

body {
  color: var(--ink);
  background: #f5f7f8;
  overflow-x: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { text-decoration: none; }

.public-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 15%, rgba(31, 111, 92, 0.13), transparent 35%),
    radial-gradient(circle at 90% 10%, rgba(59, 91, 219, 0.10), transparent 35%),
    #f7f9f9;
}

.app-shell { min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: #102a25;
  background: linear-gradient(180deg, #12332c 0%, #0d2521 100%);
  color: #d7e5e0;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
}

.sidebar-brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 1.15rem 1.2rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand strong { display: block; font-size: 0.98rem; line-height: 1.15; }
.sidebar-brand small { display: block; font-size: 0.72rem; color: #9fc0b6; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff; font-size: 1.15rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.sidebar-nav { padding: 0.9rem 0.7rem; flex: 1; overflow-y: auto; }
.sidebar-nav .nav-item {
  display: flex; align-items: center; gap: 0.7rem;
  color: #c6d8d2; padding: 0.62rem 0.75rem; border-radius: 10px;
  margin-bottom: 0.15rem; font-size: 0.92rem;
}
.sidebar-nav .nav-item i { width: 1.15rem; text-align: center; }
.sidebar-nav .nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sidebar-nav .nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(0,0,0,0.2); }
.nav-section {
  color: #7fa298; text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 0.68rem; font-weight: 700; padding: 1.1rem 0.8rem 0.35rem;
}
.sidebar-footer {
  padding: 0.9rem 1.2rem; border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; flex-direction: column; font-size: 0.86rem;
}
.sidebar-footer small { color: #92b3a9; }

.main-panel { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 64px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 0.75rem; padding: 0 1.4rem;
  position: sticky; top: 0; z-index: 1030;
}
.topbar-title { font-weight: 650; font-size: 1.02rem; }
.content { padding: 1.5rem 1.4rem 2rem; flex: 1; }
.app-footer {
  display: flex; justify-content: space-between; padding: 0.8rem 1.4rem;
  color: var(--muted); font-size: 0.78rem; border-top: 1px solid var(--line); background: #fff;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-size: 0.75rem; font-weight: 700;
}
.flash-stack { margin-bottom: 1rem; }

.card { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03); }
.card-header { background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; border-radius: 14px 14px 0 0 !important; }
.stat-card { padding: 1.1rem 1.2rem; }
.stat-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 650; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.15; margin-top: 0.15rem; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 1.2rem; }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-bottom: 1.2rem; }
.page-heading h1 { font-size: 1.45rem; font-weight: 700; margin: 0; }
.page-heading p { margin: 0; color: var(--muted); font-size: 0.88rem; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 0.72rem 0.75rem; vertical-align: middle; }
.table thead th { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom-width: 1px; }
.table-hover tbody tr:hover { background: #f8faf9; }
.table-actions { white-space: nowrap; }

.badge-status { font-weight: 600; font-size: 0.72rem; padding: 0.35em 0.6em; border-radius: 999px; }
.status-member { background: #d1fae5; color: #065f46; }
.status-regular { background: #dbeafe; color: #1e40af; }
.status-visitor { background: #fef3c7; color: #92400e; }
.status-inactive { background: #e5e7eb; color: #4b5563; }
.status-open { background: #fef3c7; color: #92400e; }
.status-paid, .status-done, .status-answered, .status-active { background: #d1fae5; color: #065f46; }
.status-void, .status-closed, .status-suspended { background: #e5e7eb; color: #4b5563; }

.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus { background: #185846; border-color: #185846; color: #fff; }
.btn-outline-brand { color: var(--brand); border-color: var(--brand); }
.btn-outline-brand:hover { background: var(--brand); color: #fff; }
.text-brand { color: var(--brand) !important; }
.bg-brand-soft { background: var(--brand-soft); }

.pipeline { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 0.9rem; overflow-x: auto; padding-bottom: 0.8rem; }
.pipeline-col { background: #eef2f1; border-radius: 14px; padding: 0.7rem; min-height: 220px; }
.pipeline-col-head { display: flex; align-items: center; justify-content: space-between; font-size: 0.82rem; font-weight: 700; margin-bottom: 0.6rem; }
.pipeline-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0.65rem 0.7rem; margin-bottom: 0.5rem; font-size: 0.85rem; }
.pipeline-card:hover { border-color: var(--brand); }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: min(440px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1.4rem; }
.auth-brand .brand-mark { width: 48px; height: 48px; font-size: 1.35rem; }
.auth-brand h1 { font-size: 1.2rem; font-weight: 750; margin: 0; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 0.82rem; }

.platform-nav { background: #102a25; }
.empty-state { padding: 2.2rem 1rem; text-align: center; color: var(--muted); }
.empty-state i { font-size: 2rem; display: block; margin-bottom: 0.5rem; color: #9ca3af; }
.timeline { position: relative; padding-left: 1.1rem; }
.timeline::before { content: ""; position: absolute; left: 0.25rem; top: 0.2rem; bottom: 0.2rem; width: 2px; background: var(--line); }
.timeline-item { position: relative; margin-bottom: 0.9rem; }
.timeline-item::before { content: ""; position: absolute; left: -0.95rem; top: 0.3rem; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.letter-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-grid; place-items: center; font-weight: 700; font-size: 0.8rem; }
.form-label { font-weight: 600; font-size: 0.83rem; }
.form-text { font-size: 0.76rem; }
.nav-tabs .nav-link { color: var(--muted); font-weight: 600; font-size: 0.86rem; }
.nav-tabs .nav-link.active { color: var(--brand); }
.kpi-note { color: var(--muted); font-size: 0.78rem; }
.progress { background: #e9eeec; }

@media (max-width: 991.98px) {
  .main-panel { margin-left: 0; }
  .sidebar-mobile { width: min(300px, 86vw); }
  .content { padding: 1.1rem 1rem 1.8rem; }
  .topbar { padding: 0 1rem; }
}

@media print {
  .sidebar, .topbar, .app-footer, .btn, .no-print { display: none !important; }
  .main-panel { margin-left: 0; }
  .content { padding: 0; }
  body { background: #fff; }
}

.theme-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  line-height: 1;
}
.theme-toggle-floating {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1060;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}
.language-floating {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1060;
}
.language-toggle {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

[data-bs-theme="dark"] {
  color-scheme: dark;
  --ink: #e5e7eb;
  --muted: #94a3b8;
  --line: #2a3542;
  --brand-soft: rgba(45, 212, 191, 0.14);
}

[data-bs-theme="dark"] body {
  background: #0b1117;
  color: var(--ink);
}

[data-bs-theme="dark"] .public-body {
  background:
    radial-gradient(circle at 15% 15%, rgba(45, 212, 191, 0.10), transparent 35%),
    radial-gradient(circle at 90% 10%, rgba(99, 102, 241, 0.12), transparent 35%),
    #0b1117;
}

[data-bs-theme="dark"] .app-body {
  background: #0b1117;
}

[data-bs-theme="dark"] .topbar,
[data-bs-theme="dark"] .app-footer {
  background: #111a22;
  border-color: var(--line);
}

[data-bs-theme="dark"] .topbar-title,
[data-bs-theme="dark"] .card-header {
  color: var(--ink);
}

[data-bs-theme="dark"] .card {
  background-color: #111a22;
  border-color: var(--line);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

[data-bs-theme="dark"] .card-header {
  background-color: #111a22;
  border-color: var(--line);
}

[data-bs-theme="dark"] .card-footer.bg-white,
[data-bs-theme="dark"] .bg-white {
  background-color: #111a22 !important;
}

[data-bs-theme="dark"] .table-hover tbody tr:hover {
  background-color: transparent !important;
}

[data-bs-theme="dark"] .table-hover tbody tr:hover > * {
  background-color: rgba(255, 255, 255, 0.045) !important;
  box-shadow: none !important;
  color: var(--ink);
}

[data-bs-theme="dark"] .text-bg-light {
  background-color: #1f2937 !important;
  color: #e5e7eb !important;
}

[data-bs-theme="dark"] .btn-light {
  background-color: #1f2937;
  border-color: #334155;
  color: #e5e7eb;
}

[data-bs-theme="dark"] .btn-light:hover,
[data-bs-theme="dark"] .btn-light:focus {
  background-color: #273449;
  border-color: #475569;
  color: #fff;
}

[data-bs-theme="dark"] .text-brand,
[data-bs-theme="dark"] .nav-tabs .nav-link.active {
  color: #5eead4 !important;
}

[data-bs-theme="dark"] .btn-outline-brand {
  color: #5eead4;
  border-color: #2dd4bf;
}

[data-bs-theme="dark"] .btn-outline-brand:hover,
[data-bs-theme="dark"] .btn-outline-brand:focus {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

[data-bs-theme="dark"] .letter-avatar,
[data-bs-theme="dark"] .avatar,
[data-bs-theme="dark"] .stat-icon {
  background: rgba(45, 212, 191, 0.14);
  color: #5eead4;
}

[data-bs-theme="dark"] .pipeline-col {
  background: #0f1720;
}

[data-bs-theme="dark"] .pipeline-card {
  background: #111a22;
  border-color: var(--line);
}

[data-bs-theme="dark"] .pipeline-card:hover {
  border-color: #2dd4bf;
}

[data-bs-theme="dark"] .timeline::before {
  background: #2a3542;
}

[data-bs-theme="dark"] .empty-state i {
  color: #64748b;
}

[data-bs-theme="dark"] .progress {
  background: #1f2937;
}

[data-bs-theme="dark"] .status-member {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

[data-bs-theme="dark"] .status-regular {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
}

[data-bs-theme="dark"] .status-visitor,
[data-bs-theme="dark"] .status-open {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

[data-bs-theme="dark"] .status-inactive,
[data-bs-theme="dark"] .status-void,
[data-bs-theme="dark"] .status-closed,
[data-bs-theme="dark"] .status-suspended {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
}

[data-bs-theme="dark"] .status-paid,
[data-bs-theme="dark"] .status-done,
[data-bs-theme="dark"] .status-answered,
[data-bs-theme="dark"] .status-active {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

[data-bs-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #0a1714 0%, #07110f 100%);
}

[data-bs-theme="dark"] .sidebar-brand {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  border-color: #334155;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  border-color: #2dd4bf;
  box-shadow: 0 0 0 0.2rem rgba(45, 212, 191, 0.18);
}

[data-bs-theme="dark"] .dropdown-menu {
  border-color: var(--line);
}

[data-bs-theme="dark"] .theme-toggle-floating {
  background: #111a22;
  border-color: var(--line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

/* Mobile navigation */
.mobile-bottom-nav {
  display: flex;
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1035;
  gap: 0.15rem;
  padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom));
  background: var(--bs-body-bg);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 22px rgba(15, 23, 42, 0.10);
}

.mobile-nav-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0.3rem 0.15rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
}

.mobile-nav-item i {
  font-size: 1.15rem;
  line-height: 1;
}

.mobile-nav-item.active {
  color: var(--brand);
  background: var(--brand-soft);
}

[data-bs-theme="dark"] .mobile-nav-item.active {
  color: #5eead4;
  background: rgba(45, 212, 191, 0.12);
}

[data-bs-theme="dark"] .mobile-bottom-nav {
  background: #111a22;
  box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.35);
}

.sidebar-mobile {
  z-index: 1045 !important;
}

.sidebar-mobile .offcanvas-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

@media (min-width: 992px) {
  .mobile-bottom-nav { display: none !important; }
}

@media (max-width: 991.98px) {
  .content { padding: 1rem 0.85rem 6rem; }
  .app-footer { display: none; }
  .topbar { height: 56px; padding: 0 0.85rem; }
  .topbar .dropdown-toggle {
    max-width: 56vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .page-heading { align-items: flex-start; gap: 0.6rem; }
  .page-heading h1 { font-size: 1.28rem; }
  .page-heading > .ms-auto { margin-left: 0 !important; width: 100%; }
  .page-heading > .ms-auto .btn,
  .page-heading > .ms-auto .btn-group { width: 100%; }
  .page-heading > .ms-auto .btn-group .btn { flex: 1; }
  .page-heading > .btn.ms-auto { margin-left: 0 !important; width: 100%; }
  .stat-card { padding: 0.9rem; }
  .stat-value { font-size: 1.45rem; }
  .card-body { padding: 1rem; }
  .table > :not(caption) > * > * { padding: 0.58rem 0.55rem; }
  .table-responsive { -webkit-overflow-scrolling: touch; }
  .table .btn-sm { min-height: 34px; }
  .pipeline { grid-auto-columns: 84vw; scroll-snap-type: x mandatory; }
  .pipeline-col { scroll-snap-align: start; }
  .auth-wrap { padding: 1.25rem 0.85rem; }
  .theme-toggle-floating {
    top: max(0.75rem, env(safe-area-inset-top));
    right: max(0.75rem, env(safe-area-inset-right));
  }
  .language-floating {
    top: max(0.75rem, env(safe-area-inset-top));
    left: max(0.75rem, env(safe-area-inset-left));
  }
  .form-control,
  .form-select,
  .form-control-sm,
  .form-select-sm { font-size: 16px; }
  .btn-sm { min-height: 36px; }
  .platform-nav .navbar-collapse { padding: 0.9rem 0 0.25rem; }
  .platform-nav .platform-account {
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    flex-wrap: wrap;
  }
  .dropdown-menu { max-width: calc(100vw - 1.5rem); }
}

@media (max-width: 575.98px) {
  .page-heading h1 { font-size: 1.16rem; }
  .stat-value { font-size: 1.3rem; }
  .table { font-size: 0.8rem; }
  .sidebar-mobile { width: min(300px, 88vw); }
  .navbar-brand { font-size: 0.98rem; }
  .mobile-nav-item { font-size: 0.62rem; }
}


