:root {
    --pink: #e6007e;
    --pink-dark: #b0005f;
    --pink-tint: #fdeef6;
    --ink: #10233f;
    --ink-soft: #4b5c72;
    --ink-faint: #7c8aa0;
    --border: #e4e9f0;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --green: #1e9e5a;
    --green-tint: #e8f7ee;
    --amber: #a9760a;
    --amber-tint: #fdf3e0;
    --red: #b42323;
    --red-tint: #fdeaea;
    --violet: #6b46c1;
    --violet-tint: #f1ecfb;
    --sidebar-bg: #0e1e38;
    --sidebar-bg-soft: #16305a;
    --sidebar-line: rgba(255,255,255,.08);
    --sidebar-text: #aebcd2;
    --sidebar-text-active: #ffffff;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --sidebar-w: 236px;
    --topbar-h: 60px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
    font-family: var(--font-sans);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); -webkit-tap-highlight-color: transparent; }
a { text-decoration: none; color: inherit; }
svg { display: block; }

/* ---------- Dashboard shell (sidebar + main) ---------- */
.dashboard-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-soft) 140%);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    transform: translateX(0); transition: transform .2s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px; padding: 22px 20px 18px;
    border-bottom: 1px solid var(--sidebar-line);
}
.sidebar-brand .mark {
    width: 32px; height: 32px; border-radius: 9px; background: var(--pink);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 14px; flex-shrink: 0;
}
.sidebar-brand .name { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; line-height: 1.2; }
.sidebar-brand .name span { display: block; color: var(--sidebar-text); font-weight: 500; font-size: 11px; margin-top: 1px; }

.sidebar-close {
    display: none; margin-left: auto; background: none; border: none; color: var(--sidebar-text);
    width: 30px; height: 30px; border-radius: var(--radius-sm); cursor: pointer; align-items: center; justify-content: center;
}

/* Side nav — repurposes the existing .tab-btn / .tabs targets from dashboard.js */
.tabs#tabs {
    display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden;
    padding: 14px 12px; margin: 0; border-bottom: none; flex: 1;
}
.tabs#tabs .tab-btn {
    flex-shrink: 0; display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
    background: none; border: none; border-radius: var(--radius-sm); padding: 10px 12px; margin: 0;
    font-size: 13.5px; font-weight: 600; color: var(--sidebar-text); cursor: pointer; position: relative;
    transition: background .15s ease, color .15s ease;
}
.tabs#tabs .tab-btn::after { content: none; }
.tabs#tabs .tab-btn svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.tabs#tabs .tab-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
/* Active nav item uses a translucent pink wash rather than solid brand
   pink, so it doesn't visually compete with primary-action buttons. */
.tabs#tabs .tab-btn.active { background: rgba(230,0,126,.14); color: #ffffff; }
.tabs#tabs .tab-btn.active svg { opacity: 1; color: #ff6fb8; }

.sidebar-foot { padding: 14px 20px 18px; border-top: 1px solid var(--sidebar-line); }
/* Base logout button — used on its own in a light topbar (tenant portal).
   The sidebar-specific rule below overrides this for the dark sidebar. */
