/* ============ Kama Express LK — design tokens from kama-proto ============ */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg: #f7f8fb;
    --bg-soft: #ffffff;
    --surface: rgba(255, 255, 255, 0.65);
    --surface-strong: rgba(255, 255, 255, 0.85);
    --border: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.12);
    --text: #0b1220;
    --text-soft: #475569;
    --text-mute: #64748b;
    --red: #c4281c;
    --red-deep: #a01f14;
    --red-soft: #fce8e4;
    --blue: #2563eb;
    --blue-soft: #eff5ff;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.03);
    --shadow-md: 0 10px 30px -12px rgba(15, 23, 42, 0.12), 0 4px 12px -4px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 30px 60px -20px rgba(15, 23, 42, 0.18), 0 10px 24px -8px rgba(15, 23, 42, 0.08);
    --radius-sm: 10px;
    --radius: 18px;
    --radius-lg: 28px;
    --container: 1240px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --header-offset: 88px;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.lk-app { padding-top: var(--header-offset); min-height: 100vh; }

a { color: inherit; }
a:hover { text-decoration: none; }

/* ============ Aurora background ============ */
.aurora {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.aurora::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60% 50% at 12% 8%, rgba(196, 40, 28, 0.18), transparent 70%),
        radial-gradient(50% 50% at 88% 20%, rgba(37, 99, 235, 0.14), transparent 70%),
        radial-gradient(55% 60% at 50% 100%, rgba(196, 40, 28, 0.10), transparent 70%),
        radial-gradient(40% 40% at 80% 80%, rgba(99, 102, 241, 0.10), transparent 70%);
    filter: blur(20px);
    animation: auroraShift 28s ease-in-out infinite alternate;
}

.aurora::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 30%, transparent 75%);
    opacity: 0.6;
}

@keyframes auroraShift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(-2%, 1%, 0) scale(1.05); }
    100% { transform: translate3d(2%, -1%, 0) scale(1.02); }
}

.glass {
    background: var(--surface);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

/* ============ Logo ============ */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Manrope', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.02em;
    white-space: nowrap;
    color: var(--text);
}

.logo-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
    display: grid;
    place-items: center;
    color: white;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.04em;
    box-shadow: 0 6px 14px -4px rgba(196, 40, 28, 0.5);
    flex-shrink: 0;
}

.logo-text { line-height: 1.2; }

.logo-sub {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-mute);
    letter-spacing: 0.02em;
}

/* ============ Header / navbar ============ */
.lk-header {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 28px);
    max-width: var(--container);
    z-index: 1030;
    border-radius: 999px;
    padding: 8px 10px 8px 18px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.lk-header .navbar-brand {
    display: flex;
    align-items: center;
    padding: 0;
    margin-right: 8px;
}

.lk-header .navbar-toggler {
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.04);
}

.lk-header .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='rgba(11,18,32,.75)' stroke-width='2' stroke-linecap='round' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.lk-header .navbar-nav {
    align-items: center;
    gap: 2px;
}

.lk-header .nav-link {
    padding: 8px 14px !important;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-soft) !important;
    border-radius: 999px;
    transition: color 0.2s, background 0.2s;
}

.lk-header .nav-link:hover {
    color: var(--text) !important;
    background: rgba(15, 23, 42, 0.05);
}

.lk-header .nav-item.active .nav-link {
    color: var(--red) !important;
    background: rgba(196, 40, 28, 0.08);
}

.lk-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.lk-track-group {
    display: flex;
    align-items: stretch;
}

.lk-track-group .trackinput {
    width: 160px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    margin: 0;
    font-size: 13px;
    height: 38px;
}

.lk-track-group .track {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    height: 38px;
    font-size: 13px;
    padding: 0 14px;
    top: 0;
}

.lk-user-menu .btn-danger {
    background: var(--bg-soft);
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    border-radius: 999px 0 0 999px;
    padding: 8px 14px;
}

.lk-user-menu .dropdown-toggle-split {
    border-radius: 0 999px 999px 0;
    border-left: 1px solid var(--border);
    padding-left: 10px;
    padding-right: 12px;
}

.lk-user-menu .btn-danger:hover,
.lk-user-menu .btn-danger:focus {
    background: rgba(15, 23, 42, 0.06);
    color: var(--text);
    box-shadow: none;
}

.lk-user-menu .dropdown-menu {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 6px;
}

.lk-user-menu .dropdown-item {
    border-radius: 8px;
    font-size: 14px;
    padding: 8px 12px;
}

