.not-set {
    color: #c55;
    font-style: italic;
}

/* add sorting icons to gridview sort links */
a.asc:after, a.desc:after {
    position: relative;
    top: 1px;
    display: inline-block;
    font-family: 'Glyphicons Halflings';
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    padding-left: 5px;
}

a.asc:after {
    content: "\e151";
}

a.desc:after {
    content: "\e152";
}

.sort-numerical a.asc:after {
    content: "\e153";
}

.sort-numerical a.desc:after {
    content: "\e154";
}

.sort-ordinal a.asc:after {
    content: "\e155";
}

.sort-ordinal a.desc:after {
    content: "\e156";
}

.grid-view td {
    white-space: nowrap;
}

.grid-view .filters input,
.grid-view .filters select {
    min-width: 50px;
}

.hint-block {
    display: block;
    margin-top: 5px;
    color: #999;
}

.error-summary {
    color: #a94442;
    background: #fdf7f7;
    border-left: 3px solid #eed3d7;
    padding: 10px 20px;
    margin: 0 0 15px 0;
}

/* align the logout "link" (button in form) of the navbar */
.nav > li > form {
    padding: 8px;
}

.nav > li > form > button:hover {
    text-decoration: none;
}

:root {
    --mayak-ink: #102238;
    --mayak-muted: #4d6075;
    --mayak-canvas: #eff4f8;
    --mayak-paper: #fff;
    --mayak-line: #d6e0e9;
    --mayak-navy: #0b2035;
    --mayak-accent: #096b60;
    --mayak-accent-dark: #07574f;
    --mayak-focus: #087d71;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--mayak-ink);
    background: var(--mayak-canvas);
    font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a {
    color: var(--mayak-accent-dark);
}

a:focus-visible,
button:focus-visible,
input[type="checkbox"]:focus-visible {
    outline: 3px solid var(--mayak-focus);
    outline-offset: 3px;
}

h1, h2, h3 {
    letter-spacing: -.025em;
}

.form-control {
    min-height: 38px;
    border-color: #b8c8d6;
    border-radius: 8px;
    color: var(--mayak-ink);
    box-shadow: none;
}

.form-control:focus {
    border-color: var(--mayak-focus);
    box-shadow: 0 0 0 3px rgba(8, 125, 113, .16);
}

.btn {
    border-radius: 8px;
    font-weight: 600;
}

.btn-primary,
.btn-success {
    border-color: var(--mayak-accent);
    background: var(--mayak-accent);
    color: #fff;
}

.btn-primary:hover, .btn-primary:focus,
.btn-success:hover, .btn-success:focus {
    border-color: var(--mayak-accent-dark);
    background: var(--mayak-accent-dark);
    color: #fff;
}

.login-page {
    background: radial-gradient(ellipse at 12% 10%, #dae9ec 0, transparent 42%), var(--mayak-canvas);
}

.login-main {
    display: grid;
    align-content: center;
    justify-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 28px 20px;
}

.login-main > .alert {
    width: min(100%, 880px);
}

.login-card {
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    width: min(100%, 880px);
    overflow: hidden;
    border: 1px solid var(--mayak-line);
    border-radius: 24px;
    background: var(--mayak-paper);
    box-shadow: 0 28px 65px rgba(16, 34, 56, .13);
}

.login-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: clamp(30px, 5vw, 64px);
    color: #fff;
    background:
        radial-gradient(ellipse at bottom right, rgba(57, 218, 189, .23), transparent 66%),
        linear-gradient(140deg, #0b2035 16%, #104744 100%);
}

.login-logo {
    display: block;
    width: 80px;
    height: auto;
    margin: 0 0 24px;
}

.login-brand-title {
    font-size: clamp(38px, 6vw, 64px);
    font-weight: 800;
    letter-spacing: -.07em;
    line-height: 1.05;
}

.login-brand p {
    max-width: 26ch;
    margin: 14px 0 0;
    color: #d8efed;
    font-size: 16px;
}

.login-content {
    min-width: 0;
    padding: clamp(26px, 5vw, 60px);
}

.login-content h1 {
    margin: 0 0 24px;
    font-size: clamp(26px, 4vw, 36px);
    font-weight: 750;
    line-height: 1.15;
}

.login-content .control-label {
    margin-bottom: 6px;
}

.login-content .form-control {
    height: 46px;
    font-size: 16px;
}

.login-content .checkbox {
    margin: 4px 0 8px;
}

.login-content input[type="checkbox"] {
    accent-color: var(--mayak-accent);
}

.login-submit {
    width: 100%;
    min-height: 46px;
    font-size: 16px;
}

.workspace-page {
    display: flex;
    flex-direction: column;
}

.workspace-page .wrap {
    flex: 1;
    min-width: 0;
}

.workspace-page .container {
    width: 100%;
    max-width: 1536px;
    padding-right: clamp(16px, 3vw, 46px);
    padding-left: clamp(16px, 3vw, 46px);
}

.workspace-nav {
    background: var(--mayak-navy);
}

.workspace-header,
.workspace-links {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 20px);
}

.workspace-header {
    min-height: 62px;
    justify-content: space-between;
}

.workspace-header::before,
.workspace-header::after {
    display: none;
}

.workspace-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 750;
}

