/* ==========================================================================
   SNA SPARSH PORTAL — application styles
   Framework-free visual layer on top of Bootstrap 5
   ========================================================================== */

:root {
    --sna-navy: #1e3a8a;
    --sna-navy-700: #1e40af;
    --sna-blue: #2563eb;
    --sna-sky: #0284c7;
    --sna-gold: #f59e0b;
    --sna-gold-soft: #fef3c7;
    --sna-green: #10b981;
    --sna-green-soft: #ecfdf5;
    --sna-red: #dc2626;
    --sna-red-soft: #fef2f2;
    --sna-pink: #9d174d;
    --sna-ink: #0f172a;
    --sna-muted: #64748b;
    --sna-line: #dbe3ef;
    --sna-surface: #ffffff;
    --sna-canvas: #f1f5f9;
    --sna-radius: 14px;
    --sna-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --sna-shadow-sm: 0 6px 18px rgba(30, 58, 138, 0.08);
    --sna-font: "Nirmala UI", "Noto Sans Gujarati", "Anek Gujarati", "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    font-family: var(--sna-font);
    color: var(--sna-ink);
    background: var(--sna-canvas);
}

.app-body {
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(37, 99, 235, 0.10), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(2, 132, 199, 0.08), transparent 60%),
        var(--sna-canvas);
}

a {
    text-decoration: none;
}

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 22px;
    color: #fff;
    background: linear-gradient(110deg, #172554 0%, #1e3a8a 42%, #1d4ed8 78%, #0284c7 100%);
    border-bottom: 4px solid var(--sna-gold);
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.18);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: #1e3a8a;
    background: linear-gradient(135deg, #fde047, #f59e0b);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.18);
    flex: 0 0 auto;
}

.brand-title {
    font-weight: 800;
    font-size: 1.02rem;
    line-height: 1.15;
    letter-spacing: 0.01em;
}

.brand-sub {
    font-size: 0.72rem;
    font-weight: 600;
    color: #dbeafe;
    margin-top: 2px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 12px 5px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    max-width: 380px;
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #fde047;
    color: #1e3a8a;
    font-weight: 900;
    flex: 0 0 auto;
}

.user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

.user-name {
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-sub {
    font-size: 0.66rem;
    font-weight: 600;
    color: #cfe0ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   Shell / cards
   -------------------------------------------------------------------------- */
.app-shell {
    width: 100%;
    max-width: 1560px;
    margin: 0 auto;
    padding: 18px 20px 26px;
}

.app-card {
    background: var(--sna-surface);
    border: 2px solid rgba(30, 58, 138, 0.85);
    border-radius: var(--sna-radius);
    box-shadow: var(--sna-shadow);
    overflow: hidden;
}

.app-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px 14px;
    background:
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border-bottom: 1px solid var(--sna-line);
}

.app-title {
    margin: 0;
    font-size: 1.28rem;
    font-weight: 900;
    color: var(--sna-navy);
    letter-spacing: 0.01em;
}

.app-subtitle {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: var(--sna-muted);
    font-weight: 500;
}

.head-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.fy-badge,
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.fy-badge {
    background: var(--sna-gold-soft);
    color: #92400e;
    border: 1px solid #fcd34d;
}

.role-badge {
    background: #dbeafe;
    color: var(--sna-navy);
    border: 1px solid #93c5fd;
}

.role-badge.role-admin {
    background: #ede9fe;
    color: #5b21b6;
    border-color: #c4b5fd;
}

.role-badge.role-school {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.role-badge.role-viewer {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

.app-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 18px;
    background: #eaf0f9;
    border-bottom: 2px solid var(--sna-navy);
    scrollbar-width: thin;
}

.app-tab {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 11px 18px 10px;
    border-radius: 10px 10px 0 0;
    color: var(--sna-navy);
    border: 1px solid transparent;
    border-bottom: none;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
    white-space: nowrap;
}

.app-tab:hover {
    background: rgba(255, 255, 255, 0.65);
    color: var(--sna-blue);
}

.app-tab.active {
    background: var(--sna-navy);
    color: #fff;
    box-shadow: 0 -4px 14px rgba(30, 58, 138, 0.22);
}

.app-tab-label {
    font-size: 0.86rem;
    font-weight: 800;
}

.app-tab-hint {
    font-size: 0.64rem;
    font-weight: 600;
    opacity: 0.72;
}

.app-content {
    padding: 18px 20px 24px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 240px);
    min-height: 420px;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 4px 0;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 600;
}

.tab-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --------------------------------------------------------------------------
   Panels
   -------------------------------------------------------------------------- */
.panel-card {
    background: #fff;
    border: 1px solid var(--sna-line);
    border-radius: 12px;
    box-shadow: var(--sna-shadow-sm);
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 18px 12px;
    border-bottom: 1px solid #e8eef7;
    background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.panel-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 900;
    color: var(--sna-navy);
}

.panel-head p {
    margin: 3px 0 0;
    font-size: 0.76rem;
    color: var(--sna-muted);
    line-height: 1.4;
}

.panel-body {
    padding: 18px;
}

.panel-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: var(--sna-navy);
    border: 1px solid #93c5fd;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.panel-tag-purple {
    background: #f3e8ff;
    color: #6b21a8;
    border-color: #d8b4fe;
}

