/* ============================================================
   AP Outsourcing Community — Admin panel
   ============================================================ */

/* ---- Dark theme tokens ---- */
[data-theme="dark"] {
  --bg: #0B1220;
  --card: #111A2E;
  --card-2: #1B2740;
  --text: #E2E8F0;
  --text-2: #94A3B8;
  --text-3: #64748B;
  --border: #223052;
  --border-2: #2E3D63;
  --primary-50: rgba(37, 99, 235, .14);
  --primary-100: rgba(37, 99, 235, .26);
  --success-bg: rgba(34, 197, 94, .13);
  --success-ink: #4ADE80;
  --warning-bg: rgba(245, 158, 11, .13);
  --warning-ink: #FBBF24;
  --danger-bg: rgba(239, 68, 68, .13);
  --danger-ink: #F87171;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
}
[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .btn-secondary { background: var(--card-2); border-color: var(--border-2); }
[data-theme="dark"] .btn-secondary:hover { background: var(--border); }

body { transition: background .25s var(--ease); }

/* ============ Layout ============ */
.admin-layout { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: 258px;
  flex-shrink: 0;
  background: #0B1220;
  color: #94A3B8;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: width .25s var(--ease), transform .25s var(--ease);
  z-index: 90;
}
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 22px;
  color: #fff;
  font-size: 17.5px;
  font-weight: 800;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.sidebar-head .brand-mark {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(37, 99, 235, .4);
}
.sidebar-head .brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sidebar-head em { font-style: normal; color: #38BDF8; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 14px 14px; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #24314f; border-radius: 4px; }
.nav-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #475569;
  padding: 18px 12px 8px;
  white-space: nowrap;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  margin-bottom: 2px;
  font-size: 14px;
  font-weight: 500;
  color: #94A3B8;
  transition: all .18s var(--ease);
  position: relative;
  white-space: nowrap;
}
.nav-item i.fa-fw { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #E2E8F0; transform: translateX(2px); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, .28), rgba(37, 99, 235, .1));
  color: #fff;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -14px; top: 20%;
  height: 60%;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: var(--secondary);
}
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: var(--r-full);
}
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .07); }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 10px;
  transition: background .18s;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-user:hover { background: rgba(255, 255, 255, .06); }
.sidebar-user b { display: block; font-size: 13.5px; color: #F1F5F9; }
.sidebar-user span { font-size: 11.5px; color: #64748B; }

/* Collapsed sidebar */
body.sb-collapsed .sidebar { width: 74px; }
body.sb-collapsed .sidebar-head { justify-content: center; padding-left: 0; padding-right: 0; }
body.sb-collapsed .sidebar-head .brand-txt,
body.sb-collapsed .nav-item span,
body.sb-collapsed .nav-item .nav-badge,
body.sb-collapsed .nav-label,
body.sb-collapsed .sidebar-user div { display: none; }
body.sb-collapsed .nav-item { justify-content: center; }
body.sb-collapsed .nav-item i.fa-fw { width: auto; }
body.sb-collapsed .sidebar-user { justify-content: center; }

/* ---- Main ---- */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---- Topbar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  height: 66px;
  background: color-mix(in srgb, var(--card) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
}
.topbar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  width: min(380px, 100%);
  transition: all .2s var(--ease);
  color: var(--text-3);
}
.topbar-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.topbar-search input { border: none; outline: none; background: none; flex: 1; font-size: 13.5px; color: var(--text); }
.topbar-search kbd {
  font-family: var(--font);
  font-size: 11px;
  padding: 2px 7px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  color: var(--text-3);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-2);
  position: relative;
  transition: all .18s var(--ease);
}
.icon-btn:hover { background: var(--card-2); color: var(--text); }
.icon-btn .dot {
  position: absolute;
  top: 9px; right: 10px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--card);
}

.profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 5px;
  border-radius: var(--r-full);
  transition: background .18s;
}
.profile-btn:hover { background: var(--card-2); }
.profile-btn .chev { font-size: 11px; color: var(--text-3); margin-right: 6px; transition: transform .2s; }
.profile-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* ---- Dropdowns ---- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 230px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(.98);
  transition: all .18s var(--ease);
  z-index: 200;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu a, .dropdown-menu button.dd-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  transition: all .15s;
  text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button.dd-item:hover { background: var(--card-2); color: var(--text); }
.dropdown-menu a i, .dropdown-menu button.dd-item i { width: 17px; text-align: center; font-size: 13.5px; }
.dropdown-menu .dd-divider { height: 1px; background: var(--border); margin: 7px 4px; }
.dropdown-menu .dd-head { padding: 10px 12px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); }
.dropdown-menu .danger { color: var(--danger-ink); }
.dropdown-menu .danger:hover { background: var(--danger-bg); color: var(--danger-ink); }

/* Notifications dropdown */
.notif-menu { min-width: 340px; padding: 0; overflow: hidden; }
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 700;
}
.notif-head a { font-size: 12.5px; font-weight: 600; color: var(--primary); }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.notif-item:hover { background: var(--card-2); }
.notif-item:last-of-type { border-bottom: none; }
.notif-ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.notif-item p { font-size: 13px; color: var(--text); line-height: 1.45; }
.notif-item time { font-size: 11.5px; color: var(--text-3); }
.notif-foot { display: block; text-align: center; padding: 11px; font-size: 13px; font-weight: 600; color: var(--primary); border-top: 1px solid var(--border); }
.notif-foot:hover { background: var(--card-2); }

