:root {
    --portal-release-marker: "buh1071-ui-runtime-v1";
    --bg: #ffffff;
    --panel: #ffffff;
    --soft: #f8fafc;
    --soft-2: #f1f5f9;
    --line: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --accent: #111827;
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --warning-bg: #fffbeb;
    --warning-text: #92400e;
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button:disabled { opacity: .5; cursor: not-allowed; }

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

.login-card {
    width: min(420px, 100%);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .06);
}

.login-logo,
.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--accent);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
}

.login-card h1 { margin: 18px 0 6px; font-size: 28px; }
.login-card p { margin: 0 0 24px; color: var(--muted); }

.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.login-form input,
.filters input,
.filters select,
.code-editor textarea,
.upload-box input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 12px 14px;
    outline: none;
}
.login-form input:focus,
.filters input:focus,
.filters select:focus,
.code-editor textarea:focus { border-color: #111827; }

.login-form button,
.upload-box button,
.code-editor button,
.logout-button,
.action-row button,
.filters button,
.button-link {
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    padding: 11px 15px;
    cursor: pointer;
    font-weight: 700;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    line-height: 1;
    white-space: nowrap;
}
.button-link.soft,
.logout-button {
    background: var(--soft-2);
    color: var(--text);
}
.logout-button { width: 100%; }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    border-right: 1px solid var(--line);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    background: #fff;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 6px; }
.brand-title { font-weight: 800; }
.brand-subtitle,
.user-role,
.topbar-subtitle,
.panel p,
.section-card-text,
.upload-box span,
.metric-note,
.muted { color: var(--muted); font-size: 13px; }

.side-nav { display: grid; gap: 4px; }
.nav-link {
    padding: 11px 12px;
    border-radius: 12px;
    color: #374151;
}
.nav-link:hover,
.nav-link.active { background: var(--soft-2); color: #111827; }
.nav-group-title {
    margin: 16px 12px 6px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.nav-submenu {
    display: grid;
    gap: 2px;
    margin: -2px 0 7px 13px;
    padding-left: 11px;
    border-left: 1px solid var(--line);
}
.nav-sublink {
    display: block;
    padding: 6px 8px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.25;
    text-decoration: none;
}
.nav-sublink:hover {
    background: var(--soft);
    color: var(--text);
}

.sidebar-footer { margin-top: auto; display: grid; gap: 10px; }
.user-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.user-name { font-weight: 800; }

.main-content { padding: 28px; max-width: 1480px; width: 100%; }
.topbar {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.topbar h1 { margin: 0 0 6px; font-size: 28px; }

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

.section-card,
.panel,
.metric-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}
.section-card,
.metric-card { padding: 20px; transition: border-color .15s ease, transform .15s ease; }
.section-card:hover { border-color: #9ca3af; transform: translateY(-1px); }
.section-card-title { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { font-size: 32px; line-height: 1.2; font-weight: 850; margin: 6px 0 2px; }

.panel { padding: 20px; margin-bottom: 16px; }
.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}
.panel-header.split { align-items: center; }
.panel h2 { margin: 0 0 6px; font-size: 20px; }
.panel p { margin: 0; }
.warning-panel { background: #fffdf7; }
.code-note { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fff; color: #374151; }

.link-list { display: flex; flex-wrap: wrap; gap: 10px; }
.link-list a {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--soft);
}

.upload-box {
    min-height: 120px;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    padding: 18px;
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    align-items: center;
    gap: 16px;
    background: var(--soft);
}
.upload-box.dragging { border-color: #111827; background: #f5f5f5; }
.upload-box div { display: grid; gap: 4px; }

.filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 220px auto auto;
    gap: 10px;
    margin-bottom: 14px;
    align-items: center;
}

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 12px; white-space: nowrap; vertical-align: top; }
th { background: var(--soft); color: var(--muted); font-weight: 750; }
tr:last-child td { border-bottom: 0; }
.table-main-link { font-weight: 750; text-decoration: underline; text-decoration-color: transparent; }
.table-main-link:hover { text-decoration-color: currentColor; }

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: var(--soft-2);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .01em;
}
.status-need_parser { background: #eff6ff; color: #1d4ed8; }
.status-need_review { background: #fffbeb; color: #92400e; }
.status-ready_for_xml { background: #ecfdf5; color: #047857; }
.status-xml_generated { background: #f0fdf4; color: #166534; }
.status-error { background: var(--danger-bg); color: var(--danger-text); }

.empty-cell { color: var(--muted); text-align: center; padding: 18px; }
.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.alert-error { background: var(--danger-bg); color: var(--danger-text); }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.detail-grid > div {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    background: var(--soft);
}
.detail-label { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.detail-value { font-weight: 750; word-break: break-word; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }
.small { font-size: 12px; }

.code-layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; }
.code-files { border: 1px solid var(--line); border-radius: 14px; padding: 8px; max-height: 72vh; overflow: auto; }
.code-file-link { display: flex; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: 10px; font-size: 13px; word-break: break-all; }
.code-file-link:hover,
.code-file-link.active { background: var(--soft-2); }
.code-file-link em { color: var(--muted); font-style: normal; font-size: 11px; }
.code-editor { display: grid; gap: 10px; }
.code-editor-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.code-editor textarea {
    min-height: 72vh;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.5;
}
.code-editor textarea[readonly] { background: #fafafa; color: #4b5563; }

@media (max-width: 1100px) {
    .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .upload-box { grid-template-columns: 1fr; }
    .filters { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .main-content { padding: 18px; }
    .topbar { flex-direction: column; }
    .metric-grid, .metric-grid.compact { grid-template-columns: 1fr; }
    .code-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .grid-cards, .detail-grid { grid-template-columns: 1fr; }
    .login-card { padding: 24px; }
}


/* === LEGACY BRAND RESET === */
:root {
    --font-main: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    --text-main: #111827;
    --text-muted: #6b7280;
    --line-soft: #e5e7eb;
}
html, body {
    font-family: var(--font-main) !important;
    font-weight: 300 !important;
    letter-spacing: -0.015em !important;
    color: var(--text-main) !important;
}
h1, h2, h3, .page-title, .section-card-title, .metric-value, .brand-title, .sidebar-title {
    font-family: var(--font-main) !important;
    font-weight: 400 !important;
    letter-spacing: -0.035em !important;
}
p, a, button, input, select, textarea, .metric-note, .section-card-text, .sidebar-link, .muted {
    font-family: var(--font-main) !important;
    font-weight: 300 !important;
}
.login-logo-img {
    display: block !important;
    width: 160px !important;
    height: auto !important;
    margin: 0 auto 18px auto !important;
    object-fit: contain !important;
}
.brand-logo-img {
    display: block !important;
    width: 34px !important;
    max-height: 34px !important;
    object-fit: contain !important;
    border-radius: 0 !important;
    background: transparent !important;
}
.brand-mark, .brand-logo {
    display: none !important;
}
/* === LEGACY BRAND RESET END === */

/* === Invoice UI v1 === */
.drop-zone {
    display: block;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    padding: 32px;
    background: #f8fafc;
    cursor: pointer;
    transition: 0.18s ease;
}
.drop-zone input {
    display: none;
}
.drop-zone-active {
    background: #eef6ff;
    border-color: #2563eb;
}
.drop-zone-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 6px;
}
.drop-zone-subtitle,
.drop-zone-files {
    color: #64748b;
    font-size: 14px;
}
.drop-zone-files {
    margin-top: 12px;
}
.upload-actions,
.registry-actions,
.review-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}
.progress-wrap {
    flex: 1;
    min-width: 280px;
}
.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 6px;
}
.progress-track {
    height: 10px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #22c55e);
    transition: width 0.25s ease;
}
.progress-done {
    background: linear-gradient(90deg, #16a34a, #22c55e);
}
.compact-table td,
.compact-table th {
    font-size: 13px;
    padding: 8px 10px;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 600;
    background: #eef2ff;
    color: #3730a3;
}
.status-PARSED,
.status-READY_FOR_XML,
.status-XML_GENERATED {
    background: #dcfce7;
    color: #166534;
}
.status-PARSING,
.status-UPLOADED,
.status-NEED_PARSER {
    background: #fef3c7;
    color: #92400e;
}
.status-ERROR,
.status-PARSE_EMPTY {
    background: #fee2e2;
    color: #991b1b;
}
.row-warning {
    background: #fff7ed;
}
.error-text {
    color: #b91c1c;
    font-size: 12px;
    margin-top: 4px;
}
.danger-button {
    color: #991b1b;
    background: #fee2e2;
}
.button-light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    padding: 9px 14px;
    background: #f1f5f9;
    color: #0f172a;
    text-decoration: none;
}
.invoice-preview-card {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 18px;
    align-items: center;
}
.invoice-preview-card img {
    width: 320px;
    max-height: 220px;
    object-fit: contain;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #f8fafc;
    cursor: zoom-in;
}
.invoice-preview-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #475569;
}
.invoice-header-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 14px;
}
.invoice-header-grid label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #475569;
    font-size: 13px;
}
.invoice-lines-scroll {
    max-height: 620px;
    overflow: auto;
}
.invoice-lines-table {
    min-width: 1250px;
}
.invoice-lines-table th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 1;
}
.invoice-lines-table input,
.invoice-lines-table select,
.invoice-header-grid input {
    width: 100%;
    min-width: 80px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 13px;
}
.invoice-lines-table td:nth-child(3) input {
    min-width: 300px;
}
.invoice-lines-table td:nth-child(10) input {
    min-width: 300px;
}
.invoice-lines-table input[readonly],
.invoice-header-grid input[readonly],
.invoice-lines-table select:disabled {
    background: #f8fafc;
    color: #334155;
    border-color: transparent;
}
.preview-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.72);
    padding: 32px;
}
.preview-modal.open {
    display: block;
}
.preview-frame {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 16px;
    background: white;
}
.preview-close {
    position: fixed;
    top: 16px;
    right: 22px;
    z-index: 10000;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
}

/* === Invoice wide layout + modal v2 === */
body:not(.login-body) main,
body:not(.login-body) .content,
body:not(.login-body) .page-content {
    max-width: 1680px !important;
}

.panel {
    max-width: none !important;
}

.invoice-review-top,
.invoice-review-top + .panel,
.invoice-review-top + .panel + .panel {
    max-width: 1560px !important;
}

.invoice-lines-table {
    min-width: 1120px !important;
}

.invoice-lines-table td:nth-child(3) input {
    min-width: 260px !important;
}

.invoice-lines-table td:nth-child(10) input {
    min-width: 260px !important;
}

.preview-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.62);
    padding: 28px;
    align-items: center;
    justify-content: center;
}

.preview-modal.open {
    display: flex !important;
}

.preview-frame {
    width: min(58vw, 1100px) !important;
    height: 88vh !important;
    border: 0;
    border-radius: 18px;
    background: white;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.32);
}

