/* Base CSS – HeatEx-Control */
:root {
    /* Основные цвета из документации */
    --color-primary: rgb(10, 29, 63);
    --color-bg: rgb(234, 233, 232);
    --color-secondary: rgb(94, 98, 108);
    --color-white: rgb(255, 255, 255);
    --color-accent: rgb(243, 195, 67);
    --color-text: rgb(0, 0, 0);

    /* Статусные */
    --color-error: #ff4d4d;
    --color-success: #28a745;
    --color-warning: #ffae42;

    /* Тени и объем */
    --shadow-soft: 0 8px 20px rgba(10, 29, 63, 0.12);
    --shadow-medium: 0 14px 30px rgba(10, 29, 63, 0.18);
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition-fast: 0.2s ease;
}

/* Шрифты */
@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
}

@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    color: var(--color-text);
    background:
        radial-gradient(circle at top right, rgba(243, 195, 67, 0.12), transparent 35%),
        radial-gradient(circle at top left, rgba(10, 29, 63, 0.08), transparent 30%),
        var(--color-bg);
}

body.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5.5rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 1rem;
    margin-bottom: 0.6rem;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: 0.2px;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-secondary);
    text-decoration: none;
}

.container {
    width: min(1200px, 92%);
    margin: 1.25rem auto 2rem;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(130deg, var(--color-primary), rgb(20, 45, 86));
    color: var(--color-white);
    padding: 0.85rem 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid rgba(243, 195, 67, 0.65);
    box-shadow: var(--shadow-medium);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.navbar a,
.nav-dropdown-toggle {
    color: var(--color-white);
    margin-right: 1rem;
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.nav-dropdown-toggle {
    background: transparent;
    border: none;
    font: inherit;
    cursor: pointer;
}

.navbar a:hover,
.nav-dropdown-toggle:hover {
    color: var(--color-white);
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--color-white);
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(10, 29, 63, 0.12);
    padding: 0.35rem;
    z-index: 80;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    color: var(--color-primary);
    margin-right: 0;
    padding: 0.45rem 0.55rem;
}

.nav-dropdown-menu a:hover {
    color: var(--color-primary);
    background-color: rgba(10, 29, 63, 0.09);
    transform: none;
}

main.container {
    background-color: rgba(255, 255, 255, 0.68);
    backdrop-filter: blur(2px);
    border: 1px solid rgba(10, 29, 63, 0.09);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 1.2rem 1.3rem 1.5rem;
}

main.auth-main {
    width: min(520px, 92%);
    min-height: auto;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.auth-screen {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-card {
    width: 100%;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 20px;
    box-shadow: 0 18px 40px rgba(10, 29, 63, 0.25);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    padding: 1.8rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--color-accent), rgba(243, 195, 67, 0.4));
}

.auth-caption {
    margin: 0;
    text-align: center;
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-secondary);
}

.auth-card h2 {
    text-align: center;
}

.auth-subtitle {
    margin: 0.1rem 0 0.35rem;
    text-align: center;
    color: var(--color-secondary);
    font-weight: 300;
}

.auth-form {
    margin-top: 1rem;
}

.auth-form .form-label {
    text-align: left;
}

.auth-submit {
    width: 100%;
    margin-top: 0.35rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 0.95rem;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
    box-shadow: 0 4px 10px rgba(10, 29, 63, 0.15);
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.btn-success {
    background-color: var(--color-success);
    color: var(--color-white);
}

.btn-danger {
    background-color: var(--color-error);
    color: var(--color-white);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(10, 29, 63, 0.35);
    color: var(--color-primary);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.88rem;
    border-radius: 8px;
}

.table {
    width: 100%;
    margin-top: 1rem;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    background-color: rgba(255, 255, 255, 0.9);
}

.table th,
.table td {
    padding: 0.72rem 0.8rem;
    border-bottom: 1px solid rgba(10, 29, 63, 0.08);
}

.table th {
    background: linear-gradient(120deg, var(--color-secondary), rgb(111, 117, 129));
    color: var(--color-white);
    font-weight: 700;
}

.table tr:last-child td {
    border-bottom: none;
}

.table-bordered th,
.table-bordered td {
    border-right: 1px solid rgba(10, 29, 63, 0.08);
}

.table-bordered th:last-child,
.table-bordered td:last-child {
    border-right: none;
}

.tr-hover {
    transition: background-color var(--transition-fast);
}

.tr-hover:hover {
    background-color: rgba(243, 195, 67, 0.15);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.62rem;
    border-radius: 999px;
    font-size: 0.79rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    border: 1px solid transparent;
    box-shadow: 0 3px 8px rgba(10, 29, 63, 0.12);
    white-space: nowrap;
}

.status-draft {
    background-color: rgba(94, 98, 108, 0.14);
    color: rgb(67, 71, 79);
    border-color: rgba(94, 98, 108, 0.3);
}

.status-contract_notified {
    background-color: rgba(10, 29, 63, 0.12);
    color: var(--color-primary);
    border-color: rgba(10, 29, 63, 0.28);
}

.status-awaiting_approval {
    background-color: rgba(243, 195, 67, 0.2);
    color: rgb(99, 74, 0);
    border-color: rgba(243, 195, 67, 0.45);
}

.status-completed {
    background-color: rgba(40, 167, 69, 0.16);
    color: rgb(18, 95, 37);
    border-color: rgba(40, 167, 69, 0.34);
}

.status-rejected {
    background-color: rgba(255, 77, 77, 0.15);
    color: rgb(142, 22, 22);
    border-color: rgba(255, 77, 77, 0.4);
}

.alert {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid transparent;
    box-shadow: var(--shadow-soft);
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.15);
    border-color: rgba(40, 167, 69, 0.35);
    color: #145226;
}