.logout-btn {
    background: #fff; border: 1.5px solid var(--border); color: var(--ink-soft);
    font-size: 12.5px; font-weight: 600; padding: 9px 16px; border-radius: var(--radius-sm); cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.logout-btn:hover { background: var(--red-tint); border-color: var(--red); color: var(--red); }

.sidebar-foot .logout-btn {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
    background: rgba(255,255,255,.06); border: 1px solid var(--sidebar-line); color: var(--sidebar-text);
    border-radius: var(--radius-sm); padding: 9px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.sidebar-foot .logout-btn:hover { background: rgba(255,255,255,.12); color: #fff; }

.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(9,17,32,.5); z-index: 45; }
.sidebar-backdrop.open { display: block; }

.main-wrap { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- Topbar ---------- */
.app-header {
    background: var(--surface); color: var(--ink); padding: 0 24px;
    height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--border);
}
.app-header .header-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.app-header h1 { font-size: 18px; margin: 0; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); }

.menu-btn {
    display: none; background: none; border: 1px solid var(--border); color: var(--ink-soft);
    width: 34px; height: 34px; border-radius: var(--radius-sm); cursor: pointer;
    align-items: center; justify-content: center; flex-shrink: 0;
}

.app-container { max-width: 1080px; margin: 0 auto; width: 100%; padding: 22px 24px 44px; }

/* ---------- Auth screens ---------- */
.auth-screen {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
    background: radial-gradient(circle at 20% 20%, #1c3557, var(--ink) 65%);
}
.auth-card { background: #fff; border-radius: var(--radius-lg); padding: 36px 30px; max-width: 400px; width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.auth-card h1 { font-size: 22px; margin: 0 0 4px; color: var(--pink); font-weight: 800; letter-spacing: -0.01em; }
.auth-card p.subtitle { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 26px; line-height: 1.5; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field input, .field select, .field textarea {
    border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px;
    font-size: 14.5px; color: var(--ink); font-weight: 400; width: 100%; background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
/* Default textareas stay sans-serif; only the M-Pesa paste box (below)
   uses monospace, since a typewriter font on a plain description field
   (e.g. maintenance requests) reads oddly. */
.field textarea { resize: vertical; min-height: 90px; font-family: var(--font-sans); font-size: 14.5px; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-tint);
}

/* M-Pesa confirmation paste box — monospace helps the tenant visually
   verify transaction codes / amounts against their SMS. */
.textarea-mpesa { font-family: var(--font-mono); font-size: 13.5px; min-height: 90px; }

/* ---------- Searchable dropdown (property picker) ---------- */
.search-results {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
    background: #fff; border: 1.5px solid var(--border); border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm); max-height: 220px; overflow-y: auto;
    box-shadow: 0 16px 32px rgba(16,35,63,.14);
}
.search-result-row { padding: 11px 13px; font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.search-result-row:last-child { border-bottom: none; }
.search-result-row:hover, .search-result-row.highlighted { background: var(--pink-tint); color: var(--pink-dark); }
.search-no-results { padding: 11px 13px; font-size: 13px; color: var(--ink-soft); }

.btn {
    display: block; width: 100%; text-align: center; border: none; border-radius: var(--radius-sm);
    padding: 13px; font-weight: 700; font-size: 14.5px; cursor: pointer;
    transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn-primary { background: var(--pink); color: #fff; }
.btn-primary:hover { background: var(--pink-dark); }
.btn-primary:disabled { background: #f3b6d8; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--pink); border: 1.5px solid var(--pink); }
.btn-outline:hover { background: var(--pink-tint); }
.btn-link { background: none; border: none; color: var(--pink); font-weight: 600; font-size: 13.5px; cursor: pointer; padding: 0; }

.btn:focus-visible, .tab-btn:focus-visible, .logout-btn:focus-visible, .field input:focus-visible, .menu-btn:focus-visible, .icon-btn:focus-visible {
    outline: 2px solid var(--pink); outline-offset: 2px;
}

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; margin: 14px 0; }
.alert-error { background: var(--red-tint); color: var(--red); }
.alert-success { background: var(--green-tint); color: var(--green); }

/* ---------- Section headings (used above Payment History, Maintenance, etc.) ---------- */
.section-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--ink);
    letter-spacing: -0.01em;
    margin: 0 0 10px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(16,35,63,.04), 0 1px 3px rgba(16,35,63,.03);
}
.card-title { font-weight: 700; font-size: 15px; color: var(--ink); margin-bottom: 4px; letter-spacing: -0.01em; }
.card-sub { color: var(--ink-soft); font-size: 13px; line-height: 1.5; }

/* Status is scannable at a glance via a left border, not just a small pill */
.card:has(.pill-pending) { border-left: 3px solid var(--amber); }
.card:has(.pill-verified) { border-left: 3px solid var(--green); }
.card:has(.pill-rejected) { border-left: 3px solid var(--red); }
.card:has(.pill-mismatch) { border-left: 3px solid var(--red); }
.card:has(.pill-awaiting) { border-left: 3px solid var(--violet); }

/* ---------- Status pill ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; letter-spacing: .01em; }
.pill-pending { background: var(--amber-tint); color: var(--amber); }
.pill-verified { background: var(--green-tint); color: var(--green); }
.pill-rejected { background: var(--red-tint); color: var(--red); }
.pill-mismatch { background: var(--red-tint); color: var(--red); }
.pill-neutral { background: #e6e9f0; color: var(--ink-soft); }
/* "Awaiting" uses a distinct violet rather than brand pink, so it doesn't
   visually compete with buttons/links/active nav that use pink for
   actions. */
.pill-awaiting { background: var(--violet-tint); color: var(--violet); }

/* ---------- Payment history rows ---------- */
.payment-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 10px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.payment-row:last-child { border-bottom: none; }
.payment-row .amount { font-weight: 700; font-family: var(--font-mono); }
.payment-row .meta { font-size: 12px; color: var(--ink-soft); }

/* ---------- Stat cards (staff dashboard overview strip) ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-box {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 16px 18px; display: flex; flex-direction: column; gap: 10px;
}
.stat-box .num { font-family: var(--font-mono); font-size: 26px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1; }
.stat-box .label { font-size: 12px; color: var(--ink-soft); line-height: 1.35; }
.stat-box::before {
    content: ""; width: 30px; height: 30px; border-radius: 8px; background: var(--pink-tint);
    display: block; order: -1;
}

/* ---------- Overview charts ---------- */
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px 20px; margin-bottom: 14px; }
.chart-card .card-title { margin-bottom: 12px; }
.chart-card canvas { max-height: 240px; }
.overview-actions { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.overview-actions .btn { width: auto; padding: 10px 18px; }

.empty-state { text-align: center; color: var(--ink-faint); padding: 36px 12px; font-size: 13.5px; }

.fab {
    position: fixed; bottom: 24px; right: 24px; background: var(--pink); color: #fff;
    width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 26px; box-shadow: 0 10px 24px rgba(230,0,126,.35); border: none; cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(230,0,126,.4); }

/* ---------- Header icon button + notifications panel ---------- */
.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.icon-btn {
    position: relative; background: var(--bg); border: 1px solid var(--border);
    color: var(--ink-soft); width: 36px; height: 36px; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 16px; display: flex; align-items: center; justify-content: center;
    transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--pink-tint); color: var(--pink-dark); }
.bell-badge {
    position: absolute; top: -5px; right: -5px; background: var(--pink); color: #fff;
    font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center; padding: 0 3px; border: 2px solid var(--surface);
}
.notif-panel {
    display: none; position: absolute; top: calc(var(--topbar-h) - 4px); right: 24px; width: 320px; max-width: calc(100vw - 32px);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: 0 20px 40px rgba(16,35,63,.18); max-height: 380px; overflow-y: auto; z-index: 40;
}
.notif-panel.open { display: block; }
.notif-row { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-row:last-child { border-bottom: none; }
.notif-row.unread { background: var(--pink-tint); }
.notif-row .notif-msg { font-size: 13px; color: var(--ink); line-height: 1.4; }
.notif-row .notif-time { font-size: 11px; color: var(--ink-faint); margin-top: 3px; }

/* ---------- Rent status summary (tenant portal) ---------- */
.rent-status-amount { font-family: var(--font-mono); font-size: 30px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.rent-status-due { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.rent-status-card.is-overdue { border-left: 3px solid var(--red); }
.rent-status-card.is-due { border-left: 3px solid var(--amber); }
.rent-status-card.is-paid { border-left: 3px solid var(--green); }

/* ---------- Arrears badge (staff tenants tab) ---------- */
.badge-arrears { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--red); background: var(--red-tint); padding: 4px 10px; border-radius: 999px; }

/* ---------- Category chip (maintenance) ---------- */
.chip { display: inline-block; font-size: 11px; font-weight: 600; color: var(--ink-soft); background: var(--bg); border: 1px solid var(--border); padding: 3px 9px; border-radius: 999px; }

/* ---------- Maintenance confirm / reopen flow (tenant portal) ---------- */
.maintenance-confirm { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.maintenance-confirm .card-sub { margin-bottom: 10px; }
.maintenance-confirm .btn, .maintenance-reopen-form .btn { width: auto; padding: 8px 16px; font-size: 13px; }
.maintenance-confirm .btn-outline, .maintenance-reopen-form .btn-outline { padding: 7px 14px; }

.maintenance-reopen-form {
    margin-top: 10px; padding: 12px 14px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.maintenance-reopen-form .field { margin-bottom: 8px; }
.maintenance-reopen-form textarea { min-height: 64px; font-family: var(--font-sans); font-size: 13.5px; }

.maintenance-tenant-note { margin-top: 6px; }
.maintenance-tenant-note strong { color: var(--ink); }

/* ---------- Maintenance comment thread ---------- */
/* "View Conversation" toggle + the thread panel it opens beneath a
   maintenance card. Tenant messages align right (brand tint), staff
   messages align left (neutral), like a normal chat thread. */
.comment-toggle {
    display: inline-block; margin-top: 12px; background: none; border: none;
    color: var(--pink); font-weight: 600; font-size: 12.5px; cursor: pointer; padding: 0;
}
.comment-toggle:hover { color: var(--pink-dark); text-decoration: underline; }

.comment-panel { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }

.comment-thread {
    display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto;
    padding-right: 2px; margin-bottom: 10px;
}
.comment-bubble { max-width: 82%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.comment-tenant { align-self: flex-end; background: var(--pink-tint); color: var(--ink); border-bottom-right-radius: 4px; }
.comment-staff { align-self: flex-start; background: var(--bg); border: 1px solid var(--border); color: var(--ink); border-bottom-left-radius: 4px; }
.comment-author { font-size: 10.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 2px; text-transform: uppercase; letter-spacing: .02em; }
.comment-text { white-space: pre-wrap; word-break: break-word; }
.comment-time { font-size: 10.5px; color: var(--ink-faint); margin-top: 4px; }

.comment-input-row { display: flex; gap: 8px; align-items: flex-end; }
.comment-input-row textarea {
    flex: 1; min-height: 40px; height: 40px; resize: none; font-family: var(--font-sans);
    font-size: 13.5px; padding: 9px 12px;
}
.comment-input-row .btn { width: auto; padding: 9px 16px; font-size: 13px; flex-shrink: 0; }

/* ---------- Collapsible "add / record" panels (staff dashboard) ---------- */
.collapse-panel { padding: 16px 20px; transition: border-color .15s ease, box-shadow .15s ease; }
.collapse-panel-toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    background: none; border: none; cursor: pointer; padding: 0; text-align: left; font: inherit;
}
.collapse-panel-toggle .card-title { margin: 0; transition: color .15s ease; }
.collapse-panel-toggle:hover .card-title { color: var(--pink-dark); }
.collapse-chevron { color: var(--ink-faint); transition: transform .15s ease, color .15s ease; }
.collapse-panel.open { border-color: var(--pink); box-shadow: 0 0 0 1px var(--pink-tint); }
.collapse-panel.open .collapse-chevron { color: var(--pink); }
.collapse-panel-body { overflow: hidden; transition: margin-top .15s ease; }
.collapse-panel-body form .btn { margin-top: 4px; }

/* ---------- Receipt (printable popup) ---------- */
.receipt-page { max-width: 420px; margin: 32px auto; font-family: var(--font-sans); color: var(--ink); padding: 0 16px; }
.receipt-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 28px 26px; }
.receipt-brand { font-weight: 800; font-size: 18px; color: var(--pink); margin-bottom: 2px; }
.receipt-sub { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 20px; }
.receipt-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.receipt-row:last-of-type { border-bottom: none; }
.receipt-row .label { color: var(--ink-soft); }
.receipt-row .value { font-weight: 600; font-family: var(--font-mono); }
.receipt-total { display: flex; justify-content: space-between; padding-top: 14px; margin-top: 6px; border-top: 2px solid var(--ink); font-size: 16px; font-weight: 800; font-family: var(--font-mono); }
.receipt-print-btn { margin-top: 22px; }
@media print { .receipt-print-btn { display: none; } body { background: #fff; } }

/* ---------- Responsive: collapse sidebar to off-canvas drawer ---------- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); width: 260px; }
    .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.3); }
    .sidebar-close { display: flex; }
    .main-wrap { margin-left: 0; }
    .menu-btn { display: flex; }
    .app-header { padding: 0 16px; }
    .app-container { padding: 18px 16px 40px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
    html { scroll-behavior: auto; }
}

/* ---------- Tenant portal: real tab switching ---------- */
/* Only the section with .active is shown — sidebar links and any
   [data-goto-section] button toggle this via portal.js. Replaces the old
   "everything visible, scroll to anchor" behavior. */
.portal-section { display: none; scroll-margin-top: calc(var(--topbar-h) + 14px); }
.portal-section.active { display: block; animation: sectionFadeIn .15s ease; }
@keyframes sectionFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Quick actions (Overview tab) ---------- */
.quick-actions-row { display: flex; gap: 10px; flex-wrap: wrap; }
.quick-action-btn {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg); border: 1.5px solid var(--border); color: var(--ink);
    font-size: 13px; font-weight: 600; padding: 10px 14px; border-radius: var(--radius-sm);
    cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.quick-action-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.quick-action-btn:hover { background: var(--pink-tint); border-color: var(--pink); color: var(--pink-dark); }

/* ---------- Table toolbar (search) ---------- */
.table-toolbar { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.table-search {
    position: relative; display: flex; align-items: center;
    background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    padding: 0 12px; max-width: 360px; flex: 1;
}
.table-search svg { width: 16px; height: 16px; color: var(--ink-faint); flex-shrink: 0; }
.table-search input {
    border: none; outline: none; background: none; padding: 10px 10px;
    font-size: 14px; color: var(--ink); width: 100%;
}
.table-search input::placeholder { color: var(--ink-faint); }

/* ---------- Data table ---------- */
.table-wrap {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    overflow: hidden; margin-bottom: 12px;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead th {
    text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
    color: var(--ink-faint); background: var(--bg); padding: 11px 16px; border-bottom: 1px solid var(--border);
}
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: background .15s ease; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--pink-tint); }
.data-table td { padding: 13px 16px; vertical-align: middle; color: var(--ink-soft); }
.data-table .cell-title { font-weight: 700; color: var(--ink); }
.data-table .cell-muted { color: var(--ink-faint); }

.table-actions { display: flex; gap: 8px; justify-content: flex-end; white-space: nowrap; }
.btn-table-action {
    background: none; border: 1.5px solid var(--border); color: var(--ink-soft);
    font-size: 12px; font-weight: 600; padding: 7px 12px; border-radius: var(--radius-sm); cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-table-action:hover { background: var(--pink-tint); border-color: var(--pink); color: var(--pink-dark); }
.btn-table-action-danger:hover { background: var(--red-tint); border-color: var(--red); color: var(--red); }

/* Responsive: collapse table to stacked cards on small screens */
@media (max-width: 720px) {
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr { padding: 12px 16px; }
    .data-table td { padding: 4px 0; border: none; }
    .data-table td[data-label]::before {
        content: attr(data-label); display: block; font-size: 11px; font-weight: 700;
        text-transform: uppercase; letter-spacing: .03em; color: var(--ink-faint); margin-bottom: 2px;
    }
    .data-table td[data-label=""]::before { content: none; }
    .table-actions { justify-content: flex-start; margin-top: 8px; }
}

.data-table td[data-label="Status"] { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
@media (max-width: 720px) {
    .data-table td[data-label="Status"] { display: block; }
    .data-table td[data-label="Status"] .pill { margin-right: 5px; }
}