.preview-close {
    position: fixed;
    top: 22px;
    right: 28px;
    z-index: 10000;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    background: white;
    color: #111827;
    border: 1px solid #e5e7eb;
}

/* === Preview large image fix === */
.preview-modal.open {
    display: flex !important;
}

.preview-large-img {
    width: min(62vw, 1180px);
    max-height: 92vh;
    object-fit: contain;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.32);
    padding: 10px;
}

#invoice-preview-img {
    cursor: zoom-in;
}

/* === Excel preview + soft delete rows === */
.excel-preview-mini {
    width: 320px;
    height: 220px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
    cursor: zoom-in;
}

.row-deleted {
    opacity: 0.42;
    background: #f1f5f9;
    text-decoration: line-through;
}

.row-deleted input,
.row-deleted select {
    text-decoration: line-through;
}

.preview-frame {
    width: min(72vw, 1300px) !important;
    height: 88vh !important;
    border: 0;
    border-radius: 18px;
    background: white;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.32);
}

/* === Always-image preview === */
#invoice-preview-img {
    width: 320px;
    max-height: 240px;
    object-fit: contain;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #ffffff;
    cursor: zoom-in;
}

.preview-large-img {
    width: min(62vw, 1180px);
    max-height: 92vh;
    object-fit: contain;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.32);
    padding: 10px;
}

.auto-upload-note {
    color: #64748b;
    font-size: 14px;
}

#invoice-preview-img {
    width: 320px;
    max-height: 240px;
    object-fit: contain;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #ffffff;
    cursor: zoom-in;
}

.preview-large-img {
    width: min(72vw, 1320px);
    max-height: 92vh;
    object-fit: contain;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.32);
    padding: 10px;
}

/* === Invoice upload progress full width === */
.upload-actions-progress-only {
    display: block !important;
    width: 100% !important;
    margin-top: 14px;
}

.upload-actions-progress-only .progress-wrap {
    width: 100% !important;
    min-width: 100% !important;
    flex: none !important;
}

.upload-actions-progress-only .progress-track {
    width: 100% !important;
}

.upload-actions-progress-only .progress-label {
    width: 100% !important;
}

/* === Preview v3: Office/PDF as pages === */
.preview-frame {
    width: min(74vw, 1360px) !important;
    height: 92vh !important;
    border: 0;
    border-radius: 18px;
    background: #0f172a;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.32);
}

/* === Accounting sheets === */
.sheet-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.sheet-filters input,
.sheet-filters select {
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
}
.sheet-lines-table input,
.sheet-form input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 7px 9px;
    background: #fff;
}
.sheet-form input[readonly],
.sheet-form input:disabled {
    border-color: transparent;
    background: #f8fafc;
    color: #334155;
}
.sheet-lines-table {
    min-width: 1100px;
}
.sheet-lines-table td:nth-child(2) input {
    min-width: 360px;
}
.pagination {
    margin-top: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
}
.pagination a {
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 10px;
    text-decoration: none;
}


/* Accounting sheets port */
.sheet-filters{display:flex;gap:10px;flex-wrap:wrap;align-items:center}.sheet-filters input,.sheet-filters select{padding:9px 12px;border:1px solid #d1d5db;border-radius:12px}.sheet-lines-table input,.sheet-form input{width:100%;border:1px solid #d1d5db;border-radius:8px;padding:7px 9px;background:#fff}.sheet-form input[readonly],.sheet-form input:disabled{border-color:transparent;background:#f8fafc;color:#334155}.sheet-lines-table{min-width:1100px}.sheet-lines-table td:nth-child(2) input{min-width:360px}.pagination{margin-top:14px;display:flex;gap:12px;align-items:center}.pagination a{padding:8px 12px;background:#f1f5f9;border-radius:10px;text-decoration:none}.error-pre{white-space:pre-wrap;background:#fff1f2;color:#991b1b;padding:14px;border-radius:12px}.sheet-ac-wrap{position:relative}.sheet-ac-list{position:absolute;z-index:60;left:0;right:0;top:100%;background:#fff;border:1px solid #d1d5db;border-radius:12px;box-shadow:0 12px 32px rgba(15,23,42,.16);max-height:260px;overflow:auto}.sheet-ac-list:empty{display:none}.sheet-ac-list button{display:flex;flex-direction:column;gap:3px;width:100%;border:0;background:white;text-align:left;padding:9px 11px;cursor:pointer}.sheet-ac-list button:hover{background:#f8fafc}.sheet-ac-list span{font-size:12px;color:#64748b}.registry-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:12px}.compact-table td,.compact-table th{font-size:13px;padding:8px 10px}

/* === Accounting sheets v2, read-safe === */
.bm-card{max-width:1700px!important;margin:0 auto 24px;background:#fff;border:1px solid #e5e7eb;border-radius:16px;padding:18px 20px 24px;box-shadow:0 18px 60px rgba(0,0,0,.06)}
.bm-card-list,.bm-card-detail{max-width:1700px!important}
.inv-filters{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-bottom:12px}.inv-filters label{font-size:13px;color:#374151}.inv-filters input,.inv-filters select{font-size:14px;padding:7px 11px;border-radius:999px;border:1px solid rgba(0,0,0,.16);background:#f8fafc;outline:none}.inv-filters input[type=text]{min-width:260px}.inv-filters button,.inv-btn-primary{padding:7px 14px;border-radius:999px;border:1px solid #ffdc73;background:#ffdc73;color:#000;font-size:14px;cursor:pointer;text-decoration:none}.inv-table-wrap{margin-top:8px;border-radius:14px;border:1px solid #e5e7eb;overflow:auto}.inv-table,.inv-header-table,.inv-lines-table,.sheet-upd-table{width:100%;border-collapse:separate;border-spacing:0;font-size:13px}.inv-table th,.inv-table td,.inv-header-table td,.inv-header-table th,.inv-lines-table td,.inv-lines-table th,.sheet-upd-table td,.sheet-upd-table th{padding:8px 10px;border-bottom:1px solid #e5e7eb;border-right:1px solid #e5e7eb;text-align:left;vertical-align:top}.inv-table th:last-child,.inv-table td:last-child,.inv-header-table td:last-child,.inv-lines-table td:last-child,.sheet-upd-table td:last-child{border-right:none}.inv-table thead,.inv-lines-table thead,.sheet-upd-table thead{background:#f9fafb}.inv-date-group-row td{background:#f3f4f6;font-weight:600;border-top:2px solid #e5e7eb;cursor:default}.inv-table tbody tr:not(.inv-date-group-row):nth-child(even){background:#fcfcfd}.inv-table tbody tr[data-href]{cursor:pointer}.inv-table tbody tr[data-href]:hover{background:#f3f4f6}.checkbox-column{width:34px}.mass-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:12px}.selected-count,.muted{color:#6b7280}.inv-msg{margin-bottom:12px;padding:8px 10px;border-radius:10px;font-size:13px}.inv-msg-err{background:#fef2f2;border:1px solid #fecaca;color:#b91c1c}.error-box{white-space:pre-wrap;background:#0f172a;color:#e5e7eb;padding:16px;border-radius:12px;overflow:auto}.invoice-form input,.invoice-form textarea,.invoice-form select{width:100%;box-sizing:border-box;border:1px solid #d1d5db;border-radius:8px;padding:7px 9px;background:#fff;font-family:inherit}.invoice-form textarea{resize:vertical}.invoice-readonly input[readonly],.invoice-readonly textarea[readonly],.invoice-readonly input:disabled,.invoice-readonly textarea:disabled{border-color:transparent;background:#f8fafc;color:#334155}.inv-detail-header-wrap,.inv-detail-lines-wrap{margin-top:0;margin-bottom:14px}.invoice-form:not(.invoice-readonly) .inv-detail-header-wrap,.invoice-form:not(.invoice-readonly) .inv-detail-lines-wrap{overflow:visible}.inv-lines-table{min-width:1180px}.inv-lines-table td:nth-child(2){min-width:360px}.inv-ac-wrap{position:relative}.inv-autocomplete-list{position:absolute;z-index:50;top:100%;left:0;right:0;max-height:260px;overflow:auto;background:#fff;border:1px solid #d1d5db;border-radius:10px;box-shadow:0 18px 50px rgba(15,23,42,.18);list-style:none;margin:4px 0 0;padding:4px;display:block}.inv-autocomplete-list:empty{display:none}.inv-autocomplete-list li{padding:8px 10px;border-radius:8px;cursor:pointer}.inv-autocomplete-list li:hover{background:#f1f5f9}.inv-pagination{margin-top:16px;display:flex;flex-wrap:wrap;gap:6px}.inv-page-link{min-width:32px;padding:5px 10px;border-radius:999px;border:1px solid #e5e7eb;text-align:center;font-size:13px;color:#374151;text-decoration:none}.inv-page-link:hover{background:#f3f4f6}.inv-page-link-active{background:#111827;color:#fff;border-color:#111827}.sheet-upd-table{margin-bottom:10px}.remove-row{background:#fee2e2;color:#991b1b}.remove-row:disabled{opacity:.4}.button-light{display:inline-flex;align-items:center;justify-content:center;border-radius:12px;padding:9px 14px;background:#f1f5f9;color:#0f172a;text-decoration:none}



/* Accounting sheets v3 */
.sheet-filters{display:flex;gap:10px;flex-wrap:wrap;align-items:center}.sheet-filters input,.sheet-filters select{padding:9px 12px;border:1px solid #d1d5db;border-radius:12px}.sheet-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:12px 0}.sheet-lines-table{min-width:1120px}.sheet-lines-table input,.sheet-form input,.sheet-form select{width:100%;border:1px solid #d1d5db;border-radius:8px;padding:7px 9px;background:#fff}.sheet-form input[readonly],.sheet-form input:disabled{border-color:transparent;background:#f8fafc;color:#334155}.sheet-lines-table td:nth-child(2) input{min-width:360px}.pagination{margin-top:14px;display:flex;gap:12px;align-items:center}.pagination a{padding:8px 12px;background:#f1f5f9;border-radius:10px;text-decoration:none}.sheet-error{background:#fff7ed;border:1px solid #fed7aa;border-radius:16px;padding:18px;color:#9a3412}.sheet-row-click{cursor:pointer}.sheet-row-click:hover{background:#f8fafc}.autocomplete-box{position:relative}.autocomplete-list{position:absolute;z-index:50;left:0;right:0;top:100%;background:#fff;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 12px 30px rgba(15,23,42,.12);margin:4px 0 0 0;padding:4px;list-style:none;max-height:260px;overflow:auto;display:none}.autocomplete-list li{padding:8px 10px;border-radius:8px;cursor:pointer}.autocomplete-list li:hover{background:#f1f5f9}.readonly-mode .remove-row,.readonly-mode #add-line,.readonly-mode #add-upd{display:none}.sheet-badge{display:inline-flex;border-radius:999px;padding:4px 8px;font-size:12px;font-weight:600;background:#eef2ff;color:#3730a3}.sheet-badge.manual{background:#fef3c7;color:#92400e}.sheet-badge.parser{background:#dcfce7;color:#166534}

/* === Fast sheets pagination === */
.pagination-fast {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 18px;
    padding-top: 12px;
}

.pagination-fast a,
.pagination-fast .current,
.pagination-fast .dots {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 14px;
}

.pagination-fast a:hover {
    background: #e2e8f0;
}

.pagination-fast .current {
    background: #0f172a;
    color: #ffffff;
    font-weight: 600;
}

.pagination-fast .dots {
    background: transparent;
    color: #64748b;
}

.pagination-fast .total-pages {
    color: #64748b;
    font-size: 14px;
    margin-left: 8px;
}

/* === Accounting sheets beautiful table v2 === */
.sheets-page-v2 {
    max-width: 1760px;
    margin: 0 auto;
}

.sheets-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 22px 24px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.045);
    margin-bottom: 18px;
}

.sheets-hero-top {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

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

.sheets-hero-actions form { margin: 0; }

.sheets-upload-label {
    position: relative;
    cursor: pointer;
}

.sheets-upload-label input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.sheets-hero h2 {
    font-size: 24px;
    margin: 0 0 8px 0;
    font-weight: 520;
    color: #0f172a;
}

.sheets-hero p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.sheets-error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.sheets-filters {
    display: grid;
    grid-template-columns: minmax(280px, 1.25fr) 170px 170px 130px 130px auto auto;
    gap: 12px;
    align-items: end;
}

.sheets-filters label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #64748b;
    font-size: 13px;
}

.sheets-filters input,
.sheets-filters select {
    height: 40px;
    border: 1px solid #d1d5db;
    background: #f8fafc;
    border-radius: 999px;
    padding: 0 14px;
    outline: none;
    color: #0f172a;
}

.sheets-filters input:focus,
.sheets-filters select:focus {
    background: #ffffff;
    border-color: #facc15;
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.18);
}

.sheets-btn {
    height: 40px;
    border-radius: 999px;
    border: 0;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    font-size: 14px;
}

.sheets-btn-yellow,
.yellow-button {
    background: #ffd966;
    color: #111827;
}

.sheets-btn-yellow:hover,
.yellow-button:hover {
    background: #facc15;
}

.sheets-btn-light {
    background: #f1f5f9;
    color: #0f172a;
}

.sheets-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.sheets-toolbar button {
    height: 38px;
    border-radius: 999px;
    border: 0;
    padding: 0 16px;
    background: #f1f5f9;
    color: #0f172a;
    cursor: pointer;
}

.sheets-toolbar button:not(:disabled):hover {
    background: #e2e8f0;
}

.sheets-toolbar button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.sheets-check-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #0f172a;
}