/* ---- Content area ---- */
.content { padding: 28px; flex: 1; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.025em; }
.page-head .sub { font-size: 14px; color: var(--text-2); margin-top: 3px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Accent color swatches */
.accent-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--card);
  cursor: pointer;
  transition: transform .15s var(--ease);
}
.accent-swatch:hover { transform: scale(1.12); }
.accent-swatch.selected { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Searchable combobox */
.combo-wrap { position: relative; }
.combo-wrap input { width: 100%; }
.combo-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}
.combo-item { padding: 10px 14px; font-size: 13.5px; cursor: pointer; }
.combo-item:hover, .combo-item.is-active { background: var(--primary-50); }

/* CSV import dropdown */
.import-drop { position: relative; }
.import-drop summary { list-style: none; cursor: pointer; }
.import-drop summary::-webkit-details-marker { display: none; }
.import-drop[open] summary { box-shadow: 0 0 0 2px var(--primary-100); }
.import-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: 360px;
  max-width: 90vw;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(15, 23, 42, .18));
  font-size: 13.5px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.breadcrumbs a { color: var(--text-3); transition: color .15s; }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs i { font-size: 8.5px; }
.breadcrumbs .current { color: var(--text-2); font-weight: 600; }

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow .2s var(--ease);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.card-head h3 i { color: var(--primary); font-size: 14px; }
.card-head .link { font-size: 13px; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 6px; }
.card-head .link:hover { text-decoration: underline; }
.card-body { padding: 22px; }
.card-body.flush { padding: 0; }

