@import url(https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap);

.header-container {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 1rem;
}

.history-title {
    margin: 0;
    font-weight: bold;
}

.button-group {
    display: flex;
    gap: 8px;
}

.button-group button {
    padding: 4px 10px;
    cursor: pointer;
}

:root {
    --bg: #f7f6f3;
    --bg-card: #ffffff;
    --bg-subtle: #f2f0ec;
    --bg-hover: #ece9e3;

    --border: #e2ded6;
    --border-mid: #ccc8c0;
    --border-strong: #b8b3aa;

    --text-primary: #1a1916;
    --text-secondary: #6b6760;
    --text-muted: #9e9b96;

    --accent: #1a1916;
    --accent-hover: #2e2c28;
    --accent-soft: #f0ede8;

    --green: #1a6b3c;
    --green-bg: #eaf5ee;
    --green-border: #b8dfc7;

    --red: #b91c1c;
    --red-bg: #fef2f2;
    --red-border: #fecaca;

    --amber: #92400e;
    --amber-bg: #fffbeb;
    --amber-border: #fde68a;

    --blue: #1e40af;
    --blue-bg: #eff6ff;
    --blue-border: #bfdbfe;

    --radius-sm: 0px;
    --radius: 0px;
    --radius-lg: 0px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);

    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    --transition: 0.15s ease;

    --row-group-bg: #f0f4f8;
    --row-group-border: #dee2e6;
    --row-group-color: #1a1916;
    --row-member-bg: #fafcff;
    --row-member-color: #1a1916;
}

[data-theme="dark"] {
    --bg: #131211;
    --bg-card: #1c1b19;
    --bg-subtle: #222120;
    --bg-hover: #2a2927;
    --border: #2e2d2a;
    --border-mid: #3d3c38;
    --border-strong: #504e49;
    --text-primary: #e8e5df;
    --text-secondary: #9a9790;
    --text-muted: #65635e;
    --accent: #e8e5df;
    --accent-hover: #ccc9c3;
    --accent-soft: #272623;
    --green: #4ade80;
    --green-bg: #052e16;
    --green-border: #14532d;
    --red: #f87171;
    --red-bg: #1f0808;
    --red-border: #7f1d1d;
    --amber: #fbbf24;
    --amber-bg: #1c1300;
    --amber-border: #78350f;
    --blue: #93c5fd;
    --blue-bg: #080f1f;
    --blue-border: #1e3a5f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.7);
    --row-group-bg: #252422;
    --row-group-border: #3d3c38;
    --row-group-color: #e8e5df;
    --row-member-bg: #1e1d1b;
    --row-member-color: #c8c5bf;
}

[data-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.025);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border-color: var(--border);
}

[data-theme="dark"] .table th,
[data-theme="dark"] .table td {
    border-color: var(--border);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] textarea {
    background-color: var(--bg-subtle);
    border-color: var(--border-mid);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] textarea:focus {
    background-color: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
    box-shadow: 0 0 0 2px rgba(232, 229, 223, 0.08);
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .btn-dark {
    background-color: #e8e5df;
    border-color: #e8e5df;
    color: #131211;
}

[data-theme="dark"] .btn-dark:hover,
[data-theme="dark"] .btn-dark:focus {
    background-color: #ccc9c3;
    border-color: #ccc9c3;
    color: #131211;
}

[data-theme="dark"] .btn-dark:disabled {
    background-color: #504e49;
    border-color: #504e49;
    color: #9a9790;
}

[data-theme="dark"] .btn-outline-dark {
    border-color: #504e49;
    color: #e8e5df;
    background-color: transparent;
}

[data-theme="dark"] .btn-outline-dark:hover,
[data-theme="dark"] .btn-outline-dark:focus {
    background-color: var(--bg-hover);
    border-color: #e8e5df;
    color: #e8e5df;
}

[data-theme="dark"] .bg-dark {
    background-color: #2a2927 !important;
    color: #e8e5df !important;
}

[data-theme="dark"] .card-header.bg-dark {
    background-color: #222120 !important;
    border-bottom-color: var(--border);
}

[data-theme="dark"] .badge.bg-dark {
    background-color: #3d3c38 !important;
    color: #e8e5df !important;
}

[data-theme="dark"] .border-dark {
    border-color: var(--border-strong) !important;
}

[data-theme="dark"] .bg-light.text-dark,
[data-theme="dark"] .badge.bg-light.text-dark {
    background-color: var(--bg-hover) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-mid) !important;
}

[data-theme="dark"] .modal-content {
    background-color: var(--bg-card);
    border-color: var(--border-mid);
    color: var(--text-primary);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--border);
}

[data-theme="dark"] .btn-close {
    filter: invert(1) brightness(0.8);
}

[data-theme="dark"] .alert-success {
    background-color: var(--green-bg);
    border-color: var(--green-border);
    color: var(--green);
}

[data-theme="dark"] .alert-danger {
    background-color: var(--red-bg);
    border-color: var(--red-border);
    color: var(--red);
}

[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .bg-light {
    background-color: var(--bg-subtle) !important;
}

[data-theme="dark"] .list-group-item {
    background-color: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-card);
    border-color: var(--border-mid);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: var(--bg-hover);
}

