:root {
    --orders-border: color-mix(in srgb, var(--apf-border, #d8dee7) 80%, #fff 20%);
    --orders-soft: var(--apf-text-secondary, #667085);
}

.orders-main {
    gap: 18px;
}

.orders-header {
    align-items: flex-start;
    gap: 16px;
}

.orders-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.orders-search {
    min-width: 280px;
    flex: 1;
}

.orders-inline-note {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: linear-gradient(135deg, rgba(0,94,184,0.08), rgba(0,94,184,0.02));
    border: 1px solid rgba(0,94,184,0.14);
    border-radius: 16px;
    padding: 14px 16px;
}

.orders-sector-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.orders-sector-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--orders-border);
    background: var(--apf-surface, #fff);
    color: var(--apf-text-primary, #111827);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
}

.orders-sector-tab:hover {
    border-color: #005EB8;
    box-shadow: 0 0 0 1px rgba(0,94,184,0.12);
}

.orders-sector-tab.is-active {
    background: rgba(0,94,184,0.12);
    color: #005EB8;
    border-color: rgba(0,94,184,0.35);
}

.orders-sector-tab-count {
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(100,116,139,0.14);
    color: #475569;
}

.orders-sector-tab.is-active .orders-sector-tab-count {
    background: rgba(0,94,184,0.16);
    color: #005EB8;
}

.orders-kpi-grid,
.orders-action-grid,
.orders-workspace-grid,
.orders-lower-grid,
.orders-stat-grid {
    display: grid;
    gap: 16px;
}

.orders-kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.orders-kpi-card,
.orders-action-card,
.orders-company-item,
.orders-priority-item,
.orders-route-item,
.orders-upload-item,
.orders-table-card {
    border: 1px solid var(--orders-border);
    background: var(--apf-surface, #fff);
    border-radius: 16px;
}

.orders-kpi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.orders-kpi-icon,
.orders-action-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: rgba(255,255,255,0.75);
}

.orders-kpi-body {
    display: grid;
    gap: 4px;
}

.orders-kpi-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.orders-kpi-label,
.orders-action-text,
.orders-company-meta,
.orders-priority-text,
.orders-compact-meta,
.orders-upload-note,
.orders-empty-note {
    font-size: 13px;
    color: var(--orders-soft);
}

.orders-action-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.orders-action-card {
    display: grid;
    gap: 8px;
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.orders-action-card:hover,
.orders-company-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.orders-action-title,
.orders-company-name,
.orders-priority-title,
.orders-compact-title {
    font-size: 18px;
    font-weight: 700;
}

.orders-workspace-grid,
.orders-lower-grid {
    grid-template-columns: 1.1fr 1fr 1fr;
}

.orders-card {
    background: transparent;
}

.orders-company-list,
.orders-priority-list,
.orders-upload-center,
.orders-list-compact {
    display: grid;
    gap: 12px;
}

.orders-company-item,
.orders-priority-item,
.orders-route-item,
.orders-upload-item {
    padding: 14px 16px;
}

.orders-company-item {
    cursor: pointer;
}

.orders-company-item.is-active {
    border-color: #005EB8;
    box-shadow: inset 0 0 0 1px rgba(0,94,184,0.18);
}

.orders-company-top,
.orders-priority-top,
.orders-compact-top,
.orders-upload-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 4px;
}

.orders-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.orders-tag.is-blue { background: rgba(59,130,246,0.12); color: #1d4ed8; }
.orders-tag.is-green { background: rgba(34,197,94,0.12); color: #15803d; }
.orders-tag.is-orange { background: rgba(245,158,11,0.14); color: #b45309; }
.orders-tag.is-red { background: rgba(239,68,68,0.12); color: #b91c1c; }
.orders-tag.is-slate { background: rgba(100,116,139,0.12); color: #475569; }
.orders-tag.is-purple { background: rgba(168,85,247,0.14); color: #7e22ce; }

.orders-priority-item {
    border-left: 4px solid #f59e0b;
}

.orders-priority-item.is-danger { border-left-color: #ef4444; }
.orders-priority-item.is-ok { border-left-color: #22c55e; }
.orders-priority-item.is-info { border-left-color: #3b82f6; }

.orders-stat-grid {
    grid-template-columns: repeat(2, 1fr);
}

.orders-mini-stat {
    border: 1px solid var(--orders-border);
    border-radius: 14px;
    padding: 14px;
    background: color-mix(in srgb, var(--apf-surface, #fff) 92%, #eff4fb 8%);
}

.orders-mini-stat-label {
    font-size: 12px;
    color: var(--orders-soft);
    margin-bottom: 6px;
}

.orders-mini-stat-value {
    font-size: 24px;
    font-weight: 700;
}

.orders-upload-center {
    min-height: 100%;
}

.orders-upload-help {
    border: 1px dashed rgba(0,94,184,0.22);
    border-radius: 16px;
    padding: 16px;
    background: color-mix(in srgb, var(--apf-surface, #fff) 96%, #eef5ff 4%);
}

.orders-upload-help code {
    display: inline-block;
    margin: 4px 6px 0 0;
}

.orders-table-card {
    padding-bottom: 2px;
}

.orders-table-wrap {
    overflow: auto;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
}

.orders-table th,
.orders-table td {
    padding: 12px 14px;
    border-top: 1px solid var(--orders-border);
    text-align: left;
    vertical-align: top;
}

.orders-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--orders-soft);
    background: color-mix(in srgb, var(--apf-surface, #fff) 92%, #eff4fb 8%);
}

.orders-order-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.orders-order-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(0,94,184,0.12);
    color: #005EB8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.orders-order-title {
    font-weight: 700;
}

.orders-order-sub {
    font-size: 12px;
    color: var(--orders-soft);
}

.orders-row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.orders-statusbar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    border-top: 1px solid var(--orders-border);
    background: color-mix(in srgb, var(--apf-surface, #fff) 90%, #eaf2fb 10%);
    color: var(--orders-soft);
    font-size: 12px;
}

.tone-blue { border-top: 4px solid #3b82f6; }
.tone-green { border-top: 4px solid #22c55e; }
.tone-sky { border-top: 4px solid #38bdf8; }
.tone-purple { border-top: 4px solid #a855f7; }
.tone-orange { border-top: 4px solid #f59e0b; }
.tone-red { border-top: 4px solid #ef4444; }
.tone-dark { border-top: 4px solid #334155; }

@media (max-width: 1200px) {
    .orders-workspace-grid,
    .orders-lower-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .orders-actions {
        justify-content: stretch;
    }

    .orders-search {
        min-width: 100%;
    }
}

@media (max-width: 640px) {
    .orders-kpi-grid,
    .orders-action-grid,
    .orders-stat-grid {
        grid-template-columns: 1fr;
    }

    .orders-statusbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