.lk-user-menu .dropdown-item:hover {
    background: var(--red-soft);
    color: var(--red);
}

/* ============ Buttons (proto + bootstrap overrides) ============ */
.btn {
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.15s var(--ease), box-shadow 0.25s var(--ease), background 0.2s;
}

.btn-default,
.btn-primary {
    color: #fff !important;
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%) !important;
    border: none !important;
    box-shadow: 0 8px 20px -8px rgba(196, 40, 28, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-default:hover,
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px -8px rgba(196, 40, 28, 0.65);
    color: #fff !important;
}

.btn-outline-primary {
    color: var(--red) !important;
    border-color: rgba(196, 40, 28, 0.35) !important;
    background: var(--bg-soft) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary.active {
    background: var(--red-soft) !important;
    border-color: var(--red) !important;
    color: var(--red-deep) !important;
}

.btn-success {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
    border: none !important;
}

.btn-secondary {
    color: var(--text);
    background: var(--bg-soft);
    border: 1px solid var(--border-strong);
}

/* ============ Main content ============ */
.lk-main {
    min-height: calc(100vh - var(--header-offset) - 100px);
    padding-bottom: 40px;
}

.lk-main .container {
    max-width: var(--container);
    padding-left: 24px;
    padding-right: 24px;
}

/* ============ Cards & panels ============ */
.card {
    background: var(--surface-strong);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-title,
.card-body h3,
.card-body h5 {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.coloredbgr {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-sm);
    padding: 14px;
}

/* ============ Forms ============ */
.form-control {
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: var(--bg-soft);
    font-size: 14px;
    color: var(--text);
    transition: border 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(196, 40, 28, 0.1);
    background: var(--bg-soft);
    color: var(--text);
}

label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-soft);
}

/* ============ Tables ============ */
.table {
    background: var(--bg-soft);
    border-radius: var(--radius-sm);
    overflow: hidden;
    font-size: 13px;
}

.table thead th {
    border-bottom: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.03);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-mute);
}

.table td,
.table th {
    border-color: var(--border);
    vertical-align: middle;
}

#table {
    font-size: 13px;
}

.lk-data-table {
    font-size: 14px;
}

.lk-data-table thead th {
    font-size: 12px;
    white-space: nowrap;
}

.lk-data-table td {
    line-height: 1.45;
}

.lk-data-table .lk-col-address {
    min-width: 220px;
    max-width: 360px;
    white-space: normal;
}

.lk-address-modal-table {
    font-size: 13px;
    margin-bottom: 0;
}

.lk-address-modal-table thead th {
    font-size: 11px;
}

.lk-address-modal-table td,
.lk-address-modal-table th {
    line-height: 1.4;
    vertical-align: top;
}

.lk-address-modal-table tbody tr {
    cursor: pointer;
}

.lk-address-modal-table tbody tr:hover {
    background: rgba(196, 40, 28, 0.05);
}

.lk-address-book-panel {
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem 1.25rem;
    box-shadow: var(--shadow-sm);
}

.sending {
    outline: none;
    border: none;
    background-color: transparent;
    pointer-events: none;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

/* ============ Alerts ============ */
.alert {
    border-radius: var(--radius-sm);
    border: none;
}

.alert-danger {
    background: var(--red-soft);
    color: var(--red-deep);
}

.alert-link {
    color: var(--red);
    font-weight: 600;
}

.alert-link:hover {
    color: var(--red-deep);
}

/* ============ Bootstrap modals ============ */
#exampleModal.modal {
    padding: 16px;
}

#exampleModal .modal-dialog.lk-modal-dialog {
    margin: 0 auto;
    width: 100%;
    max-width: min(920px, calc(100vw - 32px));
}

#exampleModal .modal-dialog.modal-dialog-centered {
    min-height: calc(100% - 32px);
}

.modal-content {
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: var(--surface-strong);
    backdrop-filter: blur(24px);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
}

.modal-title {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.modal-body { padding: 20px 24px; }

#exampleModal .modal-body {
    max-height: min(58vh, 520px);
    overflow-y: auto;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 16px 24px;
}

.close {
    opacity: 0.5;
    transition: opacity 0.2s;
}

.close:hover { opacity: 1; color: var(--red); }

/* ============ Footer ============ */
.lk-footer,
#bootom {
    margin-top: 40px;
    padding: 24px 0 30px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-mute);
    font-size: 13px;
    height: auto !important;
    line-height: 1.6 !important;
}

