:root {
    color-scheme: dark;
    --page: #151515;
    --surface: #151515;
    --surface-subtle: #1b1a1a;
    --sidebar: #202020;
    --ink: #b1b1b1;
    --muted: #727272;
    --line: #282828;
    --line-strong: #393939;
    --green: #46a83b;
    --green-dark: #319526;
    --blue: #678de3;
    --amber: #d9a354;
    --coral: #fa5c7c;
    --danger: #ff2847;
    --shadow: 0 12px 42px rgba(0,0,0,.38);
    font-family: "Segoe UI", Arial, sans-serif;
    font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--page); color: var(--ink); }
body { font-size: 12px; overflow: hidden; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; line-height: 1.2; letter-spacing: 0; }
h2 { font-size: 14px; line-height: 1.3; letter-spacing: 0; }
.page-stack { min-height: 100%; display: grid; align-content: start; gap: 13px; max-width: none; margin: 0; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-header p { margin-top: 5px; color: var(--muted); }
.eyebrow { display: block; margin-bottom: 7px; color: var(--green-dark); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.button { min-height: 30px; padding: 0 11px; border: 1px solid #393939; border-radius: 2px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: #969696; background: #2c2c2c; text-decoration: none; cursor: pointer; font-size: 12px; font-weight: 400; transition: background .12s ease, border-color .12s ease; }
.button svg { width: 16px; height: 16px; }
.button.primary { color: #fff; background: #46a83b; border-color: #3c9d31; }
.button.primary:hover { background: #319526; border-color: #298a1e; }
.button.secondary { color: #969696; background: #2c2c2c; border-color: #393939; }
.button.secondary:hover { color: #fff; background: #343434; }
.button:disabled { opacity: .55; cursor: wait; }
.button.wide { width: 100%; min-height: 32px; }
.icon-button { width: 32px; height: 30px; padding: 0; border: 1px solid #393939; border-radius: 2px; display: inline-grid; background: #2c2c2c; color: #969696; place-items: center; cursor: pointer; }
.icon-button svg { width: 19px; height: 19px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-height: 116px; padding: 14px; border: 1px solid var(--line); border-radius: 0; background: var(--surface); box-shadow: none; display: grid; grid-template-columns: 1fr auto; align-content: start; gap: 7px 12px; }
.metric-icon { grid-column: 2; grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 6px; display: grid; place-items: center; }
.metric-icon svg { width: 18px; height: 18px; }
.accent-green .metric-icon { color: var(--green-dark); background: #e9f4eb; }
.accent-blue .metric-icon { color: var(--blue); background: #e9f2f8; }
.accent-amber .metric-icon { color: var(--amber); background: #faf0df; }
.accent-coral .metric-icon { color: var(--coral); background: #faece9; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-card strong { font-size: 26px; line-height: 1.15; }
.metric-card small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .8fr); gap: 14px; }
.surface { min-width: 0; border: 1px solid var(--line); border-radius: 0; background: var(--surface); box-shadow: none; }
.surface-header { min-height: 67px; padding: 15px 17px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.surface-header p { margin-top: 4px; color: var(--muted); font-size: 11px; }
.text-link { display: inline-flex; align-items: center; gap: 6px; color: var(--green-dark); font-size: 11px; font-weight: 700; text-decoration: none; }
.text-link svg { width: 14px; height: 14px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.data-table th { height: 34px; padding: 0 8px; background: #171717; color: #d0d0d0; border-right: 1px solid #282828; border-bottom: 1px solid #303030; text-align: left; font-size: 11px; font-weight: 400; text-transform: none; }
.data-table td { height: 33px; padding: 0 8px; border-right: 1px solid #242424; border-bottom: 1px solid #282828; color: #b1b1b1; font-size: 11px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #262626; }
.data-table .numeric { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.row-link { color: var(--blue); font-weight: 800; text-decoration: none; }
.status-badge { padding: 2px 6px; border: 1px solid #3d7241; border-radius: 2px; color: #84c78b; background: #1b2a1c; font-size: 10px; font-weight: 600; }
.empty-cell { height: 100px !important; text-align: center; color: var(--muted); }
.quick-actions { align-self: start; }
.quick-actions > a { min-height: 66px; padding: 10px 14px; display: grid; grid-template-columns: 34px 1fr 16px; align-items: center; gap: 11px; border-bottom: 1px solid #edf0ee; text-decoration: none; }
.quick-actions > a:last-child { border-bottom: 0; }
.quick-actions > a:hover { background: #fafcfb; }
.quick-actions > a > svg { width: 15px; color: #9aa39d; }
.quick-actions strong, .quick-actions small { display: block; }
.quick-actions strong { font-size: 12px; }
.quick-actions small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.quick-icon { width: 34px; height: 34px; border-radius: 6px; display: grid; place-items: center; }
.quick-icon svg { width: 17px; }
.quick-icon.green { color: var(--green-dark); background: #e9f4eb; }
.quick-icon.blue { color: var(--blue); background: #e9f2f8; }
.quick-icon.amber { color: var(--amber); background: #faf0df; }
.quick-icon.coral { color: var(--coral); background: #faece9; }
.auth-layout { min-height: 100vh; padding: 32px 18px 60px; background: #171a18; display: grid; place-items: center; align-content: center; }
.auth-brand { margin-bottom: 22px; display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; }
.auth-brand .brand-mark { width: 36px; height: 36px; border: 1px solid #4c8655; border-radius: 6px; display: grid; place-items: center; color: #77cd80; background: #202a22; }
.auth-brand .brand-mark svg { width: 21px; }
.auth-brand small { align-self: flex-start; margin-top: 6px; color: #70c678; font-size: 8px; }
.auth-panel { width: min(100%, 430px); padding: 28px; border: 1px solid #313733; border-radius: 7px; background: #f9fbfa; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.setup-panel { width: min(100%, 550px); }
.auth-heading { margin-bottom: 23px; }
.auth-heading h1 { font-size: 24px; }
.auth-heading p { margin-top: 8px; color: var(--muted); line-height: 1.55; font-size: 12px; }
.form-stack { display: grid; gap: 15px; }
.form-grid { display: grid; gap: 12px; }
.form-grid.two-columns { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { color: #8a8a8a; font-size: 11px; font-weight: 400; }
.field input, .field select, .field textarea, select, input, textarea { width: 100%; min-height: 30px; padding: 0 8px; border: 1px solid #393939; border-radius: 0; color: #d0d0d0; background: #191919; outline: none; }
.field textarea { padding-top: 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, select:focus, input:focus, textarea:focus { border-color: #0874b9; box-shadow: inset 0 0 0 1px #0874b9; }
.check-field { display: flex; align-items: center; gap: 9px; color: #4e5952; font-size: 11px; cursor: pointer; }
.check-field input { width: 16px; height: 16px; accent-color: var(--green); }
.validation-summary { color: var(--danger); font-size: 11px; }
.validation-summary ul { margin: 0; padding-left: 18px; }
.alert { padding: 10px 12px; border: 1px solid; border-radius: 5px; font-size: 12px; line-height: 1.45; }
.alert.danger { color: #8f2f2b; background: #fff0ee; border-color: #ecc6c1; }
.alert.success { color: #2f6f39; background: #ecf7ed; border-color: #c7dfca; }
.auth-footnote { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 10px; line-height: 1.5; }
.connection-note { display: flex; align-items: center; justify-content: center; gap: 6px; }
.connection-note svg { width: 13px; }
.auth-loading, .route-loading { padding: 30px 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
.skeleton-card { background: linear-gradient(90deg, #fff 25%, #f2f5f3 45%, #fff 70%); background-size: 240% 100%; animation: shimmer 1.4s infinite; }
.error-state, .empty-page { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.error-state p, .empty-page p { color: var(--muted); }
.error-icon { color: var(--danger); }
.error-icon svg { width: 34px; height: 34px; }
#blazor-error-ui { display: none; position: fixed; z-index: 1000; inset: auto 18px 18px auto; max-width: 420px; padding: 12px 14px; background: #3a1715; color: white; border-radius: 6px; box-shadow: var(--shadow); }
#blazor-error-ui .reload { color: #a8dcae; margin-left: 8px; }
#blazor-error-ui .dismiss { margin-left: 8px; cursor: pointer; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -240% 0; } }
@media (max-width: 1180px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } .dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 680px) {
    h1 { font-size: 22px; }
    .page-header { align-items: stretch; flex-direction: column; }
    .header-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .metric-grid { grid-template-columns: 1fr; }
    .metric-card { min-height: 116px; }
    .form-grid.two-columns { grid-template-columns: 1fr; }
    .auth-panel { padding: 22px 18px; }
}
.modal-backdrop { position: fixed; z-index: 200; inset: 0; padding: 24px; display: grid; place-items: center; background: rgba(0,0,0,.58); }
.modal-panel { width: min(100%, 650px); max-height: calc(100vh - 48px); display: grid; grid-template-rows: auto minmax(0, 1fr); border: 1px solid #0874b9; border-radius: 0; background: #151515; box-shadow: 0 18px 60px rgba(0,0,0,.5); overflow: hidden; }
.modal-panel.wide { width: min(100%, 1080px); }
.modal-panel.reference-counterparty { width: min(100%, 456px); }
.modal-panel.reference-member { width: min(100%, 676px); }
.modal-panel.reference-service { width: min(100%, 618px); }
.modal-panel.reference-person { width: min(100%, 566px); }
.modal-panel.reference-department { width: min(100%, 356px); }
.modal-panel.reference-state { width: min(100%, 396px); }
.modal-panel.reference-group { width: min(100%, 436px); }
.modal-panel.company-editor { width: min(100%, 536px); }
.modal-panel[class*="reference-"] .modal-header { min-height: 36px; padding: 5px 10px; }
.modal-panel[class*="reference-"] .modal-header h2 { font-size: 12px; font-weight: 500; }
.modal-header { min-height: 42px; padding: 7px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 17px; }
.modal-header p { margin-top: 4px; color: var(--muted); font-size: 11px; }
.modal-body { min-height: 0; overflow-y: auto; }
.composer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; min-height: 510px; }
.composer-form { min-width: 0; padding: 18px; display: grid; align-content: start; gap: 16px; }
.composer-summary { padding: 16px; border-left: 1px solid var(--line); background: #171717; display: flex; flex-direction: column; align-items: stretch; gap: 11px; }
.composer-summary > span { color: var(--muted); font-size: 11px; }
.composer-summary > strong { font-size: 25px; }
.composer-summary dl { margin: 8px 0 auto; display: grid; gap: 9px; }
.composer-summary dl div { display: flex; justify-content: space-between; gap: 10px; }
.composer-summary dt, .composer-summary dd { margin: 0; font-size: 11px; }
.composer-summary dt { color: var(--muted); }
.composer-summary dd { font-weight: 700; }
.line-editor { display: grid; grid-template-columns: minmax(180px, 1fr) 90px 120px 90px auto; align-items: end; gap: 6px; padding: 9px; border: 1px solid var(--line); border-radius: 0; background: #171717; }
.line-editor:has(.small-field:nth-of-type(3):last-of-type) { grid-template-columns: minmax(180px, 1fr) 90px 120px auto; }
.add-line-button { white-space: nowrap; }
.composer-table { min-height: 185px; max-height: 270px; border: 1px solid var(--line); border-radius: 0; overflow: auto; }
.cell-subtext { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.row-actions { width: 45px; text-align: right; }
.row-actions .icon-button { width: 30px; height: 30px; }
.row-actions .icon-button svg { width: 15px; }
.danger-icon { color: var(--danger); }
@media (max-width: 900px) {
    .modal-backdrop { padding: 0; place-items: stretch; }
    .modal-panel, .modal-panel.wide, .modal-panel[class*="reference-"] { width: 100%; max-height: 100vh; min-height: 100vh; border: 0; border-radius: 0; }
    .composer-layout { grid-template-columns: 1fr; }
    .composer-summary { border-left: 0; border-top: 1px solid var(--line); }
    .line-editor { grid-template-columns: 1fr 1fr; }
    .line-editor .member-field { grid-column: 1 / -1; }
    .line-editor .add-line-button { grid-column: 1 / -1; }
}
.compact-surface { padding: 11px 13px; }
.toolbar { display: flex; align-items: center; gap: 10px; }
.toolbar > select { width: auto; min-width: 170px; }
.search-box { min-width: 240px; flex: 1; position: relative; }
.search-box svg { width: 16px; height: 16px; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #89928c; }
.search-box input { padding-left: 36px; }
.result-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
.roomy-table td { height: 58px; }
.link-button { padding: 0; border: 0; background: transparent; color: var(--blue); font-weight: 800; cursor: pointer; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 250px; }
.editor-main { padding: 18px; }
.editor-aside { padding: 18px; border-left: 1px solid var(--line); background: var(--surface-subtle); display: flex; flex-direction: column; gap: 11px; }
.editor-aside .button:first-of-type { margin-top: auto; }
.editor-note { padding: 11px; display: flex; align-items: flex-start; gap: 8px; color: var(--muted); background: #eef4f0; border-radius: 5px; font-size: 10px; line-height: 1.45; }
.editor-note svg { width: 15px; flex: 0 0 15px; }
.repair-details { display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: 650px; }
.repair-overview { padding: 18px; border-right: 1px solid var(--line); background: var(--surface-subtle); }
.details-list { margin: 0; display: grid; gap: 13px; }
.details-list div { display: grid; gap: 3px; }
.details-list dt, .details-notes span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.details-list dd { margin: 0; font-size: 12px; font-weight: 700; }
.details-notes { margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.details-notes div { display: grid; gap: 5px; }
.details-notes p { font-size: 11px; line-height: 1.5; white-space: pre-wrap; }
.repair-workspace { min-width: 0; padding: 18px; display: grid; align-content: start; gap: 14px; }
.subsection-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.subsection-header h3 { font-size: 13px; }
.subsection-header p { margin-top: 3px; color: var(--muted); font-size: 10px; }
.inline-editor { display: grid; gap: 8px; align-items: center; }
.repair-line-editor { grid-template-columns: minmax(170px, 1fr) 80px 105px 80px auto; }
.inset-table { border: 1px solid var(--line); border-radius: 6px; max-height: 240px; }
.details-columns { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(230px, .65fr); gap: 20px; margin-top: 5px; padding-top: 17px; border-top: 1px solid var(--line); }
.status-editor { margin-top: 10px; display: grid; grid-template-columns: 135px minmax(100px, 1fr) auto; gap: 7px; }
.timeline { margin-top: 14px; display: grid; max-height: 250px; overflow-y: auto; }
.timeline-item { display: grid; grid-template-columns: 14px 1fr; gap: 8px; min-height: 64px; }
.timeline-item > span { width: 8px; height: 8px; margin-top: 4px; border: 2px solid white; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px #9fc4a4; position: relative; }
.timeline-item > span::after { content: ""; width: 1px; height: 53px; position: absolute; top: 8px; left: 2px; background: var(--line); }
.timeline-item:last-child > span::after { display: none; }
.timeline-item strong { font-size: 11px; }
.timeline-item small { margin-left: 8px; color: var(--muted); font-size: 9px; }
.timeline-item p { margin-top: 5px; color: #414b45; font-size: 10px; line-height: 1.45; }
.upload-button { min-height: 40px; margin-top: 10px; padding: 0 12px; border: 1px dashed var(--line-strong); border-radius: 5px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--green-dark); background: var(--surface-subtle); cursor: pointer; font-size: 11px; font-weight: 700; }
.upload-button svg { width: 15px; }
.upload-button input { display: none; }
.attachment-list { margin-top: 8px; display: grid; gap: 5px; }
.attachment-list > a { min-height: 44px; padding: 7px 9px; display: grid; grid-template-columns: 18px 1fr 15px; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 5px; text-decoration: none; }
.attachment-list > a svg { width: 15px; }
.attachment-list strong, .attachment-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-list strong { font-size: 10px; }
.attachment-list small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.empty-note { padding: 18px 0; color: var(--muted); text-align: center; font-size: 10px; }
.modal-loading { min-height: 340px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
@media (max-width: 980px) {
    .editor-grid, .repair-details { grid-template-columns: 1fr; }
    .editor-aside, .repair-overview { border: 0; border-top: 1px solid var(--line); }
    .repair-overview { order: 2; }
    .details-columns { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .toolbar { align-items: stretch; flex-direction: column; }
    .toolbar > select, .search-box { width: 100%; min-width: 0; }
    .repair-line-editor, .status-editor { grid-template-columns: 1fr 1fr; }
    .repair-line-editor select, .status-editor input { grid-column: 1 / -1; }
    .repair-line-editor .button, .status-editor .button { grid-column: 1 / -1; }
}
.segmented-tabs { display: flex; align-items: center; gap: 3px; padding: 4px; overflow-x: auto; border: 1px solid var(--line); border-radius: 7px; background: #e8ece9; align-self: start; }
.segmented-tabs button { min-height: 35px; padding: 0 12px; border: 0; border-radius: 5px; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); background: transparent; cursor: pointer; white-space: nowrap; font-size: 11px; font-weight: 700; }
.segmented-tabs button svg { width: 15px; }
.segmented-tabs button span { min-width: 18px; padding: 2px 5px; border-radius: 9px; color: #68716c; background: rgba(255,255,255,.65); font-size: 9px; }
.segmented-tabs button.active { color: var(--ink); background: white; box-shadow: 0 1px 3px rgba(24,32,27,.12); }
.status-badge.negative { color: #933d35; background: #fae9e6; }
.status-badge.warning { color: #8b5a17; background: #faefd9; }
.status-badge.blue { color: #2f688f; background: #e6f0f7; }
.stock-value { font-size: 14px !important; }
.danger-text { color: var(--danger) !important; }
.success-text { color: var(--green-dark) !important; }
.warning-text { color: #9a651d !important; }
.link-icon { display: inline-grid; }
.warehouse-actions { flex-wrap: wrap; justify-content: flex-end; }
.toolbar-check { margin-left: auto; padding: 0 5px; }
.stock-editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; min-height: 500px; }
.stock-editor-main { padding: 18px; display: grid; align-content: start; gap: 16px; }
.stock-line-editor { grid-template-columns: minmax(180px, 1fr) 120px auto; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-subtle); }
.summary-number { display: grid; gap: 4px; }
.summary-number span { color: var(--muted); font-size: 11px; }
.summary-number strong { font-size: 28px; }
.order-create-group select { min-width: 175px; }
.compact-metrics .metric-card { min-height: 112px; }
.task-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 620px; }
.task-board { display: grid; gap: 8px; }
.task-row { min-height: 76px; padding: 13px 15px; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.task-row.completed { opacity: .72; }
.task-state { color: var(--amber); }
.task-row.completed .task-state { color: var(--green); }
.task-state svg { width: 20px; }
.task-content strong { font-size: 13px; }
.task-content p { margin-top: 5px; color: #525d56; font-size: 11px; line-height: 1.45; }
.task-content small { margin-top: 7px; display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; }
.task-content small svg { width: 12px; }
.done-date { color: var(--muted); font-size: 10px; }
.compact-empty { min-height: 280px; }
.compact-empty > svg { width: 32px; color: #a5aea8; }
.modal-form { padding: 18px; }
.modal-actions, .settings-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.payment-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.payment-methods label { display: flex; align-items: center; gap: 6px; }
.payment-methods label svg { width: 14px; }
.payment-total { padding: 14px; border-radius: 6px; display: grid; gap: 4px; }
.payment-total.income { color: #2f6f39; background: #eaf4eb; }
.payment-total.expense { color: #933d35; background: #fae9e6; }
.payment-total span { font-size: 10px; }
.payment-total strong { font-size: 22px; }
.small-button { min-height: 32px; padding: 0 10px; }
.report-filters { display: grid; grid-template-columns: 160px 160px minmax(180px, 1fr) auto; align-items: end; }
.report-filters input, .report-filters select { min-height: 38px; }
.filter-button { height: 38px; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.reference-tabs, .settings-tabs { max-width: 100%; }
.form-grid.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.editor-check { align-self: end; min-height: 40px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
.catalog-columns { display: grid; grid-template-columns: 1fr 1fr; }
.catalog-columns > div + div { border-left: 1px solid var(--line); }
.simple-list { display: grid; }
.simple-list > button { min-height: 55px; padding: 9px 16px; border: 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink); background: white; text-align: left; cursor: pointer; }
.simple-list > button:hover { background: var(--surface-subtle); }
.simple-list > button strong, .simple-list > button small { display: block; }
.simple-list > button strong { font-size: 12px; }
.simple-list > button small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.simple-list > button > svg { width: 15px; color: var(--muted); }
.color-preview { width: 15px; height: 15px; margin-right: 7px; border: 1px solid rgba(0,0,0,.12); border-radius: 3px; display: inline-block; vertical-align: middle; }
.settings-surface { padding-bottom: 18px; }
.settings-heading { min-height: 82px; padding: 17px 18px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--line); }
.settings-heading > div { min-width: 0; }
.settings-heading p { margin-top: 4px; color: var(--muted); font-size: 11px; }
.settings-icon { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 6px; display: grid; place-items: center; }
.settings-icon svg { width: 19px; }
.settings-icon.green { color: var(--green-dark); background: #e9f4eb; }
.settings-icon.blue { color: var(--blue); background: #e9f2f8; }
.settings-icon.amber { color: var(--amber); background: #faf0df; }
.settings-form { max-width: 800px; padding: 20px 18px 4px; display: grid; gap: 15px; }
.connection-grid { margin: 0; padding: 20px 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.connection-grid div { display: grid; gap: 5px; }
.connection-grid dt { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.connection-grid dd { margin: 0; font-size: 12px; font-weight: 700; }
.connection-state { display: inline-flex; align-items: center; gap: 7px; color: var(--green-dark); }
.connection-state > span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.database-actions { padding: 0 18px 18px; display: flex; gap: 8px; }
.danger-zone { margin: 0 18px; padding: 14px; border: 1px solid #e9cbc6; border-radius: 6px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #fff7f5; }
.danger-zone strong { color: #8d3831; font-size: 12px; }
.danger-zone p { margin-top: 4px; color: #8d6864; font-size: 10px; }
.danger-button { color: #9b3d35; border-color: #dfaaa4; background: white; }
.permission-heading select { width: 200px; margin-left: auto; }
.permission-groups { padding: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.permission-group { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.permission-group h3 { margin: 0; padding: 10px 12px; background: var(--surface-subtle); border-bottom: 1px solid var(--line); font-size: 11px; }
.permission-row { min-height: 48px; padding: 8px 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #edf0ee; cursor: pointer; }
.permission-row:last-child { border-bottom: 0; }
.permission-row strong, .permission-row small { display: block; }
.permission-row strong { font-size: 10px; }
.permission-row small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.permission-row input { width: 16px; height: 16px; accent-color: var(--green); }
.permission-groups + .settings-actions { padding: 0 18px; }
.mono-cell { font-family: Consolas, monospace; color: var(--muted); }
.print-layout { min-height: 100vh; padding: 24px; background: #e8ece9; }
.print-toolbar { max-width: 900px; margin: 0 auto 12px; display: flex; justify-content: flex-end; gap: 8px; }
.print-document { width: min(100%, 900px); min-height: 1180px; margin: 0 auto; padding: 48px; background: white; box-shadow: 0 10px 35px rgba(0,0,0,.12); }
.print-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; padding-bottom: 25px; border-bottom: 2px solid #202723; }
.print-logo { display: block; font-size: 20px; font-weight: 900; }
.print-header > div > small { display: block; margin-top: 5px; color: #667069; font-size: 10px; }
.print-document-title { text-align: right; }
.print-document-title span { color: #5d6761; font-size: 11px; text-transform: uppercase; }
.print-document-title h1 { margin-top: 5px; font-size: 25px; }
.print-meta { margin: 24px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 35px; }
.print-meta div { display: grid; grid-template-columns: 115px 1fr; gap: 10px; }
.print-meta dt { color: #667069; font-size: 10px; }
.print-meta dd { margin: 0; font-size: 11px; font-weight: 700; }
.print-table { width: 100%; border-collapse: collapse; }
.print-table th { padding: 9px 7px; border: 1px solid #bbc4be; background: #edf1ee; text-align: left; font-size: 9px; }
.print-table td { padding: 10px 7px; border: 1px solid #ccd3cf; font-size: 10px; }
.print-table th:not(:nth-child(2)), .print-table td:not(:nth-child(2)) { white-space: nowrap; }
.print-summary { width: 310px; margin: 22px 0 22px auto; display: grid; gap: 8px; }
.print-summary div { display: flex; justify-content: space-between; gap: 20px; font-size: 11px; }
.print-summary .grand-total { margin-top: 4px; padding-top: 10px; border-top: 2px solid #202723; font-size: 15px; }
.print-note, .repair-print-notes { margin: 22px 0; padding: 13px; border: 1px solid #ccd3cf; }
.print-note strong, .repair-print-notes strong { font-size: 10px; }
.print-note p, .repair-print-notes p { margin-top: 6px; font-size: 10px; line-height: 1.5; white-space: pre-wrap; }
.repair-print-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.print-footer { margin-top: 55px; display: grid; grid-template-columns: 1fr 1fr; gap: 30px; font-size: 10px; }
.print-footer p { grid-column: 1 / -1; margin-top: 25px; color: #667069; text-align: center; }
.payment-breakdown { margin: 35px 0; display: grid; gap: 12px; }
.payment-breakdown > div { padding-bottom: 10px; display: flex; justify-content: space-between; border-bottom: 1px solid #d7deda; }
.payment-breakdown .grand-total { padding: 16px; border: 2px solid #202723; font-size: 17px; }
.print-loading { min-height: 70vh; display: flex; align-items: center; justify-content: center; gap: 10px; }
@media print { .print-layout { padding: 0; background: white; } .print-toolbar { display: none; } .print-document { width: 100%; min-height: 0; padding: 0; box-shadow: none; } @page { size: A4; margin: 14mm; } }
@media (max-width: 900px) {
    .stock-editor-layout { grid-template-columns: 1fr; }
    .report-grid, .catalog-columns { grid-template-columns: 1fr; }
    .catalog-columns > div + div { border-left: 0; border-top: 1px solid var(--line); }
    .permission-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .header-actions, .warehouse-actions, .order-create-group { width: 100%; grid-template-columns: 1fr; }
    .order-create-group { display: grid; }
    .order-create-group select { width: 100%; }
    .stock-line-editor, .payment-methods, .report-filters, .form-grid.three-columns, .form-grid.four-columns, .checkbox-grid, .connection-grid, .permission-groups { grid-template-columns: 1fr; }
    .stock-line-editor select { grid-column: 1 / -1; }
    .task-metrics { grid-template-columns: 1fr; max-width: none; }
    .task-row { grid-template-columns: 22px minmax(0, 1fr); }
    .task-row > .button, .task-row > .done-date { grid-column: 2; justify-self: start; }
    .database-actions, .danger-zone { align-items: stretch; flex-direction: column; }
    .permission-heading { flex-wrap: wrap; }
    .permission-heading select { width: 100%; margin-left: 51px; }
    .print-layout { padding: 0; }
    .print-document { min-height: 100vh; padding: 24px 18px; }
    .print-header, .print-meta { grid-template-columns: 1fr; }
    .print-meta div { grid-template-columns: 95px 1fr; }
    .repair-print-notes { grid-template-columns: 1fr; }
}

/* CRMCORE v.05 desktop visual language */
.page-header { padding: 0 0 3px; align-items: center; }
.page-header .eyebrow { margin-bottom: 3px; color: #678de3; letter-spacing: 0; }
.page-header h1 { color: #d0d0d0; font-size: 18px; font-weight: 600; }
.page-header p { font-size: 11px; }
.compact-surface { padding: 7px 9px; }
.toolbar { min-height: 42px; border-color: #282828; background: #181818; }
.search-box input { background: #181818; }
.data-table { background: #181818; }
.data-table tbody tr:nth-child(even) td { background: #191919; }
.data-table tbody tr:nth-child(even):hover td { background: #262626; }
.roomy-table td { height: 36px; }
.surface-header { min-height: 48px; padding: 9px 12px; }
.text-link, .row-link, .link-button { color: #91a6d3; }
.segmented-tabs { gap: 0; padding: 0; border-radius: 0; border-color: #393939; background: #252525; }
.segmented-tabs button { min-height: 30px; border-right: 1px solid #393939; border-radius: 0; color: #a0a0a0; }
.segmented-tabs button.active { color: #fff; background: #3a3a3a; box-shadow: none; }
.quick-actions > a,
.task-row,
.simple-list > button { border-color: #282828; color: #b1b1b1; background: #181818; }
.quick-actions > a:hover,
.simple-list > button:hover { background: #262626; }
.status-badge.negative { color: #ff7e91; background: #2d171b; }
.status-badge.warning { color: #e6b96f; background: #2a241a; }
.status-badge.blue { color: #9ab0e0; background: #1c2332; }
.editor-grid,
.repair-details,
.stock-editor-layout { background: #151515; }
.editor-aside,
.repair-overview { background: #181818; }
.editor-note { color: #8d9a91; background: #1c251f; border-radius: 0; }
.inset-table,
.upload-button,
.attachment-list > a,
.permission-group,
.checkbox-grid,
.stock-line-editor { border-radius: 0; background: #181818; }
.timeline-item > span { border-color: #151515; }
.timeline-item p,
.task-content p { color: #a0a0a0; }
.alert { border-radius: 0; }
.alert.danger { color: #ff93a3; background: #2c171b; border-color: #6f2936; }
.alert.success { color: #8ed895; background: #17291a; border-color: #315f36; }
.payment-total.income { color: #8ed895; background: #17291a; }
.payment-total.expense { color: #ff93a3; background: #2c171b; }
.settings-heading,
.permission-group h3 { background: #181818; }
.danger-zone { border-radius: 0; background: #26191a; }
.auth-layout { background: #151515; }
.auth-panel { border-color: #303030; border-radius: 0; color: #b1b1b1; background: #181818; }

.legacy-loading {
    min-height: calc(100vh - 170px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #727272;
}

.legacy-home {
    min-width: 980px;
    height: calc(100vh - 153px);
    min-height: 560px;
    overflow: hidden;
}

.home-overview {
    height: 270px;
    display: grid;
    grid-template-columns: minmax(430px, .95fr) minmax(420px, 1fr) 270px;
    gap: 13px;
}

.home-repair-counters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 13px;
}

.home-counter {
    min-width: 0;
    padding: 11px 8px;
    border: 1px solid #303030;
    display: grid;
    grid-template-columns: 1fr 22px;
    grid-template-rows: auto 1fr;
    color: #727272;
    background: #151515;
}

.home-counter > span { min-width: 0; font-size: 11px; }
.home-counter > svg { width: 20px; height: 20px; padding: 5px; border-radius: 50%; color: #747779; background: #303030; }
.home-counter strong { grid-column: 1 / -1; align-self: center; justify-self: center; margin-top: 8px; font: 600 38px/1 "Segoe UI", sans-serif; }
.home-counter .pink { color: #fe1e97; }
.home-counter .red { color: #ff2847; }
.home-counter .blue { color: #91a6d3; }

.home-chart-panel,
.home-finance-panel,
.home-list-panel { border: 1px solid #303030; background: #151515; }
.home-chart-panel { min-width: 0; padding: 11px 12px 8px; }
.home-chart-panel > header,
.home-finance-panel > header { height: 27px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.home-chart-panel > header strong,
.home-finance-panel > header strong { color: #b1b1b1; font-size: 14px; }
.home-chart-panel > header span,
.home-finance-panel > header span { color: #b1b1b1; font-size: 20px; font-weight: 600; }
.home-chart-panel sup { margin-left: 4px; color: #727272; font-size: 11px; }
.home-chart { height: 218px; position: relative; border: 1px solid #282828; overflow: hidden; }
.home-chart svg { width: 100%; height: 181px; }
.home-chart line { stroke: #4b4b4b; stroke-width: 1; vector-effect: non-scaling-stroke; }
.home-chart polyline { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.home-chart .previous-week { stroke: #91a6d3; }
.home-chart .current-week { stroke: #0874b9; }
.home-chart .current-point { fill: #0785cb; }
.chart-dates { position: absolute; inset: auto 10px 3px 42px; display: flex; justify-content: space-between; color: #d0d0d0; font-size: 9px; }
.chart-legend { position: absolute; top: 48px; right: 16px; display: grid; gap: 5px; font-size: 10px; }
.chart-legend span::before { content: ""; width: 13px; height: 2px; margin-right: 6px; display: inline-block; vertical-align: middle; }
.chart-legend .previous::before { background: #91a6d3; }
.chart-legend .current::before { background: #0874b9; }

.home-finance-panel { padding: 11px 10px; }
.home-finance-panel dl { margin: 21px 0 0; display: grid; gap: 11px; }
.home-finance-panel dl div { display: flex; justify-content: space-between; gap: 12px; }
.home-finance-panel dt,
.home-finance-panel dd { margin: 0; }
.home-finance-panel dt { color: #727272; }
.home-finance-panel dd { color: #b1b1b1; font-variant-numeric: tabular-nums; }
.home-finance-panel .total dt { color: #91a6d3; }
.home-finance-panel .positive { color: #00b31c; }
.home-finance-panel .negative { color: #ff2847; }
.home-finance-panel .turnover { margin: 24px -10px 0; padding: 18px 10px 0; border-top: 1px solid #303030; }

.home-worklists {
    height: calc(100% - 283px);
    min-height: 270px;
    margin-top: 13px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 13px;
}
.home-list-panel { min-width: 0; display: grid; grid-template-rows: 47px minmax(0, 1fr); }
.home-list-panel h2 { padding: 16px 12px 0; border-bottom: 1px solid #282828; color: #d0d0d0; font-size: 13px; }
.home-list-body { min-height: 0; overflow: auto; }
.ready-repair-row { min-height: 51px; padding: 6px 10px; display: grid; grid-template-columns: 160px minmax(190px, 1fr) minmax(180px, 1fr) 120px 58px; align-items: center; gap: 8px; border-bottom: 1px solid #282828; }
.ready-repair-row > a { color: #91a6d3; text-decoration: none; font-size: 12px; }
.ready-repair-row span { min-width: 0; }
.ready-repair-row strong,
.ready-repair-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 400; }
.ready-repair-row .sum { color: #91a6d3; text-align: right; }
.ready-repair-row .row-tools { display: flex; justify-content: flex-end; gap: 6px; }
.ready-repair-row .row-tools a { color: #747779; }
.ready-repair-row .row-tools svg { width: 16px; height: 16px; }
.home-task-row { min-height: 62px; padding: 9px; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: start; gap: 8px; border-bottom: 1px solid #282828; color: #b1b1b1; text-decoration: none; }
.home-task-row:hover { background: #202020; }
.home-task-row > svg { width: 15px; height: 15px; color: #fd8027; }
.home-task-row strong,
.home-task-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-task-row small { margin-top: 4px; color: #727272; }
.home-task-row time { color: #727272; font-size: 10px; }
.legacy-empty { min-height: 100%; display: grid; place-items: center; color: #585858; font-size: 11px; }

@media (max-width: 1180px) {
    .legacy-home { min-width: 0; height: auto; min-height: 0; overflow: visible; }
    .home-overview { height: auto; grid-template-columns: 1fr 1fr; }
    .home-finance-panel { grid-column: 1 / -1; }
    .home-worklists { height: auto; min-height: 430px; grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    body { overflow: auto; }
    .home-overview { grid-template-columns: 1fr; }
    .home-repair-counters { grid-template-columns: 1fr 1fr; }
    .home-finance-panel { grid-column: auto; }
    .ready-repair-row { grid-template-columns: 64px minmax(0, 1fr) 60px; }
    .ready-repair-row > span:nth-of-type(2) { display: none; }
    .ready-repair-row .row-tools { display: none; }
}

@media (max-width: 480px) {
    .chart-dates span { display: none; }
    .chart-dates span:first-child,
    .chart-dates span:nth-child(4),
    .chart-dates span:last-child { display: inline; }
}