.sheets-toolbar-spacer {
    flex: 1;
}

.sheets-counter {
    color: #475569;
    font-size: 14px;
}

.sheets-table-shell {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: auto;
    background: #ffffff;
}

.sheets-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1320px;
    font-size: 14px;
}

.sheets-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 12px;
}

.sheets-table tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid #eef2f7;
    color: #0f172a;
    vertical-align: middle;
}

.sheets-table tbody tr {
    transition: background 0.13s ease;
}

.sheets-table tbody tr:hover {
    background: #fffdf2;
}

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

.sheets-table a {
    color: #0f172a;
    text-decoration: none;
    font-weight: 520;
}

.sheets-table a:hover {
    text-decoration: underline;
}

.check-col {
    width: 44px;
    text-align: center;
}

.date-cell {
    width: 130px;
    color: #334155;
}

.invoice-cell {
    width: 170px;
}

.party-cell {
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.num-col {
    text-align: right !important;
    width: 120px;
    font-variant-numeric: tabular-nums;
}

.small-col {
    width: 70px;
    text-align: center !important;
}

.type-col {
    width: 90px;
    text-align: center !important;
}

.sheets-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 600;
}

.sheets-pill-green {
    background: #dcfce7;
    color: #166534;
}

.sheets-pill-yellow {
    background: #fef3c7;
    color: #92400e;
}

.muted {
    color: #94a3b8;
}

.empty-row {
    text-align: center;
    color: #64748b !important;
    padding: 28px !important;
}

.sheets-pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 18px;
}

.sheets-pagination a,
.sheets-pagination .current,
.sheets-pagination .dots {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 14px;
}

.sheets-pagination a:hover {
    background: #e2e8f0;
}

.sheets-pagination .current {
    background: #0f172a;
    color: #ffffff;
    font-weight: 600;
}

.sheets-pagination .dots {
    background: transparent;
    color: #64748b;
}

.sheets-pagination .total-pages {
    color: #64748b;
    font-size: 14px;
    margin-left: 8px;
}

@media (max-width: 1200px) {
    .sheets-filters {
        grid-template-columns: 1fr 1fr;
    }

    .sheets-hero-top {
        flex-direction: column;
    }
}

/* === Accounting Orders: 1C-like clean UI === */
.orders-page-v1 {
    max-width: 1760px;
    margin: 0 auto;
}

.orders-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 22px 24px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.045);
    margin-bottom: 18px;
}

.orders-hero-top {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.orders-hero h2 {
    font-size: 24px;
    margin: 0 0 8px 0;
    font-weight: 520;
    color: #0f172a;
}

.orders-hero p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

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

.orders-warning,
.orders-error {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.orders-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.orders-error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
}

.orders-filters {
    display: grid;
    grid-template-columns: minmax(280px, 1.25fr) 170px 170px 130px auto auto;
    gap: 12px;
    align-items: end;
}

.orders-filters label,
.order-form-grid label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #64748b;
    font-size: 13px;
}

.orders-filters input,
.orders-filters select,
.order-form-grid input,
.order-form-grid select,
.order-comment {
    border: 1px solid #d1d5db;
    background: #f8fafc;
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
    color: #0f172a;
}

.orders-filters input,
.orders-filters select {
    height: 40px;
    border-radius: 999px;
}

.order-form-grid input,
.order-form-grid select {
    height: 42px;
}

.orders-filters input:focus,
.orders-filters select:focus,
.order-form-grid input:focus,
.order-form-grid select:focus,
.order-comment:focus {
    background: #ffffff;
    border-color: #facc15;
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.18);
}

.order-form-grid input[readonly],
.order-form-grid select:disabled,
.order-comment[readonly] {
    border-color: transparent;
    background: #f8fafc;
    color: #334155;
}

.orders-btn {
    height: 40px;
    border-radius: 999px;
    border: 0;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    font-size: 14px;
}

.orders-btn-yellow {
    background: #ffd966;
    color: #111827;
}

.orders-btn-yellow:hover {
    background: #facc15;
}

.orders-btn-light {
    background: #f1f5f9;
    color: #0f172a;
}

.orders-btn-dark {
    background: #0f172a;
    color: #ffffff;
}

.orders-table-top {
    display: flex;
    justify-content: flex-end;
    color: #475569;
    font-size: 14px;
    margin-bottom: 12px;
}

.orders-table-shell {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: auto;
    background: #ffffff;
}

.orders-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1450px;
    font-size: 14px;
}

.orders-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 12px;
}

.orders-table tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid #eef2f7;
    color: #0f172a;
    vertical-align: middle;
}

.orders-table tbody tr {
    transition: background 0.13s ease;
}

.orders-table tbody tr:hover {
    background: #fffdf2;
}

.orders-table a {
    color: #0f172a;
    text-decoration: none;
    font-weight: 520;
}

.orders-table a:hover {
    text-decoration: underline;
}

.num-col {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

.comment-cell {
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.orders-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 600;
}

.orders-pill-yellow {
    background: #fef3c7;
    color: #92400e;
}

.empty-row {
    text-align: center;
    color: #64748b !important;
    padding: 28px !important;
}

.orders-pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 18px;
}

.orders-pagination a,
.orders-pagination .current,
.orders-pagination .dots {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 14px;
}

.orders-pagination a:hover {
    background: #e2e8f0;
}

.orders-pagination .current {
    background: #0f172a;
    color: #ffffff;
    font-weight: 600;
}

.orders-pagination .dots {
    background: transparent;
    color: #64748b;
}

.orders-pagination .total-pages {
    color: #64748b;
    font-size: 14px;
    margin-left: 8px;
}

.order-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 16px;
}

.order-comment {
    width: 100%;
    min-height: 130px;
    resize: vertical;
}

.person-autocomplete {
    position: relative;
}

.person-suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(15,23,42,.12);
    z-index: 50;
    overflow: hidden;
}

.person-suggest:empty {
    display: none;
}

.person-suggest button {
    display: block;
    width: 100%;
    padding: 9px 12px;
    text-align: left;
    background: #ffffff;
    border: 0;
    cursor: pointer;
}

.person-suggest button:hover {
    background: #f8fafc;
}

@media (max-width: 1200px) {
    .orders-filters,
    .order-form-grid {
        grid-template-columns: 1fr 1fr;
    }

    .orders-hero-top {
        flex-direction: column;
    }
}



