:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-soft: #f1f3f6;
    --line: #e3e6eb;
    --text: #172033;
    --muted: #6f7785;
    --primary: #1f3a5f;
    --primary-soft: #eaf0f7;
    --green: #147a52;
    --green-soft: #e7f6ef;
    --red: #b63d49;
    --red-soft: #fcebed;
    --amber: #a56718;
    --amber-soft: #fff4dd;
    --purple: #6851a5;
    --purple-soft: #f1edfb;
    --radius: 18px;
    --shadow: 0 8px 28px rgba(30, 41, 59, .06);
}

* {
    box-sizing: border-box;
    min-width: 0;
}

html {
    background: var(--bg);
    color-scheme: light;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    max-width: 100%;
    font: inherit;
}

button,
a,
input,
select {
    touch-action: manipulation;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(1.75rem, 3vw, 2.45rem);
    letter-spacing: -.045em;
}

h2 {
    margin-bottom: 0;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    letter-spacing: -.025em;
}

.muted {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.6;
}

.eyebrow {
    margin-bottom: 7px;
    color: var(--primary);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .14em;
}

.eyebrow.green { color: var(--green); }
.eyebrow.red { color: var(--red); }
.eyebrow.amber { color: var(--amber); }
.eyebrow.purple { color: var(--purple); }

.app-shell {
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    display: flex;
    width: 252px;
    padding: 28px 20px;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    transition: width .22s ease, padding .22s ease, box-shadow .22s ease;
}

.sidebar-toggle {
    position: absolute;
    top: 32px;
    right: -17px;
    z-index: 2;
    display: grid;
    width: 34px;
    height: 34px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 5px 16px rgba(30, 41, 59, .12);
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 850;
    line-height: 1;
}

.sidebar-toggle:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.brand,
.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    margin: 0 8px 38px;
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border-radius: 14px;
    background: var(--primary);
    color: white;
    font-size: .8rem;
    font-weight: 900;
    letter-spacing: .05em;
    box-shadow: 0 6px 16px rgba(31, 58, 95, .2);
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: .98rem;
}

.brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: .8rem;
}

.desktop-nav {
    display: grid;
    gap: 7px;
}

.desktop-nav a {
    display: flex;
    min-height: 50px;
    padding: 8px 12px;
    align-items: center;
    gap: 12px;
    border-radius: 13px;
    color: #505968;
    font-weight: 700;
}

.desktop-nav a:hover,
.desktop-nav a.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.nav-icon {
    display: grid;
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 9px;
    font-size: .73rem;
    font-weight: 900;
}

.sidebar-user {
    display: grid;
    margin-top: auto;
    padding: 15px 10px 0;
    grid-template-columns: 38px 1fr auto;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--line);
}

.sidebar-user strong,
.sidebar-user small {
    display: block;
    overflow-wrap: anywhere;
}

.sidebar-user strong {
    font-size: .76rem;
}

.sidebar-user small {
    margin-top: 3px;
    color: var(--muted);
    font-size: .7rem;
}

.user-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: .82rem;
    font-weight: 900;
}

.user-avatar.pending {
    background: var(--amber-soft);
    color: var(--amber);
}

.text-button {
    min-height: 36px;
    padding: 4px;
    border: 0;
    background: transparent;
    color: var(--red);
    cursor: pointer;
    font-size: .72rem;
    font-weight: 800;
}

.main-content {
    position: relative;
    width: calc(100% - 252px);
    max-width: 1500px;
    min-height: 100vh;
    margin-left: 252px;
    padding: 38px clamp(22px, 4vw, 58px) 70px;
    transition: width .22s ease, margin-left .22s ease;
}

.page-quick-actions {
    position: relative;
    z-index: 12;
    display: flex;
    margin-bottom: 10px;
    justify-content: flex-end;
    gap: 8px;
}

.global-search-form {
    display: grid;
    width: min(390px, 42vw);
    grid-template-columns: minmax(0, 1fr) auto;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow);
}

.person-autocomplete {
    position: relative;
    min-width: 0;
}

.person-autocomplete:focus-within {
    z-index: 30;
}

.person-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    z-index: 50;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 16px 36px rgba(30, 41, 59, .16);
}

.person-suggestions[hidden] {
    display: none;
}

.person-suggestion {
    display: flex;
    width: 100%;
    min-height: 46px;
    padding: 8px 10px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.person-suggestion:hover,
.person-suggestion.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.person-suggestion strong {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: .76rem;
}

.person-suggestion small {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: .63rem;
    font-weight: 750;
}

.global-search-input {
    width: 100%;
    min-height: 40px;
    padding: 7px 12px;
    border: 0;
    border-radius: 11px 0 0 11px;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: .78rem;
}

.global-search-input:focus {
    box-shadow: inset 0 0 0 2px rgba(31, 58, 95, .16);
}

.global-search-button {
    display: inline-flex;
    min-height: 40px;
    padding: 7px 12px;
    align-items: center;
    gap: 6px;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0 11px 11px 0;
    background: var(--primary);
    color: white;
    cursor: pointer;
    font-size: .72rem;
    font-weight: 850;
}

.quick-action {
    position: relative;
    display: inline-flex;
    min-height: 40px;
    padding: 7px 11px;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .96);
    color: var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow);
    font-size: .72rem;
    font-weight: 850;
}

.quick-logout-form {
    display: flex;
    margin: 0;
}

.logout-action {
    color: var(--red);
}

.logout-action > span:first-child {
    background: var(--red-soft);
}

.quick-action > span:first-child {
    display: grid;
    min-width: 25px;
    height: 25px;
    padding-inline: 4px;
    place-items: center;
    border-radius: 7px;
    background: var(--primary-soft);
    font-size: .62rem;
}

.notification-action > strong {
    position: absolute;
    top: -7px;
    right: -7px;
    display: grid;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    place-items: center;
    border-radius: 999px;
    background: var(--red);
    color: white;
    font-size: .62rem;
}

.print-report-header {
    display: none;
}

.print-preview-bar {
    display: flex;
    margin-bottom: 20px;
    padding: 14px 16px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid #b9d8ca;
    border-radius: 14px;
    background: var(--green-soft);
    color: var(--green);
}

.print-preview-bar[hidden] {
    display: none;
}

.print-preview-bar strong,
.print-preview-bar span {
    display: block;
}

.print-preview-bar span {
    margin-top: 4px;
    color: #436758;
    font-size: .75rem;
}

.print-preview-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.print-dialog {
    width: min(680px, calc(100% - 24px));
    max-height: min(820px, calc(100dvh - 24px));
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 20px;
    background: transparent;
    box-shadow: 0 30px 100px rgba(15, 23, 42, .28);
}

.print-dialog::backdrop {
    background: rgba(15, 23, 42, .54);
    backdrop-filter: blur(4px);
}

.print-dialog-card {
    display: grid;
    max-height: min(820px, calc(100dvh - 24px));
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: var(--surface);
}

.print-dialog-heading {
    display: flex;
    padding: 22px 24px 16px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--line);
}

.print-dialog-heading .muted {
    margin-top: 7px;
    font-size: .78rem;
}

.dialog-close {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
    color: var(--text);
    cursor: pointer;
    font-size: 1.35rem;
}

.print-dialog-scroll {
    display: grid;
    padding: 20px 24px;
    overflow-y: auto;
    gap: 17px;
}

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

.print-fieldset {
    min-width: 0;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
}

.print-fieldset legend {
    padding: 0 6px;
    color: #4f5868;
    font-size: .73rem;
    font-weight: 850;
}

.print-fieldset-help {
    margin: 10px 2px 0;
    color: var(--muted);
    font-size: .7rem;
    line-height: 1.45;
}

.print-section-options,
.print-choice-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.print-month-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.month-choice span,
.month-choice small {
    display: block;
}

.month-choice small {
    margin-top: 2px;
    color: var(--muted);
    font-size: .64rem;
    font-weight: 650;
}

.print-choice {
    display: flex;
    min-height: 42px;
    padding: 8px 10px;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    font-size: .78rem;
    font-weight: 750;
}

.print-choice input {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    accent-color: var(--primary);
}

.print-choice.standalone {
    border: 0;
    padding-inline: 0;
}

.print-dialog-actions {
    display: flex;
    padding: 14px 24px calc(14px + env(safe-area-inset-bottom));
    justify-content: flex-end;
    gap: 9px;
    border-top: 1px solid var(--line);
    background: #fbfcfd;
}

.page-header {
    display: flex;
    margin-bottom: 25px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.search-hero {
    margin-bottom: 22px;
}

.search-page-form {
    max-width: 760px;
}

.search-page-control {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(170px, .7fr) auto;
    gap: 9px;
}

.search-page-control .person-autocomplete,
.search-page-control .person-autocomplete > input {
    width: 100%;
}

.search-empty {
    display: grid;
    min-height: 250px;
    padding: 36px 20px;
    place-content: center;
    justify-items: center;
    text-align: center;
}

.search-empty > span {
    display: grid;
    width: 58px;
    height: 58px;
    margin-bottom: 16px;
    place-items: center;
    border-radius: 18px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.7rem;
}

.search-empty h2 {
    margin-bottom: 7px;
}

.page-header > div:first-child {
    max-width: 720px;
}

.date-jump {
    width: min(300px, 100%);
}

.header-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 9px;
}

