.container {
    max-width: 1600px;
    padding-left: 25px;
    padding-right: 25px;
}

:root {
    --app-header-height: 70px;
}

main > .container {
    padding-top: calc(var(--app-header-height) + 12px);
    padding-bottom: 70px;
}

.footer {
    background-color: #f5f5f5;
    font-size: .9em;
    height: 60px;
}

.footer > .container {
    padding-right: 15px;
    padding-left: 15px;
}

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

/* add sorting icons to gridview sort links */
a.asc:after, a.desc:after {
    content: '';
    left: 3px;
    display: inline-block;
    width: 0;
    height: 0;
    border: solid 5px transparent;
    margin: 4px 4px 2px 4px;
    background: transparent;
}

a.asc:after {
    border-bottom: solid 7px #212529;
    border-top-width: 0;
}

a.desc:after {
    border-top: solid 7px #212529;
    border-bottom-width: 0;
}

.grid-view {
    overflow-x: auto;
}

.grid-view table {
    width: 100%;
}

.grid-view table:not(.structure-tree-table) {
    table-layout: fixed;
}

.grid-view th,
.grid-view td {
    text-align: center !important;
    vertical-align: middle !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.2;
}

.grid-view td {
    padding-top: 6px;
    padding-bottom: 6px;
}

.grid-view thead .filters th,
.grid-view thead .filters td {
    text-align: center;
    vertical-align: middle !important;
}

.grid-view thead .filters .form-control,
.grid-view thead .filters .form-select,
.grid-view thead .filters .select2-container {
    width: 100% !important;
}

.grid-view thead .filters .form-control,
.grid-view thead .filters .form-select,
.grid-view thead .filters .select2-selection__rendered {
    text-align: center;
}

.grid-view .list-col-id,
.grid-view .list-col-index,
.grid-view .list-col-date,
.grid-view .list-col-time,
.grid-view .list-col-unit,
.grid-view .list-col-count,
.grid-view .list-col-money,
.grid-view .list-col-status,
.grid-view .list-col-type,
.grid-view .list-col-name,
.grid-view .list-col-link,
.grid-view .list-col-comment {
    white-space: normal !important;
}

.grid-view .list-col-comment {
    min-width: 320px;
}

.grid-view .list-col-link {
    min-width: 200px;
}

.grid-view .list-col-name {
    min-width: 180px;
}

.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;
}

.form-group {
    margin-bottom: 1rem;
}

/* Название приложения ------------------ */

.app-name-container {
    height: 38px;
    margin-left: -6px;
    margin-right: 30px;
    padding-top: 2px;
    border-bottom: 2px solid #b3b3b3;
}

.app-name-text {
    transform: scale(1, 1.1);
    line-height: 0.5;
    font-size: 36px;
    font-stretch: 50%;
    font-weight: normal;
    color: #4F535B;
}

/* Форма входа в систему ---------------- */

.form-login {
    width: 400px;
    margin-top: 50px;
    border: 1px solid #aeaeae;
    border-radius: 3px;
}

.form-login-header {
    padding: 7px 0 7px 0;
    margin-bottom: 12px;
    background-color: #F8F9FA;
    border-bottom: 1px solid #aeaeae;
    font-size: large;
    text-align: center;
}

.form-login-body {
    padding: 0 15px 7px 15px;
}

/* -------------------------------------- */

/* ===== Global page styling ===== */
.page-top-panel {
    padding: 0 0 16px 0;
    margin-bottom: 16px;
}