[data-theme="dark"] code {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

[data-theme="dark"] pre {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
}

[data-theme="dark"] .note-rendered {
    color: var(--text-primary);
}

.global-config-toggle {
    display: flex;
    align-items: center;
    gap: 14px;
}

.toggle-switch {
    position: relative;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-strong);
    border-radius: 26px;
    cursor: pointer;
    transition: background var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(20px);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    max-width: 100%;
    overflow-wrap: break-word;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    font-size: 13.5px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

input[type="number"],
input[type="date"] {
    max-width: 100%;
    min-width: 0;
}

.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    height: auto;
    flex-shrink: 0;
}

.navbar .container-fluid {
    display: flex;
    align-items: center;
    padding: 0;
    height: 48px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.navbar .container-fluid::-webkit-scrollbar {
    display: none;
}

.navbar-brand {
    padding: 0 20px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.3px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    height: 100%;
    border-right: 1px solid var(--border);
    min-width: 120px;
    flex-shrink: 0;
    text-decoration: none;
    white-space: nowrap;
}

.navbar-nav {
    display: flex;
    list-style: none;
    margin: 0;
    flex-wrap: nowrap;
    height: 100%;
    align-items: stretch;
}

.nav-link {
    padding: 0 16px;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    height: 100%;
    font-size: 13px;
    font-weight: 500;
    border-right: 1px solid var(--border);
    transition: color var(--transition), background var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-subtle);
}

