/* Campaign HQ — compact Apple-style glass theme (Bootstrap 5.3 on top) */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --accent: #0a84ff;
  --accent-2: #5e5ce6;
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .82);
  --glass-border: rgba(255, 255, 255, .7);
  --line: rgba(60, 60, 67, .12);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --shadow: 0 8px 30px rgba(31, 38, 135, .10);
  --radius: 16px;
  --sidebar-w: 248px;
  --topbar-h: 54px;
}
[data-bs-theme="dark"] {
  --glass: rgba(40, 40, 46, .55);
  --glass-strong: rgba(44, 44, 50, .80);
  --glass-border: rgba(255, 255, 255, .10);
  --line: rgba(255, 255, 255, .10);
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
}

html { font-size: 13px; }
body {
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 8% -5%, rgba(10, 132, 255, .28), transparent 60%),
    radial-gradient(800px 520px at 100% 0%, rgba(191, 90, 242, .22), transparent 55%),
    radial-gradient(900px 600px at 60% 110%, rgba(52, 199, 89, .18), transparent 60%),
    #eef1f7;
  background-attachment: fixed;
}
[data-bs-theme="dark"] body {
  background:
    radial-gradient(900px 500px at 8% -5%, rgba(10, 132, 255, .25), transparent 60%),
    radial-gradient(800px 520px at 100% 0%, rgba(191, 90, 242, .20), transparent 55%),
    #0e0f14;
  background-attachment: fixed;
}
a { color: var(--accent); text-decoration: none; }
.text-muted, .text-body-secondary { color: var(--muted) !important; }

/* ---------- glass surfaces ---------- */
.glass, .card, .modal-content, .dropdown-menu, .offcanvas, .accordion-item, .nav-tabs {
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
}
.card, .glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  --bs-card-cap-bg: transparent;
  --bs-card-bg: transparent;
  color: var(--text);
}
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: .6rem .9rem; font-weight: 600; }
.card-body { padding: .85rem .9rem; }
.modal-content, .dropdown-menu, .offcanvas {
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .22);
  color: var(--text);
}
.modal-header, .modal-footer { border-color: var(--line); padding: .7rem 1rem; }
.modal-title { font-size: 1rem; font-weight: 600; }

/* ---------- layout ---------- */
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  padding: 10px; display: flex; flex-direction: column;
  transition: transform .25s ease;
}
.sidebar-inner {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 20px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
}
.brand { display: flex; align-items: center; gap: .6rem; padding: .85rem .9rem .6rem; font-weight: 700; font-size: 1.05rem; color: var(--text); }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 12px rgba(10, 132, 255, .4); }
.menu-search { padding: 0 .75rem .5rem; }
.menu-scroll { flex: 1; overflow-y: auto; padding: 0 .5rem .75rem; scrollbar-width: thin; }
.menu-link, .menu-group-btn {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .42rem .65rem; border-radius: 10px; color: var(--text); font-size: .95rem;
  background: none; border: 0; text-align: left;
}
.menu-link:hover, .menu-group-btn:hover { background: rgba(10, 132, 255, .10); color: var(--text); }
.menu-link.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 4px 14px rgba(10, 132, 255, .35); }
.menu-link i, .menu-group-btn i.lead { width: 18px; text-align: center; opacity: .85; }
.menu-group-btn { font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: .72rem; letter-spacing: .05em; margin-top: .4rem; }
.menu-group-btn .chev { margin-left: auto; transition: transform .2s; font-size: .7rem; }
.menu-group-btn[aria-expanded="true"] .chev { transform: rotate(90deg); }
.menu-sub { padding-left: .3rem; }
.menu-sub .menu-link { font-size: .9rem; padding: .32rem .65rem .32rem .8rem; }