.page-top-panel-header {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-top-panel-header a {
    margin-top: -2px;
}

.page-top-panel-header .btn {
    font-size: 0.82rem;
}

/* Global GridView improvements */
.page-content > .grid-view,
.page-content-form + .grid-view,
.page-content > div > .grid-view {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    padding: 0;
}

.grid-view > table {
    margin-bottom: 0;
}

.grid-view > table > thead > tr > th {
    background: #f9fafb !important;
    border-bottom: 2px solid #e5e7eb !important;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 10px 12px !important;
}

.grid-view > table > tbody > tr > td {
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.84rem;
    padding: 8px 12px !important;
}

.grid-view > table > tbody > tr:last-child > td {
    border-bottom: none;
}

.grid-view > table > tbody > tr:hover > td {
    background: #f0fdf4 !important;
}

.grid-view > table > tbody > tr:nth-child(even) > td {
    background: #fafbfc;
}

.grid-view > table > tbody > tr:nth-child(even):hover > td {
    background: #f0fdf4 !important;
}

/* Remove bootstrap striped yellow */
.grid-view > table.table-striped > tbody > tr:nth-of-type(odd) > td {
    --bs-table-accent-bg: transparent !important;
    background-color: transparent !important;
}

.grid-view > table > tbody > tr > td a {
    color: #1f2937;
    font-weight: 500;
    text-decoration: none;
}

.grid-view > table > tbody > tr > td a:hover {
    color: #16a34a;
}

/* Disabled inputs — clean look */
input.form-control:disabled,
input.form-control[readonly],
input.form-control-sm:disabled,
input.form-control-sm[readonly],
textarea.form-control:disabled,
textarea.form-control[readonly],
select.form-control:disabled,
select.form-control-sm:disabled,
.form-select:disabled {
    background-color: #f9fafb !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    color: #374151 !important;
    opacity: 1 !important;
    font-size: 0.84rem !important;
}

/* All form inputs — rounded */
.form-control,
.form-control-sm,
.form-select,
.form-select-sm {
    border-radius: 8px !important;
    border-color: #d1d5db;
    font-size: 0.84rem;
}

.form-control:focus,
.form-control-sm:focus,
.form-select:focus,
.form-select-sm:focus {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 2px rgba(22,163,74,0.12) !important;
}

/* Select2 rounded */
.select2-container .select2-selection--single {
    border-radius: 8px !important;
    border-color: #d1d5db !important;
    height: 31px !important;
}

.select2-container--focus .select2-selection--single {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 2px rgba(22,163,74,0.12) !important;
}

/* Labels — smaller, uppercase */
.col-form-label {
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    color: #374151 !important;
}

/* Global form styling */
.page-content-form .btn-primary,
.page-content-form .btn-outline-primary {
    border-radius: 8px;
}

.page-content-form .btn-success {
    background: linear-gradient(135deg, #16a34a, #15803d);
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(22,163,74,0.2);
}

.page-content-form .btn-success:hover {
    background: linear-gradient(135deg, #15803d, #166534);
    box-shadow: 0 4px 12px rgba(22,163,74,0.3);
}

/* Global add button in top panel */
.page-top-panel-actions .btn-outline-secondary {
    border-radius: 8px;
    font-size: 0.82rem;
    padding: 5px 14px;
    transition: all 0.12s;
}

.page-top-panel-actions .btn-outline-secondary:hover {
    border-color: #16a34a;
    color: #16a34a;
    background: #f0fdf4;
}

.page-top-panel-subheader {
    margin-top: 5px;
    text-align: center;
    font-size: large;
}

.page-content-form-filters {
    margin-bottom: 10px;
    background-color: #F8F9FA;
    border-bottom: 1px solid #e1e3e1;
}

.form-filters-header {
    padding: 5px 15px 5px 15px;
    margin-bottom: 10px;
    background-color: #F2F2F2;
    border-bottom: 1px solid #e1e3e1;
}

.form-filters-body {
    padding-left: 15px;
}

/* -------------------------------------- */

.contextMenuRow {
    cursor: pointer;
}

.form-row {
    margin-bottom: -10px;
}

.form-last-row {
    margin-bottom: 29px;
    border-bottom: 1px solid #e1e3e1;
}

.form-filters-last-row {
    margin-bottom: 10px;
}

/* Кнопка возврата ---------------------- */
.btn-return {
    border-radius: 100%;
}

.order-form .required > label::after,
.order-item-form .required > label::after {
    content: ' *';
    color: #dc3545;
    font-weight: 700;
}

/* Компактное главное меню */
#header .main-menu-compact > .nav-item > .nav-link {
    padding: 0.35rem 0.45rem;
    font-size: 0.84rem;
    line-height: 1.1;
    white-space: nowrap;
}

#header .main-menu-compact .dropdown-menu .dropdown-item {
    padding: 0.3rem 0.75rem;
    font-size: 0.88rem;
}

/* Аккуратная пагинация в списках */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    margin-bottom: 0;
    padding-left: 0;
    list-style: none;
}