.lk-footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.lk-footer a {
    color: var(--text-soft);
    font-weight: 500;
    transition: color 0.2s;
}

.lk-footer a:hover { color: var(--red); }

/* ============ Auth pages ============ */
body.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-wrap {
    width: 100%;
    max-width: 440px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 28px;
}

.auth-brand .logo {
    justify-content: center;
}

.auth-tagline {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-soft);
}

.auth-card {
    border-radius: var(--radius-lg);
    padding: 32px 28px;
}

.auth-card .card {
    border: none;
    box-shadow: none;
    background: transparent;
}

.auth-card .card-body { padding: 0; }

.auth-card .form-group { margin-bottom: 14px; }

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    font-size: 14px;
}

.auth-links a {
    color: var(--red);
    font-weight: 500;
}

.auth-links a:hover { color: var(--red-deep); }

.auth-wide-wrap {
    width: 100%;
    max-width: 820px;
}

.auth-wide-wrap .auth-card { padding: 28px 32px; }

.tracking_index {
    cursor: pointer;
    display: block;
    font-size: 12px;
    text-decoration: underline !important;
    text-align: center;
    font-weight: 700;
    color: var(--red);
}

.attach .form-control {
    height: auto;
    min-height: 46px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

#top { height: auto; }

.w-300 { min-width: 160px; }

/* ============ Создание заказа ============ */
.order-create-title {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
}

.order-create-lead {
    color: var(--text-soft);
    font-size: 0.95rem;
    margin-bottom: 0;
}

.order-section-title {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    margin: 1.75rem 0 0.75rem;
}

.order-field-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.order-field-hint {
    font-size: 0.8rem;
    color: var(--text-soft);
    margin: 0.35rem 0 0;
    line-height: 1.45;
}

.order-form-row {
    margin-bottom: 0.5rem;
}

.order-addr-card,
.order-cargo-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.order-addr-card .card-body {
    padding: 1.25rem 1.35rem;
}

.order-addr-card .card-footer {
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    padding: 0.85rem 1.35rem;
}

.order-addr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.order-addr-summary {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.order-addr-company {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}

.order-addr-contact {
    font-size: 0.92rem;
    color: var(--text-soft);
}

.order-addr-sep {
    margin: 0 0.35rem;
    opacity: 0.5;
}

.order-addr-line {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text);
}

.order-addr-empty {
    padding: 0.5rem 0;
}

.order-addr-empty-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.order-addr-empty-hint {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-soft);
}

.order-dims-x {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-soft);
    padding-bottom: 0.55rem;
}

.order-options {
    display: grid;
    gap: 1rem;
}

.order-option-label {
    font-size: 0.92rem !important;
    font-weight: 600;
}

.order-fixed-city {
    margin: 0;
    padding: 0.375rem 0;
    font-size: 0.95rem;
}

.order-calc-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
    max-width: 640px;
}

.order-calc-sum-field {
    flex: 1 1 220px;
    min-width: 200px;
}

.order-calc-sum-field .form-control {
    max-width: 320px;
}

.order-calc-btn {
    flex: 0 0 auto;
    min-height: 46px;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    font-weight: 600;
    white-space: nowrap;
}

.order-calc-bar + .order-field-hint {
    max-width: 640px;
}

.order-create-nav .btn-block {
    width: 100%;
}

@media (max-width: 767px) {
    .order-dims-x {
        display: none;
    }

    .order-dims-row .col-md-3 {
        margin-bottom: 0.75rem;
    }
}

/* jQuery UI datepicker */
.ui-datepicker {
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-md) !important;
    font-family: 'Inter', sans-serif !important;
}

.ui-state-active,
.ui-widget-content .ui-state-active {
    background: var(--red) !important;
    border-color: var(--red) !important;
}

/* ============ Responsive ============ */
@media (max-width: 991px) {
    :root { --header-offset: 120px; }

    .lk-header {
        border-radius: 24px;
        padding: 12px 14px;
    }

    .lk-header .navbar-collapse {
        width: 100%;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border);
    }

    .lk-header-actions {
        width: 100%;
        margin-left: 0;
        margin-top: 4px;
        padding-top: 8px;
        border-top: 1px solid var(--border);
    }

    .lk-track-group { width: 100%; }

    .lk-track-group .trackinput { flex: 1; width: auto; }
}

@media (max-width: 575px) {
    body.auth-page { padding: 16px; }

    .auth-card { padding: 24px 18px; }

    .auth-links { flex-direction: column; text-align: center; }
}
