* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 18px;
    background: var(--app-bg);
    color: var(--primary-text);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--group-border);
    padding: 16px;
    margin-bottom: 14px;
}

h1, h2, h3 {
    margin-top: 0;
    font-weight: 600;
}

.group-title {
    font-size: 16px;
    border-bottom: 1px solid var(--group-border);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.question {
    margin: 12px 0;
}

label, .label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    padding: 7px 8px;
    min-height: 32px;
    color: var(--primary-text);
}

textarea {
    min-height: 90px;
    resize: vertical;
}

button,
.button {
    display: inline-block;
    background: var(--button-bg);
    border: 1px solid var(--button-border);
    color: #ffffff;
    padding: 7px 13px;
    text-decoration: none;
    cursor: pointer;
    min-height: 32px;
    margin: 2px 4px 2px 0;
    font-size: 14px;
    font-weight: 600;
}

button:hover,
.button:hover {
    background: var(--button-hover);
    color: #ffffff;
}

button:active,
.button:active {
    background: var(--button-active);
    color: #082b33;
}

.primary {
    font-weight: 600;
}

.secondary-text {
    color: var(--secondary-text);
}

.disabled-text {
    color: var(--disabled-text);
}

.notice, .error, .success {
    border: 1px solid var(--group-border);
    padding: 10px;
    margin-bottom: 12px;
    background: #ffffff;
}

.error {
    border-color: #cc7777;
    background: #fff2f2;
}

.success {
    border-color: #77aa77;
    background: #f2fff2;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--table-row);
}

th {
    background: var(--table-header);
    border: 1px solid var(--group-border);
    padding: 7px;
    text-align: left;
}

td {
    border: 1px solid var(--group-border);
    padding: 7px;
    vertical-align: top;
    background: var(--table-row);
}

nav {
    margin-bottom: 12px;
}

nav a {
    margin-right: 10px;
}

.radio-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.radio-item {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid var(--group-border);
    background: #fff;
}

.required {
    color: #b00000;
}

.hidden-field {
    position: absolute;
    left: -10000px;
}

.conditional {
    display: none;
}

.conditional.visible {
    display: block;
}

.schema-table td small {
    color: var(--secondary-text);
}

.branch-chip {
    display: inline-block;
    border: 1px solid var(--group-border);
    padding: 2px 6px;
    background: #fff;
}

@media (max-width: 700px) {
    body { padding: 8px; }
    table { font-size: 12px; }
}


/* V4 LEGO / FLOW BUILDER */
.builder-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 14px;
    align-items: start;
}

.builder-sidebar {
    position: sticky;
    top: 10px;
}

.flow-section {
    margin-bottom: 16px;
    border: 1px solid var(--group-border);
    background: #ffffff;
}

.flow-section-title {
    background: var(--table-header);
    border-bottom: 1px solid var(--group-border);
    padding: 8px 10px;
    font-weight: 600;
}

.flow-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
    padding: 10px;
    flex-wrap: wrap;
}

.flow-card {
    min-width: 230px;
    max-width: 320px;
    background: #ffffff;
    border: 1px solid var(--group-border);
    padding: 9px;
    position: relative;
}

.flow-card.always {
    border-left: 5px solid #777777;
}

.flow-card.branch {
    border-left: 5px solid var(--branch-blue);
}

.flow-card.inactive {
    opacity: 0.45;
}

.flow-card-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.flow-meta {
    font-size: 12px;
    color: var(--secondary-text);
    line-height: 1.45;
}

.flow-branch {
    margin-top: 6px;
    border: 1px solid var(--group-border);
    background: #f7fbff;
    padding: 5px;
    font-size: 12px;
}

.flow-arrow {
    display: flex;
    align-items: center;
    color: var(--branch-blue);
    font-weight: 600;
    font-size: 24px;
}

.branch-map {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.branch-line {
    background: #ffffff;
    border: 1px solid var(--group-border);
    padding: 8px;
}

.branch-parent {
    font-weight: 600;
}

.branch-child {
    margin-left: 20px;
    padding: 4px 0;
}

.action-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.compact-form {
    display: inline;
}

.compact-form input[type="number"] {
    width: 75px;
}

@media (max-width: 900px) {
    .builder-layout {
        grid-template-columns: 1fr;
    }

    .builder-sidebar {
        position: static;
    }
}


/* V6 TREE BUILDER */
.tree-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 14px;
    align-items: start;
}

.tree-sidebar {
    position: sticky;
    top: 10px;
}

.section-tree-card {
    border: 1px solid var(--group-border);
    background: #ffffff;
    margin-bottom: 12px;
}

.section-tree-card.active-section {
    outline: 2px solid var(--branch-blue);
}

.section-tree-header {
    background: var(--table-header);
    border-bottom: 1px solid var(--group-border);
    padding: 10px;
}

.section-tree-title {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    font-weight: 700;
}

.section-tree-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.question-tree {
    padding: 8px 10px 10px 26px;
    position: relative;
}

.question-tree:before {
    content: "";
    position: absolute;
    left: 13px;
    top: 0;
    bottom: 0;
    border-left: 1px solid var(--group-border);
}

.question-node {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--group-border);
    margin-bottom: 8px;
    padding: 8px;
}

.question-node:before {
    content: "";
    position: absolute;
    left: -14px;
    top: 18px;
    width: 14px;
    border-top: 1px solid var(--group-border);
}

.question-node.branch-node {
    border-left: 5px solid var(--branch-blue);
}

.question-node.always-node {
    border-left: 5px solid #777777;
}

.question-node.inactive {
    opacity: 0.45;
}

.node-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.node-meta {
    font-size: 12px;
    color: var(--secondary-text);
    line-height: 1.4;
}

.node-branch {
    margin-top: 6px;
    padding: 5px;
    background: #f8fbff;
    border: 1px solid var(--group-border);
    font-size: 12px;
}

.inline-form {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form input[type="text"] {
    width: 180px;
}

.small-input {
    width: 80px !important;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.color-sample {
    display: inline-block;
    width: 28px;
    height: 18px;
    border: 1px solid var(--group-border);
    vertical-align: middle;
    margin-left: 6px;
}

.button.primary-action {
    background: var(--button-active);
    font-weight: 600;
}

@media (max-width: 900px) {
    .tree-layout {
        grid-template-columns: 1fr;
    }

    .tree-sidebar {
        position: static;
    }
}

.preview-badge {
    display: inline-block;
    padding: 3px 7px;
    border: 1px solid var(--group-border);
    background: var(--button-active);
    font-weight: 600;
}


/* V8 CLEAN SECTION BUILDER */
.clean-section-card {
    border: 1px solid var(--group-border);
    background: var(--panel-bg);
    margin-bottom: 12px;
}

.clean-section-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--group-border);
    background: var(--table-header);
}

.clean-section-title {
    font-size: 16px;
    font-weight: 700;
}

.clean-section-body {
    padding: 12px;
    background: #ffffff;
}

.clean-question-line {
    padding: 7px 0;
    border-bottom: 1px solid var(--group-border);
}

.clean-question-line:last-child {
    border-bottom: none;
}

.clean-branch {
    font-size: 12px;
    color: var(--secondary-text);
    margin-left: 18px;
}

.editor-table input[type="text"],
.editor-table input[type="number"],
.editor-table select,
.editor-table textarea {
    min-width: 120px;
}

.editor-table textarea {
    min-height: 54px;
}

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
}

.section-edit-header {
    background: var(--table-header);
    border: 1px solid var(--group-border);
    padding: 12px;
    margin-bottom: 12px;
}

.muted-box {
    border: 1px solid var(--group-border);
    background: #ffffff;
    padding: 10px;
    margin-bottom: 12px;
}


