/* ============ Theme ============ */
:root {
    --primary: #1d4ed8;
    --primary-600: #2563eb;
    --primary-dark: #1e3a8a;
    --primary-soft: #eff6ff;
    --accent: #0d9488;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --text-2: #1e293b;
    --muted: #475569;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --field-border: #94a3b8;
    --sidebar-w: 248px;
    --topbar-h: 58px;
    --bottom-h: 64px;
    --radius: 12px;

    --bs-body-color: #0f172a;
    --bs-body-bg: #f1f5f9;
    --bs-secondary-color: #475569;
    --bs-emphasis-color: #0f172a;
    --bs-primary: #1d4ed8;
    --bs-primary-rgb: 29, 78, 216;
    --bs-link-color: #1d4ed8;
    --bs-link-color-rgb: 29, 78, 216;
    --bs-link-hover-color: #1e3a8a;
    --bs-border-color: #e2e8f0;
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    --bs-body-font-size: .9rem;
}

body { background: var(--bg); color: var(--text); -webkit-tap-highlight-color: transparent; }
a { text-decoration: none; }
.text-muted, .text-secondary { color: var(--muted) !important; }
.fw-semibold { font-weight: 600 !important; }
[x-cloak] { display: none !important; }

.btn { border-radius: 8px; font-weight: 600; font-size: .875rem; padding: .5rem .95rem; }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; border-radius: 6px; }
.btn-lg { padding: .7rem 1.2rem; font-size: 1rem; border-radius: 10px; }
.btn-primary {
    --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark); --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-dark); --bs-btn-active-border-color: var(--primary-dark);
    --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: #93c5fd;
    --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary);
    --bs-btn-active-bg: var(--primary); --bs-btn-active-border-color: var(--primary);
}
.btn-success { --bs-btn-bg: #15803d; --bs-btn-border-color: #15803d; --bs-btn-hover-bg: #166534; --bs-btn-hover-border-color: #166534; }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--border-strong); --bs-btn-color: var(--text-2); --bs-btn-hover-bg: #f8fafc; --bs-btn-hover-border-color: #94a3b8; }
.btn-outline-secondary { --bs-btn-color: var(--text-2); --bs-btn-border-color: var(--border-strong); }
.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }
.text-bg-primary { background-color: var(--primary) !important; }
.text-bg-purple { background: #6d28d9 !important; color: #fff !important; }
.text-bg-warning { background: #f59e0b !important; color: #1f2937 !important; }
.text-bg-light { background: #e2e8f0 !important; color: #0f172a !important; }
.bg-brand-soft { background: var(--primary-soft); }
.text-success { color: #15803d !important; }
.text-danger { color: #b91c1c !important; }

/* ============ Sidebar ============ */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--border); z-index: 1030;
}
.brand { display: flex; align-items: center; gap: .65rem; padding: 0 1.1rem; height: var(--topbar-h); color: var(--text); font-weight: 800; font-size: 1rem; border-bottom: 1px solid var(--border); }
.brand-icon {
    width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; flex-shrink: 0; font-size: 1rem;
}
.nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; font-weight: 700; padding: 1rem 1.2rem .35rem; }
.nav-link-item {
    display: flex; align-items: center; gap: .7rem; padding: .5rem .8rem; margin: 1px .6rem; border-radius: 8px;
    color: var(--text-2); font-weight: 500; font-size: .9rem;
}
.nav-link-item i { font-size: 1.05rem; width: 1.2rem; text-align: center; color: #64748b; }
.nav-link-item:hover { background: #f1f5f9; color: var(--text); }
.nav-link-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-link-item.active i { color: var(--primary); }
.mobile-menu .nav-link-item { padding: .65rem .8rem; margin: 1px 0; }
.mobile-menu .nav-group { padding-left: .8rem; }
.mobile-menu .brand { border: 0; height: auto; padding: 0; }

/* ============ Top bar ============ */
.main-wrap { min-height: 100vh; }
@media (min-width: 992px) { .main-wrap { margin-left: var(--sidebar-w); } }
.topbar {
    position: sticky; top: 0; z-index: 1020; height: var(--topbar-h); display: flex; align-items: center; gap: .5rem;
    padding: 0 1rem; background: linear-gradient(90deg, var(--primary-dark), var(--primary)); color: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .15);
}
.topbar-title { font-size: 1.05rem; font-weight: 700; margin: 0; flex: 0 1 auto; color: #fff; }
.topbar-btn {
    border: 0; background: transparent; width: 40px; height: 40px; border-radius: 10px; display: inline-flex;
    align-items: center; justify-content: center; font-size: 1.3rem; color: #fff;
}
.topbar-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.topbar-search { margin-left: auto; position: relative; align-items: center; width: 360px; }
.topbar-search i { position: absolute; left: .8rem; color: #64748b; }
.topbar-search input { padding-left: 2.2rem; border-radius: 8px; background: #fff; border: 0; height: 38px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--primary); font-size: .95rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.party-avatar { background: var(--primary); color: #fff; }
.impersonate-bar { background: #b45309; color: #fff; text-align: center; padding: .35rem; font-size: .85rem; }

/* ============ Page ============ */
.content { padding: 1rem; max-width: 1500px; }
@media (min-width: 992px) { .content { padding: 1.25rem 1.5rem; } }
@media (max-width: 991.98px) { .content { padding-bottom: calc(var(--bottom-h) + 1.5rem + env(safe-area-inset-bottom)); } }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; justify-content: flex-end; }
.page-actions form { display: inline-flex; }
@media (max-width: 575.98px) { .page-actions { flex-wrap: nowrap; overflow-x: auto; justify-content: stretch; } .page-actions > * { flex: 1 0 auto; } .page-actions .btn { width: 100%; white-space: nowrap; } }

.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { background: #f8fafc; border-bottom: 1px solid var(--border); font-weight: 700; padding: .75rem 1rem; color: var(--text); font-size: .92rem; }
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.section-title { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin: 0 0 .6rem; }
.list-group-item { color: var(--text); border-color: var(--border); }

/* stat tiles */
.stat { display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; height: 100%; color: var(--text); position: relative; overflow: hidden; }
.stat .stat-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stat .stat-value { font-size: 1.35rem; font-weight: 800; line-height: 1.3; color: var(--text); }
.stat .stat-sub { font-size: .75rem; color: var(--muted); }
.stat .stat-icon { position: absolute; right: .8rem; top: .8rem; width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; }
a.stat:hover { border-color: #93c5fd; box-shadow: 0 4px 12px rgba(29,78,216,.1); }
.soft-primary { background: #dbeafe; color: #1e40af; } .soft-success { background: #dcfce7; color: #166534; }
.soft-warning { background: #fef3c7; color: #92400e; } .soft-danger { background: #fee2e2; color: #991b1b; }
.soft-info { background: #ccfbf1; color: #115e59; } .soft-purple { background: #ede9fe; color: #5b21b6; }
.soft-secondary { background: #e2e8f0; color: #1e293b; }

.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
@media (min-width: 768px) { .quick-actions { grid-template-columns: repeat(8, 1fr); } }
.quick-actions a { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .3rem; text-align: center; color: var(--text); font-size: .75rem; font-weight: 600; }
.quick-actions a:hover { border-color: #93c5fd; }
.quick-actions a i { display: flex; align-items: center; justify-content: center; margin: 0 auto .35rem; width: 40px; height: 40px; border-radius: 10px; font-size: 1.2rem; }

/* ============ Excel style grid ============ */
.grid-card { background: #fff; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.grid-wrap { overflow: auto; max-height: 72vh; -webkit-overflow-scrolling: touch; }
.xl-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .84rem; margin: 0; color: var(--text); }
.xl-table th, .xl-table td { white-space: nowrap; padding: .45rem .7rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); vertical-align: middle; }
.xl-table th:last-child, .xl-table td:last-child { border-right: 0; }
.xl-table thead th {
    position: sticky; top: 0; z-index: 2; background: #e8eef7; color: var(--text); font-weight: 700; font-size: .78rem;
    border-bottom: 1px solid var(--border-strong); text-transform: none; letter-spacing: 0;
}
.xl-table tbody tr:nth-child(even) td { background: #f8fafc; }
.xl-table tbody tr:hover td { background: #eaf2ff; }
.xl-table tbody td { background: #fff; }
.xl-table .col-sn { width: 44px; text-align: center; color: #64748b; font-size: .76rem; background: #f1f5f9 !important; }
.xl-table thead .col-sn { background: #dde5f1; }
.xl-table .sticky-col { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--border-strong); }
.xl-table thead .sticky-col { z-index: 3; }
.xl-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.xl-table tfoot td { position: sticky; bottom: 0; background: #e8eef7 !important; font-weight: 700; border-top: 1px solid var(--border-strong); }
.xl-table a { font-weight: 600; }
.xl-table .wrap { white-space: normal; min-width: 180px; }
.xl-table tr.row-muted td { color: #94a3b8; text-decoration: line-through; }
.xl-table tr[data-href] { cursor: pointer; }
.xl-table .badge { font-size: .72rem; }
.xl-table .actions { text-align: right; }
.xl-table .actions .btn { padding: .15rem .45rem; }
.th-sort { color: inherit !important; display: inline-flex; align-items: center; gap: .25rem; font-weight: 700 !important; }
.th-sort i { font-size: .7rem; color: #94a3b8; }
.th-sort.active i { color: var(--primary); }
.grid-empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.grid-empty i { font-size: 2rem; display: block; margin-bottom: .4rem; opacity: .5; }
.pager-bar { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; margin-top: .75rem; flex-wrap: wrap; }
.pager-bar nav { max-width: 100%; }
.pagination { flex-wrap: wrap; margin: 0; }
.page-link { color: var(--primary); }
.active > .page-link { background: var(--primary); border-color: var(--primary); }
.totals-strip { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; padding: .6rem .9rem; background: #f8fafc; border-bottom: 1px solid var(--border); font-size: .84rem; }
.totals-strip b { color: var(--text); }

/* simple tables inside cards (show pages) */
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .55rem .75rem; vertical-align: middle; }
.table thead th { font-size: .76rem; color: var(--text-2); font-weight: 700; background: #f1f5f9; white-space: nowrap; }

/* ============ Filter panel ============ */
.filter-panel { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: .65rem; }
.filter-top { display: flex; gap: .5rem; align-items: center; }
.filter-search { position: relative; flex: 1 1 auto; }
.filter-search i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: #64748b; }
.filter-search input { padding-left: 2.2rem; }
.filter-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; margin-top: .65rem; padding-top: .65rem; border-top: 1px dashed var(--border); }
.filter-field label { display: block; font-size: .74rem; font-weight: 700; color: var(--text-2); margin-bottom: .2rem; }
.filter-field .form-control, .filter-field .form-select { min-height: 38px; height: 38px; padding-top: .35rem; padding-bottom: .35rem; font-size: .85rem; }
.filter-field .ts-wrapper .ts-control, .filter-field .ts-wrapper.form-select .ts-control { min-height: 38px !important; padding: .35rem 2rem .35rem .65rem !important; font-size: .85rem; }
@media (max-width: 767.98px) { .filter-fields { grid-template-columns: 1fr 1fr; } .filter-field-wide { grid-column: 1 / -1; } }
.chip-tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: .75rem; scrollbar-width: none; }
.chip-tabs::-webkit-scrollbar { display: none; }
.chip-tabs a { white-space: nowrap; padding: .32rem .8rem; border-radius: 99px; background: #fff; color: var(--text-2); font-size: .82rem; font-weight: 600; border: 1px solid var(--border-strong); }
.chip-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============ Forms ============ */
.form-control, .form-select {
    border-radius: 8px; padding: .6rem .8rem; border: 1px solid var(--field-border); color: var(--text); min-height: 44px;
    background-color: #fff; font-size: .92rem; box-shadow: 0 1px 1px rgba(15,23,42,.04);
}
.form-select { padding-right: 2.2rem; }
.form-control:hover, .form-select:hover { border-color: #64748b; }
.form-control[readonly], .form-control:disabled, .form-select:disabled { background-color: #f1f5f9; color: #475569; }
.form-control-sm, .form-select-sm { min-height: 34px; padding: .3rem .55rem; font-size: .84rem; }
textarea.form-control { min-height: 70px; }
.form-control::placeholder { color: #8a96a8; }
.form-control:focus, .form-select:focus { border-color: var(--primary-600); box-shadow: 0 0 0 3px rgba(37,99,235,.18); outline: 0; }
.form-control-lg, .form-select-lg { min-height: 48px; font-size: 1.05rem; font-weight: 600; }
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .35rem; color: var(--text); }
.form-label .req, .req { color: #dc2626; margin-left: 2px; }
.form-text { color: var(--muted); font-size: .76rem; }
.form-check-input { border-color: #94a3b8; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-label { color: var(--text-2); }
.input-group-text { background: #f1f5f9; border-color: var(--field-border); color: var(--text); font-weight: 700; min-width: 40px; justify-content: center; }
.is-invalid { border-color: #dc2626 !important; }
@media (max-width: 767.98px) { .form-control, .form-select { font-size: 16px; } }

.form-shell { max-width: 1100px; margin: 0 auto; }
.form-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 1rem; }
.form-section { display: grid; grid-template-columns: 240px 1fr; gap: 1.5rem; padding: 1.25rem 1.25rem; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.fs-head h6 { font-weight: 700; color: var(--text); margin: 0 0 .25rem; font-size: .95rem; display: flex; align-items: center; gap: .45rem; }
.fs-head h6 i { color: var(--primary); }
.fs-head p { color: var(--muted); font-size: .8rem; margin: 0; }
@media (max-width: 767.98px) { .fs-head p { display: none; } .fs-head h6 { font-size: 1rem; } }
@media (max-width: 1199.98px) {
    .form-section { grid-template-columns: 1fr; gap: .75rem; padding: 1rem; }
    .fs-head .summary-box { display: inline-block; min-width: 200px; }
}
.choice-group { display: flex; flex-wrap: wrap; gap: .45rem; }
.choice-group .btn { font-weight: 600; }
.btn-check + .btn-outline-primary { background: #fff; color: var(--text); border: 1px solid var(--field-border); min-height: 42px; }
.btn-check + .btn-outline-primary:hover { border-color: var(--primary); color: var(--primary); background: #fff; }
.btn-check:checked + .btn-outline-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.summary-box { background: var(--primary-soft); border: 1px solid #bfdbfe; border-radius: 10px; padding: .75rem 1rem; }
.summary-box .kv { border-color: #bfdbfe; }

.form-actions {
    position: sticky; bottom: 0; z-index: 10; display: flex; gap: .6rem; justify-content: flex-end;
    background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .7rem; box-shadow: 0 -4px 16px rgba(15,23,42,.08);
}
.form-actions .btn { min-width: 140px; }
@media (max-width: 991.98px) {
    .form-actions { bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 6px); }
    .form-actions .btn { flex: 1; min-width: 0; }
}

.line-box { border: 1px solid var(--border-strong); border-radius: 10px; padding: .75rem; background: #fff; }
.line-box.on { border-color: var(--primary-600); background: #f8fbff; }

.badge { font-weight: 600; border-radius: 6px; padding: .35em .55em; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--border); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 700; text-align: right; color: var(--text); }
.amount-big { font-size: 1.5rem; font-weight: 800; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.4rem; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.timeline li::after { content: ''; position: absolute; left: 8px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty i { font-size: 2.2rem; display: block; margin-bottom: .5rem; opacity: .5; }
.att-btns .btn { min-width: 42px; }
.ts-wrapper.form-select, .ts-wrapper.form-control { padding: 0 !important; border: 0 !important; min-height: 0 !important; background: none !important; box-shadow: none !important; }
.ts-wrapper .ts-control, .ts-wrapper.form-select .ts-control, .ts-wrapper.form-control .ts-control, .ts-wrapper.form-select.single.input-active .ts-control, .ts-wrapper.single.input-active .ts-control {
    border: 1px solid var(--field-border) !important; border-radius: 8px !important; min-height: 44px; padding: .6rem 2.2rem .6rem .8rem !important;
    color: var(--text) !important; font-size: .92rem; box-shadow: 0 1px 1px rgba(15,23,42,.04) !important;
    background: #fff var(--bs-form-select-bg-img) no-repeat right .75rem center / 16px 12px !important;
}
.ts-wrapper.focus .ts-control, .ts-wrapper.form-select.focus .ts-control { border-color: var(--primary-600) !important; box-shadow: 0 0 0 3px rgba(37,99,235,.18) !important; }
.ts-wrapper .ts-control input { font-size: inherit !important; }
.ts-dropdown { border: 1px solid var(--field-border); border-radius: 8px; box-shadow: 0 8px 24px rgba(15,23,42,.15); }
.ts-dropdown .active { background: var(--primary-soft); color: var(--text); }
.ts-dropdown { color: var(--text); }

/* ============ Bottom navigation (phones) ============ */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-around; box-shadow: 0 -4px 16px rgba(15,23,42,.06);
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: #475569; font-size: .68rem; font-weight: 600; }
.bottom-nav a i { font-size: 1.25rem; }
.bottom-nav a.active { color: var(--primary); }
.bottom-nav .fab {
    width: 54px; height: 54px; border-radius: 16px; border: 0; margin-top: -26px; color: #fff; font-size: 1.6rem;
    background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: 0 8px 20px rgba(29,78,216,.35);
}
.quick-sheet { height: auto !important; border-radius: 18px 18px 0 0; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; padding-bottom: env(safe-area-inset-bottom); }
.quick-grid a { display: flex; flex-direction: column; align-items: center; gap: .35rem; color: var(--text); font-size: .75rem; font-weight: 600; text-align: center; }
.quick-grid a i { width: 50px; height: 50px; border-radius: 14px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; }

/* ============ Login ============ */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
    background: linear-gradient(160deg, var(--primary-dark) 0, var(--primary) 45%, var(--bg) 45.1%); }
.auth-card { width: 100%; max-width: 410px; }
.auth-card .brand-title { color: #fff; }

@media print {
    .sidebar, .topbar, .bottom-nav, .page-actions, .no-print, .filter-panel { display: none !important; }
    .main-wrap { margin: 0 !important; }
    .grid-wrap { max-height: none; overflow: visible; }
}

/* ============ Easy forms ============ */
.step { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
    background: var(--primary); color: #fff; font-size: .78rem; font-weight: 800; flex-shrink: 0; }
.btn-icon { width: 44px; min-height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.field-error { color: #b91c1c; font-size: .8rem; font-weight: 600; margin-top: .3rem; }
.size-rows { display: grid; gap: .5rem; }
.size-row { display: grid; grid-template-columns: 1fr 1fr 44px; gap: .5rem; }
.more-toggle { border: 0; background: none; padding: 0; font-weight: 700; color: var(--primary); font-size: .95rem; display: inline-flex; align-items: center; gap: .45rem; }
.more-section { background: #fafbfd; }
.form-section .row > [class*="col"] > .form-label:first-child { display: block; }
.invalid-feedback, .is-invalid ~ .invalid-feedback { font-weight: 600; }
.line-fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin-top: .7rem; }
@media (max-width: 575.98px) { .line-fields { grid-template-columns: 1fr 1fr; } }
.ts-wrapper.form-select.single .ts-control, .ts-wrapper.single .ts-control {
    background-image: var(--bs-form-select-bg-img, url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e")) !important;
    background-repeat: no-repeat !important; background-position: right .75rem center !important; background-size: 16px 12px !important;
}

/* ============ Attendance ============ */
.att-sheet th, .att-sheet td { padding: .35rem .4rem; min-width: 32px; }
.att-sheet .off-day { background: #eef4ff !important; }
.att-sheet thead .off-day { background: #dbe7ff !important; color: var(--primary); }
.att-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8rem; color: var(--text-2); }
.legend-box { display: inline-block; width: 14px; height: 14px; border: 1px solid #bfdbfe; border-radius: 3px; vertical-align: -2px; }
.legend-box.off-day { background: #dbe7ff; }