/* === Accounting Orders v2 === */
.orders-page-v2{max-width:1760px;margin:0 auto}.orders-card{background:#fff;border:1px solid #e5e7eb;border-radius:18px;padding:22px 24px;box-shadow:0 18px 50px rgba(15,23,42,.045);margin-bottom:18px}.orders-hero-top{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;margin-bottom:18px}.orders-hero h2{font-size:24px;margin:0 0 8px 0;font-weight:520;color:#0f172a}.orders-hero p{margin:0;color:#64748b;font-size:14px}.orders-error{background:#fff1f2;border:1px solid #fecdd3;color:#be123c;padding:12px 14px;border-radius:12px;margin-bottom:16px}.orders-filters{display:grid;grid-template-columns:minmax(260px,1.2fr) 150px 150px 210px 210px 130px auto auto;gap:12px;align-items:end}.orders-filters label,.order-grid-1c label{display:flex;flex-direction:column;gap:5px;color:#64748b;font-size:13px}.orders-filters input,.orders-filters select,.orders-table input,.orders-table select,.order-detail-form input,.order-detail-form select,.order-detail-form textarea{border:1px solid #d1d5db;background:#f8fafc;border-radius:12px;padding:8px 10px;outline:none;color:#0f172a}.orders-filters input,.orders-filters select{height:40px;border-radius:999px}.orders-btn{height:40px;border-radius:999px;border:0;padding:0 18px;display:inline-flex;align-items:center;justify-content:center;text-decoration:none;white-space:nowrap;cursor:pointer;font-size:14px}.orders-btn-yellow{background:#ffd966;color:#111827}.orders-btn-light{background:#f1f5f9;color:#0f172a}.orders-toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:14px}.orders-toolbar button{height:38px;border-radius:999px;border:0;padding:0 16px;background:#f1f5f9;color:#0f172a;cursor:pointer}.orders-toolbar button:disabled{opacity:.45;cursor:not-allowed}.orders-check-all{display:inline-flex;align-items:center;gap:8px;color:#0f172a}.orders-toolbar-spacer{flex:1}.orders-table-shell{border:1px solid #e5e7eb;border-radius:16px;overflow:auto;background:#fff}.orders-table{width:100%;border-collapse:separate;border-spacing:0;min-width:1720px;font-size:14px}.orders-table thead th{position:sticky;top:0;z-index:2;background:#f8fafc;color:#475569;font-weight:600;text-align:left;border-bottom:1px solid #e5e7eb;padding:12px}.orders-table tbody td{padding:8px 10px;border-bottom:1px solid #eef2f7;color:#0f172a;vertical-align:middle}.orders-table tbody tr:hover{background:#fffdf2}.orders-table input,.orders-table select{width:100%;min-width:90px}.orders-table td:nth-child(5) input,.orders-table td:nth-child(6) input,.orders-table td:nth-child(11) input{min-width:210px}.orders-pagination{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:18px}.orders-pagination a,.orders-pagination .current,.orders-pagination .dots{min-width:36px;height:36px;padding:0 12px;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;text-decoration:none;background:#f1f5f9;color:#0f172a;font-size:14px}.orders-pagination .current{background:#0f172a;color:#fff;font-weight:600}.order-grid-1c{display:grid;grid-template-columns:repeat(3,minmax(220px,1fr));gap:14px}.comment-label{grid-column:1/-1}.empty-row{text-align:center;color:#64748b!important;padding:28px!important}@media(max-width:1400px){.orders-filters{grid-template-columns:1fr 1fr}.order-grid-1c{grid-template-columns:1fr}}

/* === Accounting orders v3: controlled edit + people directory === */
.orders-actions form { margin: 0; }
.orders-table-edit-mode .orders-inline-table tbody tr:hover { background: #fffdf2; }
.orders-toolbar #table-save-btn { background: #ffd966; color:#111827; }
.person-autocomplete { position: relative; width: 100%; }
.person-autocomplete input { width: 100%; }
.person-suggest {
    position: absolute;
    z-index: 50;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    max-height: 260px;
    overflow-y: auto;
}
.person-suggest:empty { display: none; }
.person-suggest button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: #fff;
    padding: 10px 12px;
    cursor: pointer;
    color: #0f172a;
}
.person-suggest button:hover { background: #f8fafc; }
.in-table .person-suggest { min-width: 260px; }
.people-add-form {
    display: grid;
    grid-template-columns: 180px minmax(260px, 1fr) auto;
    gap: 10px;
    margin-top: 18px;
    max-width: 760px;
}
.people-add-form input,
.people-add-form select,
.people-table input,
.people-table select {
    height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 0 12px;
    background: #fff;
}
.orders-people-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}
.people-table { width: 100%; }
.people-table td, .people-table th { padding: 10px; }
.people-table td:first-child { width: 80px; text-align: center; }
.people-table td:last-child { width: 52px; text-align: center; }
.people-save-actions { margin-top: 18px; }
.orders-inline-table input[readonly],
.orders-inline-table select:disabled,
.order-detail-form input[readonly],
.order-detail-form textarea[readonly],
.order-detail-form select:disabled {
    background: #f8fafc;
    color: #334155;
    border-color: transparent;
}
@media (max-width: 1200px) {
    .orders-people-grid { grid-template-columns: 1fr; }
    .people-add-form { grid-template-columns: 1fr; }
}


/* === Orders stable UI === */
.people-field {
    display: flex;
    gap: 6px;
    align-items: center;
}

.people-field input {
    flex: 1;
}

.people-field .person-add {
    width: 38px;
    min-width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 0;
    background: #facc15;
    color: #111827;
    cursor: pointer;
    font-weight: 700;
}

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

.wide-field textarea {
    min-height: 110px;
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 12px;
}

.wide-field textarea[readonly] {
    background: #f8fafc;
    border-color: transparent;
}

/* === Orders page polished v2 === */
.orders-page-v2 {
    max-width: 1760px;
    margin: 0 auto;
}

.orders-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 22px 24px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.045);
    margin-bottom: 18px;
}

.orders-hero-top {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.orders-hero h2 {
    font-size: 24px;
    margin: 0 0 8px 0;
    font-weight: 520;
    color: #0f172a;
}

.orders-hero p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.orders-error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.orders-filters {
    display: grid;
    grid-template-columns: 1fr 160px 160px minmax(240px, 1.2fr) minmax(220px, 1fr) minmax(220px, 1fr) 130px 130px;
    gap: 12px;
    align-items: end;
}

.period-panel {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 10px 12px;
}

.period-panel span {
    color: #475569;
    font-size: 13px;
    margin-right: 4px;
}

.period-panel button {
    height: 32px;
    border: 0;
    border-radius: 999px;
    padding: 0 12px;
    background: #ffffff;
    color: #0f172a;
    cursor: pointer;
}

.period-panel button:hover {
    background: #fef3c7;
}

.orders-filters label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #64748b;
    font-size: 13px;
}

.orders-filters input,
.orders-filters select {
    height: 40px;
    border: 1px solid #d1d5db;
    background: #f8fafc;
    border-radius: 999px;
    padding: 0 14px;
    outline: none;
    color: #0f172a;
}

.orders-filters input:focus,
.orders-filters select:focus {
    background: #ffffff;
    border-color: #facc15;
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.18);
}

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

.orders-btn {
    height: 40px;
    border-radius: 999px;
    border: 0;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    font-size: 14px;
}

.orders-btn-yellow {
    background: #ffd966;
    color: #111827;
}

.orders-btn-yellow:hover {
    background: #facc15;
}

.orders-btn-light {
    background: #f1f5f9;
    color: #0f172a;
}

.people-field {
    display: flex;
    gap: 6px;
    align-items: center;
}

.people-field input {
    flex: 1;
    min-width: 0;
}

.people-field .person-add {
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 0;
    background: #facc15;
    color: #111827;
    cursor: pointer;
    font-weight: 700;
}

.orders-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.orders-toolbar button {
    height: 38px;
    border-radius: 999px;
    border: 0;
    padding: 0 16px;
    background: #f1f5f9;
    color: #0f172a;
    cursor: pointer;
}

.orders-toolbar button:not(:disabled):hover {
    background: #e2e8f0;
}

.orders-toolbar button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.orders-check-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #0f172a;
}

.orders-toolbar-spacer {
    flex: 1;
}

.orders-counter {
    color: #475569;
    font-size: 14px;
}

.orders-table-shell {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: auto;
    background: #ffffff;
}

.orders-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1520px;
    font-size: 14px;
}

.orders-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 12px;
}

.orders-table tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid #eef2f7;
    color: #0f172a;
    vertical-align: middle;
}

.orders-table tbody tr {
    transition: background 0.13s ease;
}

.orders-table tbody tr:hover {
    background: #fffdf2;
}

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

.orders-table a {
    color: #0f172a;
    text-decoration: none;
    font-weight: 520;
}

.orders-table a:hover {
    text-decoration: underline;
}

.check-col {
    width: 44px;
    text-align: center;
}

.order-number-cell {
    width: 150px;
}

.person-cell {
    min-width: 190px;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comment-cell {
    min-width: 260px;
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.num-col {
    text-align: right !important;
    width: 130px;
    font-variant-numeric: tabular-nums;
}

.orders-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 600;
}

.orders-pill-green {
    background: #dcfce7;
    color: #166534;
}

.orders-pill-yellow {
    background: #fef3c7;
    color: #92400e;
}

.orders-pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 18px;
}

.orders-pagination a,
.orders-pagination .current,
.orders-pagination .dots {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 14px;
}

.orders-pagination a:hover {
    background: #e2e8f0;
}

.orders-pagination .current {
    background: #0f172a;
    color: #ffffff;
    font-weight: 600;
}

.orders-pagination .dots {
    background: transparent;
    color: #64748b;
}

.orders-pagination .total-pages {
    color: #64748b;
    font-size: 14px;
    margin-left: 8px;
}

@media (max-width: 1450px) {
    .orders-filters {
        grid-template-columns: 1fr 1fr 1fr;
    }

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

/* === Orders clean simplified UI === */
.orders-page-clean {
    max-width: 1680px;
    margin: 0 auto;
}

.orders-clean-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 22px 24px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.045);
    margin-bottom: 18px;
}

.orders-clean-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}

.orders-clean-hero h2 {
    font-size: 24px;
    margin: 0 0 8px 0;
    font-weight: 520;
    color: #0f172a;
}

.orders-clean-hero p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.orders-clean-error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
    padding: 12px 14px;
    border-radius: 12px;
    margin-top: 16px;
}

.orders-clean-filters {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 160px 160px minmax(240px, 1fr) minmax(240px, 1fr) 130px auto auto;
    gap: 12px;
    align-items: end;
}

.orders-clean-filters label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #64748b;
    font-size: 13px;
}

.orders-clean-filters input,
.orders-clean-filters select,
.orders-detail-grid input,
.orders-detail-grid select,
.orders-comment-textarea {
    border: 1px solid #d1d5db;
    background: #f8fafc;
    border-radius: 14px;
    padding: 10px 13px;
    outline: none;
    color: #0f172a;
    width: 100%;
}

.orders-clean-filters input,
.orders-clean-filters select {
    height: 40px;
    border-radius: 999px;
}

.orders-clean-filters input:focus,
.orders-clean-filters select:focus,
.orders-detail-grid input:focus,
.orders-detail-grid select:focus,
.orders-comment-textarea:focus {
    background: #ffffff;
    border-color: #facc15;
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.18);
}

.orders-clean-filter-actions,
.orders-detail-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.orders-clean-btn {
    height: 40px;
    border-radius: 999px;
    border: 0;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    font-size: 14px;
}

.orders-clean-btn-yellow {
    background: #ffd966;
    color: #111827;
}

.orders-clean-btn-yellow:hover {
    background: #facc15;
}

.orders-clean-btn-light {
    background: #f1f5f9;
    color: #0f172a;
}

.orders-clean-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.orders-clean-toolbar button {
    height: 38px;
    border-radius: 999px;
    border: 0;
    padding: 0 16px;
    background: #f1f5f9;
    color: #0f172a;
    cursor: pointer;
}

.orders-clean-toolbar button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.orders-clean-check-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #0f172a;
}

.orders-clean-spacer {
    flex: 1;
}

.orders-clean-counter {
    color: #475569;
    font-size: 14px;
}

.orders-clean-table-shell {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: auto;
    background: #ffffff;
}

