/* Evertech Owner Panel */
:root {
  --app-bg: #dfe5ef;
  --app-surface: #ffffff;
  --app-border: #c9d2e1;
  --app-text: #0f172a;
  --app-muted: #475569;
  --sb-bg: #101a36;
  --sb-text: #d3dbef;
  --sb-active: #ffffff;
  --sb-hover: rgba(255,255,255,.06);
  --brand: #3b5bfd;
  --brand-soft: rgba(59,91,253,.1);
  --sb-w: 260px;
  --radius: 14px;
  --bs-primary: #3b5bfd;
  --bs-primary-rgb: 59,91,253;
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-bg: var(--app-bg);
  --bs-body-color: var(--app-text);
  --bs-secondary-color: var(--app-muted);
  --bs-border-color: var(--app-border);
  --bs-link-color-rgb: 37,64,214;
}
[data-bs-theme="dark"] {
  --app-bg: #0d1222;
  --app-surface: #151c31;
  --app-border: #2c3757;
  --app-text: #eef1f8;
  --app-muted: #aeb8cf;
  --sb-bg: #0a0f1e;
  --brand-soft: rgba(99,125,255,.16);
  --bs-body-bg: var(--app-bg);
  --bs-body-color: var(--app-text);
  --bs-secondary-color: var(--app-muted);
  --bs-border-color: var(--app-border);
  --bs-link-color-rgb: 140,160,255;
}

html, body { background: var(--app-bg); color: var(--app-text); }
body { font-size: .95rem; -webkit-font-smoothing: antialiased; }
.text-body-secondary { color: var(--app-muted) !important; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: #2f4ae0; --bs-btn-hover-border-color: #2f4ae0; --bs-btn-active-bg: #2840c4; }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); }
.text-bg-primary { background-color: var(--brand) !important; }
.page-link { --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* ---------- Shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sb-w); background: var(--sb-bg); color: var(--sb-text);
  display: flex; flex-direction: column; flex-shrink: 0;
}
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  /* Bootstrap's .offcanvas-lg forces a transparent background on desktop; keep the navy sidebar */
  .sidebar.offcanvas-lg { background-color: var(--sb-bg) !important; }
}
@media (max-width: 991.98px) {
  .sidebar.offcanvas-lg { --bs-offcanvas-width: 280px; background: var(--sb-bg); }
}
.sb-brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.1rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.06); }
.sb-brand small { color: var(--sb-text); font-size: .75rem; }
.sb-logo {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, #3b5bfd, #7c4dff); color: #fff; font-weight: 700; font-size: 1.1rem;
}
.sb-logo.lg { width: 56px; height: 56px; font-size: 1.6rem; border-radius: 16px; }
.sb-nav { padding: .5rem .6rem 1.5rem; overflow-y: auto; }
.sb-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #93a0c4; font-weight: 600; padding: 1rem .7rem .35rem; }
.sb-link {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 10px;
  color: var(--sb-text); text-decoration: none; font-weight: 500; margin-bottom: 1px;
}
.sb-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.sb-link:hover { background: var(--sb-hover); color: #fff; }
.sb-link.active { background: var(--brand); color: var(--sb-active); box-shadow: 0 6px 16px rgba(59,91,253,.35); }
.sb-badge { margin-left: auto; background: #ef4444; color: #fff; font-size: .68rem; border-radius: 20px; padding: .05rem .45rem; font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .5rem;
  padding: .7rem 1.5rem; background: var(--app-surface); box-shadow: 0 1px 4px rgba(15,23,42,.06);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--app-border);
}
.page-title { font-size: 1.15rem; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; padding: 0; font-size: 1.15rem; color: var(--app-text); border: 0; }
.btn-icon:hover { background: var(--brand-soft); color: var(--brand); }
.dot-badge { position: absolute; top: 3px; right: 2px; background: #ef4444; color: #fff; font-size: .62rem; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 3px; }
.btn-user { display: flex; align-items: center; gap: .5rem; border: 0; font-weight: 500; color: var(--app-text); }
.btn-user:hover { background: var(--brand-soft); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.content { padding: 1.5rem; flex: 1; }
.foot { padding: 1rem 1.5rem; color: var(--app-muted); font-size: .85rem; }

@media (max-width: 991.98px) {
  .content { padding: 1rem; padding-bottom: 5.5rem; }
  .topbar { padding: .55rem 1rem; }
  .foot { display: none; }
}

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; display: flex;
  background: var(--app-surface); border-top: 1px solid var(--app-border);
  padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom));
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--app-muted); text-decoration: none; font-size: .68rem; }
.bottom-nav a i { font-size: 1.2rem; }
.bottom-nav a:hover, .bottom-nav a:focus { color: var(--brand); }