.panel-tag-teal {
    background: #ccfbf1;
    color: #115e59;
    border-color: #5eead4;
}

.panel-tag-gold {
    background: var(--sna-gold-soft);
    color: #92400e;
    border-color: #fcd34d;
}

.guide-banner {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 16px;
    border-radius: 12px;
    background: linear-gradient(120deg, #eff6ff 0%, #f0f9ff 55%, #fefce8 100%);
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    font-size: 0.8rem;
    line-height: 1.45;
    font-weight: 500;
}

.guide-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--sna-navy);
    color: #fde047;
    font-weight: 900;
    flex: 0 0 auto;
    box-shadow: 0 4px 10px rgba(30, 58, 138, 0.22);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-label {
    margin-bottom: 4px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #334155;
    text-transform: uppercase;
}

.form-control,
.form-select {
    border: 1.6px solid #bfdbfe;
    border-radius: 9px;
    color: var(--sna-ink);
    font-size: 0.86rem;
    font-weight: 500;
    background-color: #fff;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--sna-gold);
    box-shadow: 0 0 0 0.22rem rgba(245, 158, 11, 0.20);
    background-color: #fffdf5;
}

.form-control[readonly] {
    background-color: #f8fafc;
    color: #334155;
}

.form-control.text-uppercase,
.text-uppercase {
    text-transform: uppercase;
}

.form-hint {
    margin-top: 5px;
    font-size: 0.7rem;
    color: var(--sna-muted);
    font-weight: 500;
}

.input-group-lg > .form-control {
    font-size: 1rem;
    letter-spacing: 0.05em;
}

.lookup-message {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: var(--sna-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.lookup-message.lookup-ok {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}

.lookup-message.lookup-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.lookup-message strong {
    font-weight: 900;
}

.info-tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.info-label {
    font-size: 0.66rem;
    font-weight: 800;
    color: var(--sna-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.info-value {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--sna-navy);
    word-break: break-word;
}

/* --------------------------------------------------------------------------
   Budget matrix
   -------------------------------------------------------------------------- */
.budget-table {
    font-size: 0.78rem;
}

.budget-table thead th {
    background: #eef4ff;
    color: var(--sna-navy);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid #bfdbfe;
    padding: 9px 12px;
    white-space: nowrap;
}

.budget-table tbody td {
    padding: 8px 12px;
    vertical-align: middle;
}

.budget-table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.budget-table tbody tr:hover {
    background: #eff6ff;
}

.budget-table tbody tr.is-selected {
    background: #dbeafe;
    box-shadow: inset 4px 0 0 var(--sna-blue);
}

.head-name {
    font-weight: 800;
    color: #1e293b;
}

.amount {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    white-space: nowrap;
}

.amount-positive {
    color: #166534;
}

.amount-negative {
    color: #b91c1c;
}

.amount-muted {
    color: #94a3b8;
}

.use-head-btn {
    border-radius: 999px;
    padding: 3px 12px;
    font-size: 0.66rem;
    font-weight: 800;
}

/* --------------------------------------------------------------------------
   Stats / totals
   -------------------------------------------------------------------------- */
.stat-box {
    height: 100%;
    padding: 13px 16px;
    border-radius: 11px;
    border: 1.6px solid transparent;
    text-align: center;
}

.stat-approved {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e40af;
}

.stat-expenses {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

.stat-pending {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}

.stat-label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.85;
}

.stat-value {
    margin-top: 3px;
    font-size: 1.32rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.bill-totals {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
    padding: 14px;
    border-radius: 12px;
    background: #f8fafc;
    border: 2px solid #dbeafe;
}

.total-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 12px;
    border-radius: 9px;
    background: #fff;
    border: 1px solid #e2e8f0;
}

.total-label {
    font-size: 0.66rem;
    font-weight: 800;
    color: var(--sna-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.total-value {
    font-size: 1.08rem;
    font-weight: 900;
    color: var(--sna-navy);
    font-variant-numeric: tabular-nums;
}

.total-60 .total-value {
    color: var(--sna-navy-700);
}

.total-40 .total-value {
    color: var(--sna-pink);
}

.total-remaining .total-value {
    color: #047857;
}

.total-remaining.is-negative .total-value {
    color: #b91c1c;
}

/* --------------------------------------------------------------------------
   Parties
   -------------------------------------------------------------------------- */
.parties-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 22px 0 12px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.parties-header h3 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 900;
    color: var(--sna-navy);
}

.parties-header p {
    margin: 3px 0 0;
    font-size: 0.74rem;
    color: var(--sna-muted);
}

.party-row {
    position: relative;
    margin-bottom: 12px;
    padding: 14px 15px 12px;
    border: 1.6px solid #bfdbfe;
    border-left: 5px solid var(--sna-blue);
    border-radius: 11px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.06);
}

.party-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.party-number {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.72rem;
    font-weight: 900;
    color: var(--sna-navy);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.party-number span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--sna-navy);
    color: #fff;
    font-size: 0.68rem;
}

.party-remove {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 7px;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 4px 10px;
}

.party-remove:hover {
    background: #fee2e2;
}

.party-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 10px;
}

.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }
.span-2 { grid-column: span 2; }
.span-6 { grid-column: span 6; }

