@charset "UTF-8";

:root {
    color-scheme: light;
    --page: #ffffff;
    --panel: #ffffff;
    --section: #f8fafb;
    --line: #dfe5ea;
    --input-line: #c9d1d8;
    --text: #333333;
    --muted: #6f7c87;
    --link: #2067b0;
    --control-bg: #e1e6e7;
    --control-bg-active: #ced3d4;
    --control-border: #bec3c4;
    --control-text: #656767;
    --control-text-active: #2c2d2e;
    --green: #00b263;
    --blue: #2fc6f6;
    --red: #d93025;
    --shadow-menu: 0 10px 28px rgba(0, 0, 0, .18);
    --font: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font: 14px/1.45 var(--font);
}

a {
    color: var(--link);
    font-weight: 500;
    text-decoration: none;
}

a:hover { text-decoration: underline; }

.app-shell {
    min-height: 100vh;
    padding: 14px 24px 36px;
}

.tabs-row {
    position: relative;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.app-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.tab {
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--control-bg);
    color: var(--control-text);
    padding: 0 15px;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.tab.is-active {
    background: var(--control-bg);
    color: var(--control-text);
}

.tab.is-active:hover,
.tab:hover {
    border-color: var(--control-border);
    background: var(--control-bg-active);
    color: var(--control-text-active);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0 15px;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.btn-black {
    background: #2a2f33;
    border-color: #2a2f33;
    color: #fff;
}

#inlineSave,
#projectSaveButton,
#settingsSaveButton {
    background: var(--green);
    border-color: var(--green);
    color: #ffffff;
}

#inlineSave:hover,
#projectSaveButton:hover,
#settingsSaveButton:hover {
    background: #009b56;
    border-color: #009b56;
}

.btn-gray {
    background: var(--control-bg);
    color: var(--control-text);
}

.btn-gray:hover {
    background: var(--control-bg-active);
    color: var(--control-text-active);
}

.project-picker { position: relative; }

.project-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5.5px;
    min-width: 0;
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--control-bg);
    color: var(--control-text);
    padding: 0 15px;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
}

.project-trigger.is-active,
.project-trigger:hover {
    border-color: var(--control-border);
    background: var(--control-bg-active);
    color: var(--control-text-active);
}

.arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 9px;
    height: 5px;
    overflow: hidden;
    font-size: 0;
    line-height: 1;
    transform: translateY(1.5px);
}

.arrow::before {
    content: "";
    display: block;
    width: 9px;
    height: 5px;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg width='9' height='5' viewBox='0 0 9 5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l3.5 3L8 1' fill='none' stroke='black' stroke-width='1.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg width='9' height='5' viewBox='0 0 9 5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l3.5 3L8 1' fill='none' stroke='black' stroke-width='1.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.project-menu,
.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: max-content;
    min-width: 220px;
    max-width: calc(100vw - 38px);
    max-height: 340px;
    overflow: auto;
    border: 0;
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow-menu);
    padding: 12px 0;
}

.project-menu {
    top: calc(100% + 8px);
    z-index: 1100;
}

#projectMenuItems {
    padding-bottom: 6px;
}

#projectMenuItems:not(:empty) {
    border-bottom: 1px solid #e5ebf0;
}

.project-menu button,
.search-results button {
    display: flex;
    min-width: 220px;
    width: 100%;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0 19px;
    min-height: 44px;
    font: inherit;
    font-size: 15px;
    font-weight: 400;
    line-height: 1;
    color: #686868;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}

.project-menu button:hover,
.project-menu button.is-active,
.search-results button:hover {
    background: #f7f7f7;
}

.project-menu-title {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.project-menu-check {
    margin-left: auto;
    color: var(--link);
    font-size: 16px;
}

.project-menu-add {
    margin-top: 6px;
    color: var(--link) !important;
}

.inline-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.settings-btn { margin-left: 0; }

.project-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 28px 0 14px;
}

.project-head h1 {
    min-width: 0;
    margin: 0;
    font-size: 28px;
    font-weight: 500;
}

.kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 10px;
}

.kpis article {
    min-height: 78px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--section);
    padding: 14px 16px;
}

.kpis span {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

.kpis b {
    font-size: 25px;
    font-weight: 500;
}

.project-action-tab {
    flex: 0 0 auto;
    height: 28px;
    border: 0;
    border-radius: 7px;
    background: var(--control-bg);
    color: var(--control-text);
    cursor: pointer;
    font: 14px/28px var(--font);
    padding: 0 14px;
    white-space: nowrap;
}

.project-action-tab:hover {
    background: var(--control-bg-active);
    color: var(--control-text-active);
}

.gpr-table-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

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

.gpr-table {
    width: 100%;
    min-width: 1780px;
    border-collapse: collapse;
    table-layout: fixed;
}

.gpr-table th,
.gpr-table td {
    border-right: 1px solid rgba(76, 111, 63, .28);
    border-bottom: 1px solid rgba(76, 111, 63, .28);
    padding: 8px 9px;
    text-align: left;
    vertical-align: middle;
}

.gpr-table th:last-child,
.gpr-table td:last-child {
    border-right: 0;
}

.gpr-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f4f6f8;
    color: #161b20;
    font-weight: 700;
    text-align: center;
}

.gpr-table th:nth-child(1) { width: 280px; }
.gpr-table th:nth-child(2) { width: 54px; }
.gpr-table th:nth-child(3) { width: 110px; }
.gpr-table th:nth-child(4) { width: 560px; }
.gpr-table th:nth-child(5) { width: 100px; }
.gpr-table th:nth-child(6),
.gpr-table th:nth-child(7) { width: 130px; }
.gpr-table th:nth-child(8),
.gpr-table th:nth-child(9),
.gpr-table th:nth-child(10),
.gpr-table th:nth-child(11),
.gpr-table th:nth-child(12) { width: 100px; }
.gpr-table th:nth-child(13) { width: 210px; }

