/* =========================================================
   Dr. Mehul Vikani — Admin Panel
   Palette & type match the public website (theme.css)
   ========================================================= */
:root {
  --brand-50: #eef8f2;
  --brand-100: #d5eedf;
  --brand-200: #acdcbf;
  --brand-300: #7bc59a;
  --brand-400: #4caa74;
  --brand-500: #2b8c57;
  --brand-600: #237447;
  --brand-700: #1d5d3a;
  --brand-800: #174a2f;
  --brand-900: #0f3320;
  --ink: #12241a;
  --ink-brand: #114b2c;
  --text: #1f2d25;
  --steel: #5d7466;
  --muted: #8a9c91;
  --line: #e4ebe6;
  --line-soft: #eef2ef;
  --bg: #f5f8f6;
  --card: #ffffff;
  --danger: #d14343;
  --danger-50: #fdf0f0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-xs: 0 1px 2px rgba(16, 40, 26, 0.05);
  --shadow: 0 1px 2px rgba(16, 40, 26, 0.04), 0 8px 24px -12px rgba(16, 40, 26, 0.12);
  --shadow-lg: 0 24px 60px -20px rgba(16, 40, 26, 0.35);
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 80px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }
a { color: var(--brand-600); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); color: var(--ink); letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--steel); }
.small { font-size: 12.5px; }
.ico { flex-shrink: 0; display: block; }
.ico.rot { transform: rotate(-90deg); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font: 600 14px var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--brand-500); color: #fff; box-shadow: 0 6px 16px -8px rgba(43, 140, 87, .7); }
.btn-primary:hover:not(:disabled) { background: var(--brand-600); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.btn-soft:hover { background: var(--brand-100); }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); border-color: #d5ded8; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #b83434; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--steel); cursor: pointer; font-size: 16px; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--brand-50); color: var(--brand-700); }
.icon-btn-danger:hover { background: var(--danger-50); color: var(--danger); }