.workspace-logo {
    width: auto;
    height: 24px;
}

.workspace-nav a {
    color: #fff;
}

.workspace-links a {
    padding: 7px 10px;
    border-radius: 7px;
}

.workspace-links a:hover,
.workspace-links a[aria-current="page"] {
    background: #153650;
    text-decoration: none;
}

.workspace-nav a:focus-visible {
    outline-color: #8be8db;
}

.dashboard {
    padding-bottom: 12px;
}

.dashboard h1 {
    margin: 4px 0 26px;
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 750;
}

.dashboard-section {
    margin-bottom: 28px;
}

.dashboard-section h2 {
    margin: 0 0 12px;
    font-size: 19px;
    font-weight: 700;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dashboard-link {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    height: 100%;
    min-height: 66px;
    padding: 12px;
    border: 1px solid var(--mayak-line);
    border-radius: 12px;
    background: var(--mayak-paper);
    color: var(--mayak-ink);
    font-weight: 650;
}

.dashboard-link:hover,
.dashboard-link:focus-visible {
    border-color: var(--mayak-accent);
    color: var(--mayak-accent-dark);
    text-decoration: none;
}

.dashboard-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 8px;
    background: #e3efef;
    color: var(--mayak-accent-dark);
}

.dashboard-arrow {
    color: var(--mayak-accent-dark);
}

.workspace-main {
    padding-top: 24px;
    padding-bottom: 40px;
}

.workspace-main > :not(.breadcrumb) h1 {
    font-weight: 750;
}

.workspace-main .breadcrumb {
    margin: 0 0 16px;
    padding: 0;
    background: transparent;
    color: var(--mayak-muted);
    font-size: 13px;
}

.workspace-main .grid-view .panel,
.workspace-main .panel.kv-grid-panel {
    border-color: var(--mayak-line);
    border-radius: 12px;
    background: var(--mayak-paper);
    box-shadow: 0 4px 18px rgba(16, 34, 56, .07);
}

.workspace-main .kv-grid-panel > .panel-heading,
.workspace-main .grid-view .panel-heading {
    padding: 14px 16px;
    border-color: var(--mayak-line);
    border-radius: 11px 11px 0 0;
    background: #e3efef;
    color: #174641;
}

.workspace-main .panel-title {
    font-weight: 700;
}

.workspace-main .kv-panel-before,
.workspace-main .kv-panel-after {
    padding: 12px 16px;
    border-color: var(--mayak-line);
}

.workspace-main .kv-grid-container,
.workspace-main .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

.workspace-main .grid-view th {
    background: #f3f7fa;
    color: #20374e;
}

.workspace-main .grid-view td,
.workspace-main .grid-view th {
    padding: 9px 11px;
    border-color: var(--mayak-line);
    vertical-align: middle;
}

.workspace-main .grid-view .filters .form-control {
    min-width: 68px;
    min-height: 34px;
    padding: 5px 7px;
}

.workspace-main .grid-view .summary {
    color: var(--mayak-muted);
}

.workspace-page .footer {
    padding: 16px 0;
    border-top: 1px solid var(--mayak-line);
    background: #e8eff5;
    color: var(--mayak-muted);
    font-size: 13px;
}

@media (max-width: 767px) {
    .workspace-main {
        padding-top: 16px;
    }

    .workspace-main .kv-panel-before > .pull-right {
        float: none !important;
        margin-bottom: 8px;
    }
}