/* ---------- Cards ---------- */
.panel { background: var(--app-surface); color: var(--app-text); border: 1px solid var(--app-border); border-radius: var(--radius); box-shadow: 0 2px 6px rgba(15,23,42,.08); margin-bottom: 1.25rem; }
.panel > .card-header { display: flex; align-items: center; gap: .5rem; background: transparent; border-bottom: 1px solid var(--app-border); padding: .85rem 1.1rem; flex-wrap: wrap; }
.panel > .card-header h2 { font-size: 1.02rem; font-weight: 700; margin: 0; color: var(--app-text); }
.panel > .card-body { padding: 1.1rem; }
.panel > .card-body.p-0 .data-table th:first-child, .panel > .card-body.p-0 .data-table td:first-child { padding-left: 1.1rem; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
@media (max-width: 575.98px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: .65rem; } }
.kpi {
  display: flex; gap: .85rem; align-items: flex-start; padding: 1rem 1.1rem; background: var(--app-surface);
  border: 1px solid var(--app-border); border-radius: var(--radius); text-decoration: none; color: var(--app-text); box-shadow: 0 2px 6px rgba(15,23,42,.08);
  transition: transform .15s, box-shadow .15s; min-width: 0;
}
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(16,26,54,.08); color: inherit; }
.kpi-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0; }
.kpi-body { min-width: 0; }
.kpi-label { font-size: .84rem; color: var(--app-muted); font-weight: 600; }
.kpi-value { font-size: 1.35rem; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: .8rem; color: var(--app-muted); margin-top: 2px; }
@media (max-width: 575.98px) {
  .kpi { flex-direction: column; gap: .5rem; padding: .8rem; }
  .kpi-icon { width: 34px; height: 34px; font-size: 1rem; border-radius: 10px; }
  .kpi-value { font-size: 1.1rem; }
}
.kpi-primary .kpi-icon { background: rgba(59,91,253,.12); color: #3b5bfd; }
.kpi-success .kpi-icon { background: rgba(16,185,129,.13); color: #059669; }
.kpi-danger .kpi-icon { background: rgba(239,68,68,.12); color: #dc2626; }
.kpi-warning .kpi-icon { background: rgba(245,158,11,.15); color: #d97706; }
.kpi-info .kpi-icon { background: rgba(14,165,233,.13); color: #0284c7; }
.kpi-purple .kpi-icon { background: rgba(139,92,246,.13); color: #7c3aed; }
.kpi-secondary .kpi-icon { background: rgba(107,116,137,.13); color: #6b7489; }
.trend { font-weight: 600; font-size: .76rem; }

/* Filter bar */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; background: var(--app-surface);
  border: 1px solid var(--app-border); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1.25rem; box-shadow: 0 2px 6px rgba(15,23,42,.08);
}
.filter-bar .form-label { font-size: .8rem; color: var(--app-text); margin-bottom: .2rem; font-weight: 600; }
.fb-item { min-width: 140px; }
.fb-actions { display: flex; gap: .4rem; min-width: 0; }
.fb-label { font-size: .85rem; font-weight: 600; align-self: center; color: var(--app-text); }
@media (max-width: 575.98px) {
  .fb-item { flex: 1 1 calc(50% - .75rem); min-width: 0; }
  .fb-actions { flex-basis: 100%; }
  .fb-actions .btn { flex: 1; }
  .fb-label { flex-basis: 100%; margin-left: 0 !important; }
}

/* Tables */
.data-table { --bs-table-bg: transparent; --bs-table-color: var(--app-text); --bs-table-hover-color: var(--app-text); --bs-table-hover-bg: var(--brand-soft); font-size: .9rem; color: var(--app-text); }
.data-table thead th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--app-muted); font-weight: 700; border-bottom-width: 1px; white-space: nowrap; background: transparent; }
.data-table tfoot th { border-top: 2px solid var(--app-border); font-weight: 700; }
.data-table td { border-color: var(--app-border); }
.data-table a { text-decoration: none; }
.pager-info { font-size: .85rem; color: var(--app-muted); }

/* Charts */
.chart-box { position: relative; width: 100%; }
.chart-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; color: var(--app-muted); font-size: .85rem; }
.chart-empty i { font-size: 2rem; opacity: .4; }

/* Lists */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px dashed var(--app-border); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .ml-main { flex: 1; min-width: 0; }
.mini-list .ml-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list .ml-sub { font-size: .8rem; color: var(--app-muted); }
.ml-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--brand-soft); color: var(--brand); }
.empty-note { color: var(--app-muted); text-align: center; padding: 1.25rem 0; font-size: .85rem; }

/* Progress bars for rankings */
.rank-bar { height: 6px; border-radius: 3px; background: var(--brand-soft); overflow: hidden; margin-top: 4px; }
.rank-bar > span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

/* Tabs */
.nav-pills.module-tabs { gap: .35rem; margin-bottom: 1.1rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.nav-pills.module-tabs .nav-link { white-space: nowrap; border-radius: 10px; color: var(--app-text); font-weight: 600; background: var(--app-surface); border: 1px solid var(--app-border); }
.nav-pills.module-tabs .nav-link.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Tasks */
.task-item { display: flex; gap: .75rem; align-items: flex-start; padding: .8rem 1.1rem; border-bottom: 1px solid var(--app-border); }
.task-item:last-child { border-bottom: 0; }
.task-item.done .task-title { text-decoration: line-through; color: var(--app-muted); }
.task-title { font-weight: 500; }
.task-meta { font-size: .8rem; color: var(--app-muted); display: flex; flex-wrap: wrap; gap: .35rem .75rem; margin-top: 2px; align-items: center; }
.task-actions { margin-left: auto; display: flex; gap: .25rem; flex-shrink: 0; }
.check-btn { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--app-border); background: transparent; display: grid; place-items: center; padding: 0; margin-top: 1px; color: transparent; flex-shrink: 0; }
.check-btn:hover { border-color: #10b981; color: #10b981; }
.task-item.done .check-btn { background: #10b981; border-color: #10b981; color: #fff; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--app-border); border-left: 1px solid var(--app-border); }
.cal-h { font-size: .72rem; text-transform: uppercase; color: var(--app-muted); font-weight: 600; text-align: center; padding: .5rem 0; border-right: 1px solid var(--app-border); border-bottom: 1px solid var(--app-border); }
.cal-d { min-height: 110px; padding: .35rem; border-right: 1px solid var(--app-border); border-bottom: 1px solid var(--app-border); font-size: .76rem; min-width: 0; }
.cal-d.out { background: color-mix(in srgb, var(--app-bg) 70%, transparent); color: var(--app-muted); }
.cal-d.today .cal-n { background: var(--brand); color: #fff; }
.cal-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-weight: 600; margin-bottom: 2px; }
.cal-e { display: block; border-radius: 5px; padding: 1px 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; font-size: .72rem; }
.cal-e.t-task { background: rgba(59,91,253,.13); color: #3b5bfd; }
.cal-e.t-rem { background: rgba(245,158,11,.17); color: #b45309; }
.cal-e.t-ren { background: rgba(239,68,68,.13); color: #dc2626; }
.cal-e.t-evt { background: rgba(16,185,129,.14); color: #047857; }
.cal-e.t-cb { background: rgba(139,92,246,.14); color: #6d28d9; }
.cal-e.t-lv { background: rgba(107,116,137,.15); color: var(--app-muted); }
@media (max-width: 767.98px) {
  .cal-d { min-height: 64px; padding: .2rem; }
  .cal-e { font-size: 0; height: 6px; padding: 0; margin-bottom: 2px; }
  .cal-n { width: 20px; height: 20px; font-size: .7rem; }
  .cal-e.d-inline-block { font-size: .72rem; height: auto; padding: 1px 6px; }
}

/* Login */
.login-page { background: var(--app-bg); }
.login-wrap { min-height: 100vh; display: flex; }
.login-art { flex: 1; background: radial-gradient(circle at 20% 20%, #3b5bfd 0, #1a2a6b 45%, #0b1230 100%); color: #fff; align-items: center; justify-content: center; padding: 3rem; }
.login-art h1 { font-size: 2.6rem; font-weight: 700; margin: 1.5rem 0 1rem; line-height: 1.15; }
.login-art p { color: #c3cbea; max-width: 380px; }
.login-art ul { list-style: none; padding: 0; margin-top: 2rem; }
.login-art li { margin-bottom: .75rem; color: #dfe4f7; }
.login-art li i { margin-right: .6rem; color: #9fb1ff; }
.login-form { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 400px; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 18px; padding: 2rem; box-shadow: 0 20px 50px rgba(16,26,54,.08); }
.login-card h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }
.otp { letter-spacing: .5em; font-weight: 600; }

/* Misc */
.text-money-pos { color: #059669; }
.text-money-neg { color: #dc2626; }
.section-gap { margin-bottom: 1.25rem; }
.stat-line { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px dashed var(--app-border); font-size: .86rem; }
.stat-line:last-child { border-bottom: 0; }
.stat-line span:last-child { font-weight: 600; }
.modal-content { border-radius: var(--radius); border-color: var(--app-border); }
@media print {
  .sidebar, .topbar, .bottom-nav, .filter-bar, .foot, .task-actions { display: none !important; }
  .content { padding: 0; }
}