.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; color: var(--brand-500); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- inputs ---------- */
input, select, textarea { width: 100%; font: 500 14px var(--font); color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input, select { height: 42px; }
input::placeholder, textarea::placeholder { color: #a3b2a9; font-weight: 400; }
input:hover, select:hover, textarea:hover { border-color: #cfd9d3; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-400); box-shadow: 0 0 0 4px rgba(43, 140, 87, .12); }
input:disabled, textarea:disabled { background: var(--bg); color: var(--steel); }
input.invalid, textarea.invalid { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(209, 67, 67, .1); }
textarea { resize: vertical; line-height: 1.55; }
.field { display: grid; gap: 6px; align-content: start; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink); }
.req { color: var(--danger); font-style: normal; }
.input-icon { position: relative; display: block; }
.input-icon > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.input-icon > input { padding-left: 40px; }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-right: 36px; cursor: pointer; }
.select-wrap > svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.select-sm select { height: 38px; font-size: 13px; }

.notice { padding: 11px 14px; border-radius: var(--radius-sm); font-weight: 500; font-size: 13.5px; background: var(--bg); color: var(--steel); border: 1px solid var(--line); }
.notice-err { background: var(--danger-50); color: #a12f2f; border-color: #f4d3d3; }
.notice-ok { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }

/* ---------- logo ---------- */
.logo { display: flex; align-items: center; gap: 12px; color: inherit; }
.logo-mark { width: 54px; height: auto; flex-shrink: 0; }
.logo-name { font-family: var(--font-display); font-weight: 800; font-size: 13.5px; letter-spacing: .12em; color: var(--ink-brand); line-height: 1.1; }
.logo-sub { font-family: var(--font-display); font-weight: 700; font-size: 9px; letter-spacing: .3em; color: var(--steel); margin-top: 5px; }
.logo-light .logo-name { color: #fff; }
.logo-light .logo-sub { color: rgba(255, 255, 255, .5); }

/* =========================================================
   Login
   ========================================================= */
.login-body { background: #fff; }
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1fr) minmax(420px, 1.05fr); }
.login-aside { position: relative; overflow: hidden; color: #fff; background: radial-gradient(120% 80% at 0% 0%, #1f6b42 0%, transparent 55%), radial-gradient(90% 70% at 100% 100%, #2b8c57 0%, transparent 50%), linear-gradient(160deg, #0f3320, #114b2c 60%, #0c2919); }
.pixel-grid { 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: 32px 32px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); }
.login-aside-inner { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 56px; gap: 40px; }
.eyebrow-light { display: inline-block; font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; color: var(--brand-300); }
.login-pitch h2 { margin-top: 16px; font-size: clamp(28px, 3vw, 40px); line-height: 1.15; font-weight: 800; color: #fff; max-width: 460px; }
.login-points { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.login-points li { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.82); font-size: 15px; }
.tick { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: rgba(76,170,116,.25); color: var(--brand-300); font-size: 13px; font-weight: 700; flex-shrink: 0; }
.login-foot { color: rgba(255,255,255,.45); font-size: 12.5px; }
.login-main { display: grid; place-items: center; padding: 40px 24px; background: linear-gradient(180deg, #fff, var(--bg)); }
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { font-size: 30px; font-weight: 800; }
.login-card > .muted { margin: 8px 0 28px; font-size: 15px; }
.login-card form { display: grid; gap: 18px; }
.login-card .notice-ok { margin-bottom: 20px; }
.login-card .input-icon > input { height: 48px; border-radius: 12px; }
.login-logo-mobile { display: none; margin-bottom: 32px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--brand-600); font: 700 12.5px var(--font); cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.pw-toggle:hover { background: var(--brand-50); }
.login-card .input-icon > input[name="password"] { padding-right: 64px; }
.back-link { display: inline-block; margin-top: 28px; color: var(--steel); font-weight: 600; font-size: 13.5px; }
.back-link:hover { color: var(--brand-600); }

/* =========================================================
   App layout
   ========================================================= */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; transition: grid-template-columns .25s var(--ease); }
.layout.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ---------- sidebar ---------- */
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: linear-gradient(180deg, #0f3320 0%, #0c2a1a 100%); color: rgba(255,255,255,.72); overflow: hidden; z-index: 30; }
.sidebar-head { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar .logo-mark { width: 46px; }
.nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 14px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-group-label { padding: 0 12px 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.35); white-space: nowrap; }
.nav-link { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; height: 42px; padding: 0 12px; margin-bottom: 2px; border: 0; border-radius: 11px; background: transparent; color: rgba(255,255,255,.7); font: 600 14px var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: linear-gradient(90deg, rgba(76,170,116,.28), rgba(76,170,116,.1)); color: #fff; }
.nav-link.active::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand-400); }
.nav-link.active .ico { color: var(--brand-300); }
.nav-badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand-400); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.07); display: grid; gap: 6px; }
.user-card { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.05); }
.user-meta { min-width: 0; }
.user-name { color: #fff; font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--brand-300); font-size: 11.5px; font-weight: 600; text-transform: capitalize; }
.logout-link:hover { background: rgba(209,67,67,.16); color: #ffb4b4; }

.layout.collapsed .logo-text, .layout.collapsed .nav-text, .layout.collapsed .nav-group-label, .layout.collapsed .user-meta, .layout.collapsed .nav-badge { display: none; }
.layout.collapsed .sidebar-head { padding: 22px 0 18px; display: flex; justify-content: center; }
.layout.collapsed .nav-link { justify-content: center; padding: 0; }
.layout.collapsed .nav-group + .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.07); }
.layout.collapsed .user-card { justify-content: center; background: transparent; padding: 6px 0; }
.sidebar-backdrop { display: none; }

