/* =====================================================================
   FYB Payment & Donation System - Design System
   Clean, modern, responsive. Shared across public / student / admin.
   ===================================================================== */

:root {
    --brand: #0f5132;
    --brand-600: #12704a;
    --brand-500: #15803d;
    --brand-50: #ecfdf5;
    --accent: #d97706;
    --accent-50: #fffbeb;
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f8fafc;
    --surface: #ffffff;
    --success: #15803d;
    --success-bg: #f0fdf4;
    --warning: #b45309;
    --warning-bg: #fffbeb;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --info: #1d4ed8;
    --info-bg: #eff6ff;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px -12px rgba(15,23,42,.18);
    --shadow-sm: 0 1px 2px rgba(15,23,42,.08);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; color: var(--ink); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1rem; }
img { max-width: 100%; height: auto; }
small { font-size: .82rem; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 780px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.muted { color: var(--muted); }
.mt-0{margin-top:0}.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}.mt-4{margin-top:2rem}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:.5rem}.mb-2{margin-bottom:1rem}.mb-3{margin-bottom:1.5rem}
.flex{display:flex}.flex-between{display:flex;justify-content:space-between;align-items:center;gap:1rem}
.flex-wrap{flex-wrap:wrap}.gap-1{gap:.5rem}.gap-2{gap:1rem}.items-center{align-items:center}
.hidden{display:none}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .65rem 1.15rem; border-radius: var(--radius-sm); border: 1px solid transparent;
    font-weight: 600; font-size: .92rem; cursor: pointer; line-height: 1.2;
    text-decoration: none; transition: background .15s, box-shadow .15s, transform .05s;
    background: var(--brand-600); color: #fff;
}
.btn:hover { background: var(--brand); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }
.btn-outline { background: transparent; color: var(--brand-600); border-color: var(--line); }
.btn-outline:hover { background: var(--brand-50); border-color: var(--brand-500); }
.btn-light { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-light:hover { background: var(--bg); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #991b1b; }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: #b45309; }
.btn-sm { padding: .4rem .75rem; font-size: .82rem; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--bg); }

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 1.5rem;
}
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.card-pad-sm { padding: 1rem; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.stat {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.15rem 1.25rem; box-shadow: var(--shadow-sm);
}
.stat-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat-value { font-size: 1.6rem; font-weight: 700; margin-top: .35rem; color: var(--ink); }
.stat-sub { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.stat-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); font-weight: 700; }