.nav-link.active {
    color: var(--text-primary);
    font-weight: 600;
    background: var(--bg);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.container-fluid {
    padding: 0;
    height: calc(100vh - 49px);
    overflow: auto;
    background: var(--bg);
}

.py-4 {
    padding: 20px;
}

.row {
    display: flex;
    margin: 0 -8px;
    flex-wrap: wrap;
}

.col-md-2 {
    flex: 0 0 16.666667%;
    padding: 0 8px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.col-md-4 {
    flex: 0 0 33.333333%;
    padding: 0 8px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.col-md-5 {
    flex: 0 0 41.666667%;
    padding: 0 8px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.col-md-6 {
    flex: 0 0 50%;
    padding: 0 8px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.col-md-7 {
    flex: 0 0 58.333333%;
    padding: 0 8px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.col-md-8 {
    flex: 0 0 66.666667%;
    padding: 0 8px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.col-md-12 {
    flex: 0 0 100%;
    padding: 0 8px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.col-xl-3 {
    flex: 0 0 25%;
    padding: 0 8px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.col-lg-4 {
    flex: 0 0 33.3%;
    padding: 0 8px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.col-sm-6 {
    flex: 0 0 50%;
    padding: 0 8px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.col-1 {
    flex: 0 0 8.333%;
    padding: 0 8px;
}

.col-2 {
    flex: 0 0 16.666%;
    padding: 0 8px;
}

.col-4 {
    flex: 0 0 33.333%;
    padding: 0 8px;
}

.col-6 {
    flex: 0 0 50%;
    padding: 0 8px;
}

.col-7 {
    flex: 0 0 58.333%;
    padding: 0 8px;
}

.g-2 {
    gap: 8px;
}

.g-3 {
    gap: 12px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.card-header h5 {
    font-size: 13.5px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.2px;
}

.card-body {
    padding: 16px;
    overflow-x: hidden;
}

.card-footer {
    padding: 12px 16px;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border);
}

h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
}

h4 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin: 0;
}

h5 {
    font-size: 13.5px;
    font-weight: 600;
    margin: 0;
}

h6 {
    font-size: 12.5px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

p {
    margin: 0 0 8px 0;
}

.small,
small {
    font-size: 11.5px;
}

.fw-bold {
    font-weight: 600;
}

.fw-semibold {
    font-weight: 500;
}

.fst-italic {
    font-style: italic;
}

.text-uppercase {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.text-end {
    text-align: right;
}

.text-center {
    text-align: center;
}

.center {
    text-align: center;
}

.text-primary {
    color: var(--text-primary);
}

.text-muted {
    color: var(--text-secondary);
}

.text-danger {
    color: var(--red);
}

.text-success {
    color: var(--green);
}

.text-decoration-none {
    text-decoration: none;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.form-control,
.form-select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 13px;
    font-family: var(--font);
    height: 34px;
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6760' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 25, 22, 0.08);
}

.form-control-sm,
.form-select-sm {
    height: 30px;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.form-select-sm {
    background-size: 10px;
    padding-right: 24px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-check-input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.form-check-label {
    font-size: 12.5px;
    color: var(--text-primary);
}

.form-check-sm .form-check-input {
    width: 13px;
    height: 13px;
}

textarea.form-control {
    height: auto;
    resize: vertical;
    line-height: 1.5;
    padding: 8px 10px;
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--bg-subtle);
    color: var(--text-muted);
    cursor: not-allowed;
    border-color: var(--border);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.btn {
    padding: 6px 14px;
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font);
    font-weight: 500;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-primary);
    min-height: 32px;
    line-height: 1.2;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition);
    white-space: nowrap;
    gap: 6px;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.btn:active {
    background: var(--bg-subtle);
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-dark {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

.btn-dark:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-subtle);
    border-color: var(--border-mid);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.btn-danger:hover {
    background: #991b1b;
    border-color: #991b1b;
    color: #fff;
}

.btn-primary {
    background: #1e40af;
    border-color: #1e40af;
    color: #fff;
}

.btn-primary:hover {
    background: #1e3a8a;
    border-color: #1e3a8a;
    color: #fff;
}

.btn-link {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
    padding: 4px 6px;
    min-height: auto;
}

.btn-link:hover {
    color: var(--text-primary);
    background: transparent;
    border-color: transparent;
    text-decoration: underline;
}

.btn-link.text-danger {
    color: var(--red);
}

.btn-link.text-danger:hover {
    color: #991b1b;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    min-height: 26px;
    border-radius: var(--radius-sm);
}

.btn-outline-dark {
    background: transparent;
    border-color: var(--border-mid);
    color: var(--text-primary);
}

.btn-outline-dark:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
}

.btn-outline-danger {
    background: transparent;
    border-color: var(--red-border);
    color: var(--red);
}

.btn-outline-danger:hover {
    background: var(--red-bg);
    border-color: var(--red);
}

.btn-outline-light {
    background: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-outline-light:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
    border-color: var(--border-mid);
}

.btn-outline-secondary {
    background: transparent;
    border-color: var(--border-mid);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.btn-outline-success {
    background: transparent;
    border-color: var(--green-border);
    color: var(--green);
}

.btn-outline-success:hover {
    background: var(--green-bg);
    border-color: var(--green);
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--blue-border);
    color: var(--blue);
}

.btn-outline-primary:hover {
    background: var(--blue-bg);
    border-color: var(--blue);
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}

.btn-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-close::before {
    content: "×";
    line-height: 1;
}

.w-100 {
    width: 100%;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--bg-card);
    min-width: 400px;
}

.table thead th {
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-mid);
    border-right: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 11.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table thead th:last-child {
    border-right: none;
}

.table tbody td {
    border-bottom: 1px solid var(--border);
    padding: 8px 12px;
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-striped tbody tr:nth-child(even) {
    background: var(--bg-subtle);
}

.table tbody tr:hover {
    background: var(--accent-soft);
    transition: background var(--transition);
}

.table-bordered {
    border: 1px solid var(--border);
}

.table tfoot th {
    background: var(--accent);
    border: none;
    padding: 10px 12px;
    font-weight: 600;
    color: #fff;
    font-size: 13px;
}

.table-sm thead th,
.table-sm tbody td {
    padding: 5px 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bg-dark {
    background: var(--accent);
    color: #fff;
}

.bg-secondary {
    background: var(--text-muted);
    color: #fff;
}

.bg-success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid var(--green-border);
}

.bg-warning {
    background: var(--amber-bg);
    color: var(--amber);
    border: 1px solid var(--amber-border);
}

.bg-light {
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

.text-dark {
    color: var(--text-primary) !important;
}

.border {
    border: 1px solid var(--border) !important;
}

.alert {
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    margin: 12px 0;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.6;
}

.alert-success {
    background: var(--green-bg);
    border-color: var(--green-border);
    color: var(--green);
}

.alert-warning {
    background: var(--amber-bg);
    border-color: var(--amber-border);
    color: var(--amber);
}

.alert-info {
    background: var(--blue-bg);
    border-color: var(--blue-border);
    color: var(--blue);
}

.alert-danger {
    background: var(--red-bg);
    border-color: var(--red-border);
    color: var(--red);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    overflow-y: auto;
    padding: 24px 16px;
}

.modal.d-block {
    display: flex !important;
    align-items: flex-start;
    justify-content: center;
}

.modal-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
    margin: auto;
    box-sizing: border-box;
    animation: modal-in 0.18s ease;
}

.modal-dialog-centered {
    align-self: center;
}

.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.99);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-lg {
    max-width: 820px;
}

.modal-xl {
    max-width: 1080px;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.modal-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.modal-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}

.modal-body {
    padding: 16px;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-footer {
    background: var(--bg-subtle);
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.list-group {
    list-style: none;
}

.list-group-flush .list-group-item {
    border-left: none;
    border-right: none;
    border-radius: 0;
}

.list-group-item {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-top: none;
    display: block;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 13px;
    transition: background var(--transition);
}

.list-group-item:first-child {
    border-top: 1px solid var(--border);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.list-group-item:last-child {
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

.list-group-item-action {
    cursor: pointer;
}

.list-group-item-action:hover {
    background: var(--bg-subtle);
}

.list-group-item.border-start {
    border-left: 4px solid !important;
}

.border-4 {
    border-width: 4px !important;
}

.border-info {
    border-color: #60a5fa !important;
}

.note-content {
    background: var(--bg-subtle);
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 200px;
}

.note-rendered {
    line-height: 1.7;
    color: var(--text-primary);
}

.note-rendered h1,
.note-rendered h2,
.note-rendered h3 {
    margin: 1em 0 0.4em;
    font-weight: 600;
}

.note-rendered ul,
.note-rendered ol {
    margin-left: 20px;
    margin-bottom: 8px;
}

.note-rendered blockquote {
    border-left: 3px solid var(--border-mid);
    padding-left: 14px;
    margin-left: 0;
    color: var(--text-secondary);
}

.note-rendered pre {
    background: var(--bg-subtle);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    border: 1px solid var(--border);
}

.note-rendered code {
    background: var(--bg-subtle);
    padding: 1px 5px;
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 11.5px;
    border: 1px solid var(--border);
}

.transaction-entry {
    background: var(--bg-subtle);
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.transaction-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    background: var(--bg-subtle);
}

.balance-warning {
    padding: 10px 14px;
    margin: 8px 0;
    border-radius: var(--radius-sm);
    background: var(--amber-bg);
    border: 1px solid var(--amber-border);
    color: var(--amber);
    font-size: 13px;
}

.balance-success {
    padding: 10px 14px;
    margin: 8px 0;
    border-radius: var(--radius-sm);
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    color: var(--green);
    font-size: 13px;
}

.d-flex {
    display: flex;
}

.d-block {
    display: block;
}

.d-none {
    display: none;
}

.d-inline-block {
    display: inline-block;
}

.flex-wrap {
    flex-wrap: wrap;
}

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

.align-items-center {
    align-items: center;
}

.align-items-start {
    align-items: flex-start;
}

.align-items-end {
    align-items: flex-end;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-center {
    justify-content: center;
}

.justify-content-end {
    justify-content: flex-end;
}

.flex-1 {
    flex: 1;
}

.gap-1 {
    gap: 4px;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 4px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 12px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-5 {
    margin-bottom: 24px;
}

.mt-1 {
    margin-top: 4px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 12px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-5 {
    margin-top: 24px;
}

.me-1 {
    margin-right: 4px;
}

.me-2 {
    margin-right: 8px;
}

.ms-1 {
    margin-left: 4px;
}

.ms-2 {
    margin-left: 8px;
}

.pt-2 {
    padding-top: 8px;
}

.pt-3 {
    padding-top: 12px;
}

.pb-2 {
    padding-bottom: 8px;
}

.ps-3 {
    padding-left: 12px;
}

.p-0 {
    padding: 0;
}

.p-2 {
    padding: 8px;
}

.p-3 {
    padding: 12px;
}

.h-100 {
    height: 100%;
}

.rounded {
    border-radius: var(--radius);
}

.rounded-0 {
    border-radius: 0;
}

.border-0 {
    border: none !important;
}

.border-top {
    border-top: 1px solid var(--border) !important;
}

.border-start {
    border-left: 1px solid var(--border) !important;
}

.border-danger {
    border-color: var(--red) !important;
}

.border-success {
    border-color: var(--green) !important;
}

.border-dark {
    border-color: var(--accent) !important;
}

.border-3 {
    border-width: 3px !important;
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.cursor {
    cursor: pointer;
}

.overflow-hidden {
    overflow: hidden;
}

.py-0 {
    padding-top: 0;
    padding-bottom: 0;
}

.py-2 {
    padding-top: 8px;
    padding-bottom: 8px;
}

.py-5 {
    padding-top: 40px;
    padding-bottom: 40px;
}

.px-2 {
    padding-left: 8px;
    padding-right: 8px;
}

.px-3 {
    padding-left: 12px;
    padding-right: 12px;
}

.fs-4 {
    font-size: 18px;
}

.fs-5 {
    font-size: 16px;
}

.fs-6 {
    font-size: 13px;
}

.bg-light {
    background: var(--bg-subtle) !important;
}

.bg-opacity-10 {
    opacity: 0.1;
}

.text-dark {
    color: var(--text-primary) !important;
}

.text-muted {
    color: var(--text-secondary) !important;
}

.text-danger {
    color: var(--red) !important;
}

.text-success {
    color: var(--green) !important;
}

.text-warning {
    color: var(--amber) !important;
}

.text-primary {
    color: var(--blue) !important;
}

.text-info {
    color: #0ea5e9 !important;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lh-1 {
    line-height: 1;
}

.fs-4,
h3 {
    font-family: var(--font-mono);
    font-size: 20px;
    letter-spacing: -0.5px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-subtle);
}

::-webkit-scrollbar-thumb {
    background: var(--border-mid);
    border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

::-webkit-scrollbar-corner {
    background: var(--bg-subtle);
}

@media print {
    body * {
        visibility: hidden;
    }

    .grouped-toggle-icon {
        visibility: hidden;
    }

    #income-statement-print,
    #income-statement-print * {
        visibility: visible;
    }

    #balance-sheet-print,
    #balance-sheet-print * {
        visibility: visible;
    }

    #cash-flow-print,
    #cash-flow-print * {
        visibility: visible;
    }

    .navbar,
    .btn-group,
    #balance-check-section,
    .alert-info {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: none;
    }

    [data-theme="dark"] {
        --bg: #f7f6f3;
        --bg-card: #ffffff;
        --bg-subtle: #f2f0ec;
        --bg-hover: #ece9e3;
        --border: #e2ded6;
        --border-mid: #ccc8c0;
        --border-strong: #b8b3aa;
        --text-primary: #1a1916;
        --text-secondary: #6b6760;
        --text-muted: #9e9b96;
        --accent: #1a1916;
        --accent-hover: #2e2c28;
        --accent-soft: #f0ede8;
        --green: #1a6b3c;
        --green-bg: #eaf5ee;
        --green-border: #b8dfc7;
        --red: #b91c1c;
        --red-bg: #fef2f2;
        --red-border: #fecaca;
        --amber: #92400e;
        --amber-bg: #fffbeb;
        --amber-border: #fde68a;
        --blue: #1e40af;
        --blue-bg: #eff6ff;
        --blue-border: #bfdbfe;
        color-scheme: light;
    }

    body {
        background: #fff !important;
        color: #1a1916 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}


@media (max-width: 1024px) {
    .col-xl-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-lg-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .modal-xl {
        max-width: 95vw;
    }

    .modal-body .row.g-4 {
        flex-direction: column;
    }

    .modal-body .col-md-5,
    .modal-body .col-md-7 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 768px) {

    .navbar .container-fluid {
        flex-direction: row;
        height: 44px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .navbar-brand {
        min-width: auto;
        padding: 0 14px;
        font-size: 13px;
        flex-shrink: 0;
        border-right: 1px solid var(--border);
        border-bottom: none;
        width: auto;
    }

    .navbar-nav {
        border-top: none;
        width: auto;
    }

    .nav-link {
        padding: 0 12px;
        font-size: 12px;
        border-bottom: none;
    }

    .container-fluid {
        height: auto;
        min-height: calc(100vh - 48px);
    }

    .py-4 {
        padding: 12px;
    }

    .col-md-2,
    .col-md-4,
    .col-md-5,
    .col-md-6,
    .col-md-7,
    .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .col-xl-3,
    .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .modal {
        padding: 0;
        align-items: flex-start;
    }

    .modal-dialog {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        min-height: 100vh;
    }

    .modal-dialog-centered {
        align-self: flex-start;
    }

    .modal-body {
        max-height: calc(100vh - 130px);
    }

    .modal-xl {
        max-width: 100%;
    }

    .modal-body .col-md-5,
    .modal-body .col-md-7 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .table {
        min-width: 500px;
    }

    .card-header {
        flex-wrap: wrap;
        gap: 6px;
    }

    .card-header .btn-group {
        flex-wrap: wrap;
    }

    h4 {
        font-size: 15px;
    }

    h2 {
        font-size: 18px;
    }

    .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .nav-link {
        font-size: 11px;
        padding: 7px 8px;
    }

    .py-4 {
        padding: 8px;
    }

    .card-body {
        padding: 10px;
    }

    .btn {
        font-size: 12px;
        padding: 5px 10px;
    }

    .btn-sm {
        font-size: 11px;
        padding: 3px 8px;
    }

    .col-xl-3,
    .col-lg-4,
    .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .modal-body [style*="flex:1"] {
        flex: 1 1 100% !important;
        min-width: 0 !important;
    }

    .modal-body [style*="width:155px"],
    .modal-body [style*="width:180px"],
    .modal-body [style*="width:130px"],
    .modal-body [style*="min-width:220px"],
    .modal-body [style*="min-width:180px"] {
        width: 100% !important;
        min-width: 0 !important;
    }

    .modal-body [style*="min-width:200px"] {
        min-width: 0 !important;
    }

    .modal-body [style*="width:200px"] {
        width: 100% !important;
    }

    .modal-body .col-md-4 {
        flex: 0 0 100%;
    }

    .col-2 {
        flex: 0 0 30%;
        min-width: 60px;
    }

    .table thead th,
    .table tbody td {
        padding: 5px 8px;
        font-size: 12px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}


.modal-header {
    align-items: flex-start !important;
    padding: 14px 16px !important;
}

.modal-header>div {
    flex: 1;
    min-width: 0;
}

.modal-header .modal-title {
    line-height: 1.4;
    margin-bottom: 0;
}

.modal-header>div .text-muted.small,
.modal-header>div p.text-muted {
    margin-top: 2px;
    margin-bottom: 0;
    line-height: 1.3;
}

.modal-header .btn-close {
    align-self: flex-start !important;
    margin-top: 1px;
    flex-shrink: 0;
}

.modal-dialog-scrollable {
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-dialog-scrollable .modal-content {
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
}

.modal-dialog-scrollable .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: none !important;
}

.modal-dialog-centered.modal-dialog-scrollable {
    align-items: center;
}

.alert {
    align-items: flex-start !important;
}

.alert.center {
    justify-content: center;
    text-align: center;
}

.card-header {
    flex-wrap: wrap !important;
    row-gap: 6px;
}

.card-header .d-flex.gap-2,
.card-header .btn-group {
    flex-wrap: wrap;
    align-items: center;
}

.transaction-card .fw-bold,
.transaction-card .mt-2.fw-bold {
    font-family: var(--font-mono);
    font-size: 12.5px;
}

.transaction-card>.d-flex:first-child {
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
}

.balance-warning,
.balance-success {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}

.navbar .container-fluid {
    height: 48px !important;
    min-height: 48px;
    overflow-x: auto;
    overflow-y: hidden;
}

.navbar-brand,
.nav-link {
    flex-shrink: 0;
    white-space: nowrap;
}

.modal-body [style*="width"],
.modal-body [style*="min-width"] {
    max-width: 100% !important;
}

.modal-body .d-flex.gap-2.flex-wrap.align-items-end {
    row-gap: 8px;
}


.row>[class*="col-"] input,
.row>[class*="col-"] select {
    min-width: 0;
    width: 100%;
}

.btn.btn-sm.btn-outline-danger.w-100 {
    min-width: 32px;
}

.text-center .btn-dark {
    min-width: 120px;
}

.d-flex.justify-content-between.align-items-center.mb-4 {
    flex-wrap: wrap;
    row-gap: 8px;
}


@media (max-width: 900px) {
    .col-xl-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-lg-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 600px) {
    .modal {
        padding: 0 !important;
        align-items: flex-end !important;
    }

    .modal-dialog,
    .modal-dialog.modal-lg,
    .modal-dialog.modal-xl {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 14px 14px 0 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: none !important;
        max-height: 92vh;
    }

    .modal-dialog-scrollable {
        max-height: 92vh;
    }

    .modal-body {
        max-height: calc(92vh - 120px) !important;
    }

    .modal-footer {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 100px;
    }

    .transaction-card .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 12px;
    }

    .d-flex.justify-content-between.align-items-center.mb-4>.d-flex.gap-2,
    .d-flex.justify-content-between.align-items-center>.btn-group {
        width: 100%;
        justify-content: flex-start;
    }
}

.modal-dialog.modal-xl.modal-dialog-scrollable {
    max-height: calc(100vh - 24px) !important;
    height: calc(100vh - 24px);
    margin: 12px auto !important;
}

.modal-dialog.modal-xl.modal-dialog-scrollable .modal-content {
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-dialog.modal-xl.modal-dialog-scrollable .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: none !important;
    padding: 0;
}

.modal-dialog.modal-xl .modal-body {
    display: flex;
    flex-direction: column;
}

.modal-dialog.modal-xl .modal-body>div[style*="background:#f8f9fa"] {
    flex-shrink: 0;
}

.modal-dialog.modal-xl .modal-body>ul.nav.nav-tabs {
    flex-shrink: 0;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid #dee2e6;
    margin: 0 !important;
    padding: 0 16px !important;
}

.modal-dialog.modal-xl .modal-body>.p-4 {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px !important;
}


.modal-dialog.modal-xl.modal-dialog-centered:not(.modal-dialog-scrollable) {
    max-height: calc(100vh - 24px);
    margin: 12px auto !important;
}

.modal-dialog.modal-xl .modal-content {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
}

.modal-dialog.modal-xl .modal-content .modal-body.p-0[style*="flex-direction:column"],
.modal-dialog.modal-xl .modal-content .modal-body.p-0[style*="flex-direction: column"] {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.modal-dialog.modal-xl .modal-content iframe[style*="min-height:520px"] {
    flex: 1 1 auto;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    border: none !important;
    display: block;
}

.modal-dialog.modal-xl .modal-content .modal-body:not(.p-0) {
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: none !important;
}

.modal-dialog.modal-xl .modal-content .modal-header {
    flex-shrink: 0;
}

.modal-dialog.modal-xl .modal-content .modal-footer {
    flex-shrink: 0;
}

.modal-dialog.modal-xl textarea[style*="min-height:380px"] {
    min-height: 320px !important;
    max-height: 50vh;
}

.modal-dialog.modal-xl ul.nav.nav-tabs {
    display: flex;
    list-style: none;
    gap: 0;
    border-bottom: 1px solid #dee2e6;
}

.modal-dialog.modal-xl ul.nav.nav-tabs .nav-item {
    display: flex;
}

.modal-dialog.modal-xl ul.nav.nav-tabs .nav-link {
    height: auto !important;
    padding: 8px 16px !important;
    font-size: 13px;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    color: var(--text-secondary);
    background: transparent;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    cursor: pointer;
}

.modal-dialog.modal-xl ul.nav.nav-tabs .nav-link:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.modal-dialog.modal-xl ul.nav.nav-tabs .nav-link.active {
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: 2px solid var(--accent) !important;
    background: #fff;
}

.modal-dialog.modal-xl ul.nav.nav-tabs .nav-link.active::after {
    display: none !important;
}

.modal-dialog.modal-lg.modal-dialog-scrollable {
    max-height: calc(100vh - 24px) !important;
    margin: 12px auto !important;
}

.modal-dialog.modal-lg.modal-dialog-scrollable .modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-dialog.modal-lg.modal-dialog-scrollable .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: none !important;
}

@media (max-width: 768px) {

    .modal-dialog.modal-xl.modal-dialog-centered,
    .modal-dialog.modal-xl.modal-dialog-scrollable {
        max-height: 100vh !important;
        height: 100vh;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .modal-dialog.modal-xl .modal-content {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-dialog.modal-xl .modal-content iframe[style*="min-height:520px"] {
        min-height: 0 !important;
    }
}

@media print {
    body * {
        visibility: hidden;
    }

    .grouped-toggle-icon {
        visibility: hidden;
    }

    #income-statement-print,
    #income-statement-print * {
        visibility: visible;
    }

    #balance-sheet-print,
    #balance-sheet-print * {
        visibility: visible;
    }

    #cash-flow-print,
    #cash-flow-print * {
        visibility: visible;
    }

    #trial-balance-print,
    #trial-balance-print * {
        visibility: visible;
    }

    .navbar,
    .btn-group,
    #balance-check-section,
    .alert-info {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: none;
    }
}

.grouped-toggle-icon {
    color: var(--text-primary, #212529) !important;
    opacity: 0.75;
}

.grouped-toggle-icon:hover {
    opacity: 1;
}

.transaction-search-panel {
    border: 2px solid var(--border-strong, #212529);
    border-radius: 0;
    overflow: hidden;
}

.transaction-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    background: var(--bg-subtle, #f0f0f0);
    color: var(--text-primary, #212529);
    border-bottom: 2px solid var(--border-strong, #212529);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.transaction-search-header:hover {
    background: var(--bg-hover, #e2e2e2);
}

.transaction-search-header h5 {
    color: var(--text-primary, #212529);
    font-weight: 700;
    letter-spacing: 0.02em;
    margin: 0;
}

.transaction-search-chevron {
    font-size: 0.85rem;
    opacity: 0.7;
    color: var(--text-secondary, #555);
}

.transaction-search-body {
    padding: 1.25rem 1.1rem 1rem;
    background: var(--bg-card, #fff);
    border-top: 1px solid var(--border, #dee2e6);
}

.app-create-menu {
    min-width: 260px;
    background: var(--bg-card);
    border: 1px solid var(--border-mid);
    border-radius: 0;
    box-shadow: var(--shadow-lg);
    list-style: none !important;
    padding: 4px 0 !important;
    margin: 0 !important;
}

.app-create-menu li {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.app-create-menu .dropdown-header {
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 600;
    padding: 8px 14px 4px;
    list-style: none;
}

.app-create-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
    list-style: none !important;
}

.app-create-item {
    display: block;
    color: var(--text-primary);
    padding: 10px 14px;
    text-decoration: none;
    cursor: pointer;
}

.app-create-item:hover,
.app-create-item:focus {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.app-create-item strong {
    font-size: 13px;
    display: block;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.app-create-item small {
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-muted) !important;
    display: block;
}


.app-toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    align-items: stretch;
    min-width: 300px;
    max-width: min(520px, calc(100vw - 32px));
    background: var(--bg-card);
    border: 1.5px solid var(--border-mid);
    box-shadow: var(--shadow-lg);
    font-family: var(--font);
    font-size: 13px;
    color: var(--text-primary);
    overflow: hidden;
}

.app-toast__accent {
    width: 4px;
    flex-shrink: 0;
}

.app-toast--success .app-toast__accent {
    background: var(--green);
}

.app-toast--warning .app-toast__accent {
    background: var(--amber);
}

.app-toast__body {
    flex: 1;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-toast__top-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-toast__icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid;
}

.app-toast--success .app-toast__icon {
    background: var(--green-bg);
    color: var(--green);
    border-color: var(--green-border);
}

.app-toast--warning .app-toast__icon {
    background: var(--amber-bg);
    color: var(--amber);
    border-color: var(--amber-border);
}

.app-toast__text {
    flex: 1;
    line-height: 1.4;
}

.app-toast__close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: color var(--transition);
}

.app-toast__close:hover {
    color: var(--text-primary);
}

.app-toast__detail-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 11.5px;
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 2px;
    width: fit-content;
    user-select: none;
}

.app-toast__detail-toggle:hover {
    color: var(--text-primary);
}

.app-toast__chevron {
    display: inline-block;
    font-style: normal;
    font-size: 13px;
    line-height: 1;
    transition: transform 0.2s ease;
    text-decoration: none;
}

.app-toast__chevron--open {
    transform: rotate(90deg);
}

.app-toast__detail-panel {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 6px;
}

.toast-bob-enter-active {
    animation: toast-enter 1.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast-bob-leave-active {
    animation: toast-leave 0.2s ease-in forwards;
}

.app-toast--neutral .app-toast__accent {
    background: var(--border-mid);
}

.app-toast--neutral .app-toast__icon {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-color: var(--border-mid);
}

[data-theme="dark"] .app-toast--neutral .app-toast__accent {
    background: var(--border-mid);
}

@keyframes toast-enter {
    0% {
        top: 60%;
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }

    15% {
        top: 42%;
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    100% {
        top: 16px;
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes toast-leave {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px);
    }
}

[data-theme="dark"] .app-toast {
    background: var(--bg-card);
    border-color: var(--border-mid);
}

[data-theme="dark"] .app-toast--success .app-toast__accent {
    background: var(--green);
}

[data-theme="dark"] .app-toast--warning .app-toast__accent {
    background: var(--amber);
}

@media (min-width: 601px) {
    .modal-dialog {
        max-height: calc(100vh - 48px);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .modal-content {
        max-height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .modal-header,
    .modal-footer {
        flex-shrink: 0;
    }

    .modal-body {
        flex: 1 1 auto;
        overflow-y: auto;
        min-height: 0;
        max-height: none !important;
    }
}

.bookmark-table {
    min-width: 0;
}

.bookmark-table td,
.bookmark-table th {
    white-space: nowrap;
}

.bookmark-table td:first-child,
.bookmark-table th:first-child {
    width: 100%;
    white-space: normal;
}


.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 820px;
    margin: 0 auto;
}

.settings-card .card-header {
    background: var(--bg-card);
    padding: 16px;
}

.settings-card-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.settings-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
}

.settings-card-title h5 {
    margin-bottom: 2px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.settings-row:first-child {
    padding-top: 0;
}

.settings-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-row--stacked {
    flex-direction: column;
    align-items: flex-start;
    border-bottom: none;
    padding-bottom: 4px;
}

.settings-row-label {
    flex: 1 1 auto;
    min-width: 0;
}

.settings-row-control {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    min-width: 220px;
    justify-content: flex-end;
}

.settings-row-control .form-select {
    min-width: 220px;
}

.settings-row-control--split {
    gap: 8px;
}

.settings-row-control--split .form-select {
    min-width: 0;
}

.settings-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 4px 0 16px;
}

.locale-upload-zone {
    border: 1.5px dashed var(--border-mid);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: border-color var(--transition), background var(--transition);
}

.locale-upload-zone:hover {
    border-color: var(--accent);
    background: var(--bg-subtle);
}

.locale-upload-icon {
    font-size: 20px;
    margin-bottom: 6px;
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .settings-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .settings-row-control {
        width: 100%;
        justify-content: flex-start;
    }

    .settings-row-control .form-select {
        width: 100%;
        min-width: 0;
    }
}

.apps-grid-row {
    justify-content: center;
}


.calc-bar-wrapper {
    position: relative;
    margin-left: auto;
    padding: 0 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    height: 100%;
}

.calc-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    padding: 0 8px;
    height: 30px;
    width: 420px;
    transition: border-color var(--transition), background var(--transition);
}

.calc-bar:focus-within {
    border-color: var(--accent);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(26, 25, 22, 0.08);
}

.calc-bar__icon {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.calc-bar__input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-primary);
    min-width: 0;
    height: 100%;
}

.calc-bar__input::placeholder {
    color: var(--text-muted);
    font-family: var(--font);
}

.calc-bar__clear {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    padding: 2px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.calc-bar__clear:hover {
    color: var(--text-primary);
}

.calc-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 12px;
    width: 280px;
    max-height: 360px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    padding: 4px 0;
}

.calc-dropdown__live {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    background: var(--accent-soft);
    border-bottom: 1px solid var(--border);
}

.calc-dropdown__live:hover {
    background: var(--bg-hover);
}

.calc-dropdown__history-label {
    padding: 8px 14px 4px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.calc-dropdown__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background var(--transition);
}

.calc-dropdown__item:hover {
    background: var(--bg-subtle);
}

.calc-dropdown__expr {
    flex: 1;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calc-dropdown__answer {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.calc-dropdown__delete {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 10px;
    padding: 3px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
}

.calc-dropdown__delete:hover {
    color: var(--red);
    background: var(--red-bg);
}

@media (max-width: 768px) {
    .calc-bar-wrapper {
        margin-left: 0;
        padding: 0 8px;
    }

    .calc-bar {
        width: 160px;
    }

    .calc-dropdown {
        width: 240px;
        right: 8px;
    }
}

.calc-dropdown__empty {
    padding: 14px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.calc-dropdown {
    position: fixed;
    width: 280px;
    max-height: 360px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1200;
    padding: 4px 0;
}

.navbar .container-fluid {
    cursor: grab;
}

.navbar .container-fluid.nav-dragging {
    cursor: grabbing;
    user-select: none;
}

.navbar-nav-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
}

.nav-scroll-btn {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    border: none;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.nav-scroll-btn:hover {
    background: var(--bg-hover);
}

.nav-scroll-btn--left {
    left: 0;
    box-shadow: 6px 0 8px -4px rgba(0, 0, 0, 0.15);
    border-right: 1px solid var(--border);
}

.nav-scroll-btn--right {
    right: 0;
    box-shadow: -6px 0 8px -4px rgba(0, 0, 0, 0.15);
    border-left: 1px solid var(--border);
}

.navbar-nav-wrapper:has(.nav-scroll-btn--left) .container-fluid {
    scroll-padding-left: 28px;
}

.navbar-nav-wrapper:has(.nav-scroll-btn--right) .container-fluid {
    scroll-padding-right: 28px;
}

.notif-dot {
    position: absolute;
    top: 2px;
    right: -6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc3545;
    animation: notif-pulse 1.5s ease-in-out infinite;
}

@keyframes notif-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.6);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(220, 53, 69, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

.notif-card {
    border: 1px solid rgba(128, 128, 128, 0.25);
    border-left: 3px solid rgba(128, 128, 128, 0.5);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.notif-card:last-child {
    margin-bottom: 0;
}

.notif-card--info {
    border-left-color: #4dabf7;
}

.notif-card--warning {
    border-left-color: #f7b84d;
}

.notif-card--critical {
    border-left-color: #f76b6b;
}

.notif-card__title {
    font-weight: 700;
    font-size: 0.95rem;
}

.notif-card__date {
    font-size: 0.75rem;
    opacity: 0.65;
    white-space: nowrap;
    margin-left: 12px;
}

.notif-card__message {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-top: 4px;
    line-height: 1.4;
}

.notif-card__link {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    color: #4dabf7;
    border: 1px solid rgba(77, 171, 247, 0.5);
    border-radius: 999px;
    padding: 2px 10px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.notif-card__link:hover {
    background-color: #4dabf7;
    color: #0a0a0a;
}

.app-busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(0.5px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: wait;
}

[data-theme="dark"] .app-busy-overlay {
    background: rgba(0, 0, 0, 0.35);
}

.app-busy-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-mid);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: app-busy-spin 0.7s linear infinite;
}

@keyframes app-busy-spin {
    to { transform: rotate(360deg); }
}

mark.acct-hit { background:#ffe066; color:#000; padding:0 1px; border-radius:2px; }

@keyframes acctFlash {
    0%, 60% { background-color: rgba(255, 193, 7, .55); }
    100%    { background-color: transparent; }
}
tr.acct-flash > td { animation: acctFlash 2s ease-out; }
tr.acct-match > td { box-shadow: inset 0 0 0 9999px rgba(255, 224, 102, .28); }
tr.acct-match > td:first-child { box-shadow: inset 4px 0 0 #f0b400, inset 0 0 0 9999px rgba(255, 224, 102, .28); }