/* Pitchside FMS design system.
   All colours are CSS variables (tokens). Re-theming = changing the [data-theme] blocks below.
   Themes: green (default), red, brown, blue. Bootstrap 5 is vendored locally; its primary colour follows --primary. */

/* ---------- tokens ---------- */
:root {
    --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bg: #f3f5f8;
    --surface: #ffffff;
    --ink: #1a2230;
    --muted: #667085;
    --line: #e4e7ec;
    --success: #12805c;
    --warning: #b54708;
    --danger: #c0362c;
    --info: #175cd3;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
    --sidebar-w: 268px;
    --topbar-h: 64px;
}
:root, [data-theme="green"] {
    --primary: #0b7a43; --primary-600: #096a3a; --primary-700: #075a31; --primary-100: #dff3e7; --primary-50: #f0f9f4; --primary-rgb: 11, 122, 67;
    --dark: #0a2e1c; --accent: #f2b705; --accent-ink: #2a2000;
    --sidebar-bg: #07341f; --sidebar-bg-2: #0a4a2b; --sidebar-ink: #d4ecde; --sidebar-muted: #86b79b;
}
[data-theme="red"] {
    --primary: #b3202e; --primary-600: #981a27; --primary-700: #7d1520; --primary-100: #fbe3e5; --primary-50: #fef3f4; --primary-rgb: 179, 32, 46;
    --dark: #3a0b11; --accent: #f4b942; --accent-ink: #2e1f00;
    --sidebar-bg: #43101a; --sidebar-bg-2: #5d1521; --sidebar-ink: #f6d9dc; --sidebar-muted: #d29aa1;
}
[data-theme="brown"] {
    --primary: #7a4a2b; --primary-600: #653c23; --primary-700: #50301c; --primary-100: #f1e4da; --primary-50: #faf5f1; --primary-rgb: 122, 74, 43;
    --dark: #24160e; --accent: #d9a441; --accent-ink: #2a1c00;
    --sidebar-bg: #2b1a10; --sidebar-bg-2: #3e2617; --sidebar-ink: #ecdccf; --sidebar-muted: #bf9f88;
}
[data-theme="blue"] {
    --primary: #1d4ed8; --primary-600: #1941b8; --primary-700: #14338f; --primary-100: #dde7fd; --primary-50: #f0f4ff; --primary-rgb: 29, 78, 216;
    --dark: #0b1b4a; --accent: #f59e0b; --accent-ink: #2a1a00;
    --sidebar-bg: #0e1f55; --sidebar-bg-2: #15307d; --sidebar-ink: #d8e2fb; --sidebar-muted: #8fa6dd;
}

/* ---------- base + Bootstrap bridge ---------- */
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: .95rem; line-height: 1.55; -webkit-font-smoothing: antialiased; }
:root { --bs-primary: var(--primary); --bs-primary-rgb: var(--primary-rgb); --bs-link-color: var(--primary); --bs-link-hover-color: var(--primary-700);
    --bs-link-color-rgb: var(--primary-rgb); --bs-body-font-family: var(--font); --bs-body-color: var(--ink); --bs-border-color: var(--line); }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.01em; }
.text-primary { color: var(--primary) !important; } .bg-primary { background: var(--primary) !important; }
.text-muted, .text-secondary { color: var(--muted) !important; }
.btn { border-radius: var(--radius-sm); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-600); --bs-btn-hover-border-color: var(--primary-600);
    --bs-btn-active-bg: var(--primary-700); --bs-btn-active-border-color: var(--primary-700); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary);
    --bs-btn-active-bg: var(--primary-700); --bs-btn-active-border-color: var(--primary-700); }
.btn-accent { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-color: var(--accent-ink); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-color: var(--accent-ink); filter: none; }
.btn-accent:hover { filter: brightness(.95); }
.form-control, .form-select { border-radius: var(--radius-sm); border-color: #cfd5de; padding: .6rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .22rem rgba(var(--primary-rgb), .18); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-label { font-weight: 600; font-size: .86rem; margin-bottom: .3rem; }
.page-link { color: var(--primary); } .page-item.active .page-link { background: var(--primary); border-color: var(--primary); }
.nav-tabs .nav-link.active, .nav-pills .nav-link.active { color: var(--primary); }
.nav-pills .nav-link.active { background: var(--primary-100); color: var(--primary-700); font-weight: 600; }
.nav-pills .nav-link { color: var(--muted); border-radius: var(--radius-sm); font-weight: 500; }
.dropdown-menu { border-radius: 12px; border-color: var(--line); box-shadow: var(--shadow); padding: .4rem; }
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; }
.modal-content { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); }
.toast { border: 0; border-radius: 12px; box-shadow: var(--shadow); }

