:root {
    --bg: #f3f6fb;
    --card: rgba(255,255,255,.94);
    --card-2: #ffffff;
    --line: #e6edf7;
    --text: #0f172a;
    --muted: #64748b;
    --blue: #2563eb;
    --blue2: #4f46e5;
    --green: #16a34a;
    --amber: #d97706;
    --red: #dc2626;
    --pill: #eef4ff;
    --shadow: 0 12px 34px rgba(15, 23, 42, .08);
    --shadow-soft: 0 8px 20px rgba(15, 23, 42, .05);
    --r-xl: 24px;
    --r-lg: 18px;
    --r-md: 14px;
    --r-sm: 12px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(79,70,229,.10), transparent 28%),
        radial-gradient(circle at top right, rgba(37,99,235,.08), transparent 22%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}

a { text-decoration: none; }

.page-shell { padding: 22px 0 40px; }
.main-wrap { max-width: 1180px; margin: 0 auto; padding: 0 14px; }
.center-wrap { max-width: 980px; margin: 0 auto; }

.glass-card {
    background: var(--card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(230,237,247,.95);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow);
}

.section-card {
    background: rgba(255,255,255,.96);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-soft);
    padding: 1.1rem;
}

.hero-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 1rem;
}

.hero-title {
    margin: 0;
    font-size: clamp(1.55rem, 2vw, 2.15rem);
    font-weight: 800;
    letter-spacing: -.03em;
}

.hero-subtitle {
    margin: .35rem 0 0;
    color: var(--muted);
    font-size: .95rem;
}

.top-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
    white-space: nowrap;
    margin-left: auto;
    font-weight: 700;
    color: var(--muted);
}

.top-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .5rem .8rem;
    border-radius: 999px;
    color: #334155;
}

.top-links a:hover,
.top-links a.active-link {
    background: #eaf0ff;
    color: var(--blue);
}

.sep { color: #94a3b8; }

.section-title {
    font-size: 1.08rem;
    font-weight: 800;
    margin-bottom: .95rem;
    color: #10213d;
}

.form-label {
    font-weight: 700;
    color: #24344d;
    font-size: .92rem;
    margin-bottom: .4rem;
}

.form-control,
.form-select {
    min-height: 50px;
    border-radius: 14px;
    border: 1px solid #dbe4f0;
    background: #fff;
    box-shadow: none;
    padding-left: .95rem;
    padding-right: .95rem;
    color: var(--text);
}

textarea.form-control {
    min-height: 104px;
    padding-top: .8rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #98b5ff;
    box-shadow: 0 0 0 .2rem rgba(37,99,235,.12);
}

.btn-modern {
    border: 0 !important;
    border-radius: 14px !important;
    min-height: 48px;
    padding: 0 1rem !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1.2 !important;
    white-space: nowrap;
    transition: transform .06s ease, opacity .2s ease, box-shadow .2s ease;
}

.btn-modern:active { transform: translateY(1px); }

.btn-primary-modern {
    background: linear-gradient(135deg, var(--blue), var(--blue2));
    color: #fff !important;
    box-shadow: 0 10px 22px rgba(37,99,235,.18);
}
.btn-primary-modern:hover { color: #fff !important; opacity: .96; }

.btn-secondary-modern {
    background: #667085;
    color: #fff !important;
}
.btn-secondary-modern:hover { color: #fff !important; background: #596578; }

.btn-danger-modern {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff !important;
}
.btn-danger-modern:hover { color: #fff !important; opacity: .96; }

.cargo-row {
    display: grid;
    grid-template-columns: 1fr 160px 115px;
    gap: 12px;
    align-items: end;
    margin-bottom: 12px;
}

.cargo-field, .cargo-price, .cargo-action {
    display: flex;
    flex-direction: column;
}

.price-display {
    min-height: 50px;
    border-radius: 14px;
    border: 1px solid #dbe4f0;
    background: linear-gradient(180deg, #f4f7ff 0%, #eef2ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #1e3a8a;
    white-space: nowrap;
}

.total-box-modern {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: .9rem;
    font-size: 1.08rem;
    font-weight: 800;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .42rem .75rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
    text-align: center;
}

.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-shipped { background: #fef3c7; color: #a16207; }
.badge-ready { background: #dcfce7; color: #15803d; }
.badge-default { background: #e2e8f0; color: #334155; }

.notice-success,
.notice-error,
.notice-info {
    border-radius: 16px;
    padding: 1rem 1.1rem;
    font-weight: 600;
}

.notice-success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.notice-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.notice-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.success-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}

.success-overlay.show { display: flex; }

.success-modal {
    width: 100%;
    max-width: 560px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(15,23,42,.2);
    padding: 26px 22px;
    text-align: center;
    border: 1px solid #e6edf7;
}

.success-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-size: 1.8rem;
    font-weight: 800;
}

.success-title {
    font-size: 1.45rem;
    font-weight: 800;
    margin-bottom: .5rem;
}

.success-text {
    color: var(--muted);
    margin-bottom: 1rem;
}

.bl-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .75rem 1rem;
    border-radius: 999px;
    background: #eef4ff;
    color: #1d4ed8;
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 1rem;
    word-break: break-word;
}

.muted { color: var(--muted); }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: .9rem;
}

.kpi-card {
    background: rgba(255,255,255,.94);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: .9rem 1rem;
    box-shadow: var(--shadow-soft);
}

.kpi-label {
    font-size: .84rem;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: .25rem;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
}

.filter-card { margin-bottom: .9rem; }

.order-card {
    background: rgba(255,255,255,.96);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    margin-bottom: .75rem;
}

.order-summary {
    padding: .85rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    min-height: 84px;
}

.order-summary:hover { background: #fbfdff; }

.order-main-lines {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
}

.order-bl {
    font-size: .98rem;
    font-weight: 800;
    line-height: 1.2;
    word-break: break-word;
}

.order-meta {
    color: #475569;
    font-size: .88rem;
    line-height: 1.25;
}

.order-small {
    color: #64748b;
    font-size: .8rem;
}

.order-right {
    text-align: right;
    min-width: 120px;
    flex-shrink: 0;
}

.order-total {
    margin-top: .35rem;
    font-size: 1rem;
    font-weight: 800;
}

.order-details {
    display: none;
    padding: 1rem;
    border-top: 1px solid #edf2f7;
    background: linear-gradient(180deg, #fcfdff 0%, #f8fbff 100%);
}

.order-card.active .order-details { display: block; }

.info-panel {
    background: #fff;
    border: 1px solid #e8eef7;
    border-radius: 15px;
    padding: .9rem;
    height: 100%;
}

.info-panel h6 {
    margin-bottom: .65rem;
    font-weight: 800;
}

.mini-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
}

.mini-table th,
.mini-table td {
    padding: .7rem .85rem;
    border-bottom: 1px solid #edf2f7;
    font-size: .9rem;
}

.mini-table th {
    background: #f8fbff;
    font-weight: 800;
}

.quick-status-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: .85rem;
}

.quick-status-wrap form { margin: 0; }
.quick-status-wrap .btn-modern {
    min-height: 40px;
    padding: 0 14px !important;
    font-size: .88rem;
}

.history-preview {
    margin-top: .9rem;
    padding-top: .8rem;
    border-top: 1px dashed #dbe4f0;
}

.history-list {
    position: relative;
    margin-top: .65rem;
    padding-left: 20px;
}

.history-list::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #d7e1ee;
}

.history-item {
    position: relative;
    padding-left: 18px;
    margin-bottom: 10px;
}

.history-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--blue2));
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #cdd8e7;
    position: absolute;
    left: -1px;
    top: 4px;
}

