:root {
    --tm-purple: #6657ff;
    --tm-teal: #11c5b4;
    --tm-green: #34c759;
    --tm-orange: #f5a85c;
    --tm-blue: #4f63ff;
    --tm-bg: #f4f7fb;
    --tm-white: #ffffff;
    --tm-text: #111827;
    --tm-muted: #6b7280;
    --tm-border: #e5eaf2;
    --tm-soft-blue: #eef0ff;
    --tm-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
    --tm-radius: 8px;
}

* { box-sizing: border-box; }

html {
    height: 100%;
    scroll-padding-top: 92px;
}

body {
    margin: 0;
    background: var(--tm-bg);
    color: var(--tm-text);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

a { text-decoration: none; }

.app-shell {
    display: block;
    min-height: 100vh;
    padding-top: 76px;
    padding-left: 260px;
    background: var(--tm-bg);
}

.topbar {
    background: var(--tm-white);
    border-bottom: 1px solid var(--tm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 34px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 76px;
    z-index: 1020;
}

.topbar,
.sidebar,
.content {
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}

.topbar-brand, .topbar-user, .brand-link {
    display: flex;
    align-items: center;
}

.brand-link {
    gap: 12px;
    color: var(--tm-purple);
    font-weight: 700;
    font-size: 22px;
}

.brand-link img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.brand-icon {
    font-size: 22px;
}

.icon-btn {
    border: 0;
    background: transparent;
    color: var(--tm-muted);
    width: 38px;
    height: 38px;
    border-radius: var(--tm-radius);
    margin-right: 10px;
}

.topbar-user {
    gap: 12px;
}

.user-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
}

.user-profile-link:hover .user-copy strong {
    color: var(--tm-purple);
}

.user-copy {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.user-copy strong {
    font-size: 13px;
    color: #0f172a;
    font-weight: 700;
}

.user-copy span {
    font-size: 13px;
    color: var(--tm-muted);
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #f2f4ff;
    border: 1px solid var(--tm-border);
    display: grid;
    place-items: center;
    color: var(--tm-purple);
    overflow: hidden;
    flex: 0 0 auto;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.logout-link {
    color: var(--tm-muted);
    padding: 8px;
}

.sidebar {
    background: var(--tm-white);
    border-right: 1px solid var(--tm-border);
    padding: 16px;
    position: fixed;
    top: 76px;
    left: 0;
    bottom: 0;
    width: 260px;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 1010;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #cfd7e6 transparent;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #cfd7e6;
    border-radius: 999px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: visible;
}

.nav-link {
    height: 50px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
    border-radius: 6px;
    color: #5f6b7a;
    font-size: 15px;
    font-weight: 500;
}

.nav-link span:first-of-type {
    flex: 1 1 auto;
    min-width: 0;
}

.nav-link i {
    width: 18px;
    color: #74808e;
}

.nav-badge {
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 87, 255, .12);
    color: var(--tm-purple);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.nav-link.active {
    background: var(--tm-soft-blue);
    color: var(--tm-purple);
    font-weight: 700;
}

.nav-link.active i {
    color: var(--tm-purple);
}

.nav-group {
    display: grid;
    gap: 4px;
}

.nav-link-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
}

.nav-caret {
    width: 14px !important;
    margin-left: auto;
    font-size: 12px;
    transition: transform .18s ease;
}

.nav-group.is-open .nav-caret,
.nav-submenu.is-open + .nav-caret {
    transform: rotate(180deg);
}

.nav-submenu {
    display: none;
    padding: 0 0 4px 44px;
    gap: 4px;
}

.nav-submenu.is-open {
    display: grid;
}

.nav-sublink {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border-radius: 8px;
    color: #667284;
    font-size: 14px;
    font-weight: 500;
}

.nav-sublink i {
    width: 16px;
    color: #8b94a3;
    font-size: 13px;
}

.nav-sublink.active {
    background: #f4f3ff;
    color: var(--tm-purple);
    font-weight: 700;
}

.nav-sublink.active i {
    color: var(--tm-purple);
}

.nav-section {
    margin: 26px 8px 10px;
    color: #3f4652;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.content {
    position: relative;
    padding: 24px;
    min-width: 0;
    width: 100%;
    min-height: calc(100vh - 76px);
    overflow: visible;
}

.panel-footer {
    padding: 16px 18px;
    border-top: 1px solid var(--tm-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
    gap: 16px;
}

.profile-photo-row {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px;
    border: 1px solid var(--tm-border);
    border-radius: 12px;
    background: #fbfcff;
}

.profile-photo-preview {
    width: 94px;
    height: 94px;
    border-radius: 50%;
    border: 4px solid #fff;
    background: linear-gradient(135deg, var(--tm-purple), var(--tm-teal));
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 34px;
    box-shadow: 0 14px 28px rgba(102, 87, 255, .2);
    overflow: hidden;
    flex: 0 0 auto;
}

.profile-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-name {
    color: #101827;
    font-size: 18px;
    font-weight: 800;
}

.profile-meta {
    color: var(--tm-muted);
    font-size: 13px;
    font-weight: 600;
}

.profile-upload-status {
    min-height: 18px;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
}

.pending-approval-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.pending-approval-banner strong {
    display: block;
    margin-bottom: 4px;
    color: #172033;
    font-size: 15px;
}

.page-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin: -24px -24px 16px;
    padding: 24px 24px 12px;
    position: sticky;
    top: 76px;
    z-index: 30;
    background: var(--tm-bg);
    border-bottom: 1px solid rgba(229, 234, 242, .72);
}

.page-title-row > div:last-child {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    flex: 0 0 auto;
}

.page-title-row .btn {
    white-space: nowrap;
}

.page-title h1 {
    font-size: 25px;
    font-weight: 700;
    margin: 0;
    color: #111827;
}

.page-title p {
    margin: 3px 0 0;
    color: var(--tm-muted);
    font-size: 13px;
}

.btn {
    border-radius: 7px;
    font-size: 13px;
    font-weight: 700;
    padding: 9px 14px;
}

.btn-primary {
    background: var(--tm-purple);
    border-color: var(--tm-purple);
}

.btn-light-action {
    background: #f4f6ff;
    border: 1px solid #dfe4ff;
    color: var(--tm-purple);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.kpi-card {
    min-height: 140px;
    color: #fff;
    border-radius: 12px;
    padding: 20px 18px;
    box-shadow: var(--tm-shadow);
    position: relative;
    overflow: hidden;
}

.kpi-card.purple { background: linear-gradient(135deg, #6b5cff, #5142d9); }
.kpi-card.teal { background: linear-gradient(135deg, #10c7b4, #04aa9f); }
.kpi-card.green { background: linear-gradient(135deg, #34c759, #18a84b); }
.kpi-card.orange { background: linear-gradient(135deg, #f9b765, #ef8654); }

.kpi-card:after {
    content: "";
    position: absolute;
    right: -22px;
    bottom: -28px;
    width: 110px;
    height: 110px;
    border: 8px solid rgba(255,255,255,.16);
    border-radius: 22px;
    transform: rotate(-16deg);
}

.kpi-card label {
    display: block;
    color: rgba(255,255,255,.68);
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 6px;
}

.kpi-card strong {
    display: block;
    font-size: 30px;
    font-weight: 800;
}

.kpi-card span {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 9px;
    border-radius: 6px;
    background: rgba(255,255,255,.22);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.panel {
    background: var(--tm-white);
    border: 1px solid var(--tm-border);
    border-radius: 12px;
    box-shadow: var(--tm-shadow);
}

.accounting-hero,
.accounting-two-grid,
.accounting-three-grid,
.compact-kpi-grid,
.accounting-section-stack {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.accounting-hero {
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
}

.hero-card,
.insight-card,
.compact-kpi {
    border-radius: 18px;
    padding: 22px;
    color: #fff;
    box-shadow: var(--tm-shadow);
    overflow: hidden;
    position: relative;
}

.hero-card {
    background: linear-gradient(135deg, #5346e8 0%, #1cbbb0 100%);
}

.hero-card::after,
.compact-kpi::after {
    content: "";
    position: absolute;
    right: -18px;
    bottom: -28px;
    width: 120px;
    height: 120px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    transform: rotate(18deg);
}

.insight-card {
    background: linear-gradient(180deg, #0f172a 0%, #16243b 100%);
}

.hero-card h2,
.insight-card h3,
.compact-kpi strong,
.compact-kpi label,
.compact-kpi span {
    position: relative;
    z-index: 1;
}

.hero-card h2,
.insight-card h3 {
    margin: 0 0 10px;
}

.hero-card h2 {
    font-size: 30px;
    line-height: 1.12;
}

.hero-card p,
.insight-card .account-line span,
.insight-card .account-line strong {
    color: rgba(255, 255, 255, 0.92);
}

.hero-card p {
    max-width: 70ch;
    margin: 0;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 12px;
    font-weight: 700;
}

.compact-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-kpi {
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.compact-kpi label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-weight: 800;
}

.compact-kpi strong {
    display: block;
    font-size: clamp(28px, 3vw, 44px);
    line-height: 1.04;
    margin-bottom: 12px;
}

.compact-kpi span {
    display: inline-flex;
    align-self: flex-start;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.18);
    font-size: 11px;
    font-weight: 700;
}

.accent-purple { background: linear-gradient(135deg, #6657ff 0%, #4f63ff 100%); }
.accent-orange { background: linear-gradient(135deg, #f5a85c 0%, #f38f49 100%); }
.accent-green { background: linear-gradient(135deg, #34c759 0%, #21a547 100%); }
.accent-teal { background: linear-gradient(135deg, #11c5b4 0%, #16a7d9 100%); }

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

.accounting-three-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel-header {
    padding: 18px 18px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.panel-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
}

.panel-header-copy {
    display: grid;
    gap: 4px;
}

.panel-subtitle {
    margin: 0;
    color: var(--tm-muted);
    font-size: 12px;
}

.panel-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.panel-body {
    padding: 18px;
}

.panel-body-soft {
    display: grid;
    gap: 14px;
}

.empty-state {
    display: grid;
    gap: 6px;
    padding: 18px;
    border: 1px dashed #d7def0;
    border-radius: 14px;
    background: linear-gradient(180deg, #fbfcff 0%, #f6f8fd 100%);
}

.empty-state strong {
    font-size: 14px;
    color: #172033;
}

.empty-state p {
    margin: 0;
    color: var(--tm-muted);
    line-height: 1.55;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.chart-box {
    min-height: 315px;
}

.table {
    margin-bottom: 0;
    color: #111827;
}

.table-responsive {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cfd7e6 transparent;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cfd7e6;
    border-radius: 999px;
}

.accounting-table-wrap {
    border-top: 1px solid var(--tm-border);
}

.accounting-table-wrap .table {
    min-width: 760px;
}

.table thead th {
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 800;
    background: #fbfcfe;
    border-bottom: 1px solid var(--tm-border);
    padding: 14px 16px;
}

.table tbody td {
    padding: 15px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--tm-border);
    font-size: 14px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-width: 66px;
    justify-content: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 700;
}

.status-paid { background: #dcfce7; color: #15803d; }
.status-partial { background: #fef3c7; color: #b45309; }
.status-pending { background: #e0f2fe; color: #0369a1; }
.status-active { background: #eef2ff; color: var(--tm-purple); }

.student-photo-col {
    width: 72px;
    min-width: 72px;
    max-width: 72px;
    text-align: center;
}

.student-avatar-thumb {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    display: inline-block !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    border: 1px solid #dfe4ff;
    background: #f7f8ff;
    box-shadow: 0 4px 10px rgba(79, 99, 255, .12);
}

.student-avatar-box {
    width: 42px !important;
    height: 42px !important;
    display: inline-grid !important;
    place-items: center !important;
    overflow: hidden !important;
    border-radius: 50% !important;
}

.student-avatar-box img {
    width: 42px !important;
    height: 42px !important;
    object-fit: cover !important;
    border-radius: 50% !important;
}

.student-avatar-fallback {
    width: 42px !important;
    height: 42px !important;
    display: inline-grid !important;
    place-items: center !important;
    border-radius: 50% !important;
    color: #ffffff !important;
    background: linear-gradient(135deg, #6657ff 0%, #11c5b4 100%) !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 0 0 1px #dfe4ff, 0 6px 14px rgba(102, 87, 255, .22) !important;
    font-size: 16px !important;
}

.student-avatar-preview,
.student-profile-photo img {
    object-fit: cover;
    border: 1px solid #dfe4ff;
    background: #f7f8ff;
}

.student-avatar-empty {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    color: #ffffff;
    background: linear-gradient(135deg, #6b5cff, #11c5b4);
    border: 3px solid #ffffff;
    box-shadow: 0 6px 14px rgba(102, 87, 255, .22), 0 0 0 1px #dfe4ff;
    font-size: 15px;
}

.student-avatar-empty.large,
.student-avatar-preview {
    width: 82px;
    height: 82px;
    border-radius: 12px;
}

.student-profile-photo {
    display: flex;
    justify-content: center;
}

.student-profile-photo img,
.student-profile-photo span {
    width: 120px;
    height: 120px;
    border-radius: 16px;
}

.student-profile-photo span {
    display: grid;
    place-items: center;
    color: var(--tm-purple);
    background: #eef0ff;
    border: 1px solid #dfe4ff;
    font-size: 42px;
}

.action-icons {
    display: flex;
    gap: 7px;
}

.action-icons a, .action-icons button {
    width: 34px;
    height: 32px;
    border-radius: 7px;
    border: 1px solid #dfe4ff;
    background: #fff;
    color: var(--tm-purple);
    display: grid;
    place-items: center;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.toolbar form {
    flex: 1;
    max-width: 420px;
}

.search-panel {
    margin-bottom: 16px;
}

.search-panel .panel-body {
    padding: 18px;
}

.search-bar-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
}

.search-form {
    flex: 1 1 auto;
    max-width: 520px;
}

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

.search-input-wrap > i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #8b94a5;
    font-size: 13px;
    pointer-events: none;
}

.search-input-wrap .form-control {
    padding-left: 40px;
}

.search-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.table-entity {
    display: grid;
    gap: 2px;
    min-width: 170px;
}

.table-entity strong,
.table-entity .text-primary {
    font-weight: 700;
}

.table-entity-meta {
    color: var(--tm-muted);
    font-size: 12px;
    line-height: 1.45;
}

.table-inline-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
}

.ledger-print-surface {
    display: grid;
    gap: 16px;
}

.ledger-print-meta {
    display: none;
}

.ledger-print-card {
    border: 1px solid var(--tm-border);
    border-radius: 12px;
    background: #f8fbff;
    padding: 14px 16px;
}

.ledger-print-card span {
    display: block;
    color: var(--tm-muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
}

.ledger-print-card strong {
    color: #172033;
    font-size: 14px;
    font-weight: 800;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

.filter-grid.filter-grid-wide {
    grid-template-columns: 1.3fr repeat(4, minmax(0, 1fr)) auto;
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.filter-note {
    margin-top: 12px;
    color: var(--tm-muted);
    font-size: 13px;
    font-weight: 600;
}

.form-control, .form-select {
    border-color: #dbe2ee;
    border-radius: 7px;
    font-size: 14px;
    min-height: 40px;
}

.form-label {
    font-size: 13px;
    color: #4b5563;
    font-weight: 700;
}

.quick-actions {
    display: grid;
    gap: 10px;
}

.quick-actions a {
    background: #f7f8ff;
    color: #4f46e5;
    border: 1px solid #e1e6ff;
    border-radius: 8px;
    padding: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #f4f7fb;
}

.login-shell {
    width: min(420px, calc(100% - 32px));
}

.login-panel {
    background: #fff;
    border-radius: 14px;
    padding: 32px;
    box-shadow: var(--tm-shadow);
    border: 1px solid var(--tm-border);
}

.brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: #eef0ff;
    color: var(--tm-purple);
    display: grid;
    place-items: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.login-panel h1 {
    font-size: 25px;
    font-weight: 800;
    margin: 0;
}

.login-panel p, .login-hint {
    color: var(--tm-muted);
    font-size: 13px;
}

.login-hint {
    margin-top: 16px;
    text-align: center;
}

.flash-message {
    position: fixed;
    top: 88px;
    right: 24px;
    z-index: 2040;
    box-shadow: var(--tm-shadow);
}

.modal-backdrop {
    z-index: 1050;
}

.modal {
    z-index: 1060;
}

.modal-dialog {
    margin-top: 92px;
}

.modal-content {
    border: 1px solid var(--tm-border);
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .18);
}

body.modal-open {
    overflow: hidden;
    padding-right: 0 !important;
}

.pagination .page-link {
    color: var(--tm-purple);
    border-color: #dfe4ff;
    font-size: 13px;
}

.pagination .active .page-link {
    background: var(--tm-purple);
    border-color: var(--tm-purple);
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 16px;
}

.student-pagination-footer {
    border-top: 1px solid #eef2f7;
    margin-top: 4px;
    padding: 18px 0 2px;
}

.table-count {
    color: var(--tm-muted);
    font-size: 13px;
    font-weight: 600;
}

.student-count-pill {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #e5eaf2;
    color: #596579;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .05);
}

.student-count-pill i,
.student-count-pill strong {
    color: var(--tm-purple);
}

.smart-pagination {
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 7px;
    padding: 8px;
    border: 1px solid #e5eaf2;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

.smart-pagination .page-link {
    min-width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 0 10px;
    border: 0;
    background: #f8faff;
    color: var(--tm-purple);
    font-weight: 700;
    font-size: 13px;
    transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}

.smart-pagination .page-link:hover {
    background: #eef0ff;
    box-shadow: 0 5px 12px rgba(79, 99, 255, .13);
}

.smart-pagination .page-link.page-text {
    min-width: 64px;
    padding: 0 14px;
}

.smart-pagination .page-item.disabled .page-link {
    color: #a3acba;
    background: #f4f6fb;
    cursor: not-allowed;
}

.smart-pagination .page-item.active .page-link {
    background: var(--tm-purple);
    color: #fff;
    box-shadow: 0 8px 16px rgba(102, 87, 255, .28);
}

@media (max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .filter-grid.filter-grid-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .accounting-hero,
    .accounting-two-grid,
    .accounting-three-grid,
    .compact-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    html {
        scroll-padding-top: 78px;
    }
    body {
        overflow-x: hidden;
        overflow-y: auto;
    }
    .app-shell {
        min-height: 100vh;
        padding-top: 68px;
        padding-left: 0;
    }
    .topbar {
        height: 68px;
        padding: 0 16px;
    }
    .brand-link { font-size: 18px; }
    .sidebar {
        display: none;
        position: fixed;
        top: 68px;
        left: auto;
        right: 12px;
        bottom: auto;
        width: min(280px, calc(100vw - 24px));
        max-height: calc(100vh - 86px);
        overflow-x: hidden;
        overflow-y: auto;
        border: 1px solid var(--tm-border);
        border-radius: 12px;
        box-shadow: 0 20px 46px rgba(15, 23, 42, .18);
        z-index: 1030;
    }
    .sidebar.open { display: block; }
    .content {
        position: static;
        top: auto;
        right: auto;
        bottom: auto;
        left: auto;
        padding: 16px;
        min-height: calc(100vh - 68px);
        overflow: visible;
    }
    .kpi-grid { grid-template-columns: 1fr; }
    .page-title-row {
        margin: 0 0 16px;
        padding: 0;
        position: static;
        top: auto;
        z-index: auto;
        background: transparent;
        border-bottom: 0;
        flex-direction: column;
        align-items: stretch;
    }
    .page-title-row > div:last-child {
        justify-content: flex-start;
        width: 100%;
    }
    .page-title-row .btn {
        flex: 1 1 auto;
        justify-content: center;
    }
    .profile-grid {
        grid-template-columns: 1fr;
    }
    .profile-photo-row {
        align-items: flex-start;
        flex-direction: column;
    }
    .modal-dialog {
        margin: 78px 12px 16px;
    }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-bar-row {
        align-items: stretch;
        flex-direction: column;
    }
    .search-form {
        max-width: none;
        width: 100%;
    }
    .search-actions,
    .filter-actions {
        justify-content: flex-start;
        width: 100%;
    }
    .search-actions .btn,
    .filter-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
    }
    .filter-grid,
    .filter-grid.filter-grid-wide {
        grid-template-columns: 1fr;
    }
    .panel-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .panel-toolbar,
    .hero-meta {
        width: 100%;
        justify-content: flex-start;
    }
    .accounting-hero,
    .accounting-two-grid,
    .accounting-three-grid,
    .compact-kpi-grid {
        grid-template-columns: 1fr;
    }
    .hero-card,
    .insight-card,
    .compact-kpi {
        padding: 18px;
        border-radius: 16px;
    }
    .hero-card h2 {
        font-size: 24px;
    }
    .compact-kpi {
        min-height: 0;
    }
    .accounting-table-wrap .table {
        min-width: 640px;
    }
    .table-footer { flex-direction: column; align-items: flex-start; }
    .smart-pagination { justify-content: flex-start; }
    .pending-approval-banner { flex-direction: column; align-items: flex-start; }
    .user-copy { display: none; }
}

@media print {
    body {
        background: #fff !important;
    }
    body * {
        visibility: hidden;
    }
    .ledger-print-surface,
    .ledger-print-surface * {
        visibility: visible;
    }
    .ledger-print-surface {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: #fff !important;
        gap: 10mm;
    }
    .ledger-no-print,
    .topbar,
    .sidebar,
    .page-title-row {
        display: none !important;
    }
    .ledger-print-meta {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4mm;
    }
    .compact-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 4mm !important;
    }
    .compact-kpi,
    .panel {
        box-shadow: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .panel-header,
    .panel-body {
        padding: 4mm 5mm !important;
    }
    .table-responsive {
        overflow: visible !important;
    }
    .table th,
    .table td {
        padding: 2.5mm !important;
        vertical-align: top !important;
    }
}