.panel-heading-actions,
.compact-period-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.compact-period-form .form-control {
    min-height: 40px;
}

.date-jump > label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
}

.date-jump > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.weekly-date-jump {
    width: min(400px, 100%);
}

.weekly-date-jump > .weekly-date-controls {
    grid-template-columns: 42px 42px minmax(0, 1fr) auto;
}

.week-step-button {
    display: grid;
    min-height: 42px;
    place-items: center;
    border: 1px solid #d8dce3;
    border-radius: 11px;
    background: var(--surface);
    color: var(--primary);
    font-size: 1.05rem;
    font-weight: 850;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.week-step-button:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
    transform: translateY(-1px);
}

.year-date-jump {
    width: min(540px, 100%);
}

.year-date-jump > div {
    grid-template-columns: minmax(90px, .55fr) minmax(180px, 1.25fr) auto;
}

.form-control {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    border: 1px solid #d8dce3;
    border-radius: 11px;
    outline: none;
    background: var(--surface);
    color: var(--text);
}

.form-control:focus {
    border-color: #7c91ad;
    box-shadow: 0 0 0 3px rgba(31, 58, 95, .1);
}

.form-control[type="file"] {
    padding: 6px;
    font-size: .75rem;
}

.form-control[type="file"]::file-selector-button {
    min-height: 32px;
    margin-right: 9px;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
    cursor: pointer;
    font-weight: 800;
}

textarea.form-control {
    min-height: 88px;
    resize: vertical;
}

.button {
    display: inline-flex;
    min-height: 46px;
    padding: 10px 17px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 11px;
    cursor: pointer;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
}

.button.primary {
    background: var(--primary);
    color: white;
}

.button.secondary {
    border-color: var(--line);
    background: var(--surface);
    color: var(--text);
}

.button.success {
    background: var(--green-soft);
    color: var(--green);
}

.button.danger {
    background: var(--red-soft);
    color: var(--red);
}

.button.compact {
    min-height: 40px;
    padding: 8px 13px;
    font-size: .82rem;
}

.button.full {
    width: 100%;
}