/* ---- Stat cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}
.stats-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.stats-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1200px) {
  .stats-grid.cols-5, .stats-grid.cols-6 { grid-template-columns: repeat(2, 1fr); }
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: all .22s var(--ease);
  animation: cardIn .5s var(--ease) both;
}
.stat-card:nth-child(2) { animation-delay: .06s; }
.stat-card:nth-child(3) { animation-delay: .12s; }
.stat-card:nth-child(4) { animation-delay: .18s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary-100); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-top span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.stat-ico {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-delta { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat-delta.up { color: var(--success-ink); }
.stat-delta.down { color: var(--danger-ink); }
.stat-delta small { color: var(--text-3); font-weight: 500; font-size: 12px; }

/* ---- Stat popups ---- */
.stat-card[data-dialog] { cursor: pointer; }
.stat-card[data-dialog]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.stat-dialog {
  margin: auto;
  width: min(460px, calc(100vw - 40px));
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0;
  box-shadow: var(--shadow-lg);
}
.stat-dialog::backdrop { background: rgba(8, 12, 24, .55); backdrop-filter: blur(2px); }
.stat-dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.stat-dialog-head b { font-size: 15px; display: flex; align-items: center; gap: 9px; }
.stat-dialog-head b i { color: var(--primary); }
.stat-dialog-sub { margin: 0; padding: 12px 20px 0; font-size: 12.5px; color: var(--text-3); }
.stat-dialog-list {
  list-style: none;
  margin: 0;
  padding: 10px 12px 14px;
  overflow-y: auto;
  max-height: min(55vh, 480px);
}
.stat-dialog-list li { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; }
.stat-dialog-list li:hover { background: var(--card-2); }
.stat-dialog-list .rank { width: 26px; flex-shrink: 0; font-size: 12px; font-weight: 700; color: var(--text-3); }
.stat-dialog-list .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stat-dialog-list .who a { font-weight: 600; color: var(--text); text-decoration: none; }
.stat-dialog-list .who a:hover { color: var(--primary); }
.stat-dialog-list .who span { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-dialog-list .years { font-size: 13px; white-space: nowrap; }
.stat-dialog-list .svc { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.stat-dialog-list .joined { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.stat-dialog-list .count-pill {
  flex-shrink: 0;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
}

/* ---- Grids ---- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left;
  padding: 12px 18px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
.data-table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: var(--bg); }
.data-table tbody tr:last-child td { border-bottom: none; }
.cell-person { display: flex; align-items: center; gap: 12px; }
.cell-person b { display: block; font-size: 13.5px; font-weight: 600; }
.cell-person span { font-size: 12px; color: var(--text-2); }
/* The rule above also matches the avatar span, greying out the initials —
   keep them white on the coloured circle. */
.cell-person .avatar { color: #fff; }

.row-actions { display: flex; gap: 4px; }
.row-actions .icon-btn { width: 32px; height: 32px; font-size: 13px; border-radius: 8px; }

/* Table toolbar */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.table-toolbar .topbar-search { width: 260px; background: var(--bg); }
.table-toolbar .table-search { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; }
.table-toolbar .search-count { flex: 1 1 100%; margin: 0; font-size: 12.5px; color: var(--text-2); }
.select-ctl {
  padding: 9px 34px 9px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394A3B8' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 15px 18px;
  font-size: 13px;
  color: var(--text-2);
}
.table-foot .pagination { display: flex; align-items: center; gap: 6px; margin: 0; }
.table-foot .pagination a,
.table-foot .pagination button {
  min-width: 34px; height: 34px;
  padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.table-foot .pagination a:hover { border-color: var(--primary); color: var(--primary); }
.table-foot .pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; }
.table-foot .pagination button:disabled { cursor: default; color: var(--text-3); background: transparent; border-color: transparent; }

/* ---- Charts ---- */
.chart-figure { width: 100%; }
.chart-figure svg { width: 100%; height: auto; }
.chart-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-2);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.axis-text { font-size: 10.5px; fill: var(--text-3); font-family: var(--font); }
.grid-line { stroke: var(--border); stroke-width: 1; }
.chart-label { font-size: 11px; font-weight: 600; fill: var(--text-2); font-family: var(--font); }

/* Donut center */
.donut-wrap { display: flex; align-items: center; gap: 26px; }
.donut-box { position: relative; width: 168px; flex-shrink: 0; }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
}
.donut-center b { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.donut-center span { font-size: 11.5px; color: var(--text-2); }
.donut-list { flex: 1; display: grid; gap: 11px; }
.donut-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.donut-list i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-list span { color: var(--text-2); flex: 1; }
.donut-list b { font-weight: 700; }
.donut-empty { font-size: 13px; color: var(--text-2); line-height: 1.6; margin: 0; padding: 18px 0; text-align: center; }

/* A balance in the red, on the dashboard money row. */
.stat-value.balance-negative { color: var(--danger); }

/* ---- Activity feed ---- */
.feed { display: grid; }
.feed-item { display: flex; gap: 14px; position: relative; padding-bottom: 22px; }
.feed-item:last-child { padding-bottom: 0; }
.feed-item::before {
  content: '';
  position: absolute;
  left: 17px; top: 38px; bottom: 2px;
  width: 2px;
  background: var(--border);
}
.feed-item:last-child::before { display: none; }
.feed-ico {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.feed-item p { font-size: 13.5px; line-height: 1.5; }
.feed-item p b { font-weight: 600; }
.feed-item time { font-size: 12px; color: var(--text-3); }

/* Icon tints */
.tint-blue   { background: var(--primary-50); color: var(--primary); }
.tint-green  { background: var(--success-bg); color: var(--success-ink); }
.tint-amber  { background: var(--warning-bg); color: var(--warning-ink); }
.tint-red    { background: var(--danger-bg); color: var(--danger-ink); }
.tint-violet { background: rgba(139, 92, 246, .12); color: var(--violet); }
.tint-sky    { background: rgba(14, 165, 233, .12); color: var(--secondary); }
.tint-teal   { background: rgba(20, 184, 166, .12); color: var(--teal); }
.tint-pink   { background: rgba(236, 72, 153, .12); color: var(--pink); }

/* ---- List rows (recent expenses, docs...) ---- */
.list-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 22px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.list-row:hover { background: var(--bg); }
.list-row:last-child { border-bottom: none; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-main b { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .lr-main span { font-size: 12px; color: var(--text-2); }
.list-row .lr-end { text-align: right; flex-shrink: 0; }
.list-row .lr-end b { display: block; font-size: 13.5px; font-weight: 700; }
.list-row .lr-end span, .list-row .lr-end time { font-size: 11.5px; color: var(--text-3); }
.file-ico {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

/* ---- Quick actions ---- */
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 18px 10px;
  border: 1px dashed var(--border-2);
  border-radius: var(--r-md);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  transition: all .2s var(--ease);
  text-align: center;
}
.quick-btn i { font-size: 19px; color: var(--primary); transition: transform .2s var(--spring); }
.quick-btn:hover { border-color: var(--primary); background: var(--primary-50); color: var(--primary); transform: translateY(-2px); }
.quick-btn:hover i { transform: scale(1.15); }

/* ---- Theme toggle ---- */
.theme-toggle { overflow: hidden; }
.theme-toggle i { transition: transform .4s var(--spring), opacity .3s; }
[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
html:not([data-theme="dark"]) .theme-toggle .fa-sun { display: none; }

/* ---- Login page ---- */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-brand {
  background: linear-gradient(150deg, #0F1E45, #16307E 55%, #1D4ED8);
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at 30% 30%, #000 25%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 30%, #000 25%, transparent 75%);
}
.login-brand > * { position: relative; }
.login-brand .quote { margin: auto 0; max-width: 440px; }
.login-brand .quote h2 { font-size: clamp(24px, 2.6vw, 34px); font-weight: 800; letter-spacing: -.03em; line-height: 1.25; margin-bottom: 18px; }
.login-brand .quote p { color: #C7D6F5; font-size: 15px; }
.login-brand .metrics { display: flex; gap: 40px; }
.login-brand .metrics b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.login-brand .metrics span { font-size: 13px; color: #93B4F5; }
.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--bg);
}
.login-card { width: 100%; max-width: 400px; animation: cardIn .5s var(--ease) both; }
.login-card h1 { font-size: 25px; font-weight: 800; letter-spacing: -.025em; margin-bottom: 6px; }
.login-card > p { font-size: 14px; color: var(--text-2); margin-bottom: 28px; }
.login-extra { display: flex; align-items: center; justify-content: space-between; margin: -6px 0 20px; font-size: 13px; }
.login-extra a { color: var(--primary); font-weight: 600; }
.login-extra label { display: flex; align-items: center; gap: 8px; color: var(--text-2); cursor: pointer; }
/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 11px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .18s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; padding-top: 22px; animation: fadeIn .25s var(--ease); }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }

/* ---- Detail pages ---- */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.profile-hero .headline { flex: 1; min-width: 220px; }
.profile-hero h2 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.profile-hero .role { font-size: 14px; color: var(--text-2); margin: 2px 0 10px; }
.profile-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.profile-meta span { display: inline-flex; align-items: center; gap: 7px; }
.profile-meta i { color: var(--text-3); font-size: 12px; }

.kv-list { display: grid; gap: 0; }
.kv-list > div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13.5px;
}
.kv-list > div:last-child { border-bottom: none; }
.kv-list dt { color: var(--text-2); font-weight: 500; }
.kv-list dd { font-weight: 600; }

/* Attendance mini bars */
.mini-bars { display: flex; align-items: flex-end; gap: 7px; height: 88px; }
.mini-bars .mb {
  flex: 1;
  border-radius: 5px 5px 0 0;
  background: var(--primary-100);
  position: relative;
  overflow: hidden;
  min-height: 8px;
}
.mini-bars .mb i {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--primary);
  border-radius: 5px 5px 0 0;
  height: var(--h);
}
.mini-bars-labels { display: flex; gap: 7px; margin-top: 8px; }
.mini-bars-labels span { flex: 1; text-align: center; font-size: 10.5px; color: var(--text-3); }

/* ---- Progress bars ---- */
.progress {
  height: 8px;
  border-radius: 5px;
  background: var(--card-2);
  overflow: hidden;
}
.progress i { display: block; height: 100%; border-radius: 5px; transition: width 1s var(--ease); }

/* ---- Calendar ---- */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.cal-dow {
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.cal-day {
  min-height: 104px;
  padding: 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  transition: background .15s;
  position: relative;
}
.cal-day:hover { background: var(--bg); }
.cal-day .d { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 50%; }
.cal-day.muted .d { color: var(--text-3); opacity: .5; }
.cal-day.today { background: var(--primary-50); }
.cal-day.today .d { background: var(--primary); color: #fff; }
.cal-evt {
  display: block;
  margin-top: 4px;
  padding: 2.5px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 3px solid;
  cursor: default;
}
.evt-meeting  { background: var(--primary-50); color: var(--primary-600); border-color: var(--primary); }
[data-theme="dark"] .evt-meeting { color: #93C5FD; }
.evt-holiday  { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger); }
.evt-birthday { background: rgba(236, 72, 153, .1); color: var(--pink); border-color: var(--pink); }
.evt-task     { background: var(--warning-bg); color: var(--warning-ink); border-color: var(--warning); }
.evt-event    { background: var(--success-bg); color: var(--success-ink); border-color: var(--success); }

.evt-list-item { display: flex; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.evt-list-item:last-child { border-bottom: none; padding-bottom: 0; }
.evt-date {
  width: 46px; height: 50px;
  border-radius: 10px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}
.evt-date b { font-size: 17px; font-weight: 800; line-height: 1; }
.evt-date span { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.evt-list-item .em { flex: 1; }
.evt-list-item .em b { font-size: 13.5px; font-weight: 600; display: block; }
.evt-list-item .em span { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-top: 2px; }

/* ---- Gallery ---- */
.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.g-item {
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
  aspect-ratio: 4 / 3;
  cursor: pointer;
  border: 1px solid var(--border);
}
.g-ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px;
  color: rgba(255, 255, 255, .85);
  transition: transform .35s var(--ease);
}
.g-item:hover .g-ph { transform: scale(1.07); }
.g-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(transparent 45%, rgba(2, 8, 30, .82));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 13px 15px;
  color: #fff;
  opacity: 0;
  transition: opacity .25s;
}
.g-item:hover .g-overlay { opacity: 1; }
.g-overlay b { font-size: 13px; }
.g-overlay span { font-size: 11.5px; opacity: .8; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(4, 10, 28, .88);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 32px;
}
.lightbox.open { display: flex; animation: fadeIn .2s; }
.lightbox-inner {
  width: min(760px, 100%);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}
.lightbox-ph {
  height: 420px;
  display: flex; align-items: center; justify-content: center;
  font-size: 84px;
  color: rgba(255, 255, 255, .9);
}
.lightbox-cap { background: var(--card); padding: 16px 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.lightbox-cap b { font-size: 14.5px; display: block; }
.lightbox-cap span { font-size: 12.5px; color: var(--text-2); }
.lightbox-close {
  position: absolute;
  top: 22px; right: 26px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 17px;
  transition: all .2s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .25); transform: rotate(90deg); }

/* ---- Upload areas ---- */
.upload-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--r-lg);
  padding: 38px 24px;
  text-align: center;
  transition: all .2s var(--ease);
  cursor: pointer;
  background: var(--bg);
}
.upload-zone:hover { border-color: var(--primary); background: var(--primary-50); }
.upload-zone i { font-size: 30px; color: var(--primary); margin-bottom: 12px; }
.upload-zone b { display: block; font-size: 14.5px; margin-bottom: 4px; }
.upload-zone b u { color: var(--primary); text-decoration: none; }
.upload-zone span { font-size: 12.5px; color: var(--text-3); }

/* ---- Folders ---- */
.folder-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.folder-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all .2s var(--ease);
  cursor: pointer;
}
.folder-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary-100); }
.folder-card i.fa-folder { font-size: 30px; color: var(--warning); }
.folder-card b { display: block; font-size: 13.5px; }
.folder-card span { font-size: 11.5px; color: var(--text-3); }

/* ---- Blog editor ---- */
.editor-toolbar {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  padding: 9px;
  border: 1px solid var(--border-2);
  border-bottom: none;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  background: var(--bg);
}
.editor-toolbar button {
  width: 34px; height: 34px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 13px;
  transition: all .15s;
}
.editor-toolbar button:hover { background: var(--card-2); color: var(--text); }
.editor-toolbar button.on { background: var(--primary-50); color: var(--primary); }
.editor-toolbar .sep { width: 1px; background: var(--border-2); margin: 5px 6px; }
.editor-area {
  min-height: 320px;
  border: 1px solid var(--border-2);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  padding: 20px;
  font-size: 14.5px;
  line-height: 1.75;
  background: var(--card);
  outline: none;
}
.editor-area:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.editor-area h2 { margin-bottom: 10px; font-size: 20px; letter-spacing: -.02em; }
.editor-area p { margin-bottom: 12px; color: var(--text-2); }

/* ---- Settings ---- */
.settings-layout { display: grid; grid-template-columns: 230px 1fr; gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: 90px; display: grid; gap: 3px; }
.settings-nav button {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  transition: all .18s;
  text-align: left;
}
.settings-nav button i { width: 18px; text-align: center; font-size: 14px; }
.settings-nav button:hover { background: var(--card-2); color: var(--text); }
.settings-nav button.active { background: var(--primary-50); color: var(--primary); }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  border-radius: var(--r-full);
  background: var(--border-2);
  transition: background .2s;
  cursor: pointer;
}
.switch .slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  transition: transform .2s var(--spring);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--primary); outline-offset: 2px; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-row b { display: block; font-size: 14px; font-weight: 600; }
.setting-row p { font-size: 12.5px; color: var(--text-2); margin-top: 2px; max-width: 420px; }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state .es-ico {
  width: 72px; height: 72px;
  border-radius: 22px;
  background: var(--primary-50);
  color: var(--primary);
  font-size: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.empty-state h4 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.empty-state p { font-size: 13.5px; color: var(--text-2); max-width: 320px; margin: 0 auto 20px; }

/* ---- Skeletons ---- */
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--card-2) 25%, var(--border) 50%, var(--card-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 26px; right: 26px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 500;
  z-index: 600;
  animation: toastIn .3s var(--spring);
}
.toast i { color: var(--success); font-size: 17px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }

/* ---- Mobile overlay ---- */
.sb-overlay {
  position: fixed; inset: 0;
  background: rgba(4, 10, 28, .5);
  z-index: 85;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s;
}
body.sb-open .sb-overlay { opacity: 1; visibility: visible; }

/* ============ Responsive ============ */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
  .gallery-grid, .folder-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }
  body.sb-open .sidebar { transform: none; }
  body.sb-collapsed .sidebar { width: 258px; }
  body.sb-collapsed .sidebar-head { justify-content: flex-start; padding: 20px 22px; }
  body.sb-collapsed .sidebar-head .brand-txt,
  body.sb-collapsed .nav-item span,
  body.sb-collapsed .nav-item .nav-badge,
  body.sb-collapsed .nav-label,
  body.sb-collapsed .sidebar-user div { display: block; }
  body.sb-collapsed .nav-item { justify-content: flex-start; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar .topbar-search { display: none; }
  .table-toolbar { padding: 12px 14px; gap: 10px; }
  .table-toolbar .topbar-search { flex: 1 1 160px; width: auto; min-width: 0; }
  .content { padding: 18px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .settings-nav button { white-space: nowrap; }
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .cal-day { min-height: 72px; }
  .cal-evt { display: none; }
  .cal-day .evt-dots { display: flex; gap: 3px; margin-top: 4px; }
  .donut-wrap { flex-direction: column; }
}
@media (min-width: 901px) {
  .cal-day .evt-dots { display: none; }
}
@media (max-width: 600px) {
  .field-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
  .stat-card { padding: 12px 14px; gap: 7px; }
  .stat-top span { font-size: 11.5px; }
  .stat-ico { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
  .stat-value { font-size: 20px; }
  .stat-delta { font-size: 11px; }
  .stat-delta small { font-size: 10.5px; }
  .gallery-grid, .folder-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .table-search .topbar-search { flex: 1 1 100%; }
  .table-search .btn { flex: 1; justify-content: center; }
}

/* ---- Real photos in gallery tiles & lightbox ---- */
.g-ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lightbox-ph img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---- Client billing ---- */
.status-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; background: #e5e7eb; color: #374151; }
.status-pill.status-sent { background: #fef3c7; color: #92400e; }
.status-pill.status-paid { background: #d1fae5; color: #065f46; }
.status-pill.status-overdue { background: #fee2e2; color: #991b1b; }
.status-pill.status-draft { background: #e0e7ff; color: #3730a3; }
.status-pill.status-cancelled { background: #f3f4f6; color: #6b7280; text-decoration: line-through; }
.items-editor input { width: 100%; padding: 8px 10px; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; font: inherit; background: var(--surface, #fff); color: inherit; }
.items-editor td.num, .items-editor th.num { text-align: right; white-space: nowrap; }
.totals-preview { min-width: 240px; font-size: 13.5px; }
.totals-preview div { display: flex; justify-content: space-between; gap: 24px; padding: 4px 0; }
.totals-preview .grand { border-top: 2px solid var(--border, #e5e7eb); margin-top: 4px; padding-top: 8px; font-size: 15px; }
.tpl-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.tpl-opt { display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; gap: 2px 10px; align-items: center; padding: 10px 12px; border: 1.5px solid var(--border, #e5e7eb); border-radius: 10px; cursor: pointer; }
.tpl-opt:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.tpl-opt input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-opt .tpl-swatch { grid-row: 1 / span 2; width: 28px; height: 28px; border-radius: 7px; }
.tpl-opt .tpl-name { font-weight: 600; font-size: 13px; }
.tpl-opt small { color: var(--text-2); font-size: 11px; }
.tpl-swatch-t01 { background: linear-gradient(135deg, #1D3FA8 50%, #fff 50%); border: 1px solid #1D3FA8; }
.tpl-swatch-t02 { background: linear-gradient(135deg, #111 50%, #fff 50%); border: 1px solid #111; }
.tpl-swatch-t03 { background: #0f766e; }
.tpl-swatch-t04 { background: linear-gradient(90deg, #4f46e5 30%, #eef2ff 30%); }
.tpl-swatch-t05 { background: linear-gradient(180deg, #fff 45%, #b08d57 45%, #b08d57 55%, #fff 55%); border: 1px solid #b08d57; }
.tpl-swatch-t06 { background: repeating-linear-gradient(0deg, #9ca3af 0 2px, #fff 2px 9px); border: 1px solid #9ca3af; }
.tpl-swatch-t07 { background: linear-gradient(180deg, #0f172a 55%, #fff 55%); border: 1px solid #0f172a; }
.tpl-swatch-t08 { background: #f1f5f9; border: 1px solid #86efac; box-shadow: inset 0 0 0 4px #fff; }
.tpl-swatch-t09 { background: linear-gradient(180deg, #4b5563 35%, #fff 35%); border: 1px solid #4b5563; }
.tpl-swatch-t10 { background: linear-gradient(135deg, #fff7ed 60%, #ea580c 60%); border: 1px solid #ea580c; }
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 22px; }
.design-card .design-thumb { height: 585px; overflow: hidden; background: var(--surface-2, #f3f4f6); border-radius: 10px; padding: 12px; }
.design-card .design-thumb > .inv { width: 794px; max-width: none; transform: scale(.5); transform-origin: top left; margin: 0; }
.design-card:has(.design-thumb.large) { grid-column: 1 / -1; }
.design-card .design-thumb.large { height: auto; overflow: auto; display: flex; justify-content: center; }
.design-card .design-thumb.large > .inv { transform: none; }
.design-card .design-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ============================================================
   Welfare funds — pooled contributions
   ============================================================ */

/* One fund per row: icon, what it is, how the collection is going, where it stands.
   Collapses to a stacked card under 760px so a phone never scrolls sideways. */
.fund-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 220px 150px;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.fund-row:last-child { border-bottom: none; }
.fund-row:hover { background: var(--bg); }
.fund-row .fund-ico { width: 44px; height: 44px; border-radius: 13px; font-size: 17px; }
.fund-title { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.fund-title a { color: var(--text); text-decoration: none; }
.fund-title a:hover { color: var(--primary); }
.fund-meta { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.fund-bar { display: grid; gap: 6px; min-width: 0; }
.fund-bar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.fund-bar-top b { font-weight: 700; }
.fund-bar-top span { color: var(--text-2); }
.fund-end { text-align: right; }

/* The collection headline on a fund's page */
.raised-hero { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.raised-hero .amt { font-size: 40px; font-weight: 800; letter-spacing: -.035em; line-height: 1; }
.raised-hero .of { font-size: 14px; color: var(--text-2); font-weight: 500; }
.shortfall { font-size: 13px; margin-top: 10px; }

/* Who has given */
.roll { display: flex; flex-wrap: wrap; gap: 6px; }
.roll .avatar { border: 2px solid var(--card); }
.roll-more {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--card-2);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--card);
}

/* "What is this receipt for?" / "Who is this for?" choosers */
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.radio-card {
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.radio-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }
.radio-card:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card b { font-size: 13.5px; display: block; }
.radio-card small { color: var(--text-2); font-size: 12px; }
.radio-card i { margin-top: 2px; color: var(--text-2); }
.radio-card:has(input:checked) i { color: var(--primary); }

@media (max-width: 760px) {
  .fund-row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px 14px;
    padding: 14px 16px;
  }
  .fund-row .fund-bar, .fund-row .fund-end { grid-column: 2; }
  .fund-end { text-align: left; }
  .fund-end .row-actions { justify-content: flex-start; }
}
@media (max-width: 600px) {
  .radio-cards { grid-template-columns: 1fr; }
  .raised-hero .amt { font-size: 30px; }
  .raised-hero .of { font-size: 13px; }
}

/* ---- Financial statement (printable card) ---- */
.stmt-picker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stmt-picker label { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.stmt-stage { display: flex; justify-content: center; padding: 8px 0 30px; }

/* The printable card. 820px is its designed width; the PDF is drawn from the
   data, not from this card, so the two no longer have to match pixel for pixel. */
.stmt { --stmt-green: #1F4D3A; --stmt-red: #8A3324; --stmt-rule: #E2E8F0;
        width: 820px; max-width: 100%; background: #fff; color: #17221D;
        box-shadow: var(--shadow-md); border-radius: 6px; overflow: hidden;
        font-family: 'Inter', sans-serif; }

.stmt-band { background: var(--stmt-green); color: #fff; padding: 22px 30px;
             display: flex; align-items: center; gap: 18px; }
.stmt-logo { width: 54px; height: 54px; object-fit: contain; flex: 0 0 auto;
             background: #fff; border-radius: 50%; padding: 4px; }
.stmt-org h2 { font-size: 19px; font-weight: 700; margin: 0; line-height: 1.25; letter-spacing: -.01em; }
.stmt-org p { margin: 5px 0 0; font-size: 12.5px; color: #A9CBBA; }
.stmt-balance { margin-left: auto; text-align: right; flex: 0 0 auto; padding-left: 16px; }
.stmt-balance b { display: block; font-size: 25px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stmt-balance span { font-size: 11.5px; color: #A9CBBA; }

.stmt-body { padding: 26px 30px 4px; }

.stmt-tiles { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid #D5E0DA; }
.stmt-tile { padding: 14px 16px; border-right: 1px solid #D5E0DA; }
.stmt-tile:last-child { border-right: 0; }
.stmt-tile-label { margin: 0 0 6px; font-size: 12px; color: #5E7A6D; }
.stmt-tile-value { margin: 0; font-size: 23px; font-weight: 800; line-height: 1;
                   letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stmt-tile.pos .stmt-tile-value { color: var(--stmt-green); }
.stmt-tile.neg .stmt-tile-value { color: var(--stmt-red); }
.stmt-tile-words { margin: 6px 0 0; font-size: 11px; color: #83998F; line-height: 1.35; }

.stmt-section { font-size: 16px; font-weight: 700; margin: 26px 0 10px; padding-left: 11px;
                border-left: 4px solid var(--stmt-green); display: flex; align-items: baseline;
                gap: 10px; flex-wrap: wrap; }
.stmt-section small { font-size: 12px; font-weight: 400; color: #6C857A; }
.stmt-section-out { border-left-color: var(--stmt-red); color: var(--stmt-red); }
.stmt-section-out small { color: #A9756B; }

.stmt-group { margin: 20px 0 9px; padding-left: 11px; border-left: 4px solid #9BBFAE; }
.stmt-group.is-general { border-left-color: #C8D2CD; }
.stmt-group-top { display: flex; align-items: baseline; gap: 10px; }
.stmt-group-top b { font-size: 13.5px; font-weight: 700; color: var(--stmt-green); }
.stmt-group.is-general .stmt-group-top b { color: #4A5A53; }
.stmt-pill { margin-left: auto; font-size: 10.5px; font-weight: 600; padding: 2px 8px;
             border-radius: 3px; background: #EDF3F0; color: var(--stmt-green); white-space: nowrap; }
.stmt-group-meta { margin: 4px 0 0; font-size: 11.5px; color: #5E7A6D; }

.stmt-table { border: 0; width: 100%; }
.stmt-table th { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 700;
                 padding: 8px 9px; }
.stmt-table td { font-size: 12.5px; line-height: 1.4; padding: 8px 9px; border-bottom: 1px solid #E6EDEA; }
.stmt-table th, .stmt-table td { white-space: normal; overflow-wrap: anywhere; }
.stmt-table .stmt-date, .stmt-table .stmt-amt, .stmt-table .stmt-sn { white-space: nowrap; overflow-wrap: normal; }
.stmt-table tbody tr:hover { background: #F7FAF9; }
.stmt-sn { width: 44px; text-align: center; }
.stmt-date { width: 92px; }
.stmt-amt { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }

.stmt-in th { background: #EDF3F0; color: var(--stmt-green); border-bottom: 2px solid var(--stmt-green); }
.stmt-out th { background: #FBF0EC; color: var(--stmt-red); border-bottom: 2px solid var(--stmt-red); }

.stmt-subtotal td { background: #F3F8F6; border-top: 2px solid var(--stmt-green); border-bottom: 0;
                    text-align: right; color: var(--stmt-green); padding: 9px 9px; }
.stmt-subtotal tr:hover td, .stmt-table tbody tr.stmt-subtotal:hover { background: #F3F8F6; }
.stmt-subtotal span { font-size: 11.5px; opacity: .72; margin-left: 18px; }
.stmt-subtotal b { font-size: 13px; font-weight: 700; margin-left: 7px; font-variant-numeric: tabular-nums; }
.stmt-unpaid { font-style: italic; }

.stmt-note { margin: 16px 0 0; font-size: 12.5px; color: #B45309; }
.stmt-empty { margin: 10px 0 0; font-size: 12.5px; color: #6C857A; font-style: italic; }

.stmt-foot { margin: 22px 0 0; padding: 12px 30px; border-top: 1px solid var(--stmt-rule);
             display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
             font-size: 11px; color: #83998F; }

/* Phones. The card stops pretending to be a sheet of paper and just reflows. */
@media (max-width: 760px) {
  .stmt-stage { padding: 4px 0 20px; }
  .stmt-band { padding: 16px 16px; gap: 12px; flex-wrap: wrap; }
  .stmt-logo { width: 42px; height: 42px; }
  .stmt-org h2 { font-size: 15.5px; }
  .stmt-org p { font-size: 11.5px; }
  .stmt-balance { margin-left: 0; text-align: left; padding-left: 0; flex-basis: 100%;
                  border-top: 1px solid rgba(255,255,255,.18); padding-top: 10px; }
  .stmt-balance b { font-size: 21px; }
  .stmt-body { padding: 16px 14px 4px; }
  .stmt-tiles { grid-template-columns: 1fr; }
  .stmt-tile { border-right: 0; border-bottom: 1px solid #D5E0DA; padding: 11px 13px; }
  .stmt-tile:last-child { border-bottom: 0; }
  .stmt-tile-value { font-size: 20px; }
  .stmt-section { font-size: 14.5px; margin: 20px 0 8px; }
  .stmt-table th { font-size: 10.5px; padding: 7px 5px; }
  .stmt-table td { font-size: 11.5px; padding: 7px 5px; }
  .stmt-sn { width: 26px; }
  .stmt-date { width: 74px; font-size: 10.5px; }
  .stmt-amt { width: 62px; }
  .stmt-subtotal td { text-align: left; padding: 9px 5px; }
  .stmt-subtotal span { margin-left: 0; margin-right: 4px; display: inline-block; }
  .stmt-subtotal b { margin-right: 12px; }
  .stmt-foot { padding: 12px 14px; font-size: 10.5px; }
  .stmt-group-top { flex-wrap: wrap; }
  .stmt-pill { margin-left: 0; }
}

/* ---------------- Gallery visibility controls ---------------- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Album card — its own component, because .folder-card is shared with Documents
   and cannot carry a visibility switch without crowding. */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.album-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 13px;
  transition: all .2s var(--ease);
}
.album-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-100); }
.ac-main { display: flex; align-items: center; gap: 13px; min-width: 0; }
.ac-main > i.fa-folder { font-size: 27px; color: var(--warning); flex-shrink: 0; }
.ac-text { min-width: 0; }
.ac-text b { display: block; font-size: 14px; font-weight: 700; }
.ac-text span { display: block; font-size: 11.5px; color: var(--text-3); }
.ac-foot { display: flex; align-items: center; gap: 11px; border-top: 1px solid var(--border); padding-top: 12px; }
.ac-state { min-width: 0; }
.ac-state b {
  display: block; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); line-height: 1.3;
}
.ac-state span { display: block; font-size: 11px; color: var(--text-3); line-height: 1.3; }
.album-card.is-public .ac-state b { color: var(--success-ink); }
.ac-acts { margin-left: auto; display: flex; gap: 2px; flex-shrink: 0; }
.album-card.is-hidden { background: #FAFBFC; border-style: dashed; }
.album-card.is-hidden .ac-main > i.fa-folder { color: var(--text-3); }
.album-card.is-hidden .ac-text b { color: var(--text-3); }
.album-card.is-public .switch .slider { background: var(--primary); }
.album-card.is-public .switch .slider::before { transform: translateX(18px); }

.switch-btn { display: inline-flex; align-items: center; padding: 0; flex-shrink: 0; }
.folder-card.is-public .switch .slider { background: var(--primary); }
.folder-card.is-public .switch .slider::before { transform: translateX(18px); }
.switch-btn:hover .switch .slider { filter: brightness(.95); }

/* Per-photo tick on a gallery tile */
.g-item .tick {
  position: absolute; top: 9px; right: 9px;
  width: 27px; height: 27px; border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(15, 23, 42, .16);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-3);
  box-shadow: var(--shadow-sm);
  z-index: 3;
  transition: all .18s var(--ease);
}
.g-item.is-public .tick { background: var(--primary); border-color: var(--primary); color: #fff; }
.g-item .tick:hover { transform: scale(1.08); }
.g-item.is-hidden .g-ph { opacity: .4; filter: saturate(.3); }
.g-item .hidechip {
  position: absolute; left: 9px; top: 11px; z-index: 3;
  background: rgba(15, 23, 42, .82); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
}

.bulkbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--primary-50); border: 1px solid var(--primary-100);
  border-radius: var(--r-md); padding: 11px 15px; margin-bottom: 18px;
}
.bulkbar b { font-size: 13px; color: var(--primary-700); }
.bulkbar .bulknote {
  font-size: 12.5px; color: var(--warning-ink);
  background: var(--warning-bg); border: 1px solid #FDE68A;
  border-radius: var(--r-sm); padding: 4px 10px;
}

.check-row { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.check-row input[type="checkbox"] { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }
.check-row b { display: block; font-size: 13.5px; font-weight: 600; }
.check-row small { display: block; font-size: 12px; color: var(--text-3); }