/* ---------- topbar ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; height: 66px; padding: 0 28px; background: rgba(255,255,255,.85); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.menu-btn { width: 38px; height: 38px; border: 1px solid var(--line); background: #fff; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-width: 0; }
.crumbs b { color: var(--ink); font-weight: 700; }
.crumbs .ico { color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.profile { position: relative; }
.profile-btn { display: flex; align-items: center; gap: 9px; height: 42px; padding: 0 10px 0 5px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; font: 600 13.5px var(--font); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.profile-btn:hover, .profile-btn[aria-expanded="true"] { border-color: var(--brand-200); box-shadow: 0 0 0 4px rgba(43,140,87,.08); }
.profile-btn .ico { color: var(--muted); }
.profile-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 260px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .16s var(--ease); }
.profile-menu-head { display: flex; align-items: center; gap: 11px; padding: 10px 10px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.profile-menu-head > div { min-width: 0; }
.profile-menu-head .cell-sub { overflow: hidden; text-overflow: ellipsis; }
.profile-menu a, .profile-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 9px; background: none; color: var(--text); font: 600 13.5px var(--font); cursor: pointer; text-align: left; }
.profile-menu a:hover, .profile-menu button:hover { background: var(--bg); }
.profile-menu .ico { color: var(--steel); }
.profile-menu [data-logout] { color: var(--danger); }
.profile-menu [data-logout] .ico { color: var(--danger); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ---------- page ---------- */
.page { padding: 28px 32px 48px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 26px; font-weight: 800; }
.page-desc { color: var(--steel); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-enter { animation: enter .3s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-head p { margin-top: 3px; }

/* ---------- avatars & thumbs ---------- */
.avatar { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; font: 700 13px var(--font-display); flex-shrink: 0; letter-spacing: .02em; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-lg { width: 52px; height: 52px; font-size: 17px; }
.avatar-xl { width: 84px; height: 84px; font-size: 28px; }
.tone-green { background: var(--brand-100); color: var(--brand-700); }
.tone-blue { background: #dfeafc; color: #2a58a8; }
.tone-amber { background: #fcefd6; color: #94590b; }
.tone-violet { background: #ebe4fb; color: #6142b0; }
.tone-rose { background: #fbe1e7; color: #a8364f; }
.tone-teal { background: #d8f2ef; color: #17716a; }
.thumb { width: 48px; height: 40px; border-radius: 9px; object-fit: cover; flex-shrink: 0; background: var(--bg); border: 1px solid var(--line-soft); }
.thumb.round { width: 40px; border-radius: 50%; }
.thumb-empty, .thumb-icon { display: inline-grid; place-items: center; color: var(--brand-600); }
.thumb-icon { width: 38px; height: 38px; background: var(--brand-50); border-color: var(--brand-100); }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; text-transform: capitalize; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { background: var(--brand-50); color: var(--brand-700); }
.pill-gray { background: #eff2f0; color: #67776d; }
.pill-blue { background: #e7f0fd; color: #2a58a8; }
.pill-violet { background: #f0ebfc; color: #6142b0; }
.pill-amber { background: #fdf3df; color: #94590b; }
.pill-red { background: var(--danger-50); color: #b23535; }
.pill-teal { background: #e0f4f1; color: #17716a; }
.you { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px; background: var(--brand-50); color: var(--brand-700); font-size: 11px; font-weight: 700; vertical-align: 1px; }

/* ---------- tables ---------- */
.table-card { padding: 0; overflow: hidden; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; max-width: 380px; min-width: 200px; }
.search-box > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { height: 38px; padding-left: 36px; background: var(--bg); border-color: transparent; }
.search-box input:focus { background: #fff; }
.segmented { display: inline-flex; padding: 3px; background: var(--bg); border-radius: 10px; border: 1px solid var(--line-soft); }
.segmented button { height: 30px; padding: 0 12px; border: 0; background: transparent; border-radius: 7px; font: 600 13px var(--font); color: var(--steel); cursor: pointer; }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-xs), 0 0 0 1px var(--line); }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 11px 18px; text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: #fafcfb; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 18px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f9fbfa; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-click tbody tr { cursor: pointer; }
.th-actions { width: 1%; }
.td-actions { width: 1%; }
.td-wide { max-width: 360px; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-text { min-width: 0; }
.cell-title { font-weight: 700; color: var(--ink); line-height: 1.35; }
.cell-sub { color: var(--steel); font-size: 12.5px; margin-top: 2px; line-height: 1.4; }
.table .cell-text { max-width: 380px; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; align-items: center; }
.row-actions .switch { margin-right: 8px; }
.metric { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--brand-700); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.pager { display: flex; align-items: center; gap: 10px; color: var(--steel); }

/* ---------- skeleton & empty ---------- */
.skeleton-list { display: grid; gap: 4px; padding: 6px 0; }
.skeleton-row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; }
.sk { display: block; border-radius: 8px; background: linear-gradient(90deg, #eef2ef 25%, #f6f8f7 50%, #eef2ef 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.sk-avatar { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; }
.sk-line { height: 12px; flex: 1; max-width: 280px; }
.sk-line.short { max-width: 120px; }
.sk-big { height: 30px; width: 60%; margin-top: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 48px 20px; }
.empty-icon { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: var(--brand-50); color: var(--brand-500); margin-bottom: 14px; }
.empty h3 { font-size: 16px; }
.empty p { margin-top: 6px; max-width: 360px; margin-inline: auto; }

/* =========================================================
   Dashboard
   ========================================================= */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 20px; }
.kpi { position: relative; overflow: hidden; display: block; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; transition: transform .18s var(--ease), box-shadow .18s; }
a.kpi:hover { transform: translateY(-3px); box-shadow: 0 16px 36px -18px rgba(16, 40, 26, .3); }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--kpi-soft); opacity: .6; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.kpi-label { font-weight: 600; color: var(--steel); }
.kpi-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--kpi-soft); color: var(--kpi-color); }
.kpi-value { position: relative; z-index: 1; margin-top: 12px; font: 800 32px/1 var(--font-display); color: var(--ink); }
.kpi-sub { position: relative; z-index: 1; margin-top: 8px; font-size: 12.5px; color: var(--steel); }
.kpi-blue { --kpi-color: #2a58a8; --kpi-soft: #e7f0fd; }
.kpi-green { --kpi-color: var(--brand-600); --kpi-soft: var(--brand-50); }
.kpi-amber { --kpi-color: #a5640c; --kpi-soft: #fdf3df; }
.kpi-violet { --kpi-color: #6142b0; --kpi-soft: #f0ebfc; }

.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.dash-recent { grid-column: span 2; grid-row: span 2; }
.activity { list-style: none; margin: 0 -10px; padding: 0; }
.activity li { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 12px; cursor: pointer; transition: background .12s; }
.activity li:hover { background: var(--bg); }
.activity li + li { border-top: 1px solid var(--line-soft); }
.activity-main { flex: 1; min-width: 0; }
.activity-main .cell-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pipeline-bar { display: flex; gap: 3px; height: 12px; border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.seg { display: block; min-width: 6px; }
.seg-new, .dot-new { background: #4b7fd6; }
.seg-contacted, .dot-contacted { background: #e2a33b; }
.seg-confirmed, .dot-confirmed { background: var(--brand-500); }
.seg-completed, .dot-completed { background: #2fa59a; }
.seg-cancelled, .dot-cancelled { background: #e06666; }
.seg-empty { background: var(--line); }
.pipeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pipeline li { display: grid; grid-template-columns: 10px 1fr auto 42px; align-items: center; gap: 10px; padding: 7px 0; }
.pipeline li b { font-family: var(--font-display); color: var(--ink); }
.pipeline li .small { text-align: right; }
.dot { width: 10px; height: 10px; border-radius: 3px; }
.content-list { list-style: none; margin: -6px -10px; padding: 0; }
.content-list a { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; color: var(--text); font-weight: 600; transition: background .12s; }
.content-list a:hover { background: var(--bg); }
.content-list b { font-family: var(--font-display); color: var(--ink); }
.content-list .ico.rot { color: var(--muted); }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-grid a { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; border: 1px dashed var(--brand-200); background: var(--brand-50); color: var(--brand-800); font-weight: 600; font-size: 13px; line-height: 1.35; transition: background .15s, border-color .15s, transform .15s; }
.quick-grid a:hover { background: var(--brand-100); border-color: var(--brand-300); transform: translateY(-2px); }
.quick-grid .ico { color: var(--brand-600); }
.dash-grid > .card:not(.dash-recent):only-child, .dash-grid > .card:first-child:not(.dash-recent) { grid-column: auto; }

/* ---------- appointments ---------- */
.status-tabs { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 2px; }
.status-tabs button { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: 600 13.5px var(--font); color: var(--steel); cursor: pointer; white-space: nowrap; transition: all .15s; }
.status-tabs button span { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--bg); color: var(--steel); font-size: 11.5px; display: grid; place-items: center; }
.status-tabs button:hover { border-color: var(--brand-200); color: var(--ink); }
.status-tabs button.active { background: var(--ink-brand); border-color: var(--ink-brand); color: #fff; }
.status-tabs button.active span { background: rgba(255,255,255,.18); color: #fff; }

/* =========================================================
   Drawer & forms
   ========================================================= */
/* Centered pop-up used for add / edit forms and detail views */
.drawer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 28px 20px; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(10, 28, 18, .5); backdrop-filter: blur(4px); opacity: 0; transition: opacity .22s; }
.drawer-panel { position: relative; width: min(720px, 100%); max-height: calc(100vh - 56px); display: flex; flex-direction: column; overflow: hidden; background: #fff; border-radius: 22px; box-shadow: 0 40px 100px -30px rgba(10, 28, 18, .55), 0 0 0 1px rgba(10, 28, 18, .04); opacity: 0; transform: translateY(18px) scale(.96); transition: opacity .22s, transform .26s var(--ease); }
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer.open .drawer-panel { opacity: 1; transform: none; }
.drawer-panel.nudge { animation: nudge .38s var(--ease); }
@keyframes nudge { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.drawer-head { position: relative; display: flex; align-items: center; gap: 14px; padding: 22px 26px 20px; background: linear-gradient(180deg, var(--brand-50), #fff); border-bottom: 1px solid var(--line); }
.drawer-head::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--brand-600), var(--brand-400)); }
.drawer-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; background: var(--brand-500); color: #fff; box-shadow: 0 10px 20px -10px rgba(43, 140, 87, .8); }
.drawer-titles { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 19px; font-weight: 800; }
.drawer-head p { margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-x { align-self: flex-start; width: 36px; height: 36px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.drawer-x:hover { background: var(--danger-50); color: var(--danger); border-color: #f0caca; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 26px 0; overscroll-behavior: contain; }
.drawer-foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; margin: 18px -26px 0; padding: 16px 26px; background: rgba(255,255,255,.95); backdrop-filter: blur(6px); border-top: 1px solid var(--line); }
.form .notice { margin-top: 16px; }
.form-section { padding: 18px 0; }
.form-section + .form-section { border-top: 1px solid var(--line-soft); }
.form-section-title { font: 700 11.5px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--brand-600); margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full, .form-grid .toggle-row { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfb; cursor: pointer; }
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch-track { position: absolute; inset: 0; border-radius: 999px; background: #cfd9d3; transition: background .2s; }
.switch-track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.switch input:checked + .switch-track { background: var(--brand-500); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 4px rgba(43,140,87,.2); }
.drawer-panel.wide { width: min(980px, 100%); }

/* image upload field */
.image-field { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: center; }
.image-drop { position: relative; width: 200px; height: 132px; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: var(--bg); border: 1.5px dashed #c6d3cb; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s; }
.image-drop:hover, .image-drop.is-over { border-color: var(--brand-400); background: var(--brand-50); color: var(--brand-600); }
.image-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.image-drop:has(img)::after { content: "Change image"; position: absolute; inset: auto 0 0; padding: 6px; background: linear-gradient(transparent, rgba(12,30,20,.75)); color: #fff; font-size: 11.5px; text-align: center; opacity: 0; transition: opacity .15s; }
.image-drop:hover::after { opacity: 1; }
.image-drop.is-uploading { cursor: progress; color: var(--brand-600); }
.image-controls { display: grid; gap: 8px; justify-items: start; min-width: 0; }
.image-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.image-remove:hover { color: var(--danger); border-color: #f0caca; background: var(--danger-50); }

/* rich text editor (Quill snow theme, restyled) */
.rte { border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.rte:focus-within { border-color: var(--brand-400); box-shadow: 0 0 0 4px rgba(43,140,87,.12); }
.rte .ql-toolbar.ql-snow { position: sticky; top: 0; z-index: 2; border: 0; border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; background: #fafcfb; padding: 8px 10px; font-family: var(--font); }
.rte .ql-toolbar.ql-snow .ql-formats { margin-right: 10px; padding-right: 10px; border-right: 1px solid var(--line); }
.rte .ql-toolbar.ql-snow .ql-formats:last-child { border-right: 0; }
.rte .ql-snow.ql-toolbar button, .rte .ql-snow .ql-picker-label { border-radius: 6px; }
.rte .ql-snow.ql-toolbar button:hover, .rte .ql-snow.ql-toolbar button.ql-active, .rte .ql-snow .ql-picker-label:hover { background: var(--brand-50); }
.rte .ql-snow.ql-toolbar button:hover .ql-stroke, .rte .ql-snow.ql-toolbar button.ql-active .ql-stroke, .rte .ql-snow .ql-picker-label:hover .ql-stroke { stroke: var(--brand-600); }
.rte .ql-snow.ql-toolbar button:hover .ql-fill, .rte .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--brand-600); }
.rte .ql-snow.ql-toolbar button.ql-active, .rte .ql-snow .ql-picker-label.ql-active { color: var(--brand-600); }
.rte .ql-snow .ql-picker-options { border-radius: 10px; box-shadow: var(--shadow-lg); border-color: var(--line) !important; padding: 6px 8px; }
.rte .ql-container.ql-snow { border: 0; font-family: var(--font); font-size: 15.5px; }
.rte .ql-editor { min-height: 380px; padding: 20px 22px; line-height: 1.75; color: var(--text); }
.rte .ql-editor.ql-blank::before { left: 22px; right: 22px; font-style: normal; color: #a3b2a9; }
.rte .ql-editor h1, .rte .ql-editor h2, .rte .ql-editor h3, .rte .ql-editor h4 { font-family: var(--font-display); color: var(--ink); margin: 1em 0 .4em; line-height: 1.3; }
.rte .ql-editor p { margin-bottom: .8em; }
.rte .ql-editor blockquote { border-left: 4px solid var(--brand-400); background: var(--brand-50); padding: 10px 16px; margin: 1em 0; border-radius: 0 10px 10px 0; color: var(--brand-800); }
.rte .ql-editor img { max-width: 100%; height: auto; border-radius: 10px; margin: .4em 0; }
.rte .ql-editor .ql-video { width: 100%; aspect-ratio: 16 / 9; height: auto; border-radius: 10px; margin: .6em 0; }
.rte .ql-editor a { color: var(--brand-600); text-decoration: underline; }
.rte .ql-snow .ql-tooltip { z-index: 5; border-radius: 10px; border-color: var(--line); box-shadow: var(--shadow-lg); padding: 8px 12px; font-family: var(--font); }
.rte .ql-snow .ql-tooltip input[type="text"] { height: 32px; border-radius: 8px; border: 1px solid var(--line); }
.rte .ql-snow .ql-tooltip a.ql-action, .rte .ql-snow .ql-tooltip a.ql-remove { color: var(--brand-600); font-weight: 600; }

/* appointment detail */
.detail-hero { display: flex; align-items: center; gap: 14px; padding: 18px 0 4px; }
.detail-name { font: 800 18px var(--font-display); color: var(--ink); }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 16px 0 4px; }
.quick-actions .btn { flex: 1; min-width: 110px; }
.status-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.status-picker button { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: 600 13px var(--font); color: var(--steel); cursor: pointer; transition: all .15s; }
.status-picker button i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .5; }
.status-picker button:hover { border-color: #cbd6cf; color: var(--ink); }
.status-picker button.active { border-color: transparent; box-shadow: 0 0 0 2px currentColor inset; }
.status-picker button.active i { opacity: 1; }
.status-picker button.pill-blue.active { background: #e7f0fd; color: #2a58a8; }
.status-picker button.pill-amber.active { background: #fdf3df; color: #94590b; }
.status-picker button.pill-green.active { background: var(--brand-50); color: var(--brand-700); }
.status-picker button.pill-teal.active { background: #e0f4f1; color: #17716a; }
.status-picker button.pill-red.active { background: var(--danger-50); color: #b23535; }
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin: 0; }
.detail-list > div.full { grid-column: 1 / -1; }
.detail-list dt { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.detail-list dd { margin: 3px 0 0; font-weight: 600; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-list.compact { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); width: 100%; text-align: left; }

/* =========================================================
   Settings, users, account
   ========================================================= */
.settings { display: grid; gap: 18px; }
.stats-edit { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.stat-edit { display: grid; grid-template-columns: 130px 1fr; gap: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfb; }
.stat-preview { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 10px; border-radius: 12px; background: linear-gradient(160deg, var(--brand-800), var(--brand-900)); color: rgba(255,255,255,.7); font-size: 11.5px; line-height: 1.3; }
.stat-preview b { font: 800 26px var(--font-display); color: #fff; margin-bottom: 4px; }
.stat-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-fields .full { grid-column: 1 / -1; }
.stat-fields input { height: 38px; }
.sticky-save { position: sticky; bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px 12px 20px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); }
.roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.role-card { padding: 16px; border-radius: 14px; border: 1px dashed var(--line); background: #fff; }
.role-card p { margin-top: 8px; }
.account-grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.profile-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 30px 24px; }
.profile-card h2 { margin-top: 10px; font-size: 19px; }
.profile-card > .muted { margin-bottom: 8px; overflow-wrap: anywhere; }
.strength { height: 5px; border-radius: 999px; background: var(--line-soft); overflow: hidden; margin-top: 4px; }
.strength span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .2s, background .2s; background: var(--danger); }
.strength span.s2 { background: #e2a33b; }
.strength span.s3 { background: var(--brand-400); }
.strength span.s4 { background: var(--brand-600); }
#pw-form .notice { margin-top: 16px; }

/* =========================================================
   Dialog & toasts
   ========================================================= */
.dialog { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.dialog-backdrop { position: absolute; inset: 0; background: rgba(12, 30, 20, .45); backdrop-filter: blur(2px); opacity: 0; transition: opacity .18s; }
.dialog-card { position: relative; width: 100%; max-width: 400px; padding: 26px; border-radius: 20px; background: #fff; box-shadow: var(--shadow-lg); text-align: center; opacity: 0; transform: scale(.96) translateY(6px); transition: opacity .18s, transform .18s var(--ease); }
.dialog.open .dialog-backdrop { opacity: 1; }
.dialog.open .dialog-card { opacity: 1; transform: none; }
.dialog-icon { display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: var(--brand-50); color: var(--brand-600); margin-bottom: 14px; }
.dialog-icon.is-danger { background: var(--danger-50); color: var(--danger); }
.dialog-card h3 { font-size: 18px; font-weight: 800; }
.dialog-card p { margin-top: 8px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; gap: 10px; justify-items: end; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 360px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s var(--ease); }
.toast.show { opacity: 1; transform: none; }
.toast-ok .ico { color: var(--brand-300); }
.toast-err { background: #8f2a2a; }
.toast-err .ico { color: #ffc2c2; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-recent { grid-column: 1 / -1; grid-row: auto; }
  .stats-edit { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .layout, .layout.collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .25s var(--ease); }
  .layout.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .layout.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(12,30,20,.45); }
  .layout.collapsed .logo-text, .layout.collapsed .nav-text, .layout.collapsed .nav-group-label, .layout.collapsed .user-meta { display: revert; }
  .layout.collapsed .nav-link { justify-content: flex-start; padding: 0 12px; }
  .login { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-logo-mobile { display: flex; }
  .account-grid { grid-template-columns: 1fr; }
  .roles { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar { padding: 0 16px; height: 60px; gap: 10px; }
  .view-site span, .profile-name, .profile-btn > .ico { display: none; }
  .view-site { width: 36px; padding: 0; }
  .profile-btn { padding: 0 5px; }
  .page { padding: 20px 16px 40px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 22px; }
  .page-actions, .page-actions .btn { width: 100%; }
  .kpis { gap: 12px; }
  .kpi { padding: 16px; }
  .kpi-value { font-size: 26px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .card-head { flex-wrap: wrap; }
  .activity li { align-items: flex-start; }
  .activity-meta .small { display: none; }
  .form-grid, .detail-list, .stat-fields { grid-template-columns: minmax(0, 1fr); }
  .stat-edit { grid-template-columns: 1fr; }
  .image-field { grid-template-columns: minmax(0, 1fr); }
  .image-drop { width: 100%; height: 170px; }
  .rte .ql-editor { min-height: 300px; padding: 16px; }
  /* pop-up becomes a bottom sheet on phones */
  .drawer { padding: 0; place-items: end stretch; }
  .drawer-panel, .drawer-panel.wide { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; transform: translateY(100%); opacity: 1; }
  .drawer-head { padding: 22px 18px 16px; }
  .drawer-head::before { inset: 8px auto auto 50%; width: 40px; height: 4px; border-radius: 999px; transform: translateX(-50%); background: #cfd9d3; }
  .drawer-icon { width: 40px; height: 40px; border-radius: 12px; }
  .drawer-body { padding-left: 18px; padding-right: 18px; }
  .drawer-foot { margin: 18px -18px 0; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); }
  .drawer-foot .btn { flex: 1; }
  .search-box { max-width: none; }
  .toolbar-filters { width: 100%; }
  .sticky-save { flex-direction: column; align-items: stretch; text-align: center; }
  /* tables become stacked cards */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
  .table td { padding: 4px 0; border: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .table td[data-label]::before { content: attr(data-label); font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
  .table td:first-child { display: block; padding-bottom: 8px; }
  .table td:first-child::before { display: none; }
  .td-actions { width: 100%; }
  .row-actions { justify-content: flex-start; padding-top: 6px; }
  .td-wide { max-width: none; }
  .table-foot { flex-direction: column; align-items: flex-start; }
  .toasts { left: 16px; right: 16px; justify-items: stretch; }
  .toast { max-width: none; }
}