.period-nav {
    display: none;
    margin-bottom: 16px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.period-nav > span {
    font-weight: 850;
}

.period-arrow {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    font-size: 1.15rem;
}

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

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

.kpi-card {
    position: relative;
    min-height: 134px;
    padding: 20px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.kpi-card::after {
    position: absolute;
    top: 17px;
    right: 17px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
    content: "";
    opacity: .7;
}

.kpi-card > span,
.kpi-card strong,
.kpi-card small {
    display: block;
}

.kpi-card > span {
    margin-bottom: 12px;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 750;
}

.screen-value {
    display: inline;
    margin: 0;
    padding: 0;
    color: inherit;
    font: inherit;
}

.print-value {
    display: none !important;
    margin: 0;
    padding: 0;
    color: inherit;
    font: inherit;
}

.kpi-card strong {
    margin-bottom: 10px;
    overflow-wrap: anywhere;
    font-size: clamp(1.22rem, 2.3vw, 1.72rem);
    letter-spacing: -.04em;
}

.kpi-card small {
    color: var(--muted);
    font-size: .72rem;
}

.kpi-card.income { color: var(--green); }
.kpi-card.expense,
.kpi-card.negative { color: var(--red); }
.kpi-card.promise { color: var(--amber); }
.kpi-card.balance { color: var(--primary); }

.panel {
    margin-bottom: 18px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel-heading {
    display: flex;
    margin-bottom: 18px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.count-badge {
    display: inline-flex;
    min-width: 34px;
    min-height: 34px;
    padding: 6px 10px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--surface-soft);
    font-size: .78rem;
    font-weight: 850;
}

.record-list {
    width: 100%;
}

.record-header,
.record-row {
    display: grid;
    align-items: center;
    gap: 12px;
}

.record-header {
    padding: 0 12px 10px;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.record-row {
    min-height: 64px;
    padding: 12px;
    border-top: 1px solid var(--line);
    font-size: .83rem;
}

.record-row:hover {
    background: #fafbfc;
}

.income-list .record-header,
.income-list .record-row {
    grid-template-columns: 110px minmax(180px, 1fr) 150px 112px;
}

.check-list .record-header,
.check-list .record-row {
    grid-template-columns: 95px 125px minmax(170px, 1fr) 95px 140px 95px 112px;
}

.promise-list .record-header,
.promise-list .record-row {
    grid-template-columns: 100px minmax(180px, 1fr) minmax(130px, .7fr) 130px 285px;
}

.record-field {
    min-width: 0;
}

.description-field,
.note-field,
.number-field {
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.45;
}

.amount-field {
    color: var(--text);
    text-align: right;
}

.amount-field.positive,
.positive {
    color: var(--green);
}

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

.mobile-label {
    display: none;
    color: var(--muted);
    font-size: .67rem;
    font-weight: 800;
}

.record-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 5px;
}

.record-actions form {
    display: flex;
    height: 38px;
    align-items: stretch;
    margin: 0;
}

.icon-button {
    display: inline-flex;
    height: 38px;
    min-height: 38px;
    padding: 8px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font-size: .72rem;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
}

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

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

.defer-link {
    color: #7c3aed;
}

.overdue-row {
    background: #fff9f9;
}

.status-badge,
.type-badge,
.inferred-badge {
    display: inline-flex;
    min-height: 26px;
    padding: 5px 9px;
    align-items: center;
    border-radius: 999px;
    font-size: .67rem;
    font-weight: 850;
}

.status-badge.open {
    background: var(--amber-soft);
    color: var(--amber);
}

.status-badge.paid {
    background: var(--green-soft);
    color: var(--green);
}

.status-badge.cancelled {
    background: var(--surface-soft);
    color: var(--muted);
}

.promise-status {
    width: max-content;
    margin: 5px 0 0 auto;
}

.overdue-row .status-badge,
.overdue-card .status-badge {
    background: var(--red-soft);
    color: var(--red);
}

.inferred {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: .62rem;
}

.record-subvalue {
    display: block;
    margin-top: 5px;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: .68rem;
}

.empty-state {
    padding: 28px 16px;
    color: var(--muted);
    line-height: 1.5;
    text-align: center;
}

.chart-panel {
    overflow: hidden;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 800;
}

.chart-legend span::before {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 5px;
    border-radius: 3px;
    content: "";
}

.legend-income::before { background: var(--green); }
.legend-check::before { background: var(--red); }
.legend-promise::before { background: var(--amber); }

.bar-chart {
    display: flex;
    width: 100%;
    min-height: 250px;
    padding: 18px 8px 0;
    align-items: stretch;
    justify-content: space-around;
    gap: clamp(10px, 3vw, 36px);
    border-bottom: 1px solid var(--line);
}

.bar-group {
    display: grid;
    min-width: 45px;
    flex: 1 1 0;
    grid-template-rows: 1fr auto;
    gap: 10px;
    color: var(--muted);
    font-size: .68rem;
    text-align: center;
}

.bar-values {
    display: flex;
    height: 190px;
    align-items: flex-end;
    justify-content: center;
    gap: 5px;
}

.bar {
    width: min(24px, 28%);
    height: max(3px, var(--bar));
    max-height: 100%;
    border-radius: 5px 5px 0 0;
}

.income-bar { background: var(--green); }
.check-bar { background: var(--red); }
.promise-bar { background: var(--amber); }

.summary-list {
    display: grid;
}

.summary-row {
    display: grid;
    padding: 16px 12px;
    grid-template-columns: minmax(150px, 1.2fr) repeat(4, minmax(115px, 1fr));
    align-items: center;
    gap: 14px;
    border-top: 1px solid var(--line);
}

.summary-row:hover {
    background: #fafbfc;
}

.summary-row > div span,
.summary-row > div strong,
.summary-date small {
    display: block;
}

.summary-row > div span,
.summary-date small {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: .67rem;
}

.income-breakdown {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: .56rem;
    font-weight: 650;
    line-height: 1.45;
}

.filter-toggle {
    display: none;
    width: 100%;
    min-height: 44px;
    padding: 8px 0;
    align-items: center;
    justify-content: space-between;
    border: 0;
    background: transparent;
    color: var(--text);
    font-weight: 850;
}

.filter-form {
    display: grid;
    grid-template-columns: minmax(170px, 1.5fr) repeat(4, minmax(125px, 1fr)) auto;
    align-items: end;
    gap: 10px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    color: #4f5868;
    font-size: .73rem;
    font-weight: 800;
}

.field-error {
    margin: 6px 0 0;
    color: var(--red);
    font-size: .72rem;
}

.filter-actions {
    display: flex;
    gap: 7px;
}

.check-card-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
}

.check-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fff;
}

.check-card.overdue-card {
    border-color: #efc1c6;
    background: #fffafa;
}

.check-card-top {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.check-card-top > div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.type-badge {
    background: var(--primary-soft);
    color: var(--primary);
}

.inferred-badge {
    background: var(--surface-soft);
    color: var(--muted);
}

.check-amount {
    flex: 0 1 auto;
    color: var(--red);
    font-size: clamp(.98rem, 2vw, 1.25rem);
    letter-spacing: -.025em;
    overflow-wrap: anywhere;
    text-align: right;
}

.check-description {
    margin-bottom: 17px;
}

.check-description strong,
.check-description span {
    display: block;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.check-description strong {
    line-height: 1.45;
}

.check-description span {
    margin-top: 5px;
    color: var(--muted);
    font-size: .73rem;
}

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

.check-details div {
    min-width: 0;
}

.check-details dt {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: .65rem;
    font-weight: 750;
}

.check-details dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: .78rem;
    font-weight: 800;
}

.check-actions {
    display: flex;
    padding-top: 14px;
    flex-wrap: wrap;
    gap: 7px;
    border-top: 1px solid var(--line);
}

.check-actions form {
    margin: 0;
}

.pagination {
    display: flex;
    margin-top: 20px;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.content-grid {
    display: grid;
    gap: 18px;
}

.admin-grid {
    grid-template-columns: minmax(260px, .65fr) minmax(0, 1.6fr);
    align-items: start;
}

.database-management-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
}

.database-card {
    display: flex;
    min-height: 100%;
    flex-direction: column;
}

.database-card .panel-heading {
    align-items: flex-start;
}

.database-card > .muted {
    margin-bottom: 18px;
    font-size: .79rem;
}

.database-card .stack-form {
    margin-top: auto;
}

.database-card-icon {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border-radius: 11px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: .9rem;
    font-weight: 900;
}

.database-card-icon.danger {
    background: var(--red-soft);
    color: var(--red);
}

.database-stats {
    display: grid;
    margin: 2px 0 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.database-stats div {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
}

.database-stats span,
.database-stats strong {
    display: block;
}

.database-stats span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: .65rem;
}

.database-stats strong {
    font-size: 1rem;
}

.database-note,
.restore-warning {
    margin: 0 0 16px;
    padding: 11px 12px;
    border-radius: 11px;
    font-size: .72rem;
    line-height: 1.5;
}

.database-note {
    background: var(--amber-soft);
    color: #765021;
}

.restore-warning {
    border: 1px solid #f0c9cd;
    background: var(--red-soft);
    color: #8c303a;
}

.database-history {
    grid-column: 1 / -1;
}

.confirmation-label {
    display: flex !important;
    margin: 0 !important;
    align-items: flex-start;
    gap: 9px;
    cursor: pointer;
    line-height: 1.45;
}

.confirmation-label input {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin: 1px 0 0;
    accent-color: var(--red);
}

.wide-panel {
    min-width: 0;
}

.stack-form {
    display: grid;
    gap: 16px;
}

.user-list {
    display: grid;
}

.user-row {
    display: grid;
    min-height: 68px;
    padding: 12px 4px;
    grid-template-columns: 40px minmax(150px, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--line);
}

.import-result {
    max-height: 320px;
    margin: 4px 0 0;
    padding: 13px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #111827;
    color: #e5e7eb;
    font-size: .72rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.audit-list {
    display: grid;
}

.audit-row {
    display: grid;
    min-height: 66px;
    padding: 12px 4px;
    grid-template-columns: minmax(170px, 1.3fr) minmax(150px, .8fr) auto;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--line);
}

.audit-row > div {
    min-width: 0;
}

.audit-row > div:first-child {
    display: flex;
    align-items: center;
    gap: 9px;
}

.audit-row span,
.audit-row strong,
.audit-row small {
    overflow-wrap: anywhere;
}

.audit-row small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: .68rem;
}

.status-badge.create,
.status-badge.import {
    background: var(--green-soft);
    color: var(--green);
}

.status-badge.update,
.status-badge.status {
    background: var(--primary-soft);
    color: var(--primary);
}

.status-badge.delete {
    background: var(--red-soft);
    color: var(--red);
}

.weekly-filter {
    grid-template-columns: minmax(180px, 1.4fr) minmax(150px, .6fr) auto;
}

.checks-filter {
    grid-template-columns: minmax(170px, 1.4fr) repeat(5, minmax(125px, 1fr)) auto;
}

.audit-filter {
    grid-template-columns: minmax(180px, 1.4fr) repeat(2, minmax(150px, .7fr)) auto;
}

.user-identity strong,
.user-identity small {
    display: block;
    overflow-wrap: anywhere;
}

.user-identity small {
    margin-top: 4px;
    color: var(--muted);
    font-size: .7rem;
}

.inline-role-form {
    display: flex;
    align-items: center;
    gap: 7px;
}

.inline-role-form .form-control {
    min-width: 125px;
}

.subsection-title {
    margin-top: 28px;
}

.form-panel {
    max-width: 860px;
}

.entry-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.field-wide,
.form-actions {
    grid-column: 1 / -1;
}

.form-actions {
    position: sticky;
    bottom: 12px;
    z-index: 3;
    display: flex;
    margin: 10px -4px -4px;
    padding: 12px;
    justify-content: flex-end;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(8px);
}

.messages {
    position: relative;
    z-index: 50;
    display: grid;
    margin-bottom: 16px;
    gap: 8px;
}

.message {
    padding: 13px 15px;
    border: 1px solid #cdd7e5;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: .82rem;
    line-height: 1.4;
}

.message.success {
    border-color: #b8dfcf;
    background: var(--green-soft);
    color: var(--green);
}

.message.error {
    border-color: #efc1c6;
    background: var(--red-soft);
    color: var(--red);
}

.auth-body {
    display: grid;
    min-height: 100vh;
    padding: 24px;
    place-items: center;
    background:
        radial-gradient(circle at 18% 15%, rgba(31, 58, 95, .08), transparent 32%),
        radial-gradient(circle at 80% 85%, rgba(20, 122, 82, .07), transparent 30%),
        var(--bg);
}

.auth-shell {
    width: min(440px, 100%);
}

.auth-card {
    display: grid;
    padding: clamp(24px, 6vw, 42px);
    gap: 28px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 24px 70px rgba(30, 41, 59, .11);
}

.auth-brand strong {
    font-size: .95rem;
}

.auth-card h1 {
    font-size: clamp(1.65rem, 6vw, 2.15rem);
}

.auth-card input {
    width: 100%;
    min-height: 50px;
    padding: 11px 13px;
    border: 1px solid #d8dce3;
    border-radius: 11px;
    outline: none;
}

.code-input {
    font-size: 1.5rem !important;
    font-weight: 850;
    letter-spacing: .28em;
    text-align: center;
}

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

.captcha-code {
    display: inline-flex;
    min-width: 142px;
    min-height: 48px;
    padding: 9px 16px;
    align-items: center;
    justify-content: center;
    border: 1px dashed #91a0b4;
    border-radius: 11px;
    background:
        repeating-linear-gradient(135deg, transparent 0 9px, rgba(31, 58, 95, .05) 9px 11px),
        var(--primary-soft);
    color: var(--primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.28rem;
    font-weight: 900;
    letter-spacing: .22em;
    line-height: 1;
    user-select: none;
}

.captcha-challenge a {
    color: var(--primary);
    font-size: .74rem;
    font-weight: 850;
}

.captcha-input {
    letter-spacing: .16em;
}

.auth-note {
    margin: 0;
    color: var(--muted);
    font-size: .72rem;
    line-height: 1.5;
    text-align: center;
}

.back-link {
    color: var(--primary);
    font-size: .78rem;
    font-weight: 800;
    text-align: center;
}

.desktop-only-page-message {
    display: none;
}

.multi-weekly-body .main-content {
    max-width: none;
}

.multi-weekly-page {
    width: 100%;
    min-width: 0;
}

.multi-weekly-page-header {
    margin-bottom: 12px;
}

.multi-weekly-period-nav {
    display: flex;
    margin-bottom: 14px;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.multi-weekly-period-nav strong {
    min-width: 150px;
    text-align: center;
}

.multi-week-grid {
    display: flex;
    width: 100%;
    align-items: start;
    gap: clamp(7px, .8vw, 12px);
}

.multi-week-column {
    position: relative;
    width: 0;
    min-width: 0;
    flex: 1 1 0;
    overflow: hidden;
    border: 1px solid #d9e0e8;
    border-radius: 14px;
    background: #f5f7fa;
    box-shadow: 0 8px 24px rgba(30, 41, 59, .07);
}

.multi-week-column::before {
    position: absolute;
    inset: 0 0 auto;
    z-index: 2;
    height: 4px;
    background: var(--primary);
    content: "";
}

.multi-week-header {
    position: relative;
    display: flex;
    min-height: 100px;
    padding: 16px 13px 13px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.multi-week-header > div {
    min-width: 0;
}

.multi-week-header .eyebrow {
    margin-bottom: 6px;
    font-size: clamp(.49rem, .55vw, .62rem);
}

.multi-week-header h2 {
    overflow-wrap: anywhere;
    font-size: clamp(.77rem, .95vw, 1rem);
    line-height: 1.18;
}

.multi-week-header .muted {
    margin-top: 6px;
    overflow-wrap: anywhere;
    font-size: clamp(.52rem, .56vw, .65rem);
    line-height: 1.4;
}

.multi-week-open {
    display: grid;
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: .78rem;
    font-weight: 900;
}

.multi-week-kpis {
    margin: 9px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.multi-week-kpis .kpi-card {
    min-height: 91px;
    padding: 11px 9px 9px;
    border-radius: 10px;
    background: white;
    box-shadow: none;
}

.multi-week-kpis .kpi-card::after {
    top: 9px;
    right: 8px;
    width: 6px;
    height: 6px;
}

.multi-week-kpis .kpi-card > span {
    margin-bottom: 7px;
    padding-right: 7px;
    font-size: clamp(.49rem, .54vw, .62rem);
    line-height: 1.25;
}

.multi-week-kpis .kpi-card strong {
    margin-bottom: 6px;
    font-size: clamp(.67rem, .75vw, .88rem);
    line-height: 1.18;
}

.multi-week-kpis .kpi-card small {
    font-size: clamp(.46rem, .49vw, .56rem);
    line-height: 1.3;
}

.multi-week-sections {
    padding: 0 9px 2px;
}

.multi-week-sections .panel {
    margin-bottom: 9px;
    padding: 10px 9px;
    border-radius: 10px;
    background: white;
    box-shadow: none;
}

.multi-week-sections .panel-heading {
    margin-bottom: 9px;
    padding-bottom: 8px;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--line);
}

.multi-week-sections .panel-heading > div {
    min-width: 0;
}

.multi-week-sections .panel-heading .eyebrow {
    margin-bottom: 3px;
    font-size: clamp(.45rem, .47vw, .54rem);
}

.multi-week-sections .panel-heading h2 {
    overflow-wrap: anywhere;
    font-size: clamp(.63rem, .68vw, .78rem);
    line-height: 1.22;
}

.multi-week-sections .panel-heading .button {
    min-height: 27px;
    padding: 5px 7px;
    flex: 0 0 auto;
    border-radius: 7px;
    font-size: clamp(.48rem, .5vw, .56rem);
}

.multi-week-sections .record-header {
    display: none;
}

.multi-week-sections .record-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
}

.multi-week-sections .record-row,
.multi-week-sections .income-list .record-row,
.multi-week-sections .check-list .record-row,
.multi-week-sections .promise-list .record-row {
    display: grid;
    min-height: 0;
    padding: 9px 8px;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fbfcfd;
    font-size: clamp(.55rem, .58vw, .66rem);
}

.multi-week-sections .description-field,
.multi-week-sections .note-field {
    grid-column: auto;
}

.multi-week-sections .record-field {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(50px, .42fr) minmax(0, 1fr);
    align-items: baseline;
    gap: 7px;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.multi-week-sections .record-field > :not(.mobile-label) {
    min-width: 0;
    text-align: left;
}

.multi-week-sections .mobile-label {
    display: block;
    margin: 0;
    color: #788291;
    font-size: clamp(.46rem, .48vw, .54rem);
    letter-spacing: .02em;
}

.multi-week-sections .amount-field {
    text-align: left;
}

.multi-week-sections .amount-field .promise-status {
    grid-column: 2;
}

.multi-week-sections .status-badge,
.multi-week-sections .type-badge,
.multi-week-sections .inferred-badge {
    min-height: 20px;
    padding: 3px 6px;
    justify-self: start;
    font-size: clamp(.43rem, .45vw, .5rem);
}

.multi-week-sections .record-subvalue,
.multi-week-sections .inferred {
    margin-top: 3px;
    font-size: clamp(.43rem, .45vw, .5rem);
}

.multi-week-sections .promise-status {
    margin-left: 0;
}

.multi-week-sections .record-actions {
    display: flex;
    grid-column: auto;
    padding-top: 4px;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 3px;
    border-top: 1px solid var(--line);
}

.multi-week-sections .record-actions form {
    height: 25px;
}

.multi-week-sections .icon-button {
    height: 25px;
    min-height: 25px;
    padding: 4px 5px;
    border-radius: 6px;
    background: var(--surface-soft);
    font-size: clamp(.43rem, .46vw, .52rem);
}

.multi-week-sections .empty-state {
    padding: 17px 6px;
    overflow-wrap: anywhere;
    border: 1px dashed #d8dee7;
    border-radius: 9px;
    background: #fbfcfd;
    font-size: clamp(.52rem, .55vw, .62rem);
}

.mobile-nav {
    display: none;
}

@media (min-width: 768px) {
    .print-action > span:first-child,
    .logout-action > span:first-child {
        display: none;
    }
}

@media (min-width: 1200px) {
    body:not(.auth-body) {
        background:
            radial-gradient(circle at 78% -10%, rgba(31, 58, 95, .055), transparent 29rem),
            var(--bg);
    }

    .sidebar {
        width: 264px;
        padding: 24px 20px 26px;
        border-right-color: #dce1e8;
        background: rgba(255, 255, 255, .985);
        box-shadow: 10px 0 35px rgba(30, 41, 59, .035);
    }

    .brand {
        margin: 0 6px 28px;
        padding: 4px 2px 20px;
        border-bottom: 1px solid var(--line);
    }

    .desktop-nav {
        gap: 5px;
    }

    .desktop-nav a {
        position: relative;
        min-height: 48px;
        padding-inline: 11px;
        transition: background .16s ease, color .16s ease, transform .16s ease;
    }

    .desktop-nav a:hover {
        transform: translateX(2px);
    }

    .desktop-nav a.active {
        background: linear-gradient(90deg, #e3ebf5, #edf2f8);
        box-shadow: inset 3px 0 0 var(--primary);
    }

    .desktop-nav a.active .nav-icon {
        border-color: var(--primary);
        background: var(--primary);
        color: white;
        box-shadow: 0 5px 12px rgba(31, 58, 95, .16);
    }

    .sidebar-user {
        padding: 17px 8px 0;
    }

    .main-content {
        width: calc(100% - 264px);
        max-width: none;
        margin-left: 264px;
        padding: 0 clamp(28px, 3vw, 52px) 72px;
    }

    .page-quick-actions {
        position: sticky;
        top: 0;
        min-height: 70px;
        margin: 0 calc(clamp(28px, 3vw, 52px) * -1) 26px;
        padding: 13px clamp(28px, 3vw, 52px);
        align-items: center;
        border: 0;
        border-bottom: 1px solid rgba(218, 223, 231, .96);
        border-radius: 0;
        background: rgba(255, 255, 255, .94);
        box-shadow: 0 8px 22px rgba(30, 41, 59, .04);
        backdrop-filter: blur(14px);
    }

    .global-search-form {
        width: min(520px, 50%);
        margin-right: auto;
        border-color: #d8dde5;
        box-shadow: none;
    }

    .global-search-input,
    .global-search-button,
    .quick-action {
        min-height: 42px;
    }

    .global-search-input {
        font-size: .82rem;
    }

    .quick-action {
        border-color: var(--line);
        background: white;
        box-shadow: none;
    }

    .quick-action:hover {
        border-color: #cbd3de;
        background: var(--surface-soft);
    }

    .page-header {
        min-height: 0;
        margin-bottom: 24px;
        padding: 2px 2px 22px;
        align-items: flex-end;
        border: 0;
        border-bottom: 1px solid #dfe3e9;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .page-header h1 {
        margin-bottom: 7px;
        font-size: clamp(2rem, 2.45vw, 2.65rem);
    }

    .page-header .muted {
        max-width: 690px;
        font-size: .91rem;
    }

    .page-header .date-jump,
    .page-header .header-actions {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .page-header .header-actions {
        align-items: center;
    }

    .page-header .date-jump > label {
        margin-left: 2px;
    }

    .page-header .form-control,
    .page-header .button {
        min-height: 42px;
    }

    .filter-panel {
        border-color: #dbe1e9;
        background: rgba(255, 255, 255, .94);
    }

    .kpi-card,
    .panel {
        border-color: #dfe3e9;
    }

    .multi-weekly-body .sidebar {
        width: 220px;
        padding-inline: 14px;
    }

    .multi-weekly-body .main-content {
        width: calc(100% - 220px);
        margin-left: 220px;
        padding: 0 14px 56px;
    }

    .multi-weekly-body .page-quick-actions {
        margin-right: -14px;
        margin-bottom: 18px;
        margin-left: -14px;
        padding-inline: 14px;
    }

    .multi-weekly-body .multi-weekly-page-header {
        margin-bottom: 10px;
        padding-bottom: 14px;
    }
}

@media (max-width: 1199px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .record-header {
        display: none;
    }

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

    .record-row,
    .income-list .record-row,
    .check-list .record-row,
    .promise-list .record-row {
        display: grid;
        min-height: 0;
        padding: 15px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 13px;
        border: 1px solid var(--line);
        border-radius: 14px;
        align-items: start;
    }

    .description-field,
    .note-field {
        grid-column: 1 / -1;
    }

    .mobile-label {
        display: block;
        margin-bottom: 4px;
    }

    .amount-field {
        text-align: left;
    }

    .record-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
        flex-wrap: wrap;
        border-top: 1px solid var(--line);
        padding-top: 6px;
    }

    .promise-status {
        margin-left: 0;
    }

    .empty-state {
        grid-column: 1 / -1;
    }

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

    .filter-actions {
        grid-column: 1 / -1;
    }

    .check-card-list {
        grid-template-columns: 1fr;
    }

    .summary-row {
        grid-template-columns: minmax(150px, 1.2fr) repeat(2, minmax(105px, 1fr));
    }

    .summary-row > div:nth-child(4),
    .summary-row > div:nth-child(5) {
        grid-column: auto;
    }

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

    .database-management-grid {
        grid-template-columns: 1fr;
    }

    .database-history {
        grid-column: auto;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .multi-weekly-body .sidebar {
        width: 188px;
        padding-inline: 12px;
    }

    .multi-weekly-body .brand {
        margin-inline: 4px;
    }

    .multi-weekly-body .main-content {
        width: calc(100% - 188px);
        margin-left: 188px;
        padding: 24px 10px 48px;
    }

    .multi-weekly-body .page-quick-actions {
        margin-bottom: 18px;
    }

    .multi-weekly-body .multi-weekly-page-header {
        align-items: flex-end;
        flex-direction: row;
    }
}

@media (max-width: 767px) {
    :root {
        --radius: 15px;
    }

    body {
        padding-bottom: calc(72px + env(safe-area-inset-bottom));
    }

    .sidebar {
        display: none;
    }

    .multi-weekly-page {
        display: none;
    }

    .desktop-only-page-message {
        display: block;
        margin-top: 10px;
    }

    .main-content {
        width: 100%;
        margin: 0;
        padding: 70px 14px 28px;
    }

    .page-quick-actions {
        position: absolute;
        top: 14px;
        right: 14px;
        left: 14px;
        margin-bottom: 0;
        justify-content: flex-end;
    }

    .global-search-form {
        width: auto;
        flex: 1 1 auto;
    }

    .global-search-input {
        min-height: 42px;
        padding-inline: 10px;
        font-size: 16px;
    }

    .global-search-button {
        min-height: 42px;
        padding-inline: 11px;
    }

    .global-search-button-label {
        display: none;
    }

    .quick-action {
        min-height: 42px;
        padding: 7px 9px;
    }

    .quick-action-label {
        display: none;
    }

    .search-page-control {
        grid-template-columns: 1fr;
    }

    .search-page-control .button {
        width: 100%;
    }

    .year-date-jump > div {
        grid-template-columns: 1fr;
    }

    .print-dialog {
        width: calc(100% - 16px);
        max-height: calc(100dvh - 16px);
        border-radius: 17px;
    }

    .print-dialog-card {
        max-height: calc(100dvh - 16px);
    }

    .print-dialog-heading,
    .print-dialog-scroll,
    .print-dialog-actions {
        padding-inline: 16px;
    }

    .print-filter-grid,
    .print-section-options,
    .print-choice-row {
        grid-template-columns: 1fr;
    }

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

    .print-dialog-actions .button {
        flex: 1 1 0;
    }

    .print-preview-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .print-preview-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .page-header {
        margin-bottom: 17px;
        align-items: stretch;
        flex-direction: column;
        gap: 15px;
    }

    .header-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .panel-heading-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .compact-period-form {
        width: 100%;
    }

    .compact-period-form .form-control {
        flex: 1 1 auto;
    }

    .database-history .panel-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .database-history .panel-heading-actions,
    .database-history .compact-period-form {
        display: grid;
        width: 100%;
        grid-template-columns: 1fr;
    }

    .database-history .compact-period-form .button {
        width: 100%;
    }

    .page-header .muted {
        font-size: .84rem;
    }

    .date-jump {
        display: none;
    }

    .desktop-week-step {
        display: none;
    }

    .period-nav {
        display: flex;
    }

    .kpi-grid,
    .kpi-grid.three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .kpi-card {
        min-height: 120px;
        padding: 16px 13px;
    }

    .kpi-card > span {
        padding-right: 10px;
        font-size: .69rem;
    }

    .kpi-card strong {
        font-size: clamp(1rem, 5vw, 1.28rem);
        line-height: 1.15;
    }

    .kpi-card small {
        font-size: .65rem;
        line-height: 1.35;
    }

    .panel {
        margin-bottom: 13px;
        padding: 15px 12px;
    }

    .panel-heading {
        margin-bottom: 14px;
    }

    .panel-heading .button {
        min-height: 40px;
        padding-inline: 11px;
        flex: 0 0 auto;
    }

    .record-list {
        grid-template-columns: 1fr;
    }

    .record-row,
    .income-list .record-row,
    .check-list .record-row,
    .promise-list .record-row {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .record-field span,
    .record-field strong {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .amount-field strong {
        font-size: .9rem;
    }

    .chart-panel {
        padding-inline: 8px;
    }

    .chart-panel .panel-heading {
        padding-inline: 6px;
        align-items: flex-start;
        flex-direction: column;
    }

    .bar-chart {
        min-height: 215px;
        padding-inline: 0;
        gap: 4px;
    }

    .bar-values {
        height: 160px;
        gap: 2px;
    }

    .bar-group {
        min-width: 0;
        font-size: .58rem;
    }

    .summary-row {
        margin-bottom: 9px;
        padding: 14px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 13px;
        border: 1px solid var(--line);
        border-radius: 13px;
    }

    .summary-date {
        grid-column: 1 / -1;
    }

    .filter-panel {
        padding-top: 8px;
    }

    .filter-toggle {
        display: flex;
    }

    .filter-form {
        display: none;
        padding-top: 10px;
        grid-template-columns: 1fr;
    }

    .filter-form.open {
        display: grid;
    }

    .filter-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .check-card {
        padding: 15px 13px;
    }

    .check-card-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .check-amount {
        align-self: stretch;
        text-align: left;
    }

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

    .check-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .check-actions .button,
    .check-actions form,
    .check-actions form .button {
        width: 100%;
    }

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

    .user-row {
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .audit-row {
        grid-template-columns: 1fr;
    }

    .inline-role-form,
    .user-row > form {
        display: grid;
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .user-row > form:not(.inline-role-form) {
        grid-template-columns: 1fr;
    }

    .entry-form {
        grid-template-columns: 1fr;
    }

    .field-wide,
    .form-actions {
        grid-column: auto;
    }

    .form-panel {
        padding-bottom: 8px;
    }

    .form-actions {
        bottom: calc(80px + env(safe-area-inset-bottom));
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .mobile-nav {
        position: fixed;
        inset: auto 0 0;
        z-index: 40;
        display: grid;
        min-height: calc(66px + env(safe-area-inset-bottom));
        padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
        grid-auto-columns: minmax(0, 1fr);
        grid-auto-flow: column;
        gap: 3px;
        border-top: 1px solid var(--line);
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 -8px 26px rgba(30, 41, 59, .07);
        backdrop-filter: blur(12px);
    }

    .mobile-nav a {
        display: flex;
        min-height: 52px;
        padding: 5px 2px;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 3px;
        border-radius: 10px;
        color: var(--muted);
        font-size: .62rem;
        font-weight: 800;
    }

    .mobile-nav a span {
        display: grid;
        width: 25px;
        height: 25px;
        place-items: center;
        border: 1px solid currentColor;
        border-radius: 8px;
        font-size: .62rem;
    }

    .mobile-nav a.active {
        background: var(--primary-soft);
        color: var(--primary);
    }
}

@media (min-width: 768px) {
    body.sidebar-collapsed .sidebar,
    body.sidebar-collapsed.multi-weekly-body .sidebar {
        width: 78px;
        padding-right: 13px;
        padding-left: 13px;
    }

    body.sidebar-collapsed .brand,
    body.sidebar-collapsed.multi-weekly-body .brand {
        margin-right: 0;
        margin-left: 0;
        justify-content: center;
    }

    body.sidebar-collapsed .brand > span:last-child,
    body.sidebar-collapsed .desktop-nav a > span:last-child,
    body.sidebar-collapsed .sidebar-user > div,
    body.sidebar-collapsed .sidebar-user > form {
        display: none;
    }

    body.sidebar-collapsed .desktop-nav a {
        padding-right: 0;
        padding-left: 0;
        justify-content: center;
    }

    body.sidebar-collapsed .desktop-nav a:hover {
        transform: none;
    }

    body.sidebar-collapsed .sidebar-user {
        padding-right: 0;
        padding-left: 0;
        grid-template-columns: 1fr;
        justify-items: center;
    }

    body.sidebar-collapsed .main-content,
    body.sidebar-collapsed.multi-weekly-body .main-content {
        width: calc(100% - 78px);
        margin-left: 78px;
    }
}

@page reportPortrait {
    size: A4 portrait;
    margin: 12mm;
}

@page reportLandscape {
    size: A4 landscape;
    margin: 10mm;
}

@media print {
    html,
    body {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        background: white !important;
        color: #111827 !important;
    }

    .app-shell {
        height: auto !important;
        min-height: 0 !important;
    }

    body.print-portrait {
        page: reportPortrait;
    }

    body.print-landscape {
        page: reportLandscape;
    }

    .sidebar,
    .mobile-nav,
    .page-quick-actions,
    .messages,
    .period-nav,
    .date-jump,
    .filter-panel,
    .button,
    .record-actions,
    .check-actions,
    .user-row > form,
    .audit-row > form,
    .pagination,
    .print-preview-bar,
    .print-dialog {
        display: none !important;
    }

    .paid-promise-record,
    .screen-value {
        display: none !important;
    }

    .print-value {
        display: inline !important;
    }

    [data-print-ignore] {
        display: none !important;
    }

    .main-content {
        width: 100% !important;
        max-width: none !important;
        min-height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .print-report-header {
        display: flex;
        margin-bottom: 8mm;
        padding-bottom: 4mm;
        align-items: flex-end;
        justify-content: space-between;
        gap: 10mm;
        border-bottom: 2px solid #1f3a5f;
    }

    .print-report-header p {
        margin: 0 0 2mm;
        color: #1f3a5f;
        font-size: 8pt;
        font-weight: 850;
        letter-spacing: .12em;
    }

    .print-report-header h1 {
        margin: 0;
        font-size: 18pt;
    }

    .print-report-meta {
        display: grid;
        max-width: 48%;
        gap: 1mm;
        color: #4b5563;
        font-size: 7.5pt;
        text-align: right;
    }

    .page-header {
        margin-bottom: 5mm;
    }

    .page-header .muted {
        display: none;
    }

    .panel,
    .kpi-card,
    .check-card,
    .summary-row,
    .record-row {
        break-inside: avoid;
        box-shadow: none !important;
    }

    .panel {
        margin-bottom: 5mm;
        padding: 4mm;
    }

    .kpi-grid,
    .kpi-grid.three {
        margin-bottom: 5mm;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 3mm;
    }

    .kpi-card {
        min-height: 25mm;
        padding: 4mm;
    }

    .record-header {
        display: none;
    }

    .record-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2mm;
    }

    .record-row,
    .income-list .record-row,
    .check-list .record-row,
    .promise-list .record-row {
        display: grid;
        min-height: 0;
        padding: 3mm;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2mm 5mm;
        border: 1px solid #d1d5db;
        border-radius: 2mm;
    }

    .description-field,
    .note-field {
        grid-column: 1 / -1;
    }

    .mobile-label {
        display: block;
    }

    .amount-field {
        text-align: left;
    }

    .check-card-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 3mm;
    }

    .bar-chart {
        min-height: 50mm;
    }

    .bar-values {
        height: 38mm;
    }

    .print-excluded {
        display: none !important;
    }

    a {
        text-decoration: none !important;
    }

    .checks-pdf-report {
        color: #172033;
    }

    .checks-pdf-intro {
        display: flex;
        margin-bottom: 2.5mm;
        padding: 2.5mm 3.5mm;
        align-items: end;
        justify-content: space-between;
        gap: 5mm;
        border: .3mm solid #b9d6ea;
        border-radius: 3.5mm;
        background: #e6f5ff;
        box-shadow: inset 0 0 0 .2mm rgba(255, 255, 255, .8);
        break-inside: avoid;
    }

    .checks-pdf-intro p,
    .checks-pdf-intro h2 {
        margin: 0;
    }

    .checks-pdf-intro p {
        margin-bottom: .5mm;
        color: #1f3a5f;
        font-size: 5.5pt;
        font-weight: 850;
        letter-spacing: .12em;
    }

    .checks-pdf-intro h2 {
        color: #172033;
        font-size: 10pt;
    }

    .checks-pdf-intro > span {
        color: #526174;
        font-size: 5.5pt;
        font-weight: 750;
        text-align: right;
    }

    .checks-pdf-table {
        width: 100%;
        margin: 0;
        table-layout: fixed;
        border-collapse: collapse;
        border-spacing: 0;
    }

    .checks-pdf-table thead {
        display: table-header-group;
    }

    .checks-pdf-table th {
        padding: 2mm 2.5mm;
        border: 1mm solid #fff;
        box-shadow: inset 0 -.3mm 0 rgba(23, 32, 51, .08);
        text-align: left;
    }

    .checks-pdf-table th span,
    .checks-pdf-table th strong,
    .checks-pdf-table th b {
        display: block;
    }

    .checks-pdf-table th span {
        margin-bottom: .6mm;
        font-size: 5pt;
        font-weight: 900;
        letter-spacing: .11em;
    }

    .checks-pdf-table th strong {
        color: #526174;
        font-size: 5.5pt;
    }

    .checks-pdf-table th b {
        margin-top: .7mm;
        font-size: 8.5pt;
    }

    .checks-pdf-table .received-heading {
        background: #eaf6f0;
        color: #147a52;
    }

    .checks-pdf-table .given-heading {
        background: #fff0f1;
        color: #a93643;
    }

    .checks-pdf-table tr,
    .checks-pdf-table td {
        break-inside: avoid;
    }

    .checks-pdf-table td {
        padding: .5mm .75mm;
        vertical-align: top;
    }

    .checks-pdf-line {
        display: grid;
        min-height: 8mm;
        padding: 1.2mm 1.7mm;
        grid-template-columns: 13mm minmax(0, 1fr) auto;
        align-items: center;
        gap: 1.5mm;
        border: .25mm solid #dbe3ec;
        border-radius: 2mm;
        background: #fff;
    }

    .checks-pdf-table .received-cell .checks-pdf-line {
        border-color: #cfe6da;
        border-left: .7mm solid #79b99a;
        background: #fbfefd;
    }

    .checks-pdf-table .given-cell .checks-pdf-line {
        border-color: #eed1d5;
        border-left: .7mm solid #d88a95;
        background: #fffafb;
    }

    .checks-pdf-line time {
        color: #6b7280;
        font-size: 5pt;
        font-weight: 750;
        white-space: nowrap;
    }

    .checks-pdf-line > div {
        min-width: 0;
    }

    .checks-pdf-line strong,
    .checks-pdf-line small {
        display: block;
        overflow-wrap: anywhere;
    }

    .checks-pdf-line strong {
        font-size: 6pt;
        line-height: 1.2;
    }

    .checks-pdf-line small {
        margin-top: .4mm;
        color: #6b7280;
        font-size: 4.6pt;
        line-height: 1.15;
    }

    .checks-pdf-line > b {
        font-size: 6pt;
        white-space: nowrap;
    }

    .checks-pdf-table .received-cell .checks-pdf-line > b,
    .checks-pdf-table .received-cell .checks-pdf-record-date {
        color: #147a52;
    }

    .checks-pdf-table .given-cell .checks-pdf-line > b,
    .checks-pdf-table .given-cell .checks-pdf-record-date {
        color: #a93643;
    }

    .checks-pdf-record-date {
        font-weight: 800;
    }

    .checks-pdf-report.is-single .checks-pdf-line {
        min-height: 9mm;
        padding: 1.5mm 2.2mm;
        grid-template-columns: 19mm minmax(0, 1fr) 32mm;
        gap: 2.5mm;
    }

    .checks-pdf-report.is-single .checks-pdf-line time,
    .checks-pdf-report.is-single .checks-pdf-line small {
        font-size: 5.5pt;
    }

    .checks-pdf-report.is-single .checks-pdf-line strong,
    .checks-pdf-report.is-single .checks-pdf-line > b {
        font-size: 7pt;
    }

    .checks-pdf-report.is-single .checks-pdf-line > b {
        text-align: right;
    }

    .checks-pdf-empty {
        padding: 8mm;
        border: .3mm dashed #cbd5e1;
        border-radius: 2mm;
        color: #6b7280;
        font-size: 7pt;
        text-align: center;
    }
}

@media (max-width: 350px) {
    .main-content {
        padding-inline: 10px;
    }

    .kpi-grid,
    .kpi-grid.three {
        grid-template-columns: 1fr;
    }

    .kpi-card {
        min-height: 108px;
    }

    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel-heading .button {
        width: 100%;
    }

    .record-row,
    .income-list .record-row,
    .check-list .record-row,
    .promise-list .record-row {
        grid-template-columns: 1fr;
    }

    .description-field,
    .note-field,
    .record-actions {
        grid-column: auto;
    }

    .check-details,
    .check-actions,
    .summary-row,
    .filter-actions,
    .form-actions {
        grid-template-columns: 1fr;
    }

    .summary-date {
        grid-column: auto;
    }
}

/* ── Çek Takvimi (check calendar) ─────────────────────────────────── */
.calendar-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.calendar-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
}

.calendar-split .record-header {
    display: none;
}

.calendar-split .record-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.calendar-split .record-row,
.calendar-split .income-list .record-row,
.calendar-split .check-list .record-row {
    display: grid;
    min-height: 0;
    padding: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
}

.calendar-split .description-field {
    grid-column: 1 / -1;
}

.calendar-split .mobile-label {
    display: block;
    margin-bottom: 4px;
}

.calendar-split .amount-field {
    text-align: left;
}

.calendar-split .record-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
}

.record-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-weight: 600;
}

.record-total strong {
    font-size: 1.05rem;
}

@media (max-width: 860px) {
    .calendar-split {
        grid-template-columns: 1fr;
    }
}

/* ── Aylık order-book PDF (print only) ────────────────────────────── */
.print-only {
    display: none;
}

@media print {
    .print-only {
        display: block;
    }

    .screen-only {
        display: none !important;
    }

    .financial-summary-report {
        display: none;
    }

    body.print-summary-mode .page-header,
    body.print-summary-mode [data-print-section] {
        display: none !important;
    }

    body.print-summary-mode,
    body.print-summary-mode .app-shell {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    body.print-summary-mode .main-content {
        position: static !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    body.print-summary-mode .print-report-header {
        margin-bottom: 4mm;
        padding-bottom: 3mm;
    }

    body.print-summary-mode .financial-summary-report {
        display: block !important;
        position: static;
    }

    body.print-summary-mode .financial-summary-report + .financial-summary-report,
    .multi-month-print-page + .multi-month-print-page {
        break-before: page;
    }

    .financial-summary-intro {
        display: flex;
        margin: 0 auto 3mm;
        padding: 4mm 6mm;
        align-items: center;
        justify-content: space-between;
        gap: 8mm;
        border: .4mm solid #b9d6ea;
        border-radius: 4mm;
        background: #e6f5ff;
        break-inside: avoid;
    }

    .financial-summary-intro p {
        margin: 0 0 1mm;
        color: #526174;
        font-size: 7pt;
        font-weight: 850;
        letter-spacing: .12em;
    }

    .financial-summary-intro h2 {
        margin: 0 0 1mm;
        color: #172033;
        font-size: 14pt;
    }

    .financial-summary-intro > div:first-child > span {
        color: #526174;
        font-size: 6.8pt;
    }

    .financial-summary-balance {
        display: grid;
        text-align: right;
    }

    .financial-summary-balance span {
        color: #526174;
        font-size: 7.5pt;
        font-weight: 750;
    }

    .financial-summary-balance strong {
        color: #1f3a5f;
        font-size: 15pt;
    }

    .financial-summary-balance.negative strong {
        color: #b63d49;
    }

    .financial-summary-legend {
        display: grid;
        margin-bottom: 2mm;
        padding-inline: 2mm;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12mm;
        break-inside: avoid;
    }

    .financial-summary-legend > div {
        display: grid;
        padding: 2mm 3mm;
        grid-template-columns: 1fr auto;
        align-items: end;
        gap: .5mm 3mm;
        border-radius: 2mm;
    }

    .financial-summary-legend > div:first-child {
        background: #eaf6f0;
        color: #147a52;
    }

    .financial-summary-legend > div:last-child {
        background: #fff0f1;
        color: #a93643;
    }

    .financial-summary-legend span,
    .financial-summary-legend strong {
        display: block;
    }

    .financial-summary-legend span {
        grid-column: 1 / -1;
        font-size: 6pt;
        font-weight: 850;
        letter-spacing: .1em;
    }

    .financial-summary-legend strong,
    .financial-summary-legend b {
        font-size: 8pt;
    }

    .financial-summary-timeline {
        position: relative;
        display: block;
    }

    .financial-summary-timeline::before {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 50%;
        width: .45mm;
        background: #1f2937;
        content: "";
        transform: translateX(-50%);
    }

    .financial-summary-group {
        position: relative;
        display: grid;
        margin-bottom: 2mm;
        grid-template-columns: minmax(0, 1fr) 9mm minmax(0, 1fr);
        align-items: stretch;
        gap: 2mm;
        break-inside: auto;
    }

    .financial-summary-side {
        overflow: hidden;
        border: .3mm solid #cbd5e1;
        border-radius: 2.5mm;
        background: white;
    }

    .financial-summary-side.incoming {
        border-color: #a9d7c3;
    }

    .financial-summary-side.outgoing {
        border-color: #e6b8be;
    }

    .financial-summary-side > header {
        display: flex;
        min-height: 8mm;
        padding: 1.5mm 2.5mm;
        align-items: center;
        justify-content: space-between;
        gap: 2mm;
        border-bottom: .25mm solid #dbe3ec;
        background: #f7f9fb;
    }

    .financial-summary-side > header strong,
    .financial-summary-side > header b {
        font-size: 6.8pt;
        white-space: nowrap;
    }

    .financial-summary-side.incoming > header b {
        color: #147a52;
    }

    .financial-summary-side.outgoing > header b {
        color: #a93643;
    }

    .financial-summary-note {
        margin: 0;
        padding: 1mm 2.5mm 0;
        color: #6b7280;
        font-size: 5.5pt;
    }

    .financial-summary-index {
        position: relative;
        z-index: 1;
        display: grid;
        place-items: start center;
        padding-top: 2mm;
    }

    .financial-summary-index span {
        display: grid;
        width: 6mm;
        height: 6mm;
        place-items: center;
        border: .4mm solid #1f2937;
        border-radius: 50%;
        background: white;
        color: #1f2937;
        font-size: 6pt;
        font-weight: 850;
    }

    .financial-summary-line {
        display: grid;
        min-height: 5mm;
        padding: .8mm 2mm;
        grid-template-columns: 7mm minmax(0, 1fr) auto;
        align-items: center;
        gap: 1.5mm;
        border-bottom: .2mm solid #edf0f3;
        break-inside: avoid;
    }

    .financial-summary-line > span {
        color: #6b7280;
        font-size: 5.2pt;
        white-space: nowrap;
    }

    .financial-summary-line > div {
        min-width: 0;
    }

    .financial-summary-line > div strong,
    .financial-summary-line > div small {
        display: block;
        overflow: hidden;
        line-height: 1.15;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .financial-summary-line > div strong {
        color: #172033;
        font-size: 5.8pt;
    }

    .financial-summary-line > div small {
        margin-top: .25mm;
        color: #6b7280;
        font-size: 4.8pt;
    }

    .financial-summary-line > b {
        color: #172033;
        font-size: 5.5pt;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }

    .financial-summary-empty {
        padding: 3mm 2mm;
        color: #6b7280;
        font-size: 5.8pt;
        text-align: center;
    }

    .financial-summary-report.dense .financial-summary-intro {
        margin-bottom: 1.5mm;
        padding: 2mm 4mm;
        border-radius: 2mm;
    }

    .financial-summary-report.dense .financial-summary-intro p {
        margin-bottom: .4mm;
        font-size: 5.5pt;
    }

    .financial-summary-report.dense .financial-summary-intro h2 {
        margin-bottom: .3mm;
        font-size: 10pt;
    }

    .financial-summary-report.dense .financial-summary-intro > div:first-child > span,
    .financial-summary-report.dense .financial-summary-balance span {
        font-size: 5pt;
    }

    .financial-summary-report.dense .financial-summary-balance strong {
        font-size: 10pt;
    }

    .financial-summary-report.dense .financial-summary-legend {
        margin-bottom: 1mm;
    }

    .financial-summary-report.dense .financial-summary-legend > div {
        padding: 1mm 2mm;
    }

    .financial-summary-report.dense .financial-summary-legend span {
        font-size: 4.5pt;
    }

    .financial-summary-report.dense .financial-summary-legend strong,
    .financial-summary-report.dense .financial-summary-legend b {
        font-size: 6pt;
    }

    .financial-summary-report.dense .financial-summary-group {
        margin-bottom: .7mm;
    }

    .financial-summary-report.dense .financial-summary-side {
        border-radius: 1.3mm;
    }

    .financial-summary-report.dense .financial-summary-side > header {
        min-height: 4mm;
        padding: .4mm 1.5mm;
    }

    .financial-summary-report.dense .financial-summary-side > header strong,
    .financial-summary-report.dense .financial-summary-side > header b {
        font-size: 5pt;
    }

    .financial-summary-report.dense .financial-summary-note {
        display: none;
    }

    .financial-summary-report.dense .financial-summary-index {
        padding-top: .5mm;
    }

    .financial-summary-report.dense .financial-summary-index span {
        width: 4.5mm;
        height: 4.5mm;
        font-size: 4.5pt;
    }

    .financial-summary-report.dense .financial-summary-line {
        min-height: 2.8mm;
        padding: .2mm 1.2mm;
        grid-template-columns: 4mm minmax(0, 1fr) auto;
        gap: .8mm;
    }

    .financial-summary-report.dense .financial-summary-line > span {
        font-size: 3.8pt;
    }

    .financial-summary-report.dense .financial-summary-line > div strong {
        font-size: 4.3pt;
    }

    .financial-summary-report.dense .financial-summary-line > div small {
        margin-top: 0;
        font-size: 3.6pt;
    }

    .financial-summary-report.dense .financial-summary-line > b {
        font-size: 4.2pt;
    }

    .financial-summary-main-grid {
        display: grid;
        height: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        gap: 4mm;
    }

    .financial-summary-card {
        overflow: hidden;
        border: .3mm solid #cbd5e1;
        border-radius: 2.5mm;
        background: #fff;
    }

    .cashflow-card {
        border-color: #a9d7c3;
    }

    .given-check-card {
        border-color: #e6b8be;
    }

    .promise-wide-card {
        height: auto;
        margin-top: 4mm;
        overflow: visible;
        border-color: #cfc4e8;
        break-inside: auto;
    }

    .financial-summary-card-header {
        display: flex;
        min-height: 12mm;
        padding: 2mm 3mm;
        align-items: center;
        justify-content: space-between;
        gap: 3mm;
        border-bottom: .3mm solid #dbe3ec;
    }

    .financial-summary-card-header.incoming {
        background: #eaf6f0;
        color: #147a52;
    }

    .financial-summary-card-header.outgoing {
        background: #fff0f1;
        color: #a93643;
    }

    .financial-summary-card-header.promise {
        background: #f2eefb;
        color: #6851a5;
    }

    .financial-summary-card-header span,
    .financial-summary-card-header strong {
        display: block;
    }

    .financial-summary-card-header span {
        margin-bottom: .4mm;
        font-size: 5.5pt;
        font-weight: 850;
        letter-spacing: .1em;
    }

    .financial-summary-card-header strong {
        font-size: 8pt;
    }

    .financial-summary-card-header > b {
        font-size: 8pt;
        white-space: nowrap;
    }

    .cashflow-categories {
        display: grid;
        height: auto;
        grid-template-rows: auto auto;
    }

    .financial-summary-category {
        min-height: 0;
        overflow: visible;
    }

    .financial-summary-category + .financial-summary-category {
        border-top: .3mm solid #a9d7c3;
    }

    .financial-summary-category > header {
        display: flex;
        min-height: 7mm;
        padding: 1.2mm 2.5mm;
        align-items: center;
        justify-content: space-between;
        gap: 2mm;
        background: #f6fbf8;
        color: #147a52;
    }

    .financial-summary-category > header strong,
    .financial-summary-category > header b {
        font-size: 6.3pt;
        white-space: nowrap;
    }

    .financial-category-body {
        min-height: 0;
    }

    .financial-category-body:not(:has(.financial-period-block))::after {
        display: block;
        padding: 5mm 2mm;
        color: #8a93a1;
        content: "Bu dönemde kayıt yok.";
        font-size: 5.5pt;
        text-align: center;
    }

    .financial-period-block {
        break-inside: avoid;
        border-bottom: .2mm solid #e8ecf0;
    }

    .financial-period-heading {
        display: flex;
        min-height: 5mm;
        padding: .7mm 2mm;
        align-items: center;
        justify-content: space-between;
        gap: 2mm;
        background: #f7f9fb;
    }

    .financial-period-heading strong,
    .financial-period-heading b {
        font-size: 5.3pt;
        white-space: nowrap;
    }

    .financial-promise-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-content: start;
    }

    .financial-promise-grid:has(> .financial-period-block:only-child) {
        display: block;
    }

    .financial-promise-grid .financial-period-block {
        break-inside: auto;
    }

    .financial-promise-grid .financial-summary-line {
        break-before: avoid;
    }

    .financial-promise-grid .financial-summary-line:nth-child(10n + 2) {
        break-before: auto;
    }

    .financial-promise-grid .financial-period-block:nth-child(odd) {
        border-right: .2mm solid #e8ecf0;
    }

    .financial-promise-grid .financial-period-block:only-child {
        grid-column: 1 / -1;
        border-right: 0;
    }

    .financial-summary-report.dense .financial-summary-main-grid {
        height: auto;
    }

    .financial-summary-report.dense .cashflow-categories {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: 1fr;
    }

    .financial-summary-report.dense .financial-summary-category + .financial-summary-category {
        border-top: 0;
        border-left: .3mm solid #a9d7c3;
    }

    .financial-summary-report.dense .financial-summary-card-header {
        min-height: 8mm;
        padding: 1mm 2mm;
    }

    .financial-summary-report.dense .financial-summary-card-header span {
        font-size: 4pt;
    }

    .financial-summary-report.dense .financial-summary-card-header strong,
    .financial-summary-report.dense .financial-summary-card-header > b {
        font-size: 5.5pt;
    }

    .financial-summary-report.dense .cashflow-categories {
        height: auto;
    }

    .financial-summary-report.dense .financial-summary-category > header {
        min-height: 5mm;
        padding: .5mm 1.2mm;
    }

    .financial-summary-report.dense .financial-summary-category > header strong,
    .financial-summary-report.dense .financial-summary-category > header b {
        font-size: 4.3pt;
    }

    .financial-summary-report.dense .financial-period-heading {
        min-height: 3.3mm;
        padding: .25mm 1mm;
    }

    .financial-summary-report.dense .financial-period-heading strong,
    .financial-summary-report.dense .financial-period-heading b {
        font-size: 3.8pt;
    }

    .financial-summary-report.dense .promise-wide-card {
        height: auto;
        margin-top: 2mm;
    }

    .financial-summary-report.dense .financial-promise-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .financial-summary-report.dense .financial-promise-grid:has(> .financial-period-block:only-child) {
        display: block;
    }

    .financial-summary-report.dense .financial-promise-grid .financial-period-block {
        border-right: .2mm solid #e8ecf0;
    }

    .orderbook-report {
        color: #111827;
        font-size: 8pt;
    }

    .ob-month-heading {
        display: flex;
        margin-bottom: 3mm;
        padding: 2.5mm 3mm;
        align-items: center;
        justify-content: space-between;
        gap: 4mm;
        border: .3mm solid #b9d6ea;
        border-radius: 2mm;
        background: #e6f5ff;
        color: #1f3a5f;
        break-inside: avoid;
    }

    .multi-month-primary-header,
    .multi-month-primary-summary {
        display: none !important;
    }

    .ob-month-kpis {
        margin-bottom: 3mm;
    }

    .ob-month-heading span {
        font-size: 6pt;
        font-weight: 850;
        letter-spacing: .1em;
    }

    .ob-month-heading strong {
        font-size: 11pt;
    }

    .ob-legend {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4mm;
        margin-bottom: 2mm;
        font-size: 8pt;
        font-weight: 850;
        letter-spacing: .06em;
    }

    .ob-legend-check {
        text-align: right;
        color: #b63d49;
    }

    .ob-legend-income {
        color: #147a52;
    }

    .ob-week {
        margin-bottom: 2.5mm;
        overflow: hidden;
        border: .3mm solid #cbd5e1;
        border-radius: 1.5mm;
        break-inside: avoid;
    }

    .ob-week-title {
        display: flex;
        justify-content: space-between;
        gap: 4mm;
        padding: 1mm 2mm;
        background: #eef2f7;
        font-size: 8pt;
        font-weight: 800;
    }

    .ob-week-body {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .ob-col {
        padding: 1mm 1.5mm;
    }

    .ob-income {
        border-right: .3mm solid #e5e7eb;
    }

    .ob-line {
        display: grid;
        grid-template-columns: 8mm 1fr auto;
        gap: 1.5mm;
        padding: .3mm 0;
        line-height: 1.25;
        border-bottom: .2mm solid #f1f2f4;
    }

    .ob-date {
        color: #6b7280;
        white-space: nowrap;
    }

    .ob-name {
        overflow-wrap: anywhere;
    }

    .ob-amt {
        text-align: right;
        white-space: nowrap;
        font-variant-numeric: tabular-nums;
    }

    .ob-empty {
        padding: .5mm 0;
        color: #9ca3af;
    }

    .ob-subtotal {
        display: flex;
        justify-content: space-between;
        margin-top: .8mm;
        padding-top: .8mm;
        border-top: .4mm solid #cbd5e1;
        font-weight: 800;
    }

    .ob-grandtotal {
        display: grid;
        grid-template-columns: 1fr auto auto;
        gap: 5mm;
        margin-top: 2mm;
        padding: 1.5mm 2.5mm;
        background: #1f3a5f;
        color: white;
        border-radius: 1.5mm;
        font-weight: 850;
    }

    .ob-grandtotal .ob-check-total {
        text-align: right;
    }
}

/* ── Çek Takvimi PDF: sol/sağ (alınan/verilen) yan yana + sıkışık satır ── */
@media print {
    .calendar-split {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 4mm !important;
        align-items: start;
    }

    .calendar-split .panel {
        margin: 0 !important;
        padding: 2mm !important;
        border: .3mm solid #cbd5e1;
        break-inside: auto;
    }

    .calendar-split .panel-heading {
        margin-bottom: 1.5mm;
    }

    .calendar-split .panel-heading h2 {
        font-size: 10pt;
    }

    .calendar-split .count-badge {
        display: none;
    }

    .calendar-split .record-list {
        display: block !important;
    }

    .calendar-split .record-header {
        display: none !important;
    }

    .calendar-split .record-row {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto auto !important;
        align-items: baseline;
        gap: 0 2mm !important;
        min-height: 0 !important;
        padding: .5mm 0 !important;
        border: 0 !important;
        border-bottom: .2mm solid #eef0f2 !important;
        border-radius: 0 !important;
        font-size: 7.5pt !important;
        line-height: 1.25;
    }

    .calendar-split .mobile-label {
        display: none !important;
    }

    .calendar-split .number-field,
    .calendar-split .status-field {
        display: none !important;
    }

    .calendar-split .description-field {
        grid-column: auto !important;
    }

    .calendar-split .date-field,
    .calendar-split .due-field {
        white-space: nowrap;
        color: #4b5563;
    }

    .calendar-split .amount-field {
        text-align: right !important;
        white-space: nowrap;
        font-weight: 700;
    }

    .calendar-split .record-total {
        margin-top: 1mm;
        padding-top: 1mm;
        font-size: 8pt;
    }
}
