*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: 'Raleway', sans-serif;
    background: linear-gradient(145deg, #f4f6f8 0%, #e8ecf1 50%, #dce3ea 100%);
    color: #2a2a2a;
    min-height: 100vh;
}

/* Header */
.header {
    background: #0075BF;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,60,120,0.15);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
}

.header-title {
    font-family: 'Raleway', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    letter-spacing: 0.5px;
}

.header-subtitle {
    font-size: 10px;
    color: rgba(255,255,255,0.65);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.header-buttons {
    display: flex;
    gap: 6px;
}

.tab-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.25);
    background: transparent;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 12px;
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.tab-btn.active-input {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-color: rgba(255,255,255,0.4);
}

.tab-btn.active-result {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-color: rgba(255,255,255,0.4);
}

.tab-btn.disabled {
    opacity: 0.35;
    cursor: default;
}

/* Content area */
.content-area {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.flex-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e0e4e8;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.card-mb {
    margin-bottom: 16px;
}

.card-header-label {
    font-size: 11px;
    color: #0075BF;
    letter-spacing: 2px;
    margin-bottom: 16px;
    text-transform: uppercase;
    font-weight: 700;
}

.card-header-label-sm {
    font-size: 11px;
    color: #0075BF;
    letter-spacing: 2px;
    margin-bottom: 12px;
    text-transform: uppercase;
    font-weight: 700;
}

/* Truck config */
.col-left {
    flex: 1 1 320px;
    min-width: 300px;
}

.col-right {
    flex: 2 1 400px;
    min-width: 300px;
}

.input-text {
    width: 100%;
    padding: 9px 12px;
    border-radius: 6px;
    border: 1px solid #cdd3da;
    background: #f8f9fb;
    color: #2a2a2a;
    font-size: 14px;
    font-family: 'Raleway', sans-serif;
    margin-bottom: 12px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.input-text:focus {
    outline: none;
    border-color: #0075BF;
    box-shadow: 0 0 0 2px rgba(0,117,191,0.12);
}

.dim-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.dim-label {
    font-size: 10px;
    color: #7a8a9a;
    margin-bottom: 4px;
    font-weight: 600;
}

.input-number {
    width: 100%;
    padding: 9px 10px;
    border-radius: 6px;
    border: 1px solid #cdd3da;
    background: #f8f9fb;
    color: #2a2a2a;
    font-size: 14px;
    font-family: 'Raleway', sans-serif;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.input-number:focus {
    outline: none;
    border-color: #0075BF;
    box-shadow: 0 0 0 2px rgba(0,117,191,0.12);
}

.volume-badge {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(0,117,191,0.08);
    border-radius: 6px;
    font-size: 12px;
    color: #0075BF;
    font-weight: 600;
    border: 1px solid rgba(0,117,191,0.15);
}

/* Stats */
.stats-body {
    font-size: 13px;
    line-height: 2;
}

.color-orange { color: #e07800; }
.color-blue { color: #0075BF; }
.color-green { color: #3a9a3e; }
.color-red { color: #d03030; }

/* Items list */
.items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.btn-add {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid rgba(0,117,191,0.3);
    background: rgba(0,117,191,0.06);
    color: #0075BF;
    cursor: pointer;
    font-size: 12px;
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-add:hover {
    background: rgba(0,117,191,0.12);
    border-color: rgba(0,117,191,0.5);
}

.items-col-headers {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    font-size: 10px;
    color: #8a96a3;
    padding: 0 4px;
    font-weight: 600;
}

.item-row {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
    align-items: center;
}

.color-dot {
    width: 6px;
    height: 6px;
    border-radius: 2px;
    flex-shrink: 0;
}

.item-input-name {
    flex: 2;
    padding: 8px 8px;
    border-radius: 5px;
    border: 1px solid #d8dde3;
    background: #f8f9fb;
    color: #2a2a2a;
    font-size: 12px;
    font-family: 'Raleway', sans-serif;
    min-width: 0;
    transition: border-color 0.2s;
}

.item-input-name:focus {
    outline: none;
    border-color: #0075BF;
    box-shadow: 0 0 0 2px rgba(0,117,191,0.12);
}

.item-input-num {
    flex: 1;
    padding: 8px 6px;
    border-radius: 5px;
    border: 1px solid #d8dde3;
    background: #f8f9fb;
    color: #2a2a2a;
    font-size: 12px;
    font-family: 'Raleway', sans-serif;
    min-width: 0;
    transition: border-color 0.2s;
}

.item-input-num:focus {
    outline: none;
    border-color: #0075BF;
    box-shadow: 0 0 0 2px rgba(0,117,191,0.12);
}

.item-input-qty {
    flex: 0.7;
    padding: 8px 6px;
    border-radius: 5px;
    border: 1px solid #d8dde3;
    background: #f8f9fb;
    color: #2a2a2a;
    font-size: 12px;
    font-family: 'Raleway', sans-serif;
    min-width: 0;
    transition: border-color 0.2s;
}

.item-input-qty:focus {
    outline: none;
    border-color: #0075BF;
    box-shadow: 0 0 0 2px rgba(0,117,191,0.12);
}

.btn-remove {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    border: 1px solid #e8d0d0;
    background: #fdf2f2;
    color: #d03030;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: #f8dada;
    border-color: #d9a0a0;
}

.btn-solve {
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    border-radius: 8px;
    border: none;
    background: #0075BF;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Raleway', sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,60,120,0.2);
}

.btn-solve:hover {
    background: #005f9c;
    box-shadow: 0 4px 14px rgba(0,60,120,0.3);
}

/* Truck selector */
.truck-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.truck-selector-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #cdd3da;
    background: #fff;
    color: #555;
    cursor: pointer;
    font-size: 12px;
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.truck-selector-btn:hover {
    border-color: #0075BF;
    color: #0075BF;
    background: rgba(0,117,191,0.04);
}

.truck-selector-btn.active {
    background: #0075BF;
    color: #fff;
    border-color: #0075BF;
    box-shadow: 0 2px 6px rgba(0,117,191,0.3);
}

/* Result view */
.col-3d {
    flex: 2 1 500px;
    min-width: 300px;
}

.col-instructions {
    flex: 1 1 300px;
    min-width: 280px;
}

.viewer-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e4e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fb;
}

.viewer-label {
    font-size: 11px;
    color: #7a8a9a;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 600;
}

.viewer-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    font-weight: 600;
}

.viewer-container {
    height: 420px;
}

.card-no-pad {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e0e4e8;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* Utilization bar */
.util-card {
    margin-top: 12px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e0e4e8;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.util-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 8px;
}

.util-bar-bg {
    height: 8px;
    background: #e8ecf1;
    border-radius: 4px;
    overflow: hidden;
}

.util-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Instructions */
.instructions-note {
    font-size: 11px;
    color: #7a8a9a;
    margin-bottom: 12px;
}

.instructions-list {
    max-height: 480px;
    overflow-y: auto;
}

.instruction-item {
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 6px;
    background: #f4f6f8;
    border: 1px solid #e4e8ec;
    cursor: pointer;
    transition: all 0.2s;
}

.instruction-item:hover {
    background: #edf1f5;
    border-color: #c8d0d8;
}

.instruction-item.selected {
    background: rgba(0,117,191,0.08);
    border: 1px solid rgba(0,117,191,0.3);
}

.instruction-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.instruction-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.instruction-name {
    font-size: 13px;
    font-weight: 600;
    color: #2a2a2a;
}

.instruction-details {
    font-size: 11px;
    color: #7a8a9a;
    padding-left: 18px;
    line-height: 1.6;
}

/* Failed items */
.failed-box {
    margin-top: 16px;
    padding: 12px;
    border-radius: 6px;
    background: #fdf2f2;
    border: 1px solid #f0d0d0;
}

.failed-title {
    font-size: 12px;
    color: #d03030;
    font-weight: 700;
    margin-bottom: 6px;
}

.failed-item {
    font-size: 11px;
    color: #a04040;
    line-height: 1.8;
}

/* Flex helpers */
.flex-2 { flex: 2; }
.flex-1 { flex: 1; }
.flex-07 { flex: 0.7; }
.w-28 { width: 28px; }

/* Blazor error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #333;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