.orders-clean-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1380px;
    font-size: 14px;
}

.orders-clean-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 12px;
}

.orders-clean-table tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid #eef2f7;
    color: #0f172a;
    vertical-align: middle;
}

.orders-clean-table tbody tr:hover {
    background: #fffdf2;
}

.orders-clean-table a {
    color: #0f172a;
    text-decoration: none;
    font-weight: 520;
}

.orders-clean-table a:hover {
    text-decoration: underline;
}

.orders-check-col {
    width: 44px;
    text-align: center;
}

.orders-number-cell {
    width: 150px;
}

.orders-person-cell {
    min-width: 190px;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.orders-comment-cell {
    min-width: 260px;
    max-width: 480px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.orders-num-col {
    text-align: right !important;
    width: 130px;
    font-variant-numeric: tabular-nums;
}

.orders-clean-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 600;
}

.orders-clean-pill-yellow {
    background: #fef3c7;
    color: #92400e;
}

.orders-muted {
    color: #94a3b8;
}

.orders-empty-row {
    text-align: center;
    color: #64748b !important;
    padding: 28px !important;
}

.orders-clean-pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 18px;
}

.orders-clean-pagination a,
.orders-clean-pagination .current,
.orders-clean-pagination .dots {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 14px;
}

.orders-clean-pagination .current {
    background: #0f172a;
    color: #ffffff;
    font-weight: 600;
}

.orders-section-title {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 520;
    color: #0f172a;
}

.orders-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 14px;
}

.orders-detail-grid.two-cols {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.orders-detail-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #64748b;
    font-size: 13px;
}

.orders-detail-grid small {
    color: #94a3b8;
    font-size: 12px;
}

.orders-detail-grid input[readonly],
.orders-detail-grid select:disabled,
.orders-comment-textarea[readonly] {
    border-color: transparent;
    background: #f8fafc;
    color: #334155;
}

.orders-comment-textarea {
    min-height: 130px;
    resize: vertical;
}

@media (max-width: 1350px) {
    .orders-clean-filters {
        grid-template-columns: 1fr 1fr;
    }

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

    .orders-detail-grid,
    .orders-detail-grid.two-cols {
        grid-template-columns: 1fr;
    }
}

.registry-search {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.registry-search input {
    min-width: min(560px, 100%);
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 9px 12px;
    background: #ffffff;
}

.registry-linear-table {
    min-width: 2400px;
}

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

.registry-linear-table td:nth-child(7),
.registry-linear-table td:nth-child(12),
.registry-linear-table td:nth-child(13),
.registry-linear-table td:nth-child(17) {
    white-space: normal;
    min-width: 220px;
}

/* === SHEETS_ORDERS_FILTER_TOTAL_V1_CSS_START === */

/* Unified compact filter line, same behavior concept as UPD filters. */
.sheets-filters-unified,
.orders-clean-filters-unified {
    align-items: end !important;
}

.sheets-filters-unified {
    grid-template-columns: minmax(320px, 1.35fr) 150px 150px 120px 120px auto auto !important;
}

.orders-clean-filters-unified {
    grid-template-columns: minmax(300px, 1.25fr) 150px 150px minmax(210px, 1fr) minmax(210px, 1fr) 120px auto !important;
}

.sheets-filter-wide,
.orders-clean-filter-wide {
    min-width: 260px;
}

.sheets-rownum-col,
.orders-rownum-col {
    width: 58px !important;
    min-width: 58px !important;
    text-align: center !important;
    color: #64748b !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sheets-table tfoot td,
.orders-clean-table tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: 12px 12px;
    border-top: 2px solid #dbeafe;
    border-bottom: 0;
    background: #f8fafc;
    color: #0f172a;
    font-weight: 700;
    vertical-align: middle;
}

.sheets-total-row,
.orders-total-row {
    box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.04);
}

.sheets-total-label,
.orders-total-label {
    text-align: right !important;
    color: #334155 !important;
}

.sheets-table tfoot .num-col,
.orders-clean-table tfoot .orders-num-col {
    background: #eef6ff;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.sheets-table {
    min-width: 1420px;
}

.orders-clean-table {
    min-width: 1480px;
}

@media (max-width: 1350px) {
    .sheets-filters-unified,
    .orders-clean-filters-unified {
        grid-template-columns: 1fr 1fr !important;
    }

    .sheets-filter-wide,
    .orders-clean-filter-wide,
    .orders-clean-filter-actions {
        grid-column: 1 / -1;
    }
}

/* === SHEETS_ORDERS_FILTER_TOTAL_V1_CSS_END === */