.history-card {
    background: #fff;
    border: 1px solid #e8eef7;
    border-radius: 12px;
    padding: .65rem .8rem;
    box-shadow: 0 6px 14px rgba(15,23,42,.04);
}

.history-date {
    font-size: .8rem;
    color: #64748b;
    margin-top: .3rem;
}

.pagination-modern {
    display: flex;
    gap: .45rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.pagination-modern a,
.pagination-modern span {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid #dbe4f0;
    background: #fff;
    color: #334155;
    font-weight: 800;
}

.pagination-modern .active {
    background: linear-gradient(135deg, var(--blue), var(--blue2));
    color: #fff;
    border-color: transparent;
}

.track-search-card { max-width: 900px; margin: 0 auto; }

.track-search-wrap {
    display: grid;
    grid-template-columns: 1fr 64px;
    gap: 10px;
}

.track-search-btn {
    min-height: 50px;
    border-radius: 14px;
    border: 0;
    background: linear-gradient(135deg, var(--blue), var(--blue2));
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
}

.track-result-card {
    background: rgba(255,255,255,.95);
    border: 1px solid #e8eef7;
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    padding: 1rem;
}

.timeline {
    position: relative;
    margin-top: 1rem;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #d7e1ee;
}

.timeline-item {
    position: relative;
    padding-left: 20px;
    margin-bottom: .85rem;
}

.timeline-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--blue2));
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #cdd8e7;
    position: absolute;
    left: -1px;
    top: 6px;
}

.timeline-card {
    background: #fff;
    border: 1px solid #e8eef7;
    border-radius: 14px;
    padding: .8rem .9rem;
    box-shadow: 0 8px 18px rgba(15,23,42,.04);
}

.timeline-date {
    font-size: .84rem;
    color: #64748b;
    margin-top: .35rem;
}

.login-wrap {
    max-width: 460px;
    margin: 60px auto 0;
}

.login-brand {
    text-align: center;
    margin-bottom: 1rem;
}

.login-brand h1 {
    margin: 0 0 .35rem;
    font-size: 1.8rem;
    font-weight: 800;
}

.login-brand p {
    margin: 0;
    color: var(--muted);
}

.spin {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 991px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-bar { flex-wrap: wrap; }
    .top-links { width: 100%; justify-content: flex-end; }
}

@media (max-width: 767px) {
    .page-shell { padding-top: 14px; }
    .main-wrap { padding: 0 10px; }
    .hero-bar { flex-direction: column; align-items: stretch; }
    .top-links {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        margin-left: 0;
    }
    .cargo-row { grid-template-columns: 1fr; }
    .track-search-wrap { grid-template-columns: 1fr; }
    .order-summary {
        flex-direction: column;
        align-items: flex-start;
        min-height: unset;
    }
    .order-right {
        text-align: left;
        min-width: 0;
    }
    .kpi-grid { grid-template-columns: 1fr; }
    .total-box-modern { justify-content: flex-start; }
}