.row-product td:not(.invoice-cell) { background: #94c47f; }
.row-service td:not(.invoice-cell) { background: #9dbbeb; }

.num { text-align: right !important; }
.strong { font-weight: 600; }

.invoice-total td {
    border-top: 2px solid rgba(0, 0, 0, .62);
    border-bottom: 2px solid rgba(0, 0, 0, .62);
    background: #ffffff;
    color: #111;
    text-align: left;
}

.invoice-cell {
    background: #ffffff;
    color: #111;
    font-weight: 700;
    text-align: center !important;
    line-height: 1.25;
}

.cell-editor {
    width: 100%;
    min-height: 30px;
    border: 1px solid var(--link);
    border-radius: 6px;
    background: #fff;
    padding: 4px 6px;
    font: inherit;
}

.empty-state,
.access-closed {
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.modal {
    width: min(1180px, calc(100vw - 28px));
    border: 0;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .26);
}

.settings-modal { width: min(720px, calc(100vw - 28px)); }

.modal::backdrop { background: rgba(20, 26, 32, .42); }

.modal-box {
    display: flex;
    flex-direction: column;
    max-height: min(84vh, 900px);
    margin: 0;
    background: #fff;
}

.modal-head,
.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.modal-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    border-bottom: 0;
}

.modal-head h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
}

.modal-body {
    overflow: auto;
    padding: 18px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: var(--control-bg);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.field {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
}

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

.input {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--input-line);
    border-radius: 8px;
    background: #fff;
    padding: 6px 9px;
    font: inherit;
}

.search-select { position: relative; }
.search-results { z-index: 5; width: 100%; }

.builder-actions { margin: 14px 0; }

.invoice-edit {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--section);
    margin-bottom: 14px;
    padding: 12px;
}

.invoice-edit header {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.invoice-title-control {
    display: flex;
    align-items: center;
    min-height: 34px;
    border: 1px solid #dfe5ea;
    border-radius: 8px;
    background: #ffffff;
    padding: 4px 8px;
}

.invoice-title-control .input {
    min-height: 24px;
    border: 0;
    padding: 0 4px 0 8px;
    outline: none;
}

.builder-table {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.builder-head,
.builder-row {
    display: grid;
    grid-template-columns: 24px 42px 110px 120px 360px 96px 110px repeat(5, 112px) 240px 64px;
    gap: 6px;
    width: 1804px;
    min-width: 1804px;
    align-items: center;
    padding: 8px;
}

.builder-head {
    background: #eef2f4;
    color: #4c5660;
    font-size: 13px;
    border-radius: 8px 8px 0 0;
}

.builder-row { border-top: 1px solid var(--line); }

.invoice-edit.is-drop-before::before,
.invoice-edit.is-drop-after::after,
.builder-row.is-drop-before::before,
.builder-row.is-drop-after::after {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    z-index: 3;
    height: 3px;
    border-radius: 3px;
    background: #0077ff;
    box-shadow: 0 0 0 2px rgba(0, 119, 255, .13);
}

.invoice-edit.is-drop-before::before,
.builder-row.is-drop-before::before {
    top: -2px;
}

.invoice-edit.is-drop-after::after,
.builder-row.is-drop-after::after {
    bottom: -2px;
}

.builder-row {
    position: relative;
}

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

.drag-field-handle {
    width: 16px;
    height: 22px;
    flex: 0 0 16px;
    border-radius: 2px;
    cursor: grab;
    background-image:
        radial-gradient(#9aa3ad 1.05px, transparent 1.15px),
        radial-gradient(#9aa3ad 1.05px, transparent 1.15px),
        radial-gradient(#9aa3ad 1.05px, transparent 1.15px),
        radial-gradient(#9aa3ad 1.05px, transparent 1.15px),
        radial-gradient(#9aa3ad 1.05px, transparent 1.15px),
        radial-gradient(#9aa3ad 1.05px, transparent 1.15px);
    background-size: 4px 4px;
    background-position: 2px 4px, 8px 4px, 2px 10px, 8px 10px, 2px 16px, 8px 16px;
    background-repeat: no-repeat;
}

.drag-field-handle:active {
    cursor: grabbing;
}

.small-btn,
.link-button {
    min-height: 30px;
    border: 0;
    border-radius: 6px;
    background: var(--control-bg);
    padding: 0 9px;
    font: inherit;
    color: var(--control-text);
    cursor: pointer;
}

.link-button {
    margin-top: 10px;
    background: transparent;
    color: var(--link);
}

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

.row-tools {
    display: flex;
    gap: 4px;
}

.user-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px 12px;
    max-height: 280px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
}

.user-list label {
    display: flex;
    gap: 8px;
    align-items: center;
}

.install-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.install-box {
    width: min(520px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    text-align: center;
}

.install-box h1 {
    margin: 0 0 12px;
    font-size: 28px;
    font-weight: 500;
}

.status-ok { color: var(--green); }
.status-error { color: var(--red); }

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 100;
    max-width: 420px;
    border-radius: 8px;
    background: #2a2f33;
    color: #fff;
    padding: 12px 14px;
    box-shadow: var(--shadow-menu);
}

@media (max-width: 760px) {
    .app-shell { padding: 12px; }
    .tabs-row { align-items: flex-start; }
    .app-tabs { flex-wrap: wrap; }
    .project-trigger { min-width: min(260px, calc(100vw - 24px)); }
    .kpis { grid-template-columns: 1fr; }
    .project-head h1 { font-size: 22px; }
}