@media (max-width: 620px) {
    .login-card {
        grid-template-columns: 1fr;
        border-radius: 18px;
    }

    .login-brand {
        padding: 24px 26px;
    }

    .login-logo {
        width: 60px;
        margin-bottom: 12px;
    }

    .login-brand p {
        max-width: none;
        margin-top: 8px;
        font-size: 14px;
    }
}

.object-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    border: 1px solid var(--mayak-line);
    border-radius: 12px;
    background: var(--mayak-paper);
}

.object-menu a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 5px 10px;
    border-radius: 7px;
    color: var(--mayak-accent-dark);
    font-size: 14px;
    font-weight: 600;
}

.object-menu a:hover,
.object-menu a[aria-current="page"] {
    background: #e3efef;
    text-decoration: none;
}

.workspace-main:has(.editor-card) {
    max-width: 1080px;
}

.object-menu-sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-self: start;
    gap: 12px;
}

.object-menu-sidebar .object-menu-home {
    grid-column: 1 / -1;
    border-bottom: 1px solid var(--mayak-line);
    border-radius: 0;
}

.object-menu-group {
    min-width: 0;
}

.object-menu-group h2 {
    margin: 0 10px 4px;
    color: var(--mayak-muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
}

.object-menu-group a {
    display: flex;
    overflow-wrap: anywhere;
}

@media (min-width: 1200px) {
    .workspace-main:has(> .object-menu-sidebar):has(.editor-card) {
        display: grid;
        grid-template-columns: minmax(205px, 235px) minmax(0, 1fr);
        gap: 16px 24px;
        max-width: 1320px;
    }

    .workspace-main:has(> .object-menu-sidebar):has(.editor-card)::before,
    .workspace-main:has(> .object-menu-sidebar):has(.editor-card)::after {
        display: none;
    }

    .workspace-main:has(> .object-menu-sidebar):has(.editor-card) > :not(.object-menu-sidebar) {
        grid-column: 2;
        min-width: 0;
    }

    .workspace-main:has(> .object-menu-sidebar):has(.editor-card) > :is(.breadcrumb, .alert) {
        grid-column: 1 / -1;
        margin-bottom: 0;
    }

    .workspace-main > .object-menu-sidebar {
        grid-column: 1;
        grid-template-columns: minmax(0, 1fr);
        margin-bottom: 0;
    }
}

.editor-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.editor-heading h1 {
    margin: 0;
}

.editor-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.editor-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    background: #dfefec;
    color: #174641;
}

.editor-summary strong {
    font-size: 19px;
    white-space: nowrap;
}

.editor-card {
    margin-top: 16px;
    padding: clamp(16px, 3vw, 30px);
    border: 1px solid var(--mayak-line);
    border-radius: 16px;
    background: var(--mayak-paper);
    box-shadow: 0 4px 18px rgba(16, 34, 56, .07);
}

.editor-card > form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
    margin: 0;
}

.editor-card > form > * {
    grid-column: 1 / -1;
    min-width: 0;
}

.editor-card > form > .form-group[class*="field-"] {
    grid-column: auto;
    margin: 0;
}

.editor-card > form > .form-group:has(textarea, input[type="file"]) {
    grid-column: 1 / -1;
}

.editor-card > form > #options:not(:empty) {
    padding: 12px 16px;
    border: 1px solid var(--mayak-line);
    border-radius: 10px;
    background: var(--mayak-canvas);
}

.editor-card > form > #options:empty {
    display: none;
}

.editor-card label.control-label {
    display: inline-block;
    margin-bottom: 5px;
}

.editor-card .form-control,
.editor-card .bootstrap-select > .dropdown-toggle {
    min-height: 42px;
}

.editor-card .bootstrap-select,
.editor-card .twitter-typeahead {
    width: 100%;
    max-width: 100%;
}

.editor-card .help-block {
    margin-bottom: 0;
}

.editor-card .help-block:empty {
    display: none;
}

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
    padding-top: 16px;
    border-top: 1px solid var(--mayak-line);
}

.editor-actions .btn {
    min-width: 110px;
    min-height: 42px;
}

@media (max-width: 620px) {
    .editor-card > form {
        grid-template-columns: minmax(0, 1fr);
    }

    .editor-card .form-control,
    .editor-card .bootstrap-select > .dropdown-toggle {
        font-size: 16px;
    }

    .editor-actions .btn {
        width: 100%;
    }
}