/* ---------- Progress ---------- */
.progress { background: #e8edf3; border-radius: 999px; height: 10px; overflow: hidden; }
.progress-lg { height: 16px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--brand-600)); border-radius: 999px; transition: width .5s ease; }
.progress-bar.accent { background: linear-gradient(90deg, #f59e0b, var(--accent)); }
.progress-bar.danger { background: linear-gradient(90deg, #ef4444, var(--danger)); }
.progress-meta { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); margin-top: .4rem; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .6rem;
    border-radius: 999px; font-size: .75rem; font-weight: 600; text-transform: capitalize;
    background: #eef2f6; color: var(--ink-soft); white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: #f1f5f9; color: var(--muted); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.1rem; }
label { display: block; font-weight: 600; font-size: .87rem; margin-bottom: .4rem; color: var(--ink-soft); }
.required::after { content: ' *'; color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel],
input[type=date], input[type=file], select, textarea {
    width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
    font-family: inherit; font-size: .93rem; color: var(--ink); background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(21,128,61,.14);
}
textarea { min-height: 110px; resize: vertical; }
.form-help { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.form-error { font-size: .82rem; color: var(--danger); margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.checkbox { display: flex; align-items: flex-start; gap: .55rem; font-weight: 500; font-size: .9rem; }
.checkbox input { width: auto; margin-top: .2rem; }

/* ---------- Alerts ---------- */
.alert { padding: .85rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .9rem; border: 1px solid transparent; display: flex; gap: .6rem; align-items: flex-start; }
.alert-success { background: var(--success-bg); color: #14532d; border-color: #bbf7d0; }
.alert-error   { background: var(--danger-bg); color: #7f1d1d; border-color: #fecaca; }
.alert-warning { background: var(--warning-bg); color: #78350f; border-color: #fde68a; }
.alert-info    { background: var(--info-bg); color: #1e3a8a; border-color: #bfdbfe; }
.alert-icon { font-weight: 700; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: .75rem .9rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { background: #f8fafc; font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: .72rem; letter-spacing: .04em; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafcff; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .84rem; }

/* ---------- Public site ---------- */
.site-header {
    background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .7rem; font-weight: 800; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, var(--brand-500), var(--brand)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .95rem; }
.brand-text small { display: block; font-size: .72rem; color: var(--muted); font-weight: 500; }
.nav-links { display: flex; align-items: center; gap: .35rem; list-style: none; margin: 0; padding: 0; }
.nav-links a { padding: .5rem .7rem; border-radius: 8px; color: var(--ink-soft); font-weight: 500; font-size: .9rem; }
.nav-links a:hover { background: var(--bg); color: var(--brand-600); text-decoration: none; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; cursor: pointer; }

.hero {
    background: radial-gradient(1200px 500px at 15% -10%, #dcfce7 0%, transparent 55%),
                radial-gradient(900px 500px at 95% 0%, #fef3c7 0%, transparent 50%),
                linear-gradient(180deg, #f8fafc, #ffffff);
    padding: 4rem 0 3rem; border-bottom: 1px solid var(--line);
}
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; }
.hero h1 { font-size: 2.6rem; letter-spacing: -0.02em; }
.hero p.lead { font-size: 1.1rem; color: var(--ink-soft); }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand-600); background: var(--brand-50); padding: .3rem .7rem; border-radius: 999px; margin-bottom: 1rem; }

.section { padding: 3.5rem 0; }
.section-alt { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-title { text-align: center; max-width: 680px; margin: 0 auto 2.5rem; }
.section-title h2 { font-size: 1.9rem; }
.section-title p { color: var(--muted); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow-sm); }
.feature-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); font-size: 1.2rem; margin-bottom: .85rem; }

.site-footer { background: #0b1220; color: #94a3b8; padding: 3rem 0 1.5rem; margin-top: 2rem; }
.site-footer a { color: #cbd5e1; }
.site-footer h4 { color: #fff; font-size: .95rem; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.2fr; gap: 2rem; }
.footer-bottom { border-top: 1px solid #1e293b; margin-top: 2rem; padding-top: 1.25rem; font-size: .82rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: linear-gradient(160deg, #f0fdf4 0%, #f8fafc 45%, #fefce8 100%); }
.auth-card { width: 100%; max-width: 460px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; }
.auth-wide { max-width: 620px; }
.auth-head { text-align: center; margin-bottom: 1.5rem; }
.auth-head .brand { justify-content: center; }
.auth-foot { text-align: center; margin-top: 1.25rem; font-size: .88rem; color: var(--muted); }

/* ---------- App shell (student/admin) ---------- */
.app-shell { display: grid; grid-template-columns: 258px 1fr; min-height: 100vh; }
.sidebar {
    background: #0b1220; color: #cbd5e1; padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: .25rem;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { color: #fff; padding: .5rem .5rem 1.25rem; }
.sidebar .brand small { color: #64748b; }
.side-nav { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .15rem; }
.side-nav a {
    display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 9px;
    color: #cbd5e1; font-size: .9rem; font-weight: 500;
}
.side-nav a:hover { background: #16203a; color: #fff; text-decoration: none; }
.side-nav a.active { background: var(--brand-600); color: #fff; }
.side-nav .nav-ico { width: 18px; text-align: center; opacity: .9; }
.side-nav .nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 1rem .75rem .35rem; font-weight: 700; }
.side-nav .count { margin-left: auto; background: #1e293b; color: #e2e8f0; border-radius: 999px; padding: .05rem .45rem; font-size: .72rem; }

.app-main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: #fff; border-bottom: 1px solid var(--line); padding: .8rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; position: sticky; top: 0; z-index: 40;
}
.topbar-title { font-weight: 700; font-size: 1.05rem; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }
.bell { position: relative; display: inline-flex; padding: .4rem; border-radius: 9px; color: var(--ink-soft); }
.bell:hover { background: var(--bg); text-decoration: none; }
.bell .dot { position: absolute; top: 2px; right: 2px; background: var(--danger); color: #fff; border-radius: 999px; font-size: .62rem; padding: 0 .3rem; min-width: 16px; text-align: center; line-height: 16px; }
.user-chip { display: flex; align-items: center; gap: .55rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-50); color: var(--brand-600); display: grid; place-items: center; font-weight: 700; font-size: .82rem; }
.app-content { padding: 1.75rem 1.5rem 3rem; max-width: 1400px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.55rem; margin-bottom: .2rem; }
.page-head p { color: var(--muted); margin: 0; font-size: .9rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-main-side { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.25rem; align-items: start; }

/* ---------- Misc ---------- */
.pagination { display: flex; gap: .3rem; list-style: none; padding: 0; margin: 1rem 0 0; flex-wrap: wrap; }
.pagination a, .pagination span { padding: .4rem .7rem; border: 1px solid var(--line); border-radius: 8px; font-size: .85rem; background: #fff; }
.pagination .current { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state .icon { font-size: 2.4rem; margin-bottom: .5rem; opacity: .5; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.divider { height: 1px; background: var(--line); margin: 1.25rem 0; border: 0; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem 1rem; font-size: .9rem; }
.kv dt { color: var(--muted); font-size: .8rem; }
.kv dd { margin: 0; font-weight: 600; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs a { padding: .55rem .9rem; font-size: .88rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--brand-600); border-bottom-color: var(--brand-600); }
.tabs a:hover { text-decoration: none; color: var(--brand-600); }
.bar-chart { display: flex; align-items: flex-end; gap: .75rem; height: 160px; padding-top: 1rem; }
.bar-chart .bar { flex: 1; background: linear-gradient(180deg, var(--brand-500), var(--brand)); border-radius: 6px 6px 0 0; min-height: 4px; position: relative; }
.bar-chart .bar-label { position: absolute; bottom: -1.4rem; left: 0; right: 0; text-align: center; font-size: .7rem; color: var(--muted); }
.chart-wrap { position: relative; padding-bottom: 1.6rem; }
.receipt-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; z-index: 100; padding: 1rem; }
.modal { background: #fff; border-radius: var(--radius); max-width: 560px; width: 100%; padding: 1.5rem; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.amount-positive { color: var(--success); font-weight: 700; }
.amount-negative { color: var(--danger); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .grid-main-side, .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; top: 0; z-index: 90; width: 260px; transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: inline-flex; }
    .nav-toggle { display: inline-flex; }
    .nav-links { display: none; position: absolute; top: 68px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: .75rem; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
    .nav-links.open { display: flex; }
    .hero h1 { font-size: 2rem; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .stat-value { font-size: 1.35rem; }
    .card { padding: 1.1rem; }
    .app-content { padding: 1.25rem 1rem 2.5rem; }
}
.sidebar-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .55rem; cursor: pointer; }

@media print {
    .sidebar, .topbar, .site-header, .site-footer, .no-print, .btn { display: none !important; }
    .app-shell { grid-template-columns: 1fr; }
    body { background: #fff; }
    .card { box-shadow: none; border-color: #ddd; }
}

/* =====================================================================
   Extended components: filter bars, tabs, detail lists, notifications,
   ticket threads, permission grids and print styles.
   ===================================================================== */

/* Filter bar (admin list headers) */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: 1rem 1.25rem;
    margin: 0;
}
.filter-bar input[type=search],
.filter-bar input[type=text],
.filter-bar input[type=date],
.filter-bar select {
    padding: .5rem .7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: .85rem;
    background: #fff;
    color: var(--ink);
    min-width: 0;
}
.filter-bar input[type=search] { flex: 1 1 220px; }
.filter-bar .spacer { flex: 1 1 auto; }

/* Tabs */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    border-bottom: 1px solid var(--line);
    padding: 0 0 .5rem;
}
.tabs .tab {
    padding: .5rem .95rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    color: var(--ink-soft);
    text-decoration: none;
    border: 1px solid transparent;
}
.tabs .tab:hover { background: var(--bg); }
.tabs .tab.active {
    background: var(--brand-50);
    color: var(--brand);
    border-color: #bbf7d0;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Definition list for record details */
.detail-list {
    display: grid;
    grid-template-columns: minmax(140px, 34%) 1fr;
    gap: 0;
    margin: 0;
    font-size: .9rem;
}
.detail-list dt {
    padding: .6rem 0;
    color: var(--muted);
    font-weight: 500;
    border-bottom: 1px solid var(--line);
}
.detail-list dd {
    padding: .6rem 0;
    margin: 0;
    border-bottom: 1px solid var(--line);
    word-break: break-word;
}
.detail-list dt:last-of-type,
.detail-list dd:last-of-type { border-bottom: none; }

/* Compact lists (installment tranches) */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--line);
    font-size: .85rem;
}
.mini-list li:last-child { border-bottom: none; }

/* Notification centre */
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
}
.notif:last-child { border-bottom: none; }
.notif.unread { background: var(--brand-50); }
.notif-body { flex: 1 1 auto; min-width: 0; }
.notif-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: .2rem;
}
.notif-title a { color: var(--ink); text-decoration: none; }
.notif-title a:hover { color: var(--brand-500); text-decoration: underline; }
.notif-text { font-size: .85rem; color: var(--ink-soft); line-height: 1.5; }

/* Support ticket thread */
.thread {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1.25rem;
    max-height: 32rem;
    overflow-y: auto;
}
.msg {
    max-width: 82%;
    padding: .7rem .9rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    line-height: 1.55;
}
.msg-in { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.msg-out { align-self: flex-end; background: var(--brand-50); border: 1px solid #bbf7d0; }
.msg-head {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    font-size: .75rem;
    margin-bottom: .3rem;
    color: var(--muted);
}
.msg-body { word-break: break-word; }

/* Permission matrix */
.perm-group { margin: 0 0 1rem; }
.perm-group-title {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    margin: 0 0 .5rem;
}
.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: .4rem .9rem;
}

/* Utility */
.spacer { flex: 1 1 auto; }
.text-mono { font-family: var(--mono); }
.w-100 { width: 100%; }
.nowrap { white-space: nowrap; }
.opacity-70 { opacity: .7; }

/* Print: receipts and statements */
@media print {
    .sidebar, .topbar, .site-header, .site-footer, .btn, .tabs, .filter-bar { display: none !important; }
    .app-shell, .app-main, .app-content { display: block !important; margin: 0 !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #cbd5e1 !important; break-inside: avoid; }
    body { background: #fff !important; }
}