/* V9 ENERGO PUBLIC FORM STYLE */
.client-shell {
    max-width: 1180px;
    margin: 0 auto;
}

.client-topbar {
    background: #123d47;
    color: #ffffff;
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 26px;
    border-bottom: 4px solid #79b68d;
}

.client-brand {
    font-size: 32px;
    line-height: 1;
    letter-spacing: -1px;
    color: #79b68d;
    font-weight: 700;
}

.client-brand span {
    display: block;
    color: #ffffff;
    font-size: 12px;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-top: 2px;
}

.client-lang-switch a {
    color: #ffffff;
    text-decoration: none;
    margin-left: 12px;
    border: 1px solid rgba(255,255,255,0.35);
    padding: 6px 9px;
}

.client-lang-switch a:hover {
    background: rgba(255,255,255,0.12);
}

.client-form-card {
    background: #ffffff;
    border: 1px solid var(--group-border);
    padding: 22px;
    margin: 16px 0;
    box-shadow: 0 2px 10px rgba(8,43,51,0.06);
}

.client-form-card h1 {
    color: #082b33;
}

.client-form-card .group-title {
    color: #082b33;
    border-bottom: 2px solid #79b68d;
}

.language-card {
    text-align: center;
    padding: 40px 24px;
}

.language-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.language-button {
    min-width: 190px;
    background: #123d47;
    color: #ffffff;
    text-decoration: none;
    padding: 18px 24px;
    border: 2px solid #79b68d;
    font-size: 20px;
}

.language-button:hover {
    background: #1b5664;
}

.language-button .flag {
    display: block;
    font-size: 42px;
    margin-bottom: 8px;
}

.add-plus {
    display: inline-block;
    margin-left: 12px;
    text-decoration: none;
    background: #123d47;
    color: #ffffff;
    border: 1px solid #0b2d35;
    padding: 6px 10px;
    font-size: 14px;
}

.add-plus:hover {
    background: #1b5664;
}

.danger-button {
    background: #fff2f2;
    border-color: #b00000;
    color: #7a0000;
}

.danger-button:hover {
    background: #ffdede;
}


/* V10 readable Energo admin polish */
body {
    background:
        linear-gradient(180deg, #edf4f2 0%, #f7faf9 42%, #edf4f2 100%);
}

.panel,
.section-edit-header,
.clean-section-card,
.muted-box {
    box-shadow: 0 2px 10px rgba(8, 43, 51, 0.04);
}

nav {
    background: #ffffff;
    border-bottom: 1px solid var(--group-border);
    padding: 8px 0 12px 0;
}

nav a {
    color: #123d47;
    font-weight: 600;
    text-decoration: none;
    padding: 5px 8px;
    border-radius: 3px;
}

nav a:hover {
    background: #e4eeeb;
    color: #082b33;
}

h1, h2, h3 {
    color: #082b33;
}

table {
    border: 1px solid var(--group-border);
}

th {
    color: #082b33;
    font-weight: 700;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    color: #082b33;
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid rgba(121, 182, 141, 0.35);
    border-color: #79b68d;
}

.primary-action {
    background: #79b68d !important;
    color: #082b33 !important;
    border-color: #5c9c70 !important;
}

.primary-action:hover {
    background: #8fc79f !important;
    color: #082b33 !important;
}

.notice {
    background: #f6fbf9;
    border-color: #c8d8d4;
    color: #082b33;
}

.success {
    background: #eef8f1;
    border-color: #79b68d;
    color: #082b33;
}

.error {
    background: #fff2f2;
    border-color: #cc7777;
    color: #5f0000;
}

.secondary-text {
    color: #526b6e;
}

.add-plus {
    background: #79b68d;
    color: #082b33;
    border-color: #5c9c70;
    font-weight: 700;
}

.add-plus:hover {
    background: #8fc79f;
    color: #082b33;
}

.danger-button {
    background: #fff2f2 !important;
    border-color: #b00000 !important;
    color: #7a0000 !important;
}

.danger-button:hover {
    background: #ffdede !important;
    color: #7a0000 !important;
}

/* Public client form keeps Energo dark header, but fields remain bright */
.client-topbar {
    background: linear-gradient(90deg, #123d47 0%, #0b2d35 100%);
}

.client-form-card {
    border-top: 3px solid #79b68d;
}

.language-button {
    color: #ffffff;
}


/* V12 employee ref copy */
.copy-link-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
}

.copy-link-input {
    min-width: 230px;
    font-family: Consolas, monospace;
    font-size: 12px;
}

@media (max-width: 900px) {
    .copy-link-wrap {
        flex-direction: column;
        align-items: stretch;
    }

    .copy-link-input {
        min-width: 220px;
        width: 100%;
    }
}


/* V13 real logo support */
.client-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    min-height: 58px;
}

.client-logo {
    display: block;
    max-height: 62px;
    max-width: 260px;
    object-fit: contain;
}

.client-logo-link.logo-missing {
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

@media (max-width: 700px) {
    .client-logo {
        max-height: 48px;
        max-width: 210px;
    }
}


/* V15 clean branching */
.question-wrap.conditional {
    display: none;
}

.question-wrap.conditional.visible {
    display: block;
}

/* V15 address repeater */
.address-repeater {
    border: 1px solid var(--group-border);
    background: #f8fbfa;
    padding: 12px;
}

.address-repeater-item {
    border: 1px solid var(--group-border);
    background: #ffffff;
    padding: 12px;
    margin-bottom: 12px;
}

.address-repeater-title {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    color: #082b33;
}

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

.address-grid label {
    font-weight: 600;
}

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

@media (max-width: 800px) {
    .address-grid {
        grid-template-columns: 1fr;
    }
}


/* V16 contact repeaters */
.contact-repeater {
    border: 1px solid var(--group-border);
    background: #f8fbfa;
    padding: 12px;
}

.contact-repeater-item {
    border: 1px solid var(--group-border);
    background: #ffffff;
    padding: 12px;
    margin-bottom: 12px;
}

.contact-repeater-title {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    color: #082b33;
}

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

.contact-grid label {
    font-weight: 600;
}

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

@media (max-width: 800px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }
}


/* V17 Crystal-style report */
.report-body {
    background: #e9f1ef;
    color: #082b33;
}

.report-page {
    max-width: 1050px;
    margin: 24px auto;
    background: #ffffff;
    border: 1px solid #b9cbc7;
    box-shadow: 0 3px 18px rgba(8, 43, 51, 0.10);
    padding: 26px;
}