.workspace-shell > .workspace-main {
    min-width: 0;
    width: 100%;
    margin-inline: auto;
}

.workspace-shell > .workspace-function-menu {
    margin-top: 24px;
}

.workspace-function-title {
    grid-column: 1 / -1;
    margin: 0;
    padding: 4px 10px 10px;
    border-bottom: 1px solid var(--mayak-line);
    font-size: 17px;
    font-weight: 750;
}

.workspace-function-menu .object-menu-group h3 {
    margin: 0 10px 4px;
    color: var(--mayak-muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
}

@media (min-width: 900px) {
    .workspace-shell {
        display: grid;
        grid-template-columns: minmax(185px, 210px) minmax(0, 1fr);
        gap: 20px;
        align-items: start;
    }

    .workspace-shell::before,
    .workspace-shell::after {
        display: none;
    }

    .workspace-shell > .workspace-function-menu {
        grid-template-columns: minmax(0, 1fr);
    }
}

.object-profile {
    display: grid;
    gap: 18px;
}

.object-profile-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 20px;
    padding: clamp(18px, 3vw, 32px);
    border-radius: 14px;
    background: var(--mayak-navy);
    color: #fff;
}

.object-profile-header h1 {
    margin: 0;
    font-size: clamp(25px, 4vw, 36px);
    overflow-wrap: anywhere;
}

.object-profile-header p {
    margin: 8px 0 0;
    color: #d4e5ed;
    overflow-wrap: anywhere;
}

.object-profile-header .glyphicon {
    margin-right: 5px;
    color: #8be8db;
}

.object-action-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.object-action-groups .dashboard-section,
.object-profile-details {
    min-width: 0;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--mayak-line);
    border-radius: 14px;
    background: var(--mayak-paper);
}

.object-action-groups .dashboard-section h2,
.object-profile-details h2 {
    margin: 0 0 10px;
    font-size: 17px;
    font-weight: 750;
}

.object-action-groups .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}

.object-action-groups .dashboard-grid li + li {
    border-top: 1px solid var(--mayak-line);
}

.object-action-groups .dashboard-link {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    min-height: 42px;
    padding: 6px;
    border: 0;
    border-radius: 7px;
    overflow-wrap: anywhere;
}

.object-action-groups .dashboard-link:hover,
.object-action-groups .dashboard-link:focus-visible {
    background: #edf7f5;
}

.object-action-groups .dashboard-icon {
    width: 28px;
    height: 28px;
    font-size: 13px;
}

.object-action-groups .dashboard-section-priority {
    grid-column: 1 / -1;
    padding: 22px;
    background: #edf5fa;
}

.object-action-groups .dashboard-section-priority h2 {
    margin-bottom: 14px;
    font-size: 22px;
}

.object-action-groups .dashboard-section-priority .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 208px), 1fr));
    gap: 10px;
}

.object-action-groups .dashboard-section-priority .dashboard-grid li {
    border: 0;
}

.object-action-groups .dashboard-section-priority .dashboard-link {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    height: 100%;
    min-height: 68px;
    padding: 10px;
    border: 1px solid var(--mayak-line);
    background: var(--mayak-paper);
    font-size: 15px;
}

.object-action-groups .dashboard-section-priority .dashboard-link:is(:hover, :focus-visible) {
    background: #e0efed;
}

.object-action-groups .dashboard-section-priority .dashboard-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
}

.object-action-groups .dashboard-section-priority .dashboard-link-new-payment {
    color: #fff;
    background: #a22635;
    border-color: #a22635;
}

.object-action-groups .dashboard-section-priority .dashboard-link-new-payment:is(:hover, :focus-visible) {
    color: #fff;
    background: #851d2a;
    border-color: #851d2a;
}

.dashboard-link-new-payment :is(.dashboard-icon, .dashboard-arrow) {
    color: #fff;
}

.dashboard-link-new-payment .dashboard-icon {
    background: #ffffff26;
}

.object-profile-details dl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr));
    gap: 12px 18px;
    margin-bottom: 14px;
}

.object-profile-details dt {
    color: var(--mayak-muted);
    font-size: 13px;
}