.app-main { margin-left: calc(var(--sidebar-w) + 10px); padding: 10px 14px 24px 4px; min-height: 100vh; }
.app-topbar {
  position: sticky; top: 10px; z-index: 1030; height: var(--topbar-h); margin-bottom: 14px;
  display: flex; align-items: center; gap: .6rem; padding: 0 .8rem;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 16px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
}
.top-nav { display: flex; gap: .15rem; }
.top-nav a { padding: .35rem .7rem; border-radius: 999px; color: var(--text); font-weight: 500; }
.top-nav a:hover { background: rgba(10, 132, 255, .10); }
.top-nav a.active { background: rgba(10, 132, 255, .16); color: var(--accent); }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--text); position: relative; }
.icon-btn:hover { background: rgba(10, 132, 255, .12); }
.icon-btn .dot { position: absolute; top: 5px; right: 5px; min-width: 15px; height: 15px; padding: 0 3px; font-size: .62rem; line-height: 15px; text-align: center; border-radius: 99px; background: #ff3b30; color: #fff; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, #ff9f0a, #ff375f); }
.campaign-switch { max-width: 210px; border-radius: 999px; background-color: var(--glass-strong); border-color: var(--glass-border); }

.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .9rem; }
.page-head h1 { font-size: 1.35rem; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.page-head .sub { color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .4rem; }

/* ---------- controls ---------- */
.form-control, .form-select {
  background-color: var(--glass-strong); border: 1px solid var(--line); border-radius: 10px; color: var(--text);
  padding: .38rem .65rem; font-size: .95rem;
}
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(10, 132, 255, .18); background-color: var(--glass-strong); color: var(--text); }
.form-label { font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: .2rem; }
.btn { border-radius: 10px; font-weight: 500; font-size: .92rem; padding: .36rem .8rem; }
.btn-sm { font-size: .82rem; padding: .22rem .55rem; border-radius: 8px; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 0; box-shadow: 0 4px 12px rgba(10, 132, 255, .30); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-light, .btn-glass { background: var(--glass-strong); border: 1px solid var(--line); color: var(--text); }
.btn-light:hover, .btn-glass:hover { background: rgba(10, 132, 255, .12); color: var(--text); }
.badge { font-weight: 600; font-size: .72rem; letter-spacing: .01em; }

/* ---------- tabs / accordion ---------- */
.nav-tabs { border: 0; gap: .25rem; background: var(--glass); padding: .25rem; border-radius: 12px; display: inline-flex; flex-wrap: wrap; }
.nav-tabs .nav-link { border: 0; border-radius: 9px; color: var(--muted); padding: .3rem .8rem; font-weight: 500; }
.nav-tabs .nav-link.active { background: var(--glass-strong); color: var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.accordion { --bs-accordion-bg: transparent; --bs-accordion-border-color: var(--line); --bs-accordion-btn-bg: transparent; --bs-accordion-active-bg: rgba(10, 132, 255, .08); --bs-accordion-active-color: var(--text); --bs-accordion-btn-color: var(--text); --bs-accordion-color: var(--text); }
.accordion-item { background: var(--glass); border-radius: 14px !important; margin-bottom: .5rem; overflow: hidden; border: 1px solid var(--glass-border); }
.accordion-button { font-weight: 600; padding: .65rem .9rem; box-shadow: none !important; }

/* ---------- stat cards ---------- */
.stat { display: flex; gap: .7rem; align-items: center; padding: .75rem .85rem; height: 100%; color: var(--text); transition: transform .15s, box-shadow .15s; }
a.stat:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(31, 38, 135, .16); color: var(--text); }
.stat .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 1.1rem; flex: none; }
.stat .num { font-size: 1.45rem; font-weight: 700; line-height: 1.05; letter-spacing: -.02em; }
.stat .lbl { color: var(--muted); font-size: .8rem; }
.stat .sub { color: var(--muted); font-size: .72rem; }
.ico-primary { background: rgba(10, 132, 255, .15); color: #0a84ff; }
.ico-success { background: rgba(52, 199, 89, .17); color: #1f9d46; }
.ico-danger { background: rgba(255, 59, 48, .15); color: #e0352b; }
.ico-warning { background: rgba(255, 159, 10, .18); color: #d98200; }
.ico-info { background: rgba(90, 200, 250, .2); color: #118ab5; }
.ico-secondary { background: rgba(142, 142, 147, .2); color: #6e6e73; }
.mini-stat { padding: .55rem .7rem; border-radius: 12px; background: var(--glass-strong); border: 1px solid var(--line); height: 100%; }
.mini-stat .n { font-size: 1.15rem; font-weight: 700; }
.mini-stat .l { font-size: .74rem; color: var(--muted); }
.chart-box { position: relative; height: 240px; }

/* ---------- tables / datatables ---------- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--line); --bs-table-hover-bg: rgba(10, 132, 255, .06); font-size: .92rem; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .45rem .65rem; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
div.dt-container .dt-search input, div.dt-container .dt-length select { background: var(--glass-strong); border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: .25rem .55rem; }
div.dt-container .page-link { background: var(--glass-strong); border-color: var(--line); color: var(--text); border-radius: 8px !important; margin: 0 2px; }
div.dt-container .active > .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
div.dt-container .dt-info, div.dt-container label { color: var(--muted); font-size: .85rem; }
.row-actions { white-space: nowrap; }
.row-actions .btn { padding: .12rem .4rem; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.login-card { width: 100%; max-width: 400px; padding: 1.6rem; }

/* ---------- permission matrix ---------- */
.perm-table td, .perm-table th { text-align: center; vertical-align: middle; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

/* ---------- command centre ---------- */
.progress { background: rgba(120, 120, 128, .18); border-radius: 99px; }
.progress-bar { border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------- responsive ---------- */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-105%); }
  body.sidebar-open .app-sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 1035; }
  .app-main { margin-left: 0; padding: 8px 10px 24px; }
  .app-topbar { top: 8px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .chart-box { height: 210px; }
}
@media (max-width: 575.98px) {
  html { font-size: 12.5px; }
  .modal-dialog { margin: .5rem; }
  .stat .num { font-size: 1.25rem; }
}

/* ---------- print (Save as PDF) ---------- */
@media print {
  body { background: #fff !important; }
  .app-sidebar, .app-topbar, .no-print, .sidebar-backdrop, .dt-search, .dt-length, .dt-paging { display: none !important; }
  .app-main { margin: 0; padding: 0; }
  .card, .glass { box-shadow: none; background: #fff; border: 1px solid #ddd; -webkit-backdrop-filter: none; backdrop-filter: none; break-inside: avoid; }
  .table { font-size: 10px; }
}

.min-w-0{min-width:0}