.report-header {
    display: grid;
    grid-template-columns: 180px 1fr 230px;
    gap: 18px;
    align-items: center;
    border-bottom: 3px solid #79b68d;
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.report-logo {
    max-width: 170px;
    max-height: 75px;
    object-fit: contain;
}

.report-title-block h1 {
    margin: 0 0 8px 0;
    color: #082b33;
    font-size: 26px;
}

.report-subtitle {
    font-size: 18px;
    color: #526b6e;
    font-weight: 600;
}

.report-meta {
    background: #e4eeeb;
    border: 1px solid #c8d8d4;
    padding: 10px;
    font-size: 13px;
    line-height: 1.6;
}

.report-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 14px 0 18px 0;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.report-summary div {
    background: #f8fbfa;
    border: 1px solid #c8d8d4;
    padding: 10px;
}

.report-summary span {
    display: block;
    color: #526b6e;
    font-size: 12px;
    margin-bottom: 4px;
}

.report-summary strong {
    font-size: 15px;
}

.report-section {
    margin: 18px 0;
    page-break-inside: avoid;
}

.report-section h2 {
    background: #123d47;
    color: #ffffff;
    padding: 8px 10px;
    margin: 0;
    font-size: 16px;
    letter-spacing: 0.2px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #c8d8d4;
}

.report-table th {
    width: 34%;
    text-align: left;
    vertical-align: top;
    background: #e4eeeb;
    color: #082b33;
    border: 1px solid #c8d8d4;
    padding: 8px;
}

.report-table td {
    vertical-align: top;
    background: #ffffff;
    border: 1px solid #c8d8d4;
    padding: 8px;
    white-space: normal;
}

.report-footer {
    margin-top: 26px;
    border-top: 1px solid #c8d8d4;
    padding-top: 10px;
    color: #526b6e;
    font-size: 12px;
}

@media print {
    body.report-body {
        background: #ffffff;
    }

    .report-page {
        max-width: none;
        margin: 0;
        border: none;
        box-shadow: none;
        padding: 0;
    }

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

    .report-section h2 {
        background: #e4eeeb !important;
        color: #082b33 !important;
        border: 1px solid #c8d8d4;
    }

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

@media (max-width: 800px) {
    .report-header {
        grid-template-columns: 1fr;
    }

    .report-summary {
        grid-template-columns: 1fr;
    }
}


/* V18 clickable logo */
.client-logo-link,
.report-logo-wrap a {
    cursor: pointer;
}

.client-logo-link:hover .client-logo,
.report-logo-wrap a:hover .report-logo {
    opacity: 0.88;
    transform: translateY(-1px);
}

.client-logo,
.report-logo {
    transition: opacity 0.15s ease, transform 0.15s ease;
}


/* V18.1 explicit home button */
.client-home-button {
    border-color: #79b68d !important;
    background: rgba(121, 182, 141, 0.12);
    color: #ffffff !important;
    font-weight: 700;
}

.client-home-button:hover {
    background: rgba(121, 182, 141, 0.28);
    color: #ffffff !important;
}


/* V18.2 forced logo home fix */
.client-logo-link {
    cursor: pointer !important;
}

.client-home-button {
    display: inline-block;
    border: 1px solid #79b68d !important;
    background: rgba(121, 182, 141, 0.16);
    color: #ffffff !important;
    font-weight: 700;
    padding: 8px 12px !important;
    text-decoration: none;
}

.client-home-button:hover {
    background: rgba(121, 182, 141, 0.32);
    color: #ffffff !important;
}


/* V19 easy links */
.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.shortcut-card {
    display: block;
    background: #ffffff;
    border: 1px solid var(--group-border);
    border-left: 5px solid #79b68d;
    padding: 14px;
    text-decoration: none;
    color: #082b33;
    box-shadow: 0 2px 8px rgba(8,43,51,0.05);
}

.shortcut-card:hover {
    background: #f8fbfa;
    color: #082b33;
    transform: translateY(-1px);
}

.shortcut-card strong {
    display: block;
    font-size: 17px;
    margin-bottom: 5px;
}

.shortcut-card span {
    display: block;
    color: #526b6e;
    font-size: 13px;
}

code {
    background: #eef5f3;
    border: 1px solid #c8d8d4;
    padding: 2px 5px;
}


/* V20 admin logo header */
.admin-shell {
    max-width: 1180px;
    margin: 0 auto 14px auto;
}

.admin-topbar {
    background: linear-gradient(90deg, #123d47 0%, #0b2d35 100%);
    min-height: 86px;
    border-bottom: 4px solid #79b68d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    box-sizing: border-box;
}

.admin-logo-link {
    display: inline-flex;
    align-items: center;
    min-height: 54px;
    text-decoration: none;
    cursor: pointer;
}

.admin-logo {
    max-height: 60px;
    max-width: 260px;
    object-fit: contain;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.admin-logo-link:hover .admin-logo {
    opacity: 0.88;
    transform: translateY(-1px);
}

.admin-logo-link.logo-missing {
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

.admin-top-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.admin-top-actions a {
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.45);
    padding: 8px 12px;
    text-decoration: none;
    font-weight: 700;
}

.admin-top-actions a:hover {
    background: rgba(255,255,255,0.12);
    color: #ffffff;
}

.admin-nav {
    background: #ffffff;
    border: 1px solid var(--group-border);
    border-top: 0;
    padding: 10px 14px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    box-shadow: 0 2px 10px rgba(8,43,51,0.04);
}

.admin-nav a {
    color: #123d47;
    font-weight: 700;
    text-decoration: none;
    padding: 7px 10px;
    border-radius: 3px;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: #e4eeeb;
    color: #082b33;
}

/* Avoid double old nav visual if some old nav remains */
.page > .admin-shell + .panel nav {
    display: none;
}

@media (max-width: 700px) {
    .admin-topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .admin-logo {
        max-height: 48px;
        max-width: 220px;
    }
}


/* V21 clean export actions */
.export-inline-form {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    margin: 2px 0;
}

.export-inline-form select {
    min-width: 138px;
    height: 32px;
    padding: 4px 6px;
}

.export-inline-form button {
    min-height: 32px;
    white-space: nowrap;
}

td .button,
td .export-inline-form {
    vertical-align: middle;
}


/* V22 preview back to home */
.preview-home-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-home-button {
    display: inline-block;
    border: 1px solid #79b68d;
    background: rgba(121, 182, 141, 0.16);
    color: #ffffff !important;
    padding: 9px 13px;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.preview-home-button:hover {
    background: rgba(121, 182, 141, 0.32);
    color: #ffffff !important;
}

.client-topbar {
    gap: 14px;
}

@media (max-width: 700px) {
    .preview-home-actions {
        margin-left: 0;
        width: 100%;
    }

    .preview-home-button {
        width: 100%;
        text-align: center;
    }
}


/* V22.2 preview header cleanup */
.client-home-button {
    display: none !important;
}

.preview-home-button {
    display: inline-block;
    border: 1px solid #79b68d;
    background: rgba(121, 182, 141, 0.18);
    color: #ffffff !important;
    padding: 9px 13px;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.preview-home-button:hover {
    background: rgba(121, 182, 141, 0.34);
    color: #ffffff !important;
}


/* V23 admin logged user header */
.admin-current-user {
    display: inline-flex;
    align-items: center;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.08);
    padding: 8px 12px;
    font-weight: 700;
    min-height: 20px;
}

.admin-preview-button {
    display: none !important;
}


/* V23.1 real DB user name */
.admin-current-user {
    display: inline-flex;
    align-items: center;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.08);
    padding: 8px 12px;
    font-weight: 700;
    min-height: 20px;
}


/* V24 settings gear admin only */
.admin-settings-gear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff !important;
    border: 1px solid rgba(255,255,255,0.45);
    background: rgba(255,255,255,0.08);
    width: 38px;
    height: 36px;
    padding: 0 !important;
    text-decoration: none;
    font-size: 20px;
    line-height: 1;
    font-weight: 700;
}

.admin-settings-gear:hover {
    background: rgba(255,255,255,0.18);
    color: #ffffff !important;
}

.shortcut-card[href="settings.php"] {
    display: none !important;
}


/* V31 online users */
.online-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    background: #1c9b4b;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: middle;
}

.online-badge {
    display: inline-block;
    background: #dff4e7;
    border: 1px solid #8fd0a8;
    color: #0d5f2d;
    padding: 3px 8px;
    font-weight: 700;
    border-radius: 3px;
}

.offline-badge {
    display: inline-block;
    background: #f2f2f2;
    border: 1px solid #cccccc;
    color: #555555;
    padding: 3px 8px;
    font-weight: 700;
    border-radius: 3px;
}


/* V33 add client button */
.dashboard-add-client-panel {
    border-left: 5px solid #79b68d;
}

.add-client-button {
    display: inline-block;
    font-size: 15px;
    font-weight: 700;
    padding: 10px 16px;
}


/* V34 power user edit submissions */
.edit-submission-section {
    border-left: 5px solid #79b68d;
}

.edit-question {
    margin: 12px 0;
    padding: 10px;
    border: 1px solid var(--group-border);
    background: #ffffff;
}

.edit-question small {
    display: block;
    color: var(--secondary-text);
    margin: 3px 0 6px 0;
}

.edit-question input,
.edit-question textarea {
    width: 100%;
    box-sizing: border-box;
}

.edit-question textarea {
    min-height: 82px;
}

.edit-array-entry {
    border: 1px solid var(--group-border);
    background: #f8fbfa;
    padding: 10px;
    margin: 8px 0;
}

.edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}


/* V35 activity log */
.online-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    background: #1c9b4b;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: middle;
}