.object-profile-details dd {
    margin: 3px 0 0;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.object-delete {
    display: inline-block;
    margin-top: 4px;
    color: #a02530;
    font-size: 13px;
}

@media (max-width: 620px) {
    .object-action-groups {
        grid-template-columns: minmax(0, 1fr);
    }
}

.object-index .object-grid-actions {
    white-space: nowrap;
    min-width: 145px;
}

.parts-index .parts-grid-actions {
    white-space: nowrap;
    min-width: 85px;
}

@media (min-width: 1350px) {
    .workspace-shell:has(.object-index, .parts-index) {
        width: calc(100% - 40px);
        max-width: 1920px;
    }

    :is(.object-index, .parts-index) .grid-view .filters .form-control {
        min-width: 0;
    }

    .workspace-main .parts-index .grid-view :is(th, td) {
        padding-inline: 8px;
    }

    .parts-index .grid-view td {
        overflow-wrap: anywhere;
    }
}

@media (min-width: 1350px) {
    .workspace-shell:has(.invoices-table) {
        max-width: 1800px;
    }

    .workspace-main .invoices-table {
        width: 100%;
        table-layout: fixed;
        font-size: 13px;
    }

    .workspace-main .invoices-table :is(th, td) {
        padding: 7px 5px;
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.35;
    }

    .invoices-table thead tr:first-child th:nth-child(1) { width: 30px; }
    .invoices-table thead tr:first-child th:nth-child(2) { width: 88px; }
    .invoices-table thead tr:first-child th:nth-child(3) { width: 68px; }
    .invoices-table thead tr:first-child th:nth-child(4) { width: 50px; }
    .invoices-table thead tr:first-child th:nth-child(5) { width: 143px; }
    .invoices-table thead tr:first-child th:nth-child(8) { width: 90px; }
    .invoices-table thead tr:first-child th:nth-child(9) { width: 64px; }
    .invoices-table thead tr:first-child th:nth-child(10) { width: 76px; }
    .invoices-table thead tr:first-child th:nth-child(11),
    .invoices-table thead tr:first-child th:nth-child(12) { width: 65px; }

    .workspace-main .invoices-table .filters .form-control {
        width: 100%;
        min-width: 0;
        padding-inline: 5px;
        font-size: 12px;
    }

    .workspace-main .invoices-table tbody td:nth-child(5) {
        white-space: nowrap;
    }
}

.workspace-main .invoices-table .invoice-day-heading th {
    padding: 8px 12px;
    background: #e3efef;
    color: #174641;
}

.workspace-main .invoices-table .invoice-day-total :is(th, td) {
    background: #f2f7fa;
    color: var(--mayak-ink);
    font-weight: 700;
}

.workspace-main .invoices-table .invoice-day-amount {
    text-align: right;
    white-space: nowrap;
}

.invoice-period-total {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    margin-top: 12px;
    padding: 12px 16px;
    border: 1px solid var(--mayak-line);
    border-radius: 8px;
    background: #e3efef;
    color: #174641;
    font-weight: 700;
}

.invoice-period-total strong {
    white-space: nowrap;
}

.invoice-detail {
    display: grid;
    gap: 16px;
}

.invoice-detail dl {
    margin-bottom: 0;
}

.invoice-serial {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
    gap: 20px;
}

.invoice-serial-status {
    min-height: 2.8em;
    color: var(--mayak-muted);
}

.invoice-serial-error {
    color: #a02530;
}

.invoice-serial-settings {
    margin-top: 18px;
}

.invoice-serial-settings summary {
    margin-bottom: 10px;
    color: var(--mayak-accent-dark);
    cursor: pointer;
}

.invoice-serial label[for="serial-receipt"] {
    display: block;
}

.invoice-serial textarea {
    max-width: 290px;
    background: #fff;
    font-family: Consolas, monospace;
    font-size: 13px;
    resize: vertical;
}

@media (max-width: 680px) {
    .invoice-serial {
        grid-template-columns: minmax(0, 1fr);
    }
}

.invoice-template-layout textarea {
    font-family: Consolas, monospace;
    resize: vertical;
}

.invoice-template-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
    gap: 12px;
    margin: 0;
}

.part-modal-frame {
    display: block;
    width: 100%;
    height: min(660px, 72vh);
    border: 0;
}

.workspace-main.parts-embedded {
    width: 100%;
    padding: 8px;
}

.parts-embedded .editor-card {
    box-shadow: none;
    padding: 14px;
}