.alert-error {
    background-color: rgba(255, 77, 77, 0.15);
    border-color: rgba(255, 77, 77, 0.35);
    color: #6f1717;
}

.alert-info {
    background-color: rgba(10, 29, 63, 0.1);
    border-color: rgba(10, 29, 63, 0.25);
    color: var(--color-primary);
}

.messages-stack {
    margin-top: 1rem;
    margin-bottom: 0;
}

.messages-stack .alert:first-child {
    margin-top: 0;
}

body.auth-page .messages-stack {
    position: fixed;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(640px, 92%);
    z-index: 120;
    margin: 0;
}

body.auth-page .messages-stack .alert {
    margin-top: 0;
}


form {
    margin: 0;
}

form p {
    margin: 0 0 0.85rem;
}

.transfer-form-layout {
    display: grid;
    gap: 1rem;
}

.form-section {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(10, 29, 63, 0.1);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    box-shadow: 0 6px 14px rgba(10, 29, 63, 0.08);
}

.form-section h3 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    font-size: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem 1rem;
}

.form-field {
    min-width: 0;
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    flex-wrap: wrap;
}

.approval-compact-grid {
    gap: 0.6rem;
}

.approval-compact-card {
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(10, 29, 63, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
}

.approval-compact-card h4 {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
}

.approval-compact-line {
    margin: 0 0 0.3rem;
    font-size: 0.93rem;
}

.approval-form-compact {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.4rem;
}

.approval-checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0;
    font-weight: 500;
}

.approval-checkbox-inline input {
    width: auto;
    min-height: auto;
    margin: 0;
}

.textarea-compact {
    min-height: 2.35rem;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

.errorlist {
    margin: 0.3rem 0 0;
    padding: 0;
    list-style: none;
    color: #8d1e1e;
    font-size: 0.86rem;
}

label,
.form-label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--color-primary);
    font-weight: 500;
}

input,
select,
textarea,
.form-control,
.form-select {
    width: 100%;
    min-height: 2.55rem;
    padding: 0.55rem 0.72rem;
    border: 1px solid rgba(10, 29, 63, 0.25);
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.98);
    color: var(--color-text);
    font-family: 'Roboto', sans-serif;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: rgba(243, 195, 67, 0.9);
    box-shadow: 0 0 0 3px rgba(243, 195, 67, 0.2);
}

.pagination {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

/* Utility-классы, используемые в шаблонах */
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.25rem; }
.mt-5 { margin-top: 1.8rem; }
.mb-2 { margin-bottom: 0.65rem; }
.mb-3 { margin-bottom: 1rem; }
.ms-2 { margin-left: 0.5rem; }
.d-inline { display: inline-block; }
.w-auto { width: auto; min-width: 170px; }

.row {
    display: flex;
    flex-wrap: wrap;
}

.g-3 {
    gap: 0.75rem;
}

.col-auto {
    flex: 0 0 auto;
}

/* HTMX loading indicator */
.htmx-indicator {
    opacity: 0.6;
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .navbar-left {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 0.2rem;
    }

    .navbar a,
    .nav-dropdown-toggle {
        margin-right: 0;
    }

    .nav-dropdown-menu {
        position: static;
        margin-top: 0.35rem;
        width: 100%;
    }

    .container {
        width: 95%;
    }

    main.container {
        padding: 1rem;
    }

    main.auth-main {
        width: 94%;
        min-height: auto;
    }

    .auth-card {
        padding: 1.25rem 1rem;
        border-radius: 16px;
    }

    .table {
        font-size: 0.92rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}