/* ---------- cards ---------- */
.card-soft { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-soft > .card-head, .card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.02rem; }
.card-pad { padding: 1.25rem; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 1.1rem 1.2rem; display: flex; gap: .9rem; align-items: flex-start; height: 100%; }
.stat-card .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-100); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex: none; }
.stat-card.warn .ico { background: #fef0c7; color: var(--warning); } .stat-card.bad .ico { background: #fee4e2; color: var(--danger); } .stat-card.info .ico { background: #dbeafe; color: var(--info); }
.stat-card .label { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-card > div:last-child { min-width: 0; }
.stat-card .value { font-size: clamp(1.05rem, 1.35vw, 1.4rem); font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.stat-card .sub { color: var(--muted); font-size: .82rem; }
.pos { color: var(--success); font-weight: 600; } .neg { color: var(--danger); font-weight: 600; }

/* ---------- app shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex: none; background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2)); color: var(--sidebar-ink);
    position: fixed; inset: 0 auto 0 0; z-index: 1040; display: flex; flex-direction: column; transition: transform .25s ease; }
.sidebar .brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.15rem; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .1); min-height: var(--topbar-h); }
.sidebar .brand:hover { text-decoration: none; }
.crest { width: 42px; height: 42px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .9rem; flex: none; overflow: hidden; }
.crest img { width: 100%; height: 100%; object-fit: cover; }
.brand b { display: block; line-height: 1.2; font-size: .95rem; } .brand small { color: var(--sidebar-muted); font-size: .72rem; }
.sidebar nav { flex: 1; overflow-y: auto; padding: .5rem .75rem 1rem; }
.nav-group { text-transform: uppercase; letter-spacing: .09em; font-size: .66rem; color: var(--sidebar-muted); margin: 1.1rem .7rem .35rem; font-weight: 700; }
.sidebar .nav-item-link { display: flex; align-items: center; gap: .75rem; padding: .62rem .8rem; border-radius: 10px; color: var(--sidebar-ink); font-weight: 500; min-height: 44px; }
.sidebar .nav-item-link i { font-size: 1.1rem; width: 1.3rem; text-align: center; opacity: .9; }
.sidebar .nav-item-link:hover { background: rgba(255, 255, 255, .08); text-decoration: none; color: #fff; }
.sidebar .nav-item-link.active { background: rgba(255, 255, 255, .15); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-user { border-top: 1px solid rgba(255, 255, 255, .1); padding: .85rem 1rem; display: flex; align-items: center; gap: .7rem; }
.sidebar-user .who { min-width: 0; flex: 1; line-height: 1.2; }
.sidebar-user .who b { display: block; font-size: .85rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .who small { color: var(--sidebar-muted); font-size: .72rem; }
.sidebar-user .btn-logout { background: rgba(255, 255, 255, .1); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 10px; }
.sidebar-user .btn-logout:hover { background: rgba(255, 255, 255, .2); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(10, 15, 25, .5); z-index: 1035; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-100); color: var(--primary-700); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; object-fit: cover; font-size: .85rem; }
.avatar-lg { width: 96px; height: 96px; font-size: 2rem; }
.sidebar .avatar { background: rgba(255, 255, 255, .15); color: #fff; }

.main-area { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1030; height: var(--topbar-h); background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; }
.topbar .page-title { font-weight: 700; font-size: 1.05rem; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .clock { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; position: relative; }
.icon-btn:hover { background: var(--primary-50); color: var(--primary); }
.icon-btn .dot { position: absolute; top: 6px; right: 5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.content { padding: 1.5rem; max-width: 1400px; width: 100%; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.5rem; margin: 0; } .page-head .sub { color: var(--muted); font-size: .9rem; }
.burger { display: none; }

/* tablet: condensed, collapsible sidebar */
@media (max-width: 1199.98px) and (min-width: 768px) {
    :root { --sidebar-w: 232px; }
    .content { padding: 1.1rem; } .topbar { padding: 0 1rem; }
}
/* below desktop the sidebar is an off-canvas drawer */
@media (max-width: 1023.98px) {
    .sidebar { transform: translateX(-105%); width: 288px; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .sidebar-overlay { display: block; }
    body.nav-open { overflow: hidden; }
    .main-area { margin-left: 0; }
    .burger { display: inline-flex; }
}

/* ---------- tables ---------- */
.table-modern { --bs-table-bg: transparent; margin: 0; font-size: .9rem; }
.table-modern thead th { background: #f8fafc; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; border-bottom: 1px solid var(--line); padding: .8rem 1rem; white-space: nowrap; }
.table-modern thead th a { color: inherit; }
.table-modern td { padding: .75rem 1rem; vertical-align: middle; border-color: var(--line); }
.table-modern td .badge { white-space: nowrap; }
.table-modern tbody tr:hover { background: var(--primary-50); }
.table-modern .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline; }
.person { display: flex; align-items: center; gap: .65rem; color: inherit; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.4rem; display: block; margin-bottom: .5rem; opacity: .5; }
.filter-bar { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.filter-bar > div { min-width: 150px; flex: 1 1 150px; max-width: 260px; } .filter-bar .grow { flex: 2 1 240px; max-width: 380px; }
.list-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .9rem 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

/* status pills */
.badge { font-weight: 600; padding: .38em .7em; border-radius: 99px; font-size: .74rem; letter-spacing: .01em; background: #eef0f3; color: #475467; }
.status-active, .status-paid, .status-published, .status-win, .status-present, .status-recovered, .status-signed, .status-income, .status-good, .status-new, .status-success, .status-valid { background: #d1fadf; color: #05603a; }
.status-injured, .status-severe, .status-expired, .status-loss, .status-absent, .status-rejected, .status-cancelled, .status-expense, .status-disabled, .status-damaged, .status-red_card, .status-failed { background: #fee4e2; color: #912018; }
.status-suspended, .status-moderate, .status-pending, .status-reserved, .status-postponed, .status-late, .status-recovering, .status-draft, .status-worn, .status-yellow_card, .status-on_trial { background: #fef0c7; color: #93370d; }
.status-scheduled, .status-loan, .status-spotted, .status-invited, .status-offered, .status-excused, .status-minor, .status-used, .status-principal { background: #d1e9ff; color: #194185; }
.status-draw, .status-released, .status-played, .status-unverified, .status-inactive { background: #eef0f3; color: #475467; }
.status-goal { background: #d1fadf; color: #05603a; }

/* ---------- forms ---------- */
.form-section { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--primary); font-weight: 700; padding-bottom: .4rem; border-bottom: 1px solid var(--line); margin: .5rem 0 0; }
.pw-wrap { position: relative; } .pw-wrap .form-control { padding-right: 3rem; }
.pw-toggle { position: absolute; top: 0; right: 0; height: 100%; min-width: 44px; border: 0; background: transparent; color: var(--muted); font-size: 1.1rem; }
.pw-toggle:hover { color: var(--primary); }
.meter { height: 6px; background: #e6eaf0; border-radius: 99px; overflow: hidden; margin-top: .4rem; }
.meter i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }
.input-prefix { display: flex; } .input-prefix > span { display: inline-flex; align-items: center; padding: 0 .85rem; background: #f2f4f7; border: 1px solid #cfd5de; border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); font-weight: 700; }
.input-prefix .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.theme-picker { display: flex; flex-wrap: wrap; gap: .65rem; }
.theme-opt { display: flex; align-items: center; gap: .55rem; border: 2px solid var(--line); border-radius: 12px; padding: .55rem .95rem; cursor: pointer; font-weight: 600; min-height: 44px; background: #fff; }
.theme-opt input { position: absolute; opacity: 0; } .theme-opt .sw { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7); }
.theme-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }

/* ---------- details / sections ---------- */
dl.details { display: grid; grid-template-columns: minmax(130px, 220px) 1fr; gap: .55rem 1rem; margin: 0; }
dl.details dt { color: var(--muted); font-weight: 500; font-size: .86rem; } dl.details dd { margin: 0; font-weight: 500; word-break: break-word; }
.scoreline { display: flex; align-items: center; justify-content: center; gap: 1.25rem; flex-wrap: wrap; font-weight: 700; font-size: 1.15rem; padding: .5rem 0 .75rem; }
.scoreline .score { font-size: 2.3rem; background: var(--primary); color: #fff; border-radius: 14px; padding: .1em .65em; letter-spacing: .1em; }
.result-row { display: flex; justify-content: space-between; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); align-items: center; }
.result-row:last-child { border-bottom: 0; }
.bar-chart { display: flex; align-items: flex-end; gap: .6rem; height: 150px; padding-top: .5rem; }
.bar-chart .col-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .3rem; height: 100%; justify-content: flex-end; }
.bar-chart .pair { display: flex; align-items: flex-end; gap: 3px; width: 100%; justify-content: center; flex: 1; }
.bar-chart .pair i { width: 40%; max-width: 22px; border-radius: 5px 5px 0 0; display: block; min-height: 2px; }
.bar-chart .inc { background: var(--primary); } .bar-chart .exp { background: var(--accent); }
.bar-chart small { color: var(--muted); font-size: .7rem; }

/* ---------- sign-in page ---------- */
.auth-page { min-height: 100vh; background: linear-gradient(160deg, var(--dark) 0%, var(--primary) 100%) fixed; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-brand { text-align: center; color: #fff; margin-bottom: 1.25rem; }
.auth-brand .crest { width: 72px; height: 72px; font-size: 1.3rem; border-radius: 18px; margin: 0 auto .75rem; }
.auth-brand h1 { font-size: 1.5rem; font-weight: 800; margin: 0; }
.auth-brand p { margin: .15rem 0 0; opacity: .85; }
.auth-card { width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.auth-foot { color: rgba(255, 255, 255, .75); font-size: .82rem; margin: 1.25rem 0 0; text-align: center; }

/* ---------- print ---------- */
@media print {
    .sidebar, .topbar, .sidebar-overlay, .no-print, .filter-bar, .list-footer, .page-head .btn, .row-actions, .alert, .pagination, .toast-container { display: none !important; }
    .main-area { margin-left: 0 !important; } body { background: #fff; } .content { padding: 0; max-width: none; }
    .card-soft, .stat-card { box-shadow: none; border-color: #bbb; break-inside: avoid; }
    .table-modern thead th { background: #eee !important; } a { color: inherit; }
}

/* ---------- cashier desk ---------- */
.total-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--primary-50); border: 1px dashed rgba(var(--primary-rgb), .4); border-radius: 12px; padding: .8rem 1rem; }
.pay-link { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