/* === SHEETS_FAST_TOTAL_FIX_V2_CSS_START === */
.sheets-rownum-col { width: 58px; min-width: 58px; text-align: center; color: #64748b; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheets-total-row td { padding: 12px; border-top: 2px solid #dbeafe; background: #f8fafc; font-weight: 700; }
.sheets-total-label { text-align: right; color: #334155; }
.sheets-total-row .num-col { background: #eef6ff; color: #0f172a; font-variant-numeric: tabular-nums; }
/* === SHEETS_FAST_TOTAL_FIX_V2_CSS_END === */

/* === СЕРВИС БУХУСЛУГИ / OUTSOURCING PORTAL v1 === */
.brand-monogram,
.login-brand-monogram {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 12px;
    background: #111827;
    color: #fff;
    font-weight: 750;
    letter-spacing: -0.04em;
}
.brand-monogram { width: 38px; height: 38px; font-size: 13px; }
.login-brand-monogram { width: 58px; height: 58px; margin-bottom: 18px; font-size: 18px; }
.login-card h1 { margin-top: 0; }
.brand-logo-img, .login-logo-img { display: none !important; }

.topbar-actions,
.form-actions,
.chat-compose-actions,
.document-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.metric-grid.compact.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-text { margin: 10px 0 5px; font-size: 17px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }

.two-column-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    gap: 16px;
    align-items: start;
}
.side-stack { display: grid; gap: 16px; }
.side-stack .panel { margin-bottom: 0; }
.narrow-panel { max-width: 940px; }
.form-panel { padding: 24px; }
.stack-form { display: grid; gap: 22px; }
.form-section { display: grid; gap: 14px; }
.form-section + .form-section { border-top: 1px solid var(--line); padding-top: 22px; }
.form-section-title { font-size: 15px; font-weight: 750; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span,
.file-field > span { color: #4b5563; font-size: 13px; font-weight: 600; }
.field input,
.field select,
.field textarea,
.file-field input,
.chat-compose textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    padding: 11px 13px;
    outline: none;
}
.field textarea,
.chat-compose textarea { resize: vertical; line-height: 1.45; }
.field input:focus,
.field select:focus,
.field textarea:focus,
.chat-compose textarea:focus { border-color: #6b7280; box-shadow: 0 0 0 3px rgba(17, 24, 39, .05); }
.file-field { display: grid; gap: 8px; }
.file-field input { padding: 9px; }
.check-field { display: flex; align-items: center; gap: 9px; min-height: 44px; color: #374151; font-size: 13px; }
.check-field input { width: 17px; height: 17px; margin: 0; }
.form-actions { padding-top: 2px; }
.form-actions button,
.stack-form > button,
.chat-compose button,
.danger-button {
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    padding: 11px 15px;
    cursor: pointer;
    font-weight: 700;
}
.danger-button { background: #fff; color: #991b1b; border: 1px solid #fecaca; padding: 9px 12px; }
.info-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    border: 1px solid #dbeafe;
    background: #f8fbff;
    border-radius: 14px;
    padding: 14px;
    color: #334155;
    font-size: 13px;
}
.prose-block { white-space: pre-wrap; line-height: 1.6; color: #374151; }
.empty-block { border: 1px dashed #d1d5db; border-radius: 12px; padding: 18px; color: var(--muted); text-align: center; }
.empty-state { text-align: center; padding: 42px 24px; }
.empty-state h2 { margin: 0 0 8px; }
.empty-state p { max-width: 680px; margin: 0 auto; }
.compact-list { display: grid; gap: 8px; }
.compact-list-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.link-row:hover { background: var(--soft); }
.text-clip { max-width: 430px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.danger-text { color: #b91c1c; }
.row-overdue td { background: #fffafa; }

.status-org-onboarding { background: #eff6ff; color: #1d4ed8; }
.status-org-active { background: #ecfdf5; color: #047857; }
.status-org-paused { background: #fffbeb; color: #92400e; }
.status-org-archived, .muted-pill { background: #f3f4f6; color: #6b7280; }
.status-task-new { background: #eff6ff; color: #1d4ed8; }
.status-task-in_progress { background: #f5f3ff; color: #6d28d9; }
.status-task-waiting_client { background: #fff7ed; color: #c2410c; }
.status-task-review { background: #fffbeb; color: #92400e; }
.status-task-done { background: #ecfdf5; color: #047857; }
.status-task-cancelled { background: #f3f4f6; color: #6b7280; }
.priority-pill { display: inline-flex; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 700; background: #f3f4f6; }
.priority-low { color: #6b7280; }
.priority-normal { color: #374151; }
.priority-high { background: #fff7ed; color: #c2410c; }
.priority-urgent { background: #fef2f2; color: #b91c1c; }

.outsourcing-filters { grid-template-columns: minmax(190px, 1fr) minmax(160px, 230px) minmax(160px, 230px) auto auto; }
.tasks-filters { grid-template-columns: minmax(190px, 1fr) minmax(180px, 260px) minmax(150px, 210px) auto auto; }

/* BUH1034: task-scoped legal entity and outgoing-document controls. */
.task-title-actions,
.task-inline-form,
.task-assignment-form,
.task-document-toolbar,
.task-table-assign,
.task-table-document-actions {
    display: flex;
    align-items: center;
}
.task-title-actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.task-inline-form { margin: 0; gap: 8px; }
.task-assignment-form { min-width: min(520px, 48vw); }
.task-assignment-form select,
.task-table-assign select {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
}
.task-assignment-form select {
    flex: 1 1 280px;
    height: 40px;
    padding: 0 36px 0 12px;
    font-size: 13px;
}
.task-document-organization {
    display: grid;
    gap: 2px;
    max-width: 360px;
    padding: 5px 10px;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: #eff6ff;
    color: #1e3a8a;
}
.task-document-organization span {
    overflow: hidden;
    font-size: 13px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.task-document-organization small { color: #64748b; font-size: 10px; }
.danger-outline { color: #b42318 !important; border-color: #fecaca !important; }
.task-document-toolbar {
    min-height: 54px;
    margin-bottom: 14px;
    padding: 7px 10px;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}
.task-document-toolbar .button-link {
    min-height: 38px;
    padding: 8px 13px;
    font-size: 13px;
}
.task-document-hint { margin-left: 6px; color: var(--muted); font-size: 12px; }
.task-document-org-cell { min-width: 210px; }
.task-document-org-cell > strong,
.task-document-org-cell > small { display: block; }
.task-document-org-cell > strong { max-width: 240px; font-size: 12px; line-height: 1.3; }
.task-document-org-cell > small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.task-document-org-cell form { margin: 5px 0 0; }
.task-table-assign { gap: 5px; }
.task-table-assign select { width: 145px; height: 32px; padding: 0 8px; font-size: 11px; }
.task-table-assign button,
.task-table-text-button {
    border: 0;
    background: transparent;
    color: #2563eb;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}
.task-table-assign button { height: 32px; padding: 0 4px; }
.task-table-text-button { padding: 0; }
.task-table-document-actions { flex-wrap: wrap; gap: 4px; min-width: 142px; }
.task-table-document-actions a {
    padding: 5px 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #334155;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}
.task-table-document-actions a:hover { border-color: #93c5fd; color: #1d4ed8; }

/* BUH1040: task assignment and document actions are two rows above the registry. */
.task-registry-workspace {
    display: grid;
    width: 100%;
    margin-bottom: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}
.task-registry-assignment-row,
.task-registry-document-row {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 9px 12px;
}
.task-registry-assignment-row {
    min-height: 54px;
    border-bottom: 1px solid var(--line);
}
.task-registry-document-row { min-height: 48px; }
.task-registry-selected-title {
    min-width: 180px;
    max-width: 420px;
    margin-right: auto;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 16px;
    font-weight: 750;
    line-height: 1.3;
}
.task-registry-document-row .button-link,
.task-registry-assignment-row .button-link {
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 9px;
    font-size: 12px;
}
.button-link.is-disabled {
    opacity: .48;
    cursor: not-allowed;
    pointer-events: none;
}
.task-row-selected td { background: #eef5ff !important; }
.task-card-link {
    display: inline-block;
    margin-top: 4px;
    color: #64748b;
    font-size: 10px;
    font-weight: 650;
}
.task-card-link:hover { color: #1d4ed8; text-decoration: underline; }

@media (max-width: 1100px) {
    .task-title-actions { justify-content: flex-start; }
    .task-assignment-form { width: 100%; min-width: 0; }
    .task-document-toolbar { flex-wrap: wrap; }
    .task-document-hint { flex-basis: 100%; margin-left: 0; }
    .task-registry-selected-title {
        width: 100%;
        max-width: none;
        margin-right: 0;
    }
}

.calendar-panel { padding: 0; overflow: hidden; }
.calendar-toolbar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 12px; padding: 20px; border-bottom: 1px solid var(--line); text-align: center; }
.calendar-toolbar h2 { margin: 0 0 4px; }
.calendar-toolbar p { margin: 0; }
.calendar-nav { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 20px; }
.calendar-nav:hover { background: var(--soft); }
.calendar-weekdays,
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays { border-bottom: 1px solid var(--line); background: var(--soft); }
.calendar-weekdays > div { padding: 10px; text-align: center; color: var(--muted); font-size: 12px; font-weight: 700; }
.calendar-day { min-height: 150px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; min-width: 0; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { background: #fafafa; color: #9ca3af; }
.calendar-day.today { box-shadow: inset 0 0 0 2px #111827; }
.calendar-day-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; font-size: 13px; font-weight: 700; }
.calendar-day-head a { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; color: #6b7280; }
.calendar-day-head a:hover { background: var(--soft-2); color: #111827; }
.calendar-day-events { display: grid; gap: 5px; }
.calendar-entry { display: grid; gap: 2px; border-radius: 8px; padding: 6px 7px; background: #f8fafc; border-left: 3px solid #64748b; min-width: 0; }
.calendar-entry span { font-size: 10px; color: #64748b; }
.calendar-entry strong { font-size: 11px; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; }
.calendar-entry em { font-size: 10px; color: #64748b; font-style: normal; overflow: hidden; text-overflow: ellipsis; }
.calendar-entry.task-entry { border-left-color: #b45309; background: #fffbeb; }
.calendar-entry.event-reporting, .calendar-entry.event-tax { border-left-color: #1d4ed8; background: #eff6ff; }
.calendar-entry.event-meeting { border-left-color: #6d28d9; background: #f5f3ff; }
.calendar-legend { display: flex; gap: 18px; color: var(--muted); font-size: 12px; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; background: #64748b; }
.task-dot { background: #b45309; }
.event-dot { background: #1d4ed8; }

.chat-client-list { display: grid; }
.chat-client-row { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.chat-client-row:last-child { border-bottom: 0; }
.chat-client-row:hover { background: var(--soft); }
.chat-client-avatar, .team-avatar { display: grid; place-items: center; border-radius: 12px; background: var(--soft-2); color: #374151; font-weight: 750; }
.chat-client-avatar { width: 44px; height: 44px; }
.chat-client-main { min-width: 0; }
.chat-client-head { display: flex; justify-content: space-between; gap: 10px; }
.chat-client-head time { color: var(--muted); font-size: 11px; }
.chat-preview { margin-top: 4px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #4b5563; }
.chat-arrow { color: #9ca3af; }
.chat-panel { padding: 0; overflow: hidden; }
.chat-context { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--soft); }
.chat-context div { display: grid; gap: 3px; }
.chat-context span { color: var(--muted); font-size: 12px; }
.chat-context a { font-size: 13px; text-decoration: underline; }
.chat-stream { min-height: 360px; max-height: 62vh; overflow-y: auto; display: grid; align-content: start; gap: 10px; padding: 20px; background: #fafafa; }
.chat-message { max-width: min(720px, 82%); justify-self: start; border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 11px 13px; background: #fff; }
.chat-message.mine { justify-self: end; border-radius: 16px 4px 16px 16px; background: #f0fdf4; border-color: #d1fae5; }
.chat-message.internal { background: #fffbeb; border-color: #fde68a; }
.chat-message-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 6px; font-size: 11px; color: var(--muted); }
.chat-message-meta strong { color: #374151; }
.chat-message-meta span { border-radius: 999px; background: #fef3c7; color: #92400e; padding: 2px 6px; }
.chat-message-body { white-space: pre-wrap; line-height: 1.45; overflow-wrap: anywhere; }
.chat-empty { align-self: center; }
.chat-compose { display: grid; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); }
.chat-compose-actions { justify-content: space-between; }

.documents-layout { grid-template-columns: minmax(0, 2fr) minmax(300px, .8fr); }
.document-list { display: grid; }
.document-row { display: grid; grid-template-columns: 50px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.document-row:last-child { border-bottom: 0; }
.document-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--soft-2); font-size: 10px; font-weight: 800; color: #4b5563; }
.document-main { min-width: 0; }
.document-main .small { margin-top: 3px; overflow-wrap: anywhere; }
.document-actions { justify-content: flex-end; }
.document-actions form { margin: 0; }
.upload-document-panel { position: sticky; top: 20px; }

.team-layout { grid-template-columns: minmax(0, 2fr) minmax(320px, .9fr); }
.team-list { display: grid; gap: 10px; }
.team-user-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.team-user-card summary { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px; cursor: pointer; list-style: none; }
.team-user-card summary::-webkit-details-marker { display: none; }
.team-user-card[open] summary { border-bottom: 1px solid var(--line); background: var(--soft); }
.team-avatar { width: 40px; height: 40px; font-size: 12px; }
.team-user-main { display: grid; gap: 3px; min-width: 0; }
.team-user-main span, .team-org { color: var(--muted); font-size: 12px; }
.team-edit-form { padding: 16px; }
.create-user-panel { position: sticky; top: 20px; }

@media (max-width: 1180px) {
    .metric-grid.compact.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .two-column-layout, .documents-layout, .team-layout { grid-template-columns: 1fr; }
    .upload-document-panel, .create-user-panel { position: static; }
    .calendar-day { min-height: 125px; }
    .outsourcing-filters, .tasks-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .form-grid.two { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .metric-grid.compact.four { grid-template-columns: 1fr; }
    .calendar-panel { overflow-x: auto; }
    .calendar-weekdays, .calendar-grid { min-width: 840px; }
    .calendar-day { min-height: 120px; }
    .outsourcing-filters, .tasks-filters { grid-template-columns: 1fr; }
    .document-row { grid-template-columns: 42px 1fr; }
    .document-actions { grid-column: 1 / -1; justify-content: flex-start; }
    .team-user-card summary { grid-template-columns: 40px 1fr auto; }
    .team-org { grid-column: 2 / -1; }
    .chat-message { max-width: 92%; }
    .chat-compose-actions { align-items: stretch; flex-direction: column; }
}
/* === СЕРВИС БУХУСЛУГИ / OUTSOURCING PORTAL v1 END === */

/* === BUH-V4 MULTI-COMPANY CLIENT CONTOUR START === */
.public-auth-body,
.public-register-body {
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(135deg, #f4f7fb 0%, #eef5f2 52%, #f8fafc 100%);
    color: #1f2937;
}
.public-auth-shell {
    width: min(1080px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
    align-items: center;
    gap: 72px;
    padding: 48px 0;
}
.public-auth-brand { display: grid; gap: 22px; }
.public-brand { display: inline-flex; align-items: center; gap: 12px; width: fit-content; color: #172033; text-decoration: none; }
.public-brand > span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; background: #1f4f46; color: #fff; font-weight: 800; letter-spacing: -.03em; }
.public-brand strong { font-size: 20px; letter-spacing: -.02em; }
.public-auth-brand h1, .register-intro h1 { margin: 0; font-size: clamp(36px, 5vw, 58px); line-height: 1.02; letter-spacing: -.045em; max-width: 720px; }
.public-auth-brand > p, .register-intro > p { max-width: 680px; margin: 0; color: #596579; font-size: 18px; line-height: 1.6; }
.public-feature-list { display: grid; gap: 10px; padding: 0; margin: 4px 0 0; list-style: none; }
.public-feature-list li { display: flex; align-items: center; gap: 10px; color: #334155; font-weight: 650; }
.public-feature-list li::before { content: "✓"; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: #dcfce7; color: #166534; font-size: 13px; }
.public-auth-card { background: rgba(255,255,255,.94); border: 1px solid rgba(203,213,225,.8); box-shadow: 0 24px 70px rgba(30,41,59,.12); border-radius: 24px; padding: 34px; }
.auth-card-head { margin-bottom: 24px; }
.auth-card-head h2 { margin: 5px 0 8px; font-size: 29px; letter-spacing: -.025em; }
.auth-card-head p { color: #64748b; line-height: 1.5; margin: 0; }
.eyebrow { color: #28675c; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.wide-button { width: 100%; min-height: 46px; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 20px; font-size: 13px; }
.auth-links a { color: #275f56; text-decoration: underline; text-underline-offset: 3px; }
.staff-login-links { justify-content: center; }

/* === BUH1009 STAFF AUTH === */
.staff-login-body {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 100svh;
    padding: 32px 20px;
    background:
        radial-gradient(circle at 16% 16%, rgba(194, 226, 255, .96) 0 8%, transparent 32%),
        radial-gradient(circle at 82% 17%, rgba(32, 112, 205, .62) 0 8%, transparent 34%),
        radial-gradient(circle at 79% 82%, rgba(7, 55, 124, .88) 0 11%, transparent 43%),
        linear-gradient(145deg, #a8d4ff 0%, #5ca3ec 43%, #0d4f9b 100%);
}
.staff-login-body::before,
.staff-login-body::after {
    content: "";
    position: fixed;
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(44px);
}
.staff-login-body::before {
    width: min(58vw, 760px);
    height: min(58vw, 760px);
    top: -30%;
    left: -14%;
    background: rgba(224, 241, 255, .58);
}
.staff-login-body::after {
    width: min(60vw, 820px);
    height: min(60vw, 820px);
    right: -20%;
    bottom: -40%;
    background: rgba(0, 43, 103, .54);
}
.staff-login-card {
    width: min(440px, 100%);
    padding: 42px 42px 38px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 28px;
    background: rgba(5, 62, 135, .20);
    box-shadow: 0 34px 90px rgba(3, 39, 87, .27), inset 0 1px 0 rgba(255, 255, 255, .16);
    color: #fff;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}
.staff-login-card .staff-login-avatar {
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    margin: 0 auto 22px;
    border-radius: 50%;
    background: rgba(0, 67, 148, .84);
    box-shadow: 0 14px 30px rgba(1, 42, 95, .22), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.staff-login-avatar svg {
    width: 55px;
    height: 55px;
    fill: none;
    stroke: #fff;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.2;
}
.staff-login-card h1 {
    margin: 0 0 32px;
    color: #fff;
    font-size: clamp(27px, 6vw, 34px);
    font-weight: 400 !important;
    line-height: 1.15;
    letter-spacing: .12em !important;
    text-align: center;
    text-transform: uppercase;
}
.staff-login-card .alert {
    margin: 0 0 18px;
    border: 1px solid rgba(254, 202, 202, .64);
    background: rgba(127, 29, 29, .55);
    color: #fff;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.staff-login-card .login-form {
    gap: 22px;
}
.staff-login-card .staff-login-field {
    gap: 5px;
    color: rgba(255, 255, 255, .94);
}
.staff-login-field-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.staff-login-input-wrap {
    display: grid;
    grid-template-columns: 27px minmax(0, 1fr);
    align-items: center;
    gap: 13px;
    border-bottom: 2px solid rgba(255, 255, 255, .76);
    transition: border-color .16s ease, box-shadow .16s ease;
}
.staff-login-input-wrap:focus-within {
    border-color: #fff;
    box-shadow: 0 3px 0 -1px rgba(255, 255, 255, .18);
}
.staff-login-input-wrap > svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: rgba(255, 255, 255, .92);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}
.staff-login-card .login-form .staff-login-input-wrap input {
    min-width: 0;
    height: 50px;
    padding: 4px 0;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    color: #fff;
    font-size: 17px;
    font-weight: 400 !important;
    box-shadow: none;
}
.staff-login-card .login-form .staff-login-input-wrap input:focus {
    border: 0;
}
.staff-login-card .login-form .staff-login-input-wrap input::placeholder {
    color: rgba(255, 255, 255, .84);
    opacity: 1;
}
.staff-login-card .login-form .staff-login-input-wrap input:-webkit-autofill,
.staff-login-card .login-form .staff-login-input-wrap input:-webkit-autofill:hover,
.staff-login-card .login-form .staff-login-input-wrap input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff;
    -webkit-box-shadow: 0 0 0 1000px transparent inset;
    transition: background-color 9999s ease-out;
}
.staff-login-remember {
    display: inline-flex !important;
    grid-template-columns: none !important;
    align-items: center;
    justify-self: start;
    gap: 9px !important;
    color: rgba(255, 255, 255, .95) !important;
    font-size: 14px !important;
    cursor: pointer;
    user-select: none;
}
.staff-login-card .login-form .staff-login-remember input {
    appearance: none;
    display: grid;
    place-content: center;
    width: 17px;
    height: 17px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .82);
    border-radius: 3px;
    background: rgba(0, 47, 109, .58);
    cursor: pointer;
}
.staff-login-card .login-form .staff-login-remember input::before {
    content: "";
    width: 8px;
    height: 4px;
    border-bottom: 2px solid #fff;
    border-left: 2px solid #fff;
    opacity: 0;
    transform: translateY(-1px) rotate(-45deg) scale(.5);
    transition: opacity .12s ease, transform .12s ease;
}
.staff-login-card .login-form .staff-login-remember input:checked::before {
    opacity: 1;
    transform: translateY(-1px) rotate(-45deg) scale(1);
}
.staff-login-card .login-form .staff-login-remember input:focus-visible {
    outline: 3px solid rgba(255, 255, 255, .34);
    outline-offset: 3px;
}
.staff-login-card .login-form > button {
    min-height: 52px;
    margin-top: 3px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 3px;
    background: rgba(0, 65, 148, .9);
    color: #fff;
    font-size: 16px;
    font-weight: 700 !important;
    letter-spacing: .08em;
    text-transform: uppercase;
    box-shadow: 0 14px 30px rgba(0, 36, 85, .18);
    transition: background-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.staff-login-card .login-form > button:hover {
    background: rgba(0, 54, 130, .98);
    box-shadow: 0 17px 35px rgba(0, 36, 85, .28);
    transform: translateY(-1px);
}
.staff-login-card .login-form > button:active {
    transform: translateY(0);
}
@media (max-width: 560px) {
    .staff-login-body { padding: 18px 14px; }
    .staff-login-card { padding: 34px 24px 30px; border-radius: 22px; }
    .staff-login-card .staff-login-avatar { width: 76px; height: 76px; }
    .staff-login-avatar svg { width: 48px; height: 48px; }
    .staff-login-card h1 { margin-bottom: 27px; letter-spacing: .08em !important; }
}
@media (prefers-reduced-motion: reduce) {
    .staff-login-card .login-form > button,
    .staff-login-input-wrap { transition: none; }
}
/* === BUH1009 STAFF AUTH END === */
.public-register-header { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.public-register-shell { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 80px; display: grid; gap: 28px; }
.register-intro { display: grid; gap: 16px; }
.registration-flow { display: flex; gap: 8px; flex-wrap: wrap; }
.registration-flow span { padding: 7px 11px; border: 1px solid #d7dee8; border-radius: 999px; background: rgba(255,255,255,.72); color: #64748b; font-size: 12px; font-weight: 700; }
.registration-flow span.done { border-color: #a7d8c9; color: #166534; background: #ecfdf5; }
.registration-form { padding: 30px; }
.split-actions { justify-content: space-between; }

.metric-grid.compact.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.danger-text { color: #b42318 !important; }
.accounting-tool-panel { margin-top: 18px; }
.tool-grid.v4-tools { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.tool-grid.v4-tools a { display: grid; gap: 6px; min-height: 108px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.tool-grid.v4-tools a:hover { border-color: #9fc4bb; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(31,79,70,.08); }
.tool-grid.v4-tools strong { color: #20352f; }
.tool-grid.v4-tools span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.portfolio-layout { display: grid; grid-template-columns: minmax(0, 2.25fr) minmax(320px, .75fr); gap: 18px; align-items: start; margin-top: 18px; }
.portfolio-filters { grid-template-columns: minmax(180px, 1.2fr) repeat(3, minmax(150px, .8fr)) auto auto; }
.portfolio-table td { vertical-align: top; }
.progress-line { width: 100%; height: 7px; border-radius: 99px; overflow: hidden; background: #e9eef3; margin-bottom: 6px; }
.progress-line > span { display: block; height: 100%; border-radius: inherit; background: #2f7a68; }
.progress-line.large { height: 10px; margin: 8px 0; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 18px; padding-top: 18px; }
.pagination a { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.task-agenda-panel { position: sticky; top: 18px; max-height: calc(100vh - 36px); overflow: auto; }
.agenda-list { display: grid; }
.agenda-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.agenda-row:last-child { border-bottom: 0; }
.agenda-row time { display: grid; place-items: center; min-height: 40px; border-radius: 10px; background: #edf5f2; color: #245b50; font-size: 12px; font-weight: 800; }
.agenda-row.overdue time { background: #fef3f2; color: #b42318; }
.agenda-row > div { display: grid; min-width: 0; gap: 3px; }
.agenda-row strong { font-size: 13px; line-height: 1.35; }
.agenda-row div span { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.company-hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); align-items: center; gap: 30px; }
.company-identity { display: flex; align-items: flex-start; gap: 15px; }
.company-identity h2 { margin: 0 0 5px; font-size: 25px; letter-spacing: -.025em; }
.company-identity p { margin: 0; color: var(--muted); }
.company-progress-block { padding-left: 24px; border-left: 1px solid var(--line); }
.company-progress-block small { color: var(--muted); }
.company-workspace-layout { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(310px, .7fr); gap: 18px; align-items: start; margin-top: 18px; }
.company-main-stack, .company-side-stack { display: grid; gap: 18px; }
.onboarding-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.onboarding-step { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid #dbe3ea; border-radius: 11px; background: #fafcfd; color: #475569; font-size: 13px; }
.onboarding-step .check { flex: 0 0 auto; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: #eef2f6; color: #64748b; font-weight: 800; }
.onboarding-step.done { border-color: #b9dfd3; background: #f2fbf7; color: #235d50; }
.onboarding-step.done .check { background: #d8f3e7; color: #166534; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid .span-3 { grid-column: 1 / -1; }
.confirmation-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; padding: 14px; border-radius: 12px; background: #f7faf9; border: 1px solid #dce8e4; }
.row-actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.row-actions form { margin: 0; }
.link-button { border: 0; padding: 0; background: none; font: inherit; color: #355f57; text-decoration: underline; cursor: pointer; }
.link-button.danger { color: #b42318; }
.contract-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.contract-card { display: grid; gap: 11px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.contract-card.active { border-color: #8ec9b9; box-shadow: inset 3px 0 #2f7a68; }
.contract-card h3 { margin: 0; font-size: 15px; }
.contract-meta { color: var(--muted); font-size: 12px; }
.service-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.service-chips span { padding: 4px 7px; border-radius: 999px; background: #eff5f3; color: #315f55; font-size: 10px; font-weight: 700; }
.task-row-end { display: flex; align-items: center; gap: 10px; }
.sticky-tools { position: sticky; top: 18px; }
.side-tool-list { display: grid; }
.side-tool-list a { padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 650; }
.side-tool-list a:last-child { border-bottom: 0; }
.inline-reset { display: grid; grid-template-columns: minmax(90px,1fr) auto; gap: 5px; max-width: 210px; }
.inline-reset input, .inline-reset button { min-height: 32px; font-size: 11px; }
.inline-create { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.inline-create summary { cursor: pointer; color: #245b50; font-weight: 700; }
.compact-form { margin-top: 12px; }
.narrow-form-panel { width: min(760px,100%); }
.wide-form-panel { width: min(1040px,100%); }
.service-checkbox-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.service-checkbox { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fafcfc; }
.service-checkbox input { margin-top: 3px; }
.service-checkbox span { display: grid; gap: 4px; }
.service-checkbox small { color: var(--muted); line-height: 1.35; }
.schedule-summary { display: flex; flex-wrap: wrap; gap: 10px; }
.schedule-summary span { padding: 10px 13px; border-radius: 10px; background: #f3f7f6; color: #45625c; font-size: 12px; }
.status-toggle { min-width: 94px; padding: 6px 10px; border: 1px solid #d5dde5; border-radius: 999px; background: #f8fafc; color: #64748b; font-size: 11px; cursor: pointer; }
.status-toggle.on { border-color: #a8d5c7; background: #eaf8f2; color: #166534; }

@media (max-width: 1280px) {
    .metric-grid.compact.five { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .tool-grid.v4-tools { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .portfolio-layout, .company-workspace-layout { grid-template-columns: 1fr; }
    .task-agenda-panel, .sticky-tools { position: static; max-height: none; }
    .portfolio-filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 900px) {
    .public-auth-shell { grid-template-columns: 1fr; gap: 34px; padding: 32px 0; }
    .public-auth-brand h1, .register-intro h1 { font-size: 38px; }
    .company-hero { grid-template-columns: 1fr; }
    .company-progress-block { padding-left: 0; padding-top: 18px; border-left: 0; border-top: 1px solid var(--line); }
    .form-grid.three { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .form-grid .span-3 { grid-column: 1 / -1; }
    .confirmation-grid, .onboarding-grid, .contract-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
    .public-auth-card, .registration-form { padding: 20px; border-radius: 17px; }
    .public-register-header { align-items: flex-start; }
    .public-register-header .public-brand strong { display: none; }
    .metric-grid.compact.five, .tool-grid.v4-tools, .portfolio-filters, .form-grid.three, .service-checkbox-grid { grid-template-columns: 1fr; }
    .form-grid .span-3 { grid-column: auto; }
    .company-identity { flex-direction: column; }
    .agenda-row { grid-template-columns: 42px minmax(0,1fr); }
    .agenda-row > .status-pill { grid-column: 2; justify-self: start; }
    .task-row-end { align-items: flex-end; flex-direction: column; }
}
/* === BUH-V4 MULTI-COMPANY CLIENT CONTOUR END === */

/* === BUH-V9 PREMIUM APPLICATION SHELL START === */
:root {
    --bg: #f7f8fc;
    --panel: #ffffff;
    --soft: #f7f9fc;
    --soft-2: #eef2f7;
    --line: #e6eaf0;
    --text: #182230;
    --muted: #718096;
    --accent: #315fdb;
    --brand: #315fdb;
    --brand-strong: #244ab7;
    --brand-soft: #eef3ff;
    --sidebar-bg: #ffffff;
    --surface-shadow: 0 10px 30px rgba(24, 34, 48, .055);
    --surface-shadow-hover: 0 22px 48px rgba(24, 34, 48, .12);
}

html,
body {
    font-family: "Segoe UI Variable Text", "Segoe UI Variable", Inter, "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-weight: 400 !important;
    letter-spacing: -.012em !important;
    background: var(--bg) !important;
    color: var(--text) !important;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
.page-title,
.section-card-title,
.metric-value,
.brand-title,
.sidebar-title {
    font-family: "Segoe UI Variable Display", "Segoe UI Variable Text", Inter, "Segoe UI", ui-sans-serif, system-ui, sans-serif !important;
    font-weight: 650 !important;
    letter-spacing: -.035em !important;
}

p,
a,
button,
input,
select,
textarea,
.metric-note,
.section-card-text,
.sidebar-link,
.muted {
    font-family: inherit !important;
    font-weight: 400 !important;
}

button,
a,
.nav-link,
.nav-sublink,
.logout-button,
.section-card,
.button-link {
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, transform .3s ease, opacity .3s ease;
}

.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: none;
    grid-template-columns: 156px minmax(0, 1fr);
    background: var(--bg);
}

.sidebar {
    z-index: 20;
    gap: 16px;
    height: 100vh;
    height: 100dvh;
    padding: 16px 10px 14px;
    overflow: hidden;
    border-right: 1px solid rgba(218, 224, 233, .9);
    background: rgba(255, 255, 255, .96);
    box-shadow: 10px 0 34px rgba(31, 41, 55, .035);
    backdrop-filter: blur(18px);
}

.brand {
    gap: 8px;
    min-height: 46px;
    padding: 3px 4px 5px;
    border-radius: 11px;
}

.brand:hover {
    background: #f8faff;
}

.brand-monogram.brand-monogram-v9 {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: linear-gradient(145deg, #3e70e8 0%, #254eb9 100%);
    color: #fff;
    box-shadow: 0 9px 22px rgba(49, 95, 219, .24);
}

.brand-monogram-v9 svg {
    width: 22px;
    height: 22px;
}

.brand-title {
    color: #172033;
    font-size: 12px;
    line-height: 1.2;
}

.brand-subtitle {
    margin-top: 2px;
    color: #8a95a6;
    font-size: 9px;
    line-height: 1.15;
    letter-spacing: .005em;
}

.side-nav {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px 2px 12px 0;
    scrollbar-width: thin;
    scrollbar-color: #d9e0ea transparent;
}

.side-nav::-webkit-scrollbar { width: 5px; }
.side-nav::-webkit-scrollbar-thumb { border-radius: 999px; background: #d9e0ea; }
.side-nav::-webkit-scrollbar-track { background: transparent; }

.nav-link {
    position: relative;
    display: grid;
    grid-template-columns: 4px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 39px;
    padding: 8px 7px 8px 6px;
    border: 0;
    border-radius: 11px;
    color: #566276;
    font-size: 12px;
    line-height: 1.25;
}

.nav-link-indicator {
    width: 4px;
    height: 4px;
    align-self: center;
    border-radius: 999px;
    background: #b6bfcc;
    transition: width .3s ease, height .3s ease, background-color .3s ease, box-shadow .3s ease;
}

.nav-link-label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.nav-link:hover {
    background: #f5f7fb;
    color: #263247;
    transform: translateX(2px);
}

.nav-link:hover .nav-link-indicator {
    background: #8d99aa;
}

.nav-link.active {
    background: linear-gradient(90deg, #edf3ff 0%, #f4f7ff 100%);
    color: #244db8;
    box-shadow: inset 0 0 0 1px rgba(49, 95, 219, .035);
}

.nav-link.active .nav-link-indicator {
    width: 4px;
    height: 20px;
    background: var(--brand);
    box-shadow: 0 4px 10px rgba(49, 95, 219, .25);
}

.nav-submenu {
    display: grid;
    gap: 2px;
    margin: 2px 0 12px 20px;
    padding: 5px 0 5px 16px;
    border-left: 1px solid #e5e9f0;
}

.nav-sublink {
    display: grid;
    grid-template-columns: 5px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 6px 8px;
    border-radius: 8px;
    color: #8791a1;
    font-size: 11px;
    line-height: 1.28;
}

.nav-sublink-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #c4cbd5;
    transition: background-color .3s ease, transform .3s ease;
}

.nav-sublink:hover,
.nav-sublink.active {
    background: #f5f7fb;
    color: #40516b;
}

.nav-sublink:hover .nav-sublink-dot,
.nav-sublink.active .nav-sublink-dot {
    background: var(--brand);
    transform: scale(1.35);
}

.sidebar-footer {
    gap: 9px;
    padding-top: 4px;
}

.user-card {
    padding: 10px 9px;
    border: 1px solid #e7ebf1;
    border-radius: 13px;
    background: linear-gradient(145deg, #ffffff 0%, #fafbfe 100%);
    box-shadow: 0 5px 18px rgba(24, 34, 48, .035);
}

.user-name {
    color: #253044;
    font-size: 11.5px;
    font-weight: 650;
}

.user-role {
    margin-top: 2px;
    color: #8b95a5;
    font-size: 9.5px;
    overflow-wrap: anywhere;
}

.logout-button {
    min-height: 36px;
    gap: 6px;
    border: 1px solid #e3e8ef;
    border-radius: 11px;
    background: #fff;
    color: #667287;
    box-shadow: 0 2px 8px rgba(24, 34, 48, .025);
    font-size: 11px;
    font-weight: 550 !important;
}

.logout-button svg {
    width: 16px;
    height: 16px;
}

.logout-button:hover {
    border-color: #cfd7e3;
    background: #f7f9fc;
    color: #29364c;
    box-shadow: 0 7px 18px rgba(24, 34, 48, .07);
    transform: translateY(-1px);
}

.main-content {
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 34px 42px 56px;
    background:
        radial-gradient(circle at 90% 0%, rgba(72, 112, 222, .045), transparent 26rem),
        var(--bg);
}

.topbar {
    margin-bottom: 27px;
}

.topbar h1 {
    margin: 0;
    color: #172033;
    font-size: clamp(27px, 2.2vw, 34px);
    line-height: 1.14;
}

:focus-visible {
    outline: 3px solid rgba(49, 95, 219, .22);
    outline-offset: 3px;
}

@media (max-width: 1180px) {
    .app-shell { grid-template-columns: 156px minmax(0, 1fr); }
    .main-content { padding: 30px 28px 48px; }
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: relative;
        height: auto;
        max-height: none;
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid #e1e6ed;
        box-shadow: 0 8px 28px rgba(24, 34, 48, .05);
    }
    .side-nav { max-height: 440px; }
    .main-content { padding: 25px 20px 44px; }
}

@media (max-width: 640px) {
    .sidebar { padding: 16px 13px; }
    .main-content { padding: 22px 14px 38px; }
    .topbar h1 { font-size: 27px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
/* === BUH-V9 PREMIUM APPLICATION SHELL END === */


/* buh1009: breadcrumbs for legacy modules opened inside an organization context */
.global-accounting-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin: 0 0 16px;
    color: #9aa5b5;
    font-size: 11px;
    line-height: 1.3;
}

.global-accounting-context a,
.global-accounting-context strong {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0 9px;
    border: 1px solid #e1e7ef;
    border-radius: 8px;
    background: #fff;
    color: #63738a;
    font-weight: 550;
    text-decoration: none;
}

.global-accounting-context a:hover {
    border-color: #bdcbe1;
    color: #315fdb;
}

.global-accounting-context strong {
    border-color: #cbd7e9;
    background: #f3f6fb;
    color: #354761;
    font-weight: 650;
}