.pagination li {
    margin: 0;
}

.pagination > li > a,
.pagination > li > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    text-decoration: none;
    color: #2f4b6a;
    background: #fff;
    transition: all .15s ease-in-out;
}

.pagination > li > a:hover,
.pagination > li > span:hover {
    border-color: #8fb5d8;
    background: #f3f8fd;
    color: #1f3f62;
}

.pagination > .active > a,
.pagination > .active > span,
.pagination > .active > a:hover,
.pagination > .active > span:hover {
    border-color: #2f6ea8;
    background: #2f6ea8;
    color: #fff;
}

.pagination > .disabled > span,
.pagination > .disabled > a,
.pagination > .disabled > span:hover,
.pagination > .disabled > a:hover {
    color: #9aa4af;
    border-color: #e3e6ea;
    background: #f8f9fa;
    pointer-events: none;
}

/* Structure page */
.structure-stats-row {
    margin-top: 14px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.structure-stat-card {
    border: 1px solid #e1e3e1;
    border-radius: 6px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
}

.structure-stat-label {
    color: #6b7280;
    font-size: 12px;
}

.structure-stat-value {
    margin-top: 2px;
    color: #23364a;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
}

.structure-layout {
    margin-top: 2px;
}

.structure-card {
    border: 1px solid #e1e3e1;
    border-radius: 6px;
    background-color: #fff;
    overflow: hidden;
}

.structure-card-header {
    padding: 10px 12px;
    border-bottom: 1px solid #e9ecef;
    background-color: #f8f9fa;
    font-size: 14px;
    font-weight: 600;
    color: #3b3f45;
}

.structure-card-body {
    padding: 12px;
}

.structure-tree-table > tbody > tr > td {
    vertical-align: middle !important;
}

.structure-tree-row.is-selected > td {
    background-color: #eef5ff !important;
}

.structure-tree-name-wrap {
    display: flex;
    align-items: center;
    min-height: 28px;
}

.structure-row-hidden {
    display: none;
}

.structure-toggle-btn {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: #5f6b7a;
    cursor: pointer;
    line-height: 1;
}

.structure-toggle-btn:hover,
.structure-toggle-btn:focus {
    background-color: #eef3f8;
    color: #2f4b6a;
    outline: none;
}

.structure-toggle-spacer {
    display: inline-block;
    width: 18px;
    margin-right: 8px;
}

.structure-tree-branch {
    display: inline-block;
    width: 10px;
    height: 0;
    margin-right: 8px;
    border-top: 1px solid #adb5bd;
}

.structure-tree-name {
    color: #214f78;
    font-weight: 500;
}

.structure-tree-name:hover,
.structure-tree-name:focus {
    color: #3d75f3;
}

.structure-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    line-height: 1.4;
    border: 1px solid transparent;
}

.structure-type-management {
    background-color: #e9f1ff;
    border-color: #c9dcff;
    color: #2b4c84;
}

.structure-type-department {
    background-color: #edf9ee;
    border-color: #cfead2;
    color: #2d6b3a;
}

.structure-type-section {
    background-color: #fff6e9;
    border-color: #ffe3be;
    color: #8a5d17;
}

.structure-scope-switch {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