.online-badge {
    display: inline-block;
    background: #dff4e7;
    border: 1px solid #8fd0a8;
    color: #0d5f2d;
    padding: 3px 8px;
    font-weight: 700;
    border-radius: 3px;
}

.offline-badge {
    display: inline-block;
    background: #f2f2f2;
    border: 1px solid #cccccc;
    color: #555555;
    padding: 3px 8px;
    font-weight: 700;
    border-radius: 3px;
}


/* V37 unified button system
   Mērķis: visas pogas izskatās kā vienas sistēmas daļa.
   - Primary: galvenā darbība
   - Secondary: neitrāla darbība
   - Danger: dzēšana/bīstama darbība
*/

:root {
    --ek-button-primary-bg: #123d47;
    --ek-button-primary-hover: #1b5664;
    --ek-button-secondary-bg: #f7f7f7;
    --ek-button-secondary-hover: #e4eeeb;
    --ek-button-border: #8fb7ae;
    --ek-button-danger-bg: #9b2f2f;
    --ek-button-danger-hover: #7f2424;
}

/* Normalizējam visas pogas un link-pogas */
button,
input[type="submit"],
input[type="button"],
input[type="reset"],
.button,
.primary-action,
.admin-top-actions a,
.admin-settings-gear,
.shortcut-card button,
.export-inline-form button,
a.button {
    min-height: 34px;
    box-sizing: border-box;
    border: 1px solid var(--ek-button-border);
    border-radius: 0;
    padding: 8px 13px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

/* Noklusētā poga = sekundāra */
button,
input[type="submit"],
input[type="button"],
input[type="reset"],
.button,
a.button {
    background: var(--ek-button-secondary-bg);
    color: var(--primary-text);
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
input[type="reset"]:hover,
.button:hover,
a.button:hover {
    background: var(--ek-button-secondary-hover);
    color: var(--primary-text);
}

/* Galvenā darbība */
.primary-action,
button.primary-action,
a.primary-action,
input.primary-action,
.add-client-button {
    background: var(--ek-button-primary-bg) !important;
    border-color: var(--ek-button-primary-bg) !important;
    color: #ffffff !important;
}

.primary-action:hover,
button.primary-action:hover,
a.primary-action:hover,
input.primary-action:hover,
.add-client-button:hover {
    background: var(--ek-button-primary-hover) !important;
    border-color: var(--ek-button-primary-hover) !important;
    color: #ffffff !important;
}

/* Sekundārās tumšās darbības, kuras iepriekš bija dažādās krāsās */
.section-card button,
.section-actions button,
.form-schema-section button,
.builder-section button,
.edit-section-header button,
.section-header button {
    background: var(--ek-button-secondary-bg);
    border-color: var(--ek-button-border);
    color: var(--primary-text);
}

.section-card button:hover,
.section-actions button:hover,
.form-schema-section button:hover,
.builder-section button:hover,
.edit-section-header button:hover,
.section-header button:hover {
    background: var(--ek-button-secondary-hover);
    color: var(--primary-text);
}

/* Ja pogai teksts ir Labot, to turam kā primary, bet ar vienādu formu */
button[data-action="edit"],
a[data-action="edit"],
button.edit-button,
a.edit-button {
    background: var(--ek-button-primary-bg) !important;
    border-color: var(--ek-button-primary-bg) !important;
    color: #ffffff !important;
}

/* Dzēšana tikai sarkanā krāsā */
button.danger,
a.danger,
.delete-button,
button[name*="delete"],
button[name*="dzest"],
button[name*="delete_section"],
button[name*="delete_question"] {
    background: var(--ek-button-danger-bg) !important;
    border-color: var(--ek-button-danger-bg) !important;
    color: #ffffff !important;
}

button.danger:hover,
a.danger:hover,
.delete-button:hover,
button[name*="delete"]:hover,
button[name*="dzest"]:hover,
button[name*="delete_section"]:hover,
button[name*="delete_question"]:hover {
    background: var(--ek-button-danger-hover) !important;
    border-color: var(--ek-button-danger-hover) !important;
    color: #ffffff !important;
}

/* Mazās pogas tabulās */
table button,
table .button,
table a.button,
table .primary-action {
    min-height: 31px;
    padding: 6px 10px;
    font-size: 13px;
}

/* Augšējā tumšā josla saglabā balto tekstu */
.admin-top-actions a,
.admin-settings-gear {
    background: rgba(255,255,255,0.08) !important;
    color: #ffffff !important;
    border-color: rgba(255,255,255,0.45) !important;
}

.admin-top-actions a:hover,
.admin-settings-gear:hover {
    background: rgba(255,255,255,0.18) !important;
    color: #ffffff !important;
}

/* Select un input nav pogas, bet vizuāli saskan */
select,
input[type="text"],
input[type="password"],
input[type="email"],
textarea {
    border-radius: 0;
}


/* V37.2 employees table layout fix */
.table-scroll {
    overflow-x: auto;
}

.employees-table {
    min-width: 940px;
}

.employees-table th,
.employees-table td {
    vertical-align: middle;
}

.employee-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.employee-link-cell {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 230px;
}

.employee-link-cell input {
    width: 100%;
    min-width: 125px;
}

.employee-inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 230px;
}

.employee-inline-form select {
    min-width: 122px;
}

.employee-password-form {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 210px;
}

.employee-password-form input[type="password"] {
    min-width: 125px;
}


/* V37.3 Darbinieki bez Last seen kolonnas */
.employees-table {
    min-width: 940px;
}


/* V37.4 kompaktāka Darbinieki tabula */
.employees-table {
    min-width: 940px;
    table-layout: fixed;
}

.employees-table th:nth-child(1),
.employees-table td:nth-child(1) {
    width: 38px;
}

.employees-table th:nth-child(2),
.employees-table td:nth-child(2) {
    width: 105px;
}

.employees-table th:nth-child(3),
.employees-table td:nth-child(3) {
    width: 110px;
}

.employees-table th:nth-child(4),
.employees-table td:nth-child(4) {
    width: 90px;
}

.employees-table th:nth-child(5),
.employees-table td:nth-child(5) {
    width: 245px;
}

.employees-table th:nth-child(6),
.employees-table td:nth-child(6) {
    width: 210px;
}

.employees-table th:nth-child(7),
.employees-table td:nth-child(7) {
    width: 95px;
}

.employees-table th:nth-child(8),
.employees-table td:nth-child(8) {
    width: 210px;
}

.employee-link-cell {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 0;
}

.employee-link-cell input {
    width: 150px;
    min-width: 150px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.employee-inline-form {
    min-width: 0;
}

.employee-inline-form select {
    width: 120px;
    min-width: 120px;
}

.employee-password-form {
    min-width: 0;
}

.employee-password-form input[type="password"] {
    width: 125px;
    min-width: 125px;
}

.employees-table td {
    overflow: hidden;
}

.employees-table .button,
.employees-table button {
    padding-left: 9px;
    padding-right: 9px;
}


/* V37.5 vienots tabulas darbību pogu stils
   Piemērs: Atvērt PDF / Labot / Atvērt Excel / Eksportēt.
   Tabulas darbību pogām jāizskatās vienādi.
*/
table td a.button,
table td a.primary-action,
table td button,
table td input[type="submit"],
table td input[type="button"],
.export-inline-form button {
    background: var(--ek-button-primary-bg) !important;
    border-color: var(--ek-button-primary-bg) !important;
    color: #ffffff !important;
    min-height: 31px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.1;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

table td a.button:hover,
table td a.primary-action:hover,
table td button:hover,
table td input[type="submit"]:hover,
table td input[type="button"]:hover,
.export-inline-form button:hover {
    background: var(--ek-button-primary-hover) !important;
    border-color: var(--ek-button-primary-hover) !important;
    color: #ffffff !important;
}

/* Select nav poga nav, bet darbību kolonnā pielīdzinām augstumu */
table td select,
.export-inline-form select {
    min-height: 31px;
    height: 31px;
    padding: 5px 8px;
    border: 1px solid var(--ek-button-border);
    background: #ffffff;
    font-size: 13px;
    box-sizing: border-box;
}

/* Darbību kolonnā atstarpes */
td .actions-inline,
.actions-inline,
.export-inline-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

/* Ja palicis vecs dekoratīvs atdalītājs |, tas lai nav redzams */
.action-separator,
.export-separator {
    display: none !important;
}


/* V37.6 Eksportēt poga ar izvēlni pēc klikšķa */
.export-menu-wrap {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.export-menu-button {
    background: var(--ek-button-primary-bg) !important;
    border-color: var(--ek-button-primary-bg) !important;
    color: #ffffff !important;
}

.export-menu-wrap .export-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 150px;
    background: #ffffff;
    border: 1px solid var(--ek-button-border);
    box-shadow: 0 6px 16px rgba(0,0,0,0.16);
    z-index: 50;
}

.export-menu-wrap.open .export-menu {
    display: block;
}

.export-menu a {
    display: block !important;
    padding: 9px 12px !important;
    min-height: auto !important;
    border: 0 !important;
    background: #ffffff !important;
    color: var(--primary-text) !important;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.export-menu a:hover {
    background: var(--ek-button-secondary-hover) !important;
    color: var(--primary-text) !important;
}

/* Rindā vairs nerādām formāta select, ja vecs HTML vēl palicis */
.export-inline-form select[name="format"] {
    display: none !important;
}


/* V37.7 noņem vecos darbību atdalītājus */
.action-separator,
.export-separator,
.separator-pipe {
    display: none !important;
}


/* V37.8 darbību pogu secība un Eksportēt dropdown labojums */
.actions-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.export-menu-wrap {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.export-menu-button {
    background: var(--ek-button-primary-bg) !important;
    border-color: var(--ek-button-primary-bg) !important;
    color: #ffffff !important;
}

.export-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 160px;
    background: #ffffff;
    border: 1px solid var(--ek-button-border);
    box-shadow: 0 6px 16px rgba(0,0,0,0.18);
    z-index: 9999;
}

.export-menu-wrap.open .export-menu {
    display: block;
}

.export-menu a {
    display: block !important;
    padding: 9px 12px !important;
    min-height: auto !important;
    border: 0 !important;
    background: #ffffff !important;
    color: var(--primary-text) !important;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.export-menu a:hover {
    background: var(--ek-button-secondary-hover) !important;
    color: var(--primary-text) !important;
}

/* Lai dropdown neapgriežas tabulas šūnā */
table td {
    overflow: visible;
}


/* V37.9 Darbības kolonna salabota */
.actions-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.export-menu-wrap {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.export-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 160px;
    background: #ffffff;
    border: 1px solid var(--ek-button-border);
    box-shadow: 0 6px 16px rgba(0,0,0,0.18);
    z-index: 9999;
}

.export-menu-wrap.open .export-menu {
    display: block;
}

.export-menu a {
    display: block !important;
    padding: 9px 12px !important;
    min-height: auto !important;
    border: 0 !important;
    background: #ffffff !important;
    color: var(--primary-text) !important;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.export-menu a:hover {
    background: var(--ek-button-secondary-hover) !important;
    color: var(--primary-text) !important;
}

table td {
    overflow: visible;
}


/* V41 database backup */
.backup-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.backup-actions form {
    margin: 0;
}


/* V41.1 Sistēma -> Backup poga */
.system-actions-panel {
    border-left: 5px solid #79b68d;
}

.system-actions-panel .button {
    display: inline-flex;
}


/* V44 API token notifier */
.employee-token-cell {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 210px;
}

.employee-token-cell input {
    width: 120px;
    min-width: 120px;
}

.employee-token-form {
    margin-top: 6px;
}

.employee-token-form button {
    font-size: 12px;
    min-height: 28px;
    padding: 5px 8px;
}


/* V45 API tokenu rezerve */
.employee-token-cell {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 210px;
}

.employee-token-cell input {
    width: 120px;
    min-width: 120px;
}

.employee-token-form {
    margin-top: 6px;
}

.employee-token-form button {
    font-size: 12px;
    min-height: 28px;
    padding: 5px 8px;
}


/* V46 statusa maiņa uz V45 tokenu versijas */
.status-inline-form {
    margin: 0;
}

.status-inline-form select {
    min-width: 110px;
    height: 31px;
    font-weight: 700;
}

.status-report-form {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.status-report-form select {
    min-width: 140px;
    height: 34px;
    font-weight: 700;
}

.status-report-panel {
    border-left: 5px solid #79b68d;
}


/* V47 vienkāršs statuss: Jauns / Izlasīts */
.status-inline-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid var(--ek-button-border);
    font-weight: 700;
    white-space: nowrap;
}

.status-new {
    background: #fff8e1;
    color: #5c4500;
}

.status-read {
    background: #e4eeeb;
    color: var(--primary-text);
}

.status-finish-button {
    min-height: 28px;
    padding: 5px 9px;
    font-size: 12px;
}

.status-report-form {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.status-report-panel {
    border-left: 5px solid #79b68d;
}


/* V47.4 Darbinieki tabulas izkārtojuma labojums */
.employees-table-wrap {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
}

.employees-table {
    min-width: 1180px;
    width: 100%;
    table-layout: fixed;
}

.employees-table th,
.employees-table td {
    vertical-align: middle;
    box-sizing: border-box;
}

/* Kolonnu platumi, lai parole vairs netiek nogriezta */
.employees-table th:nth-child(1),
.employees-table td:nth-child(1) { width: 42px; }

.employees-table th:nth-child(2),
.employees-table td:nth-child(2) { width: 120px; }

.employees-table th:nth-child(3),
.employees-table td:nth-child(3) { width: 125px; }

.employees-table th:nth-child(4),
.employees-table td:nth-child(4) { width: 100px; }

.employees-table th:nth-child(5),
.employees-table td:nth-child(5) { width: 270px; }

.employees-table th:nth-child(6),
.employees-table td:nth-child(6) { width: 235px; }

.employees-table th:nth-child(7),
.employees-table td:nth-child(7) { width: 105px; }

.employees-table th:nth-child(8),
.employees-table td:nth-child(8) { width: 235px; }

.employees-table th:nth-child(9),
.employees-table td:nth-child(9) { width: 230px; }

.employee-link-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

.employee-link-cell input {
    width: 165px !important;
    max-width: 165px !important;
}

.employee-inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.employee-inline-form select {
    width: 135px;
    min-width: 135px;
}

.employee-token-cell {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.employee-token-cell input {
    width: 135px !important;
    max-width: 135px !important;
}

.employee-token-form {
    margin-top: 6px;
}

.employee-password-form {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    min-width: 210px;
}

.employee-password-form input[name="new_password"] {
    width: 135px !important;
    max-width: 135px !important;
}

.employee-password-form button {
    white-space: nowrap;
}

/* Lai mazākos ekrānos parole tomēr ir aizsniedzama ar horizontālo scroll */
@media (max-width: 1300px) {
    .employees-table-wrap {
        border: 1px solid var(--group-border);
        background: #ffffff;
    }
}


/* V47.5 Pievienot jaunu sadaļu */
.add-section-panel {
    border-left: 5px solid #79b68d;
}

.add-section-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.add-section-form label {
    display: block;
    font-weight: 700;
}

.add-section-form input[type="text"] {
    width: 100%;
    margin-top: 5px;
}

@media (max-width: 900px) {
    .add-section-form {
        grid-template-columns: 1fr;
    }
}


/* V47.6 Sadaļu secība un PVN loģika */
.section-order-panel,
.vat-logic-panel {
    border-left: 5px solid #79b68d;
}

.section-order-input {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--secondary-text);
}

.section-order-input input[type="number"] {
    width: 70px;
    min-width: 70px;
    height: 28px;
    padding: 3px 6px;
}

#sectionOrderForm > button[type="submit"] {
    margin-bottom: 12px;
}


/* V48 clean VAT */
.vat-logic-panel {
    border-left: 5px solid #79b68d;
}


/* V48.2 PVN numura slēpšanas wrapper */
.vat-number-auto-wrapper {
    display: block;
}

.vat-number-auto-label {
    font-weight: 700;
    margin-bottom: 4px;
}


/* V48.3 Conditional field visibility */
.question-wrap.conditional {
    display: none;
}

.question-wrap.conditional.visible {
    display: block;
}


/* V49 KYC jautājumi */
.kyc-info-panel { border-left: 5px solid #79b68d; }


/* V50 vienots admin lapu izkārtojums */
html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: #eef5f3;
}

/*
 * Galvenais admin lapu platums.
 * Mērķis: Sākums, Formas, Online, Klientu aptaujas forma, Darbinieki un Sistēma izskatās vienādi.
 */
.page,
.container,
.admin-container,
.main-container,
.layout,
.wrapper,
.content-wrapper {
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
}

/*
 * Ja lapa neizmanto speciālu wrapperi, galvenos tiešos blokus turam vienā platumā.
 */
body > header,
body > nav,
body > main,
body > .panel,
body > .card,
body > .admin-header,
body > .topbar,
body > .navbar {
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
}

/*
 * Kopējais header/navbar izskats.
 */
.admin-header,
.topbar,
.header,
.site-header {
    box-sizing: border-box;
    width: 100%;
}

.admin-header,
.topbar {
    margin-top: 14px;
}

/*
 * Navigācijas bloks vienāds visās lapās.
 */
nav,
.nav,
.navbar,
.admin-nav {
    box-sizing: border-box;
}

/*
 * Satura paneļi vienādā platumā un stilā.
 */
.panel,
.card,
.box,
.content-panel {
    box-sizing: border-box;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/*
 * Samazina situāciju, kur viena lapa pieliek ārējo borderi un cita neliek.
 */
body > .panel,
body > .card,
body > main > .panel,
body > main > .card {
    margin-top: 14px;
}

/*
 * Tabulas lai neizstumj layout ārā.
 */
table {
    max-width: 100%;
}

.table-wrap,
.employees-table-wrap {
    max-width: 100%;
}

/*
 * Header logo un pogu zona vienāda.
 */
.admin-header img,
.topbar img,
.header img,
.site-header img {
    max-height: 72px;
}

/*
 * Ja kādai lapai ir pārāk liela kreisā atkāpe, piespiežam vienotu.
 */
main,
.main,
.content {
    box-sizing: border-box;
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
}

/*
 * Mazākiem ekrāniem: vienāda iekšējā atkāpe.
 */
@media (max-width: 1180px) {
    .page,
    .container,
    .admin-container,
    .main-container,
    .layout,
    .wrapper,
    .content-wrapper,
    body > header,
    body > nav,
    body > main,
    body > .panel,
    body > .card,
    body > .admin-header,
    body > .topbar,
    body > .navbar,
    main,
    .main,
    .content {
        max-width: calc(100% - 28px);
    }
}


/* V50.1 augša/apakša vienādā platumā */
:root {
    --ek-admin-width: 1120px;
    --ek-admin-side-gap: 16px;
}

/*
 * Viss admin karkass vienā platumā:
 * logo josla, navigācija un visi satura paneļi.
 */
.admin-header,
.topbar,
.header,
.site-header,
nav,
.nav,
.navbar,
.admin-nav,
main,
.main,
.content,
.page,
.container,
.admin-container,
.main-container,
.layout,
.wrapper,
.content-wrapper,
body > .panel,
body > .card,
body > main,
body > header,
body > nav {
    max-width: var(--ek-admin-width) !important;
    width: calc(100% - (var(--ek-admin-side-gap) * 2)) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/*
 * Ja headeris sastāv no 2 daļām — tumšā logo josla un baltā izvēlne —
 * abām jābūt vienādā platumā.
 */
.admin-header,
.topbar,
.header,
.site-header {
    overflow: hidden;
}

/*
 * Satura paneļi zem izvēlnes nedrīkst būt platāki/šaurāki par augšējo joslu.
 */
.panel,
.card,
.box,
.content-panel {
    max-width: var(--ek-admin-width) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/*
 * Noņem gadījumus, kur sākuma lapa ieliek papildu ārējo rāmi/malu,
 * bet citas lapas to neliek.
 */
body > .panel:first-of-type,
body > main > .panel:first-of-type,
main > .panel:first-child,
.content > .panel:first-child {
    margin-top: 14px !important;
}

/*
 * Vienādas kreisās/labās iekšējās atstarpes paneļiem.
 */
.panel,
.card,
.box {
    padding-left: 16px;
    padding-right: 16px;
}

/*
 * Tabulas un platie elementi neizstiepj apakšējo daļu ārpus header platuma.
 */
table,
.table-wrap,
.employees-table-wrap {
    max-width: 100% !important;
}

/*
 * Mazākiem ekrāniem saglabā vienādas malas.
 */
@media (max-width: 1180px) {
    :root {
        --ek-admin-side-gap: 14px;
    }

    .admin-header,
    .topbar,
    .header,
    .site-header,
    nav,
    .nav,
    .navbar,
    .admin-nav,
    main,
    .main,
    .content,
    .page,
    .container,
    .admin-container,
    .main-container,
    .layout,
    .wrapper,
    .content-wrapper,
    body > .panel,
    body > .card,
    body > main,
    body > header,
    body > nav {
        width: calc(100% - 28px) !important;
    }
}


/* V50.2 STRICT — augša un apakša identiski vienā platumā */
:root {
    --ek-shell-width: 1120px;
    --ek-shell-gap: 16px;
}

/*
 * Galvenais princips:
 * Katrs tiešais lapas bloks, kas ir redzams kā header/nav/saturs,
 * tiek nolikts vienā un tajā pašā platumā.
 */
body {
    background: #eef5f3 !important;
}

body > * {
    box-sizing: border-box;
}

/*
 * Piespiežam galvenos vizuālos blokus vienā līnijā.
 * Šis ir stingrāks par iepriekšējo variantu.
 */
body > header,
body > nav,
body > main,
body > .header,
body > .topbar,
body > .admin-header,
body > .site-header,
body > .navbar,
body > .nav,
body > .admin-nav,
body > .page,
body > .container,
body > .admin-container,
body > .main-container,
body > .wrapper,
body > .layout,
body > .content,
body > .main,
body > .panel,
body > .card {
    width: min(var(--ek-shell-width), calc(100vw - (var(--ek-shell-gap) * 2))) !important;
    max-width: var(--ek-shell-width) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/*
 * Ja headeris ir iekšā kā .container vai .page bērns, arī to nepārsniedzam.
 */
.header,
.topbar,
.admin-header,
.site-header,
.navbar,
.nav,
.admin-nav,
main,
.main,
.content,
.page,
.container,
.admin-container,
.main-container,
.wrapper,
.layout {
    box-sizing: border-box !important;
}

/*
 * Tumšā josla un baltā navigācija:
 * tām jābūt tieši vienāda platuma.
 */
.header,
.topbar,
.admin-header,
.site-header {
    width: min(var(--ek-shell-width), calc(100vw - (var(--ek-shell-gap) * 2))) !important;
    max-width: var(--ek-shell-width) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.nav,
.navbar,
.admin-nav,
nav {
    width: min(var(--ek-shell-width), calc(100vw - (var(--ek-shell-gap) * 2))) !important;
    max-width: var(--ek-shell-width) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/*
 * Satura paneļiem zemāk ir jābeidzas tieši turpat, kur headerim.
 */
.panel,
.card,
.box,
.content-panel {
    box-sizing: border-box !important;
    max-width: 100% !important;
}

/*
 * Bet, ja panelis ir tiešais body bērns, tam jāiet tajā pašā shell platumā.
 */
body > .panel,
body > .card,
body > main,
body > .content,
body > .main {
    width: min(var(--ek-shell-width), calc(100vw - (var(--ek-shell-gap) * 2))) !important;
    max-width: var(--ek-shell-width) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/*
 * Dažās lapās pirmais panelis satur arī headeri un rada dubultu malu.
 * Normalizējam iekšējo attālumu.
 */
body > .panel:first-child,
body > .card:first-child,
body > .container:first-child,
body > .page:first-child,
body > .admin-container:first-child {
    padding-left: 14px !important;
    padding-right: 14px !important;
}

/*
 * Ja sākuma lapa izmanto iekšēju rāmi ap headeri, neļaujam tam padarīt headeri šaurāku.
 */
body > .panel:first-child .header,
body > .panel:first-child .topbar,
body > .panel:first-child .admin-header,
body > .panel:first-child .site-header,
body > .container:first-child .header,
body > .container:first-child .topbar,
body > .container:first-child .admin-header,
body > .container:first-child .site-header {
    width: 100% !important;
    max-width: none !important;
}

/*
 * Tabulas nepārrauj layout.
 */
table,
.table-wrap,
.employees-table-wrap {
    max-width: 100% !important;
}

/*
 * Precīzāks vienādojums biežākajiem admin header/navigācijas gadījumiem.
 */
.admin-header + nav,
.admin-header + .nav,
.admin-header + .navbar,
.topbar + nav,
.topbar + .nav,
.topbar + .navbar,
.header + nav,
.header + .nav,
.header + .navbar {
    width: min(var(--ek-shell-width), calc(100vw - (var(--ek-shell-gap) * 2))) !important;
    max-width: var(--ek-shell-width) !important;
}

/*
 * Mazākos ekrānos saglabā vienādas malas.
 */
@media (max-width: 1180px) {
    :root {
        --ek-shell-gap: 14px;
    }
}


/* V50.3 precīzs header/nav platuma labojums */

/*
 * Šis labojums mērķē uz problēmu, kur Sākums lapā tumšā logo josla bija
 * šaurāka nekā baltā navigācija un saturs.
 *
 * Risinājums:
 * - ārējais lapas apvalks paliek 1120px;
 * - ja headeris ir iekšā panelī/konteinerī ar padding, tumšajai joslai dodam
 *   negatīvas malas, lai tā aiziet līdz tā paša paneļa ārējai malai;
 * - navigācija un saturs paliek tajā pašā ārējā platumā.
 */

:root {
    --ek-shell-width-final: 1120px;
    --ek-shell-gap-final: 16px;
    --ek-inner-pad-final: 14px;
}

/* Galvenie ārējie bloki vienā platumā */
body > header,
body > nav,
body > main,
body > .page,
body > .container,
body > .admin-container,
body > .main-container,
body > .wrapper,
body > .layout,
body > .content,
body > .main,
body > .panel,
body > .card {
    width: min(var(--ek-shell-width-final), calc(100vw - (var(--ek-shell-gap-final) * 2))) !important;
    max-width: var(--ek-shell-width-final) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/*
 * Tumšā josla, ja tā ir tiešā body līmenī.
 */
body > .admin-header,
body > .topbar,
body > .header,
body > .site-header {
    width: min(var(--ek-shell-width-final), calc(100vw - (var(--ek-shell-gap-final) * 2))) !important;
    max-width: var(--ek-shell-width-final) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/*
 * Tumšā josla, ja tā ir ievietota iekšā panelī/konteinerī.
 * Šis ir tas, kas izlabo Sākums lapas sašaurināto headeri.
 */
.panel > .admin-header,
.panel > .topbar,
.panel > .header,
.panel > .site-header,
.card > .admin-header,
.card > .topbar,
.card > .header,
.card > .site-header,
.container > .admin-header,
.container > .topbar,
.container > .header,
.container > .site-header,
.page > .admin-header,
.page > .topbar,
.page > .header,
.page > .site-header,
.admin-container > .admin-header,
.admin-container > .topbar,
.admin-container > .header,
.admin-container > .site-header,
.main-container > .admin-header,
.main-container > .topbar,
.main-container > .header,
.main-container > .site-header {
    width: calc(100% + (var(--ek-inner-pad-final) * 2)) !important;
    max-width: none !important;
    margin-left: calc(var(--ek-inner-pad-final) * -1) !important;
    margin-right: calc(var(--ek-inner-pad-final) * -1) !important;
    box-sizing: border-box !important;
}

/*
 * Navigācija zem headera tāpat aiziet līdz ārējai malai.
 */
.panel > nav,
.panel > .nav,
.panel > .navbar,
.panel > .admin-nav,
.card > nav,
.card > .nav,
.card > .navbar,
.card > .admin-nav,
.container > nav,
.container > .nav,
.container > .navbar,
.container > .admin-nav,
.page > nav,
.page > .nav,
.page > .navbar,
.page > .admin-nav,
.admin-container > nav,
.admin-container > .nav,
.admin-container > .navbar,
.admin-container > .admin-nav,
.main-container > nav,
.main-container > .nav,
.main-container > .navbar,
.main-container > .admin-nav {
    width: calc(100% + (var(--ek-inner-pad-final) * 2)) !important;
    max-width: none !important;
    margin-left: calc(var(--ek-inner-pad-final) * -1) !important;
    margin-right: calc(var(--ek-inner-pad-final) * -1) !important;
    box-sizing: border-box !important;
}

/*
 * Ja tumšajai joslai pašai ir iekšējā maliņa, saglabājam saturu iekšā.
 */
.admin-header,
.topbar,
.header,
.site-header {
    overflow: hidden !important;
}

/*
 * Satura paneļi neizstumjas ārpus tā paša platuma.
 */
.panel,
.card,
.box,
.content-panel {
    box-sizing: border-box !important;
}

/*
 * Ātrās saites un līdzīgi divu kolonnu bloki nedrīkst pārbīdīt platumu.
 */
.quick-links,
.quick-grid,
.cards-grid,
.grid,
.table-wrap,
.employees-table-wrap {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/*
 * Ja konkrēts sākuma panelis ir ar iekšējo paddingu, tas nedrīkst
 * mainīt header/nav ārējās malas.
 */
body > .panel:first-child,
body > .container:first-child,
body > .page:first-child,
body > .admin-container:first-child,
body > .main-container:first-child {
    padding-left: var(--ek-inner-pad-final) !important;
    padding-right: var(--ek-inner-pad-final) !important;
}

/*
 * Mazākiem ekrāniem.
 */
@media (max-width: 1180px) {
    :root {
        --ek-shell-gap-final: 14px;
        --ek-inner-pad-final: 14px;
    }
}


/* V50.4 STRUKTURĀLS ADMIN HEADER LABOJUMS */

/*
 * Šajā versijā headeris PHP struktūrā ir izcelts ārpus .panel.
 * Tāpēc vairs nevajag negatīvo marginu trikus no iepriekšējiem ielāpiem.
 */
:root {
    --ek-admin-shell-width: 1120px;
    --ek-admin-shell-gap: 16px;
}

body {
    background: #eef5f3 !important;
}

/* Galvenais lapas apvalks */
.page {
    width: min(var(--ek-admin-shell-width), calc(100vw - (var(--ek-admin-shell-gap) * 2))) !important;
    max-width: var(--ek-admin-shell-width) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/* Header + navigācija vienā platumā */
.admin-shell {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 14px 0 !important;
    box-sizing: border-box !important;
}

/* Tumšā logo josla */
.admin-topbar {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* Baltā navigācija zem logo joslas */
.admin-nav {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* Satura paneļi zem headera */
.page > .panel,
.page > .card,
.page > main,
.page > .content,
.page > .main {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

/*
 * Neitralizē iepriekšējos V50.3 negatīvo malu noteikumus, ja tie paliek CSS failā.
 * Headeris vairs nav panelī, tāpēc šie noteikumi nedrīkst darboties.
 */
.panel > .admin-header,
.panel > .topbar,
.panel > .header,
.panel > .site-header,
.panel > .admin-topbar,
.panel > nav,
.panel > .nav,
.panel > .navbar,
.panel > .admin-nav,
.card > .admin-header,
.card > .topbar,
.card > .header,
.card > .site-header,
.card > .admin-topbar,
.card > nav,
.card > .nav,
.card > .navbar,
.card > .admin-nav,
.container > .admin-header,
.container > .topbar,
.container > .header,
.container > .site-header,
.container > .admin-topbar,
.container > nav,
.container > .nav,
.container > .navbar,
.container > .admin-nav {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Attēli un tabulas neizstumj platumu */
img,
table,
.table-wrap,
.employees-table-wrap {
    max-width: 100% !important;
}

@media (max-width: 1180px) {
    :root {
        --ek-admin-shell-gap: 14px;
    }
}


/* V50.5 scrollbar/nobīdes labojums */

/*
 * Kļūdas iemesls:
 * Daļā lapu saturs ir garāks un parādās vertikālais scrollbars.
 * Ja platums tiek rēķināts ar 100vw, scrollbars tiek ieskaitīts platumā
 * un lapas karkass var vizuāli nobīdīties.
 *
 * Labojums:
 * - vienmēr rezervējam vertikālo scrollbar vietu;
 * - nelietojam 100vw admin karkasam;
 * - lietojam 100%, kas neieskaita scrollbar platumu.
 */

html {
    overflow-y: scroll !important;
}

body {
    margin: 0 !important;
    padding: 0 !important;
    background: #eef5f3 !important;
}

:root {
    --ek-final-width: 1120px;
    --ek-final-gap: 16px;
}

/*
 * Viens vienots lapas karkass visām admin lapām.
 * Lietojam 100%, nevis 100vw.
 */
.page {
    width: calc(100% - (var(--ek-final-gap) * 2)) !important;
    max-width: var(--ek-final-width) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/*
 * Header + navigācija + satura paneļi paliek tieši .page platumā.
 */
.page > .admin-shell,
.page > .panel,
.page > .card,
.page > main,
.page > .content,
.page > .main {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

/*
 * Admin headera iekšējie elementi nedrīkst ietekmēt ārējo platumu.
 */
.admin-shell,
.admin-topbar,
.admin-nav {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

/*
 * Neitralizē visus iepriekšējos 100vw/min(100vw...) override efektus
 * tieši galvenajām admin klasēm.
 */
body > .page,
body > .container,
body > .admin-container,
body > .main-container,
body > .wrapper,
body > .layout,
body > .content,
body > .main,
body > header,
body > nav,
body > main,
body > .panel,
body > .card {
    width: calc(100% - (var(--ek-final-gap) * 2)) !important;
    max-width: var(--ek-final-width) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/*
 * Ja header/nav kādreiz ir iekšā panelī, tas joprojām paliek 100% no vecāka.
 */
.panel > .admin-shell,
.panel > .admin-topbar,
.panel > .admin-nav,
.container > .admin-shell,
.container > .admin-topbar,
.container > .admin-nav,
.page > .admin-shell,
.page > .admin-topbar,
.page > .admin-nav {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/*
 * Tabulas un platie elementi nedrīkst izstumt lapu sāniski.
 */
table,
.table-wrap,
.employees-table-wrap,
.quick-links,
.quick-grid,
.cards-grid,
.grid {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/*
 * Mazākiem ekrāniem.
 */
@media (max-width: 1180px) {
    :root {
        --ek-final-gap: 14px;
    }
}


/* V50.6 Darbinieki — iestatījumi otrajā rindā */
.employees-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: auto !important;
}

.employees-table th:nth-child(1),
.employees-table td:nth-child(1) {
    width: 45px;
}

.employees-table th:nth-child(2),
.employees-table td:nth-child(2) {
    width: 140px;
}

.employees-table th:nth-child(3),
.employees-table td:nth-child(3) {
    width: 150px;
}

.employees-table th:nth-child(4),
.employees-table td:nth-child(4) {
    width: 110px;
}

.employees-table th:nth-child(5),
.employees-table td:nth-child(5) {
    width: 280px;
}

.employees-table th:nth-child(6),
.employees-table td:nth-child(6) {
    width: 250px;
}

.employees-table th:nth-child(7),
.employees-table td:nth-child(7) {
    width: 120px;
}

.employee-settings-row td {
    background: #f7fbfa !important;
    border-top: 0 !important;
    padding: 10px 12px !important;
}

.employee-settings-grid {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(280px, 420px);
    gap: 14px;
    align-items: start;
}

.employee-settings-box {
    border-left: 4px solid #79b68d;
    background: #ffffff;
    padding: 10px 12px;
    box-sizing: border-box;
}

.employee-settings-title {
    font-weight: 700;
    margin-bottom: 8px;
}

.employee-token-cell,
.employee-password-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.employee-token-cell input {
    width: 260px !important;
    max-width: 100% !important;
}

.employee-password-form input[name="new_password"] {
    width: 240px !important;
    max-width: 100% !important;
}

.employee-token-form {
    margin-top: 8px;
}

.employee-link-cell input {
    width: 180px !important;
    max-width: 180px !important;
}

.employee-inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.employee-inline-form select {
    width: 150px;
    min-width: 150px;
}

.employee-inline-form button,
.employee-token-cell button,
.employee-token-form button,
.employee-password-form button {
    white-space: nowrap;
}

@media (max-width: 900px) {
    .employee-settings-grid {
        grid-template-columns: 1fr;
    }

    .employee-token-cell input,
    .employee-password-form input[name="new_password"] {
        width: 100% !important;
    }
}


/* V51 pilnvarotais parakstītājs */
.authorized-signer-info-panel {
    border-left: 5px solid #79b68d;
}

/* V52 employee email/admin notification fields */
.checkbox-label{display:inline-flex;align-items:center;gap:6px;margin:4px 0;}
.employee-inline-form input[type=email]{min-width:190px;}