.party-grid .form-label {
    font-size: 0.64rem;
}

.auto-60-input {
    background: #dbeafe !important;
    border-color: #93c5fd !important;
    color: #1e40af !important;
    font-weight: 900 !important;
    text-align: right;
}

.auto-40-input {
    background: #fce7f3 !important;
    border-color: #f9a8d4 !important;
    color: #9d174d !important;
    font-weight: 900 !important;
    text-align: right;
}

.submit-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */
.empty-state {
    padding: 48px 20px;
    text-align: center;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    color: var(--sna-muted);
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: #eff6ff;
    color: var(--sna-blue);
}

.empty-icon svg {
    width: 32px;
    height: 32px;
}

.empty-state h2 {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--sna-navy);
}

.empty-state p {
    max-width: 560px;
    margin: 0 auto;
    font-size: 0.8rem;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Toolbars (BMIS / system check)
   -------------------------------------------------------------------------- */
.toolbar-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-radius: 12px;
    background: linear-gradient(110deg, #172554 0%, #1e3a8a 55%, #1d4ed8 100%);
    color: #fff;
    border-bottom: 4px solid var(--sna-gold);
    box-shadow: var(--sna-shadow-sm);
}

.toolbar-left h2 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 900;
}

.toolbar-left p {
    margin: 3px 0 0;
    font-size: 0.72rem;
    color: #dbeafe;
    font-weight: 600;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-card {
    border-color: #dbeafe;
}

/* --------------------------------------------------------------------------
   BMIS printable area
   -------------------------------------------------------------------------- */
.bmis-print-area {
    padding: 16px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--sna-line);
    box-shadow: var(--sna-shadow-sm);
}

.bmis-print-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border-radius: 9px;
    color: #fff;
    background: linear-gradient(100deg, #1e3a8a 0%, #2563eb 65%, #0284c7 100%);
    border-bottom: 4px solid var(--sna-gold);
    margin-bottom: 14px;
}

.bmis-print-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.bmis-print-header p {
    margin: 3px 0 0;
    font-size: 0.7rem;
    color: #dbeafe;
    font-weight: 600;
}

.bmis-print-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #e0f2fe;
    text-align: right;
}

.bmis-print-meta strong {
    color: #fde047;
    font-weight: 900;
}

.bmis-summary-cards {
    margin-bottom: 14px;
}

.bmis-table-wrap {
    max-height: 520px;
    border: 1px solid #dbeafe;
    border-radius: 9px;
}

.bmis-table-wrap table {
    margin: 0;
}

.bmis-table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #eef4ff;
    color: var(--sna-navy);
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 7px 8px;
}

