:root {
    --app-bg: #eef2f6;
    --app-surface: #ffffff;
    --app-surface-muted: #f7f9fc;
    --app-border: #d9e1ea;
    --app-border-strong: #b9c6d4;
    --app-text: #18212f;
    --app-muted: #64748b;
    --app-primary: #2457a6;
    --app-primary-dark: #183f7d;
    --app-primary-soft: #e8f0ff;
    --app-success: #23805c;
    --app-warning: #b7791f;
    --app-danger: #c2413f;
    --app-shadow: 0 10px 24px rgba(24, 33, 47, 0.08);
    --app-shadow-soft: 0 2px 10px rgba(24, 33, 47, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0 !important;
    padding: 18px;
    background:
        linear-gradient(180deg, #f8fafc 0, var(--app-bg) 280px, var(--app-bg) 100%) !important;
    color: var(--app-text);
    font-family: Arial, "Helvetica Neue", sans-serif !important;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--app-text);
    letter-spacing: 0;
}

h1 {
    font-size: clamp(24px, 2vw, 34px);
    font-weight: 800;
}

a {
    color: var(--app-primary);
}

.container {
    max-width: 1440px;
}

.header,
body > .container > .d-flex.justify-content-between.align-items-center.mb-4 {
    align-items: center !important;
    gap: 16px;
    margin-bottom: 18px !important;
    padding: 16px 18px !important;
    border: 1px solid rgba(217, 225, 234, 0.85);
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    box-shadow: var(--app-shadow-soft) !important;
}

.header h1,
body > .container > .d-flex.justify-content-between.align-items-center.mb-4 h1 {
    margin: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px !important;
}

.nav-link {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    color: var(--app-primary) !important;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.nav-link:hover {
    border-color: var(--app-border);
    background: var(--app-primary-soft) !important;
    color: var(--app-primary-dark) !important;
}

.nav-link.active {
    border-color: var(--app-primary) !important;
    background: var(--app-primary) !important;
    color: #fff !important;
}

.logout-btn {
    min-height: 36px;
    border-radius: 6px !important;
    background: var(--app-danger) !important;
    font-weight: 700;
    line-height: 1.2;
}

.logout-btn:hover {
    background: #a63331 !important;
}

.content,
.section,
.card,
.login-container,
#invoicePreview,
.table-responsive {
    border-radius: 8px !important;
}

.content,
.section,
.login-container {
    border: 1px solid rgba(217, 225, 234, 0.9);
    background: var(--app-surface) !important;
    box-shadow: var(--app-shadow) !important;
}

.content,
.section {
    padding: 20px !important;
}

.card {
    overflow: hidden;
    border: 1px solid var(--app-border) !important;
    box-shadow: none;
}

.card-header {
    border-bottom: 1px solid var(--app-border);
    background: var(--app-surface-muted) !important;
}

.card-header h5,
.card-header h6 {
    font-weight: 800;
}

.card-body {
    background: var(--app-surface);
}

.summary-grid,
.summary-bar,
.quick-grid {
    gap: 12px !important;
}

.summary-tile,
.summary-item,
.quick-link {
    border-color: var(--app-border) !important;
    border-radius: 8px !important;
    background: var(--app-surface) !important;
    box-shadow: var(--app-shadow-soft);
}

.summary-tile,
.summary-item {
    min-height: 88px;
}

.summary-label,
.summary-note,
.quick-desc,
.muted,
.text-muted {
    color: var(--app-muted) !important;
}

.summary-value {
    color: var(--app-text);
}

.quick-link {
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.quick-link:hover {
    transform: translateY(-1px);
    border-color: var(--app-border-strong) !important;
    box-shadow: var(--app-shadow);
}

.quick-icon {
    background: var(--app-primary-soft) !important;
    color: var(--app-primary) !important;
}

.toolbar,
.filters {
    padding: 14px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: var(--app-surface-muted);
}

.form-control,
.form-select,
input,
textarea,
select {
    border-color: var(--app-border-strong) !important;
    border-radius: 6px !important;
}

.form-control:focus,
.form-select:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: var(--app-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(36, 87, 166, 0.15) !important;
}

.btn {
    border-radius: 6px !important;
    font-weight: 700;
}

.btn-primary {
    border-color: var(--app-primary) !important;
    background: var(--app-primary) !important;
}

.btn-primary:hover {
    border-color: var(--app-primary-dark) !important;
    background: var(--app-primary-dark) !important;
}

.btn-success {
    border-color: var(--app-success) !important;
    background: var(--app-success) !important;
}

.btn-secondary {
    border-color: #5e6b7b !important;
    background: #5e6b7b !important;
}

.table-container,
.table-responsive {
    border: 1px solid var(--app-border);
    background: var(--app-surface);
}

.table {
    margin-bottom: 0;
    vertical-align: middle;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid var(--app-border-strong) !important;
    background: #edf2f7 !important;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
    white-space: nowrap;
}

.table tbody td {
    border-color: #edf2f7;
}

.table-hover tbody tr:hover {
    background-color: #f5f8fc;
}

.badge {
    border-radius: 999px;
    font-weight: 800;
}

.status-badge {
    padding: 6px 10px !important;
}

.bg-info {
    background-color: #aee8f6 !important;
    color: #164e63 !important;
}

.bg-warning {
    background-color: #fde68a !important;
    color: #6b4e16 !important;
}

.bg-success {
    background-color: var(--app-success) !important;
}

.bg-danger {
    background-color: var(--app-danger) !important;
}

.exchange-rate-info {
    padding: 7px 10px;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    background: var(--app-surface-muted);
    color: var(--app-primary) !important;
    white-space: nowrap;
}

.modal-content {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-shadow: var(--app-shadow);
}

.shipment-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.shipment-timeline {
    display: grid;
    gap: 12px;
}

.shipment-event {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: var(--app-surface);
}

.shipment-event-date {
    color: var(--app-muted);
    font-size: 13px;
    font-weight: 700;
}

.shipment-event-body {
    min-width: 0;
}

.shipment-event-text {
    margin-top: 6px;
    color: var(--app-text);
}

.login-container {
    padding: 28px !important;
}

.login-container h2 {
    font-weight: 800;
}

.login-container button {
    border-radius: 6px !important;
    background: var(--app-primary) !important;
}

.error-message {
    color: var(--app-danger) !important;
}

@media (max-width: 900px) {
    body {
        padding: 12px;
    }

    .header,
    body > .container > .d-flex.justify-content-between.align-items-center.mb-4 {
        align-items: flex-start !important;
        flex-direction: column;
    }

    .nav-links {
        justify-content: flex-start;
        width: 100%;
    }

    .nav-link,
    .logout-btn {
        min-height: 34px;
        padding: 7px 10px !important;
        font-size: 13px;
    }

    .content,
    .section {
        padding: 14px !important;
    }

    .section-header,
    .card-header .d-flex {
        align-items: flex-start !important;
        flex-direction: column;
    }

    .shipment-event {
        grid-template-columns: 1fr;
    }
}
