@font-face {
    font-family: "Source Sans Pro";
    src: url("fonts/sourcesanspro.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Source Sans Pro";
    src: url("fonts/sourcesanspro-bold.woff") format("woff");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Source Sans Pro";
    src: url("fonts/sourcesanspro-light.woff") format("woff");
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "FontAwesome";
    src: url("fonts/fontawesome-webfont.woff") format("woff");
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

:root {
    --bg: #eef1f5;
    --sidebar: #f7f8fa;
    --surface: #ffffff;
    --surface-soft: #f6f8fb;
    --line: #dfe4ec;
    --line-strong: #c9d1de;
    --text: #1f2937;
    --ink: #0f172a;
    --muted: #788397;
    --primary: #2185f5;
    --primary-dark: #1468c7;
    --teal: #10a99a;
    --rose: #ef4b63;
    --amber: #f59e0b;
    --shadow: 0 8px 22px rgba(15, 23, 42, .06);
    --shadow-soft: 0 2px 8px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Source Sans Pro", "Segoe UI", Arial, Helvetica, sans-serif;
    font-size: 13px;
    line-height: 1.42;
    letter-spacing: 0;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: none; }
button, input, select, textarea { font: inherit; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 278px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px 14px 16px;
    background: var(--sidebar);
    border-right: 1px solid var(--line);
    box-shadow: 8px 0 24px rgba(15, 23, 42, .04);
}

.brand {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: center;
    gap: 11px;
    padding: 0 4px 14px;
    color: #05070c;
    border-bottom: 1px solid var(--line);
}

.brand:hover { color: #05070c; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: #05070c;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
}

.brand strong {
    display: block;
    overflow: hidden;
    color: #05070c;
    font-size: 23px;
    font-weight: 700;
    line-height: .95;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.1;
}

.side-nav {
    display: grid;
    gap: 8px;
    overflow-y: auto;
    padding-right: 2px;
}

.nav-section {
    border: 1px solid transparent;
    border-radius: 8px;
}

.nav-section[open] {
    background: #fff;
    border-color: var(--line);
    box-shadow: var(--shadow-soft);
}

.nav-section summary {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    color: #6e7788;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    list-style: none;
    text-transform: uppercase;
}

.nav-section summary::-webkit-details-marker { display: none; }

.nav-section summary i::before {
    content: "\f105";
    font-family: "FontAwesome";
    font-style: normal;
}

.nav-section[open] summary i::before { content: "\f107"; }

.nav-section-links {
    display: grid;
    gap: 2px;
    padding: 0 6px 8px;
}

.nav-section-links a {
    min-height: 38px;
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 6px;
    color: #767f91;
    font-size: 13px;
    font-weight: 600;
}

.nav-section-links a:hover {
    background: #f0f5fb;
    color: #263244;
}

.nav-section-links a.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(33, 133, 245, .22);
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    color: inherit;
}

.nav-icon::before {
    font-family: "FontAwesome";
    font-size: 15px;
    font-weight: normal;
    line-height: 1;
}

.nav-icon.grid::before { content: "\f0e4"; }
.nav-icon.platform::before { content: "\f0ac"; }
.nav-icon.client::before { content: "\f0c0"; }
.nav-icon.cash::before { content: "\f0d6"; }
.nav-icon.stock::before { content: "\f1b3"; }
.nav-icon.users::before { content: "\f001"; }
.nav-icon.invoice::before { content: "\f0f6"; }
.nav-icon.chart::before { content: "\f080"; }
.nav-icon.lock::before { content: "\f023"; }
.nav-icon.settings::before { content: "\f013"; }
.nav-icon.building::before { content: "\f1ad"; }
.nav-icon.pilot::before { content: "\f201"; }
.nav-icon.advance::before { content: "\f0ab"; }
.nav-icon.maintenance::before { content: "\f0ad"; }

.sidebar-foot {
    margin-top: auto;
    display: grid;
    gap: 7px;
    padding: 12px 8px 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.sidebar-foot strong {
    overflow: hidden;
    color: var(--text);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-main {
    min-height: 100vh;
    margin-left: 278px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 26px;
    background: rgba(238, 241, 245, .94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
}

.topbar h1 {
    margin: 0;
    color: #151d2b;
    font-size: 20px;
    font-weight: 300;
    line-height: 1.1;
    text-transform: uppercase;
}

.eyebrow {
    margin: 0 0 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.content {
    width: min(1640px, 100%);
    padding: 18px 22px 32px;
}

.icon-button {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.icon-button::before {
    content: "\f0c9";
    font-family: "FontAwesome";
}

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

.page-title h2 {
    margin: 0;
    color: #263244;
    font-size: 18px;
    font-weight: 600;
}

.page-title p {
    margin: 4px 0 0;
    color: var(--muted);
}

.title-actions,
.action-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-cell.stacked {
    align-items: flex-start;
    flex-direction: column;
}

.panel,
.filters,
.search-box,
.kpi,
.hero-stat,
.login-panel,
.invoice-sheet {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    margin: 16px 0;
    padding: 16px;
}

.panel.dense {
    overflow: hidden;
    padding: 0;
}

.panel h2,
.panel-head h2 {
    margin: 0;
    color: #303a4c;
    font-size: 17px;
    font-weight: 600;
}

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

.panel-head.padded {
    margin: 0;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.panel-head span {
    color: var(--muted);
    font-size: 13px;
}

.hero-stat {
    min-height: 132px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: 26px 30px;
    margin-bottom: 16px;
    border-color: var(--line);
}

.hero-stat span,
.kpi span {
    display: block;
    color: #526074;
    font-weight: 700;
}

.hero-stat strong {
    display: block;
    margin-top: 8px;
    color: #111827;
    font-size: 30px;
    font-weight: 700;
}

.hero-stat p {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.hero-mini {
    min-width: 226px;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.hero-mini strong { font-size: 22px; }

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

.kpi-grid.compact-kpis {
    margin-top: 14px;
}

.panel-grid {
    display: grid;
    gap: 16px;
}

.panel-grid.two {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
}

.kpi {
    min-height: 84px;
    padding: 14px 15px;
}

.kpi strong {
    display: block;
    margin-top: 8px;
    color: #111827;
    font-size: 20px;
    font-weight: 700;
}

.kpi small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}

.filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    gap: 12px;
    align-items: end;
    padding: 14px;
    margin-bottom: 16px;
}

.filters-short {
    grid-template-columns: minmax(180px, 260px) auto;
    justify-content: start;
}

label {
    display: grid;
    gap: 6px;
    color: #677386;
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33, 133, 245, .12);
}

textarea { resize: vertical; }

.button,
.row-action {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
}

.button:hover,
.row-action:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

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

.button.danger {
    border-color: var(--rose);
    background: var(--rose);
    color: #fff;
}

.button.danger:hover {
    border-color: #cf2f48;
    background: #cf2f48;
    color: #fff;
}

.row-action {
    min-height: 31px;
    padding: 5px 9px;
    background: var(--surface-soft);
    font-size: 13px;
}

.row-action.danger { color: var(--rose); }

.strong-link {
    color: var(--ink);
    font-weight: 700;
}

.strong-link:hover { color: var(--primary); }

.mini-logo,
.company-switcher-mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.tab-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    margin: 8px 0 18px;
    border-bottom: 1px solid var(--line);
}

.tab-strip a {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    padding: 0 0 10px;
    border-bottom: 3px solid transparent;
    color: #667085;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.tab-strip a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.sub-tabs {
    margin-top: -2px;
}

.search-box {
    width: min(370px, 100%);
    min-height: 45px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 13px;
    margin: 10px 0;
    box-shadow: var(--shadow-soft);
}

.search-box span::before {
    content: "\f002";
    color: var(--primary);
    font-family: "FontAwesome";
    font-size: 16px;
}

.search-box input {
    min-height: 28px;
    border: 0;
    padding: 0;
    box-shadow: none;
    font-size: 15px;
}

.search-box input:focus {
    box-shadow: none;
}

.panel-tools {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.panel-tools .search-box {
    min-height: 40px;
    margin: 0;
    box-shadow: none;
}

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

th {
    background: #fff;
    color: #606b7c;
    font-size: 13px;
    font-weight: 700;
}

tbody tr:nth-child(even) { background: #f7f9fc; }
tbody tr:hover { background: #f1f6fd; }
tbody tr.muted-row {
    color: var(--muted);
    background: #f5f6f8;
}

td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.wrap-cell {
    max-width: 540px;
    white-space: normal;
}

.business-table th {
    border-right: 1px solid var(--line);
}

.business-table td {
    color: #5f6b7d;
}

.section-row td {
    background: #f0f3f8;
    color: var(--ink);
    font-weight: 700;
}

.total-row td {
    border-top: 2px solid var(--amber);
    border-bottom: 2px solid var(--amber);
    color: #b45f00;
    font-weight: 700;
    text-transform: uppercase;
}

.empty-state {
    min-height: 170px;
    display: grid;
    align-content: center;
    gap: 9px;
    padding: 28px;
    margin: 16px 0;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
}

.empty-state strong {
    color: var(--text);
    font-size: 18px;
}

.empty-state p {
    max-width: 660px;
    margin: 0;
}

.empty {
    color: var(--muted);
    text-align: center;
}

.badge {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: #edf1f6;
    color: #687386;
    font-size: 12px;
    font-weight: 700;
}

.badge.ok { background: #e1f7f1; color: #057a68; }
.badge.warn { background: #fff3d7; color: #9a5b00; }
.badge.todo { background: #eaf0f8; color: #526070; }
.badge.danger { background: #ffe4e8; color: #b3233b; }
.badge.muted,
.badge.neutral { background: #eef1f5; color: #7b8494; }

.category-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.category-chip {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text);
    font-weight: 700;
}

.category-chip i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.category-chip small {
    min-width: 20px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    text-align: center;
}

.receipt-sheet {
    width: min(860px, 100%);
    margin: 0 auto 24px;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.receipt-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.receipt-mark {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    margin-bottom: 10px;
    border-radius: 8px;
    background: #05070c;
    color: #fff;
    font-weight: 700;
}

.receipt-head h2 {
    margin: 0;
    color: #111827;
    font-size: 22px;
    line-height: 1.05;
}

.receipt-head p,
.receipt-meta span,
.receipt-note {
    margin: 4px 0 0;
    color: var(--muted);
}

.receipt-meta {
    display: grid;
    gap: 4px;
    min-width: 210px;
    text-align: right;
}

.receipt-meta strong {
    color: var(--primary);
    font-size: 19px;
}

.receipt-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin: 20px 0;
}

.receipt-info-grid dl {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 8px 12px;
    margin: 0;
}

.receipt-info-grid dt {
    color: var(--muted);
    font-weight: 700;
}

.receipt-info-grid dd { margin: 0; }

.receipt-table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
}

.receipt-total {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 24px;
    padding-top: 18px;
    color: #111827;
}

.receipt-total span {
    color: var(--muted);
    font-weight: 700;
}

.receipt-total strong {
    font-size: 24px;
}

.ranking-list {
    display: grid;
    gap: 15px;
}

.ranking-list.compact {
    gap: 12px;
}

.ranking-row {
    display: grid;
    grid-template-columns: 210px minmax(150px, 1fr) 140px;
    gap: 16px;
    align-items: center;
}

.bar {
    height: 18px;
    overflow: hidden;
    border-radius: 999px;
    background: #d8dee8;
}

.bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 13px;
}

.full { grid-column: 1 / -1; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.calc-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border-radius: 6px;
    background: var(--surface-soft);
}

.calc-preview span {
    color: var(--muted);
    font-weight: 700;
}

.calc-preview strong { font-size: 22px; }

.detail-grid,
.invoice-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(330px, .44fr);
    gap: 16px;
    align-items: start;
}

.danger-zone {
    border-color: #ffd0d7;
    background: linear-gradient(180deg, #fff, #fff7f8);
}

.danger-zone p {
    margin: 0 0 14px;
    color: #7a2534;
}

.muted-text {
    margin: 0 0 14px;
    color: var(--muted);
}

.check-list {
    display: grid;
    gap: 9px;
}

.check-list span {
    position: relative;
    padding-left: 22px;
    color: #526074;
    font-weight: 700;
}

.check-list span::before {
    content: "\f00c";
    position: absolute;
    left: 0;
    top: 1px;
    color: var(--teal);
    font-family: "FontAwesome";
    font-weight: normal;
}

.info-list {
    display: grid;
    grid-template-columns: minmax(145px, .55fr) 1fr;
    gap: 10px 14px;
    margin: 16px 0 0;
}

.info-list.solo { grid-template-columns: 90px 1fr; }
.info-list dt { color: var(--muted); font-weight: 700; }
.info-list dd { margin: 0; }

.permission-board {
    display: grid;
    gap: 12px;
}

.permission-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

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

.permission-card h3 {
    margin: 0;
    font-size: 16px;
}

.permission-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 8px;
}

.check-line {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
}

.check-line input {
    width: 18px;
    min-height: 18px;
}

.inline-form { display: inline; margin: 0; }

.inline-cancel-form {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto;
    gap: 6px;
    align-items: center;
}

.inline-cancel-form input {
    min-height: 31px;
    padding: 5px 8px;
}
.inline-selector { width: min(280px, 100%); }

.module-toggle-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(190px, 1fr));
    gap: 10px;
}

.module-toggle-grid.compact {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.module-toggle {
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
}

.module-toggle input {
    width: 18px;
    min-height: 18px;
    flex: 0 0 auto;
}

.module-toggle strong,
.module-toggle small { display: block; }
.module-toggle small { color: var(--muted); font-size: 12px; }

.form-subsection {
    padding-top: 4px;
}

.form-subsection h3 {
    margin: 0 0 5px;
    color: #303a4c;
    font-size: 15px;
}

.form-subsection p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.user-management-list,
.client-edit-list {
    display: grid;
    gap: 12px;
}

.user-management-card,
.client-edit-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.user-management-card {
    display: grid;
    gap: 12px;
}

.user-management-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.user-management-head h3 {
    margin: 0;
    font-size: 16px;
}

.user-management-head small { color: var(--muted); }

.user-edit-grid,
.compact-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
    gap: 10px;
    align-items: end;
}

.role-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.role-chip {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 7px 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
}

.role-chip span { font-weight: 700; }
.role-chip small { color: var(--muted); }

.role-chip button {
    min-height: 26px;
    padding: 3px 8px;
    border: 0;
    border-radius: 999px;
    background: #eef1f5;
    color: var(--rose);
    cursor: pointer;
    font-weight: 700;
}

.button:disabled,
.row-action:disabled,
.role-chip button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.client-edit-card {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 10px;
}

.alert {
    padding: 11px 13px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-weight: 700;
}

.alert.success {
    border-color: #bdeede;
    background: #effcf7;
    color: #057a68;
}

.alert.error {
    border-color: #ffd0d7;
    background: #fff1f3;
    color: #b3233b;
}

.stack {
    display: grid;
    gap: 12px;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #eef1f5;
}

.login-panel {
    width: min(430px, 100%);
    padding: 26px;
}

.login-brand { margin-bottom: 22px; }

.invoice-sheet {
    padding: 32px;
    box-shadow: none;
}

.invoice-head,
.invoice-beneficiary {
    display: flex;
    justify-content: space-between;
    gap: 28px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 22px;
}

.invoice-head h2 {
    margin: 0 0 8px;
    font-size: 26px;
}

.invoice-head p,
.invoice-beneficiary p,
.invoice-copy {
    margin: 4px 0;
    color: var(--muted);
}

.invoice-meta {
    min-width: 180px;
    display: grid;
    gap: 5px;
    text-align: right;
}

.invoice-meta span,
.invoice-beneficiary span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.invoice-beneficiary { margin-top: 24px; }
.invoice-beneficiary strong { display: block; margin: 5px 0; }
.invoice-copy { margin-top: 28px; }
.invoice-table th:last-child,
.invoice-table td:last-child { text-align: right; }
.invoice-table tfoot th { background: #fff; color: var(--text); font-size: 16px; }
.invoice-side { position: sticky; top: 88px; }

.home-hero {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 24px;
}

.home-hero h2 {
    margin: 4px 0 8px;
    font-size: 28px;
}

.home-hero p {
    max-width: 680px;
    margin: 0;
    color: var(--muted);
}

.home-summary {
    min-width: 340px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.home-summary div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.home-summary dt {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.home-summary dd {
    margin: 0;
    color: var(--text);
    font-size: 20px;
    font-weight: 800;
}

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 12px;
    padding: 16px;
}

.shortcut-card {
    min-height: 96px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
}

.shortcut-card .nav-icon { grid-row: span 2; }
.shortcut-card strong { font-size: 15px; }
.shortcut-card small { color: var(--muted); }

.document-template {
    --doc-primary: #155d75;
    --doc-accent: #f3b316;
    width: min(920px, 100%);
    min-height: 1120px;
    margin: 0 auto 24px;
    padding: 46px;
    border: 1px solid #d9e1eb;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font-size: 14px;
}

.document-head,
.document-top-grid,
.document-party-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(250px, .9fr);
    gap: 28px;
}

.document-head {
    align-items: start;
    margin-bottom: 24px;
}

.document-head h2 {
    margin: 0;
    color: var(--doc-primary);
    font-size: 48px;
    font-weight: 500;
    line-height: .95;
    text-align: right;
}

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

.document-logo-mark {
    width: 52px;
    height: 52px;
    display: inline-grid;
    place-items: center;
    border-radius: 6px;
    background: var(--doc-primary);
    color: #fff;
    font-weight: 900;
}

.document-brand strong {
    display: block;
    color: #111827;
    font-size: 20px;
}

.document-brand small {
    color: #65758b;
}

.document-company p,
.document-party-grid p,
.document-copy p,
.document-footer-copy {
    margin: 5px 0;
}

.document-meta-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--doc-primary);
}

.document-meta-card div {
    padding: 10px 12px;
    border-bottom: 1px solid #cbd7e3;
}

.document-meta-card div:nth-child(odd) {
    border-right: 1px solid #cbd7e3;
}

.document-meta-card span,
.document-party-grid h3 {
    display: block;
    margin: 0 0 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.document-meta-card span,
.document-party-grid h3 {
    color: var(--doc-primary);
}

.document-meta-card strong {
    color: #111827;
    font-size: 16px;
}

.document-party-grid {
    margin: 26px 0;
}

.document-party-grid section {
    min-height: 128px;
    padding: 16px;
    border: 1px solid #d9e1eb;
    border-top: 30px solid var(--doc-primary);
    border-radius: 4px;
}

.document-party-grid h3 {
    margin-top: -38px;
    margin-bottom: 20px;
    color: #fff;
}

.document-party-grid strong {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
}

.document-copy {
    margin: 28px 0 22px;
    color: #111827;
    font-size: 16px;
}

.document-template .invoice-table {
    width: 100%;
    border: 1px solid #111827;
    border-collapse: collapse;
}

.document-template .invoice-table th {
    background: var(--doc-primary);
    color: #fff;
    font-size: 13px;
    text-transform: uppercase;
}

.document-template .invoice-table th,
.document-template .invoice-table td {
    padding: 12px;
    border: 1px solid #111827;
}

.document-total-zone {
    display: flex;
    justify-content: flex-end;
    margin: 40px 0 26px;
}

.document-total-zone dl {
    width: min(390px, 100%);
    margin: 0;
    border: 1px solid #111827;
}

.document-total-zone div {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    border-bottom: 1px solid #111827;
}

.document-total-zone div:last-child { border-bottom: 0; }

.document-total-zone dt,
.document-total-zone dd {
    margin: 0;
    padding: 9px 12px;
    font-weight: 800;
}

.document-total-zone dt {
    background: #f7f8fb;
}

.document-total-zone dd {
    text-align: right;
}

.document-total-main dt {
    background: var(--doc-accent);
    color: #111827;
}

.document-total-main dd {
    font-size: 24px;
}

.document-footer-copy {
    margin-top: 18px;
    color: #48566a;
}

.template-modern {
    border-top: 10px solid var(--doc-primary);
    box-shadow: 0 22px 60px rgba(15, 23, 42, .08);
}

.template-modern .document-head h2 {
    padding: 10px 0;
    font-size: 42px;
    font-weight: 800;
}

.template-modern .document-party-grid section,
.template-modern .document-meta-card {
    border-radius: 8px;
    overflow: hidden;
}

.template-modern.invoice-sheet .invoice-table,
.template-modern .invoice-table th,
.template-modern .invoice-table td {
    border-color: #d7deea;
}

.template-compact {
    padding: 34px;
    font-size: 13px;
}

.template-compact .document-head {
    margin-bottom: 14px;
}

.template-compact .document-head h2 {
    font-size: 34px;
    font-weight: 800;
}

.template-compact .document-party-grid,
.template-compact .document-top-grid {
    gap: 14px;
}

.template-compact .document-party-grid section {
    min-height: 90px;
    padding: 12px;
}

.template-compact .document-copy {
    margin: 18px 0;
    font-size: 14px;
}

.template-compact .document-total-zone {
    margin-top: 22px;
}

.eye-button {
    min-width: 50px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border-radius: 6px;
    background: #31b6c9;
    color: #fff;
    font-weight: 700;
}

.month-links {
    padding: 12px 0 16px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: #6d7890;
    font-size: 14px;
}

.month-links a {
    margin-left: 6px;
    white-space: nowrap;
}

@media (max-width: 1100px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    body.sidebar-open .sidebar { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .icon-button { display: inline-grid; place-items: center; }

    .filters,
    .kpi-grid,
    .panel-grid.two,
    .home-summary,
    .shortcut-grid,
    .document-head,
    .document-top-grid,
    .document-party-grid,
    .form-grid,
    .detail-grid,
    .invoice-layout,
    .module-toggle-grid,
    .user-edit-grid,
    .compact-form,
    .client-edit-card {
        grid-template-columns: 1fr 1fr;
    }

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

    .document-head h2 {
        text-align: left;
    }
}

@media (max-width: 720px) {
    .content { padding: 16px; }
    .topbar { padding: 12px 16px; }
    .topbar h1 { font-size: 19px; }

    .page-title,
    .hero-stat,
    .invoice-head,
    .invoice-beneficiary,
    .receipt-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .filters,
    .filters-short,
    .kpi-grid,
    .home-summary,
    .shortcut-grid,
    .document-head,
    .document-top-grid,
    .document-party-grid,
    .form-grid,
    .detail-grid,
    .invoice-layout,
    .info-list,
    .ranking-row,
    .permission-actions,
    .module-toggle-grid,
    .module-toggle-grid.compact,
    .panel-grid.two,
    .user-edit-grid,
    .compact-form,
    .client-edit-card {
        grid-template-columns: 1fr;
    }

    .home-summary {
        min-width: 0;
    }

    .document-template {
        min-height: 0;
        padding: 22px;
    }

    .document-head h2 {
        font-size: 34px;
        text-align: left;
    }

    .document-meta-card {
        grid-template-columns: 1fr;
    }

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

    .button { width: 100%; }
    .invoice-meta,
    .receipt-meta { text-align: left; }

    .receipt-sheet { padding: 18px; }
    .receipt-info-grid,
    .receipt-info-grid dl {
        grid-template-columns: 1fr;
    }

    .company-switcher {
        width: 100%;
        margin-left: 0;
    }
}

@media print {
    @page {
        size: A4;
        margin: 14mm;
    }

    body { background: #fff; }
    .sidebar,
    .topbar,
    .page-title,
    .invoice-side,
    .alert,
    .tab-strip {
        display: none !important;
    }

    .app-main { margin: 0; }
    .content { width: 100%; padding: 0; }
    .invoice-layout { display: block; }
    .invoice-sheet,
    .document-template {
        width: 100%;
        min-height: 0;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .document-template {
        font-size: 12px;
    }

    .document-head h2 {
        font-size: 42px;
    }

    .receipt-sheet {
        width: 100%;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
}

.company-switcher {
    width: min(360px, 100%);
    margin-left: auto;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
}

.company-switcher label {
    display: grid;
    gap: 4px;
    font-size: 11px;
}

.company-switcher select {
    min-height: 36px;
    border-radius: 999px;
    padding-right: 28px;
}