.bmis-table-wrap tbody td {
    font-size: 0.72rem;
    padding: 6px 8px;
    vertical-align: middle;
}

.bmis-table-wrap tfoot td {
    font-size: 0.72rem;
    padding: 7px 8px;
    background: #e2e8f0;
}

.util-bar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    font-size: 0.66rem;
    padding: 2px 7px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
}

.util-bar.is-over {
    background: #fee2e2;
    color: #991b1b;
}

.util-bar.is-full {
    background: #dcfce7;
    color: #166534;
}

.bmis-analytics {
    margin-top: 16px;
}

.chart-card {
    height: 100%;
    padding: 14px;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    background: #fff;
}

.chart-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.chart-head h3 {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 900;
    color: var(--sna-navy);
}

.chart-head span {
    font-size: 0.66rem;
    color: var(--sna-muted);
    font-weight: 600;
}

.chart-wrap {
    position: relative;
    height: 340px;
}

.head-summary-table {
    font-size: 0.68rem;
    max-height: 340px;
}

.head-summary-table thead th {
    background: #eef4ff;
    color: var(--sna-navy);
    font-size: 0.6rem;
    font-weight: 900;
    text-transform: uppercase;
    white-space: nowrap;
}

.head-summary-table tbody td {
    padding: 4px 6px;
    vertical-align: middle;
}

.head-summary-table tfoot td {
    background: #e2e8f0;
    font-weight: 900;
}

.history-table {
    font-size: 0.72rem;
}

.history-table thead th {
    background: #eef4ff;
    color: var(--sna-navy);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Users / system check
   -------------------------------------------------------------------------- */
.user-status {
    display: inline-flex;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.user-status.active {
    background: #dcfce7;
    color: #166534;
}

.user-status.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.role-pill {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 900;
    background: #e0e7ff;
    color: #3730a3;
}

.system-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.sys-card {
    padding: 14px;
    border-radius: 11px;
    border: 1.6px solid transparent;
}

.sys-card h3 {
    margin: 0 0 8px;
    font-size: 0.8rem;
    font-weight: 900;
}

.sys-card .sys-value {
    font-size: 1.45rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.sys-card.sys-ok {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}

.sys-card.sys-warn {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

.sys-card.sys-error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

.sys-table {
    font-size: 0.74rem;
}

.sys-table thead th {
    background: #eef4ff;
    color: var(--sna-navy);
    font-size: 0.62rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.sys-alert {
    padding: 12px 14px;
    border-radius: 9px;
    font-size: 0.76rem;
    font-weight: 600;
}

.sys-alert ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

/* --------------------------------------------------------------------------
   Alerts / utilities
   -------------------------------------------------------------------------- */
.alert {
    border-radius: 10px;
    font-size: 0.8rem;
    border-width: 1.5px;
}

.btn {
    border-radius: 9px;
    font-size: 0.82rem;
}

.btn-lg {
    font-size: 0.92rem;
}

.btn-primary {
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(180deg, #1d4ed8, #1e40af);
    border-color: #1e40af;
}

.table > :not(caption) > * > * {
    border-color: #e2e8f0;
}

.text-end { text-align: right !important; }
.text-center { text-align: center !important; }
.fw-bold { font-weight: 800 !important; }
.fw-semibold { font-weight: 700 !important; }

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.login-body {
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(135deg, #172554 0%, #1e3a8a 43%, #1d4ed8 72%, #0284c7 100%);
    overflow-x: hidden;
}

.login-backdrop {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.login-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    opacity: 0.35;
    animation: floatOrb 12s ease-in-out infinite;
}

.login-orb-1 {
    width: 420px;
    height: 420px;
    top: -160px;
    right: -100px;
    background: radial-gradient(circle at 30% 30%, #38bdf8, transparent 70%);
}

.login-orb-2 {
    width: 360px;
    height: 360px;
    bottom: -120px;
    left: -100px;
    background: radial-gradient(circle at 60% 40%, #f59e0b, transparent 70%);
    animation-delay: -4s;
}

.login-orb-3 {
    width: 240px;
    height: 240px;
    top: 45%;
    left: 55%;
    background: radial-gradient(circle at 50% 50%, #22d3ee, transparent 70%);
    animation-delay: -8s;
}

@keyframes floatOrb {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(0, -18px, 0) scale(1.05); }
}

.login-shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 28px 16px 18px;
}

.login-card {
    width: 100%;
    max-width: 470px;
    padding: 30px 32px 22px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.45);
    border-top: 5px solid var(--sna-gold);
    backdrop-filter: blur(12px);
}

.login-brand {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.login-logo {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #fde047;
    box-shadow: 0 8px 18px rgba(30, 58, 138, 0.32);
    flex: 0 0 auto;
}

.login-logo svg {
    width: 30px;
    height: 30px;
}

.login-brand h1 {
    margin: 0;
    font-size: 1.22rem;
    font-weight: 900;
    color: var(--sna-navy);
    letter-spacing: 0.01em;
}

.login-subtitle {
    margin: 2px 0 0;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--sna-blue);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.login-block {
    margin: 3px 0 0;
    font-size: 0.68rem;
    color: #64748b;
    font-weight: 600;
}

.sys-status-bar {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    margin-bottom: 16px;
    border-radius: 9px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 0.7rem;
    font-weight: 700;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    flex: 0 0 auto;
}

.sys-status-bar.sys-ok {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}

.sys-status-bar.sys-ok .status-dot {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}

.sys-status-bar.sys-warn {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

.sys-status-bar.sys-warn .status-dot {
    background: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
}

.sys-status-bar.sys-error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

.sys-status-bar.sys-error .status-dot {
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18);
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap .form-control {
    padding-left: 42px;
    padding-right: 42px;
    height: 46px;
    font-weight: 600;
}

.login-input-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #64748b;
    z-index: 2;
    pointer-events: none;
}

.login-input-icon svg {
    width: 18px;
    height: 18px;
}

.login-eye {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 7px;
    z-index: 2;
}

.login-eye:hover {
    background: #f1f5f9;
    color: var(--sna-navy);
}

.login-eye svg {
    width: 19px;
    height: 19px;
}

.login-eye.is-visible {
    color: var(--sna-blue);
}

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    border: none;
    border-radius: 10px;
    font-weight: 900;
    font-size: 0.9rem;
    color: #fff;
    background: linear-gradient(110deg, #1e3a8a, #2563eb 55%, #0284c7);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-login:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.36);
}

.btn-login svg {
    width: 18px;
    height: 18px;
}

.login-demo {
    margin-top: 18px;
    padding: 11px 13px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
}

.login-demo-title {
    font-size: 0.64rem;
    font-weight: 900;
    color: #475569;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.login-demo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 12px;
    font-size: 0.66rem;
    color: #64748b;
    font-weight: 600;
}

.login-demo-grid strong {
    color: #334155;
}

.login-foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    font-size: 0.62rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.login-copyright {
    margin: 16px 0 0;
    color: #dbeafe;
    font-size: 0.68rem;
    font-weight: 600;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
    .app-topbar {
        position: relative;
        flex-wrap: wrap;
        padding: 12px 14px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .user-chip {
        max-width: 100%;
    }

    .app-shell {
        padding: 12px 10px 20px;
    }

    .app-card-head {
        flex-direction: column;
    }

    .head-badges {
        justify-content: flex-start;
    }

    .app-content {
        padding: 14px 12px 20px;
    }

    .bill-totals {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .system-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .party-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .span-4,
    .span-3,
    .span-2,
    .span-6 {
        grid-column: span 6;
    }

    .chart-wrap {
        height: 280px;
    }
}

@media (max-width: 576px) {
    .brand-sub {
        display: none;
    }

    .app-tab-hint {
        display: none;
    }

    .app-tab {
        padding: 10px 14px;
    }

    .login-card {
        padding: 24px 20px 18px;
    }

    .login-brand {
        flex-direction: column;
    }

    .login-demo-grid {
        grid-template-columns: 1fr;
    }

    .bill-totals,
    .system-summary {
        grid-template-columns: 1fr;
    }

    .party-grid {
        grid-template-columns: 1fr;
    }

    .span-4,
    .span-3,
    .span-2,
    .span-6 {
        grid-column: span 1;
    }

    .toolbar-actions {
        width: 100%;
    }

    .toolbar-actions .btn {
        flex: 1 1 auto;
    }
}

@media print {
    .app-topbar,
    .app-tabs,
    .app-footer,
    .toolbar-card,
    .filter-card,
    .no-print {
        display: none !important;
    }

    .app-shell,
    .app-content {
        padding: 0 !important;
        background: #fff !important;
    }

    .app-card,
    .panel-card {
        border: none !important;
        box-shadow: none !important;
    }
}
