:root {
    --bg-primary: #0f0f0f;
    --bg-card: #1a1a1a;
    --bg-input: #252525;
    --accent: #ff4d6a;
    --accent-dark: #d63a56;
    --accent-glow: rgba(255, 77, 106, 0.3);
    --text-primary: #f4f4f4;
    --text-secondary: #9a9a9a;
    --text-muted: #626262;
    --border: #333;
    --success: #4ecdc4;
    --warning: #ffe66d;
    --error: #ff6b6b;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "DM Sans", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 18% 16%, rgba(255, 77, 106, 0.07) 0%, transparent 46%),
        radial-gradient(ellipse at 84% 82%, rgba(78, 205, 196, 0.05) 0%, transparent 48%);
    pointer-events: none;
}

.app-shell {
    position: relative;
    z-index: 1;
    width: min(860px, calc(100% - 32px));
    margin: 0 auto;
    padding: 44px 0 72px;
}

.app-header {
    text-align: center;
    margin-bottom: 34px;
}

.app-header h1 {
    margin: 0;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(2.2rem, 7vw, 3.6rem);
    line-height: 1;
    font-weight: 900;
    letter-spacing: 0;
    background: linear-gradient(135deg, var(--accent), #ff8fa3 48%, var(--success));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.app-header p {
    margin: 10px 0 0;
    color: var(--text-secondary);
    font-size: 1.02rem;
}

.panel {
    position: relative;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 22px;
}

.panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--success));
}

.panel-label {
    margin-bottom: 14px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sku-entry {
    display: flex;
    gap: 10px;
}

.sku-entry input {
    flex: 1;
    min-width: 0;
    height: 52px;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    font: 600 1rem "DM Sans", Arial, sans-serif;
    outline: none;
}

.sku-entry input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.sku-entry button {
    height: 52px;
    padding: 0 24px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font: 800 1rem "DM Sans", Arial, sans-serif;
    cursor: pointer;
}

.sku-entry button:hover {
    background: var(--accent-dark);
}

.sku-entry button:disabled {
    background: #444;
    cursor: wait;
}

.sku-hint {
    margin: 9px 0 16px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.lookup-spinner {
    display: none;
    align-items: center;
    gap: 9px;
    margin: 0 0 14px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.lookup-spinner.active {
    display: flex;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1s ease-in-out infinite;
}

.dot:nth-child(2) {
    animation-delay: 0.15s;
}

.dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes pulse {
    0%, 100% { opacity: 0.32; transform: scale(0.82); }
    50% { opacity: 1; transform: scale(1.18); }
}

#status {
    display: none;
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.92rem;
}

#status.info {
    display: block;
    color: var(--accent);
    background: rgba(255, 77, 106, 0.08);
    border-color: rgba(255, 77, 106, 0.2);
}

#status.error {
    display: block;
    color: var(--error);
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.25);
}

.item-list {
    list-style: none;
    margin: 18px 0 0;
    padding: 0;
}

.item-list:empty::after {
    content: "No items added yet";
    display: block;
    padding: 28px 0;
    color: var(--text-muted);
    text-align: center;
}

.item-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    padding: 16px;
    margin-bottom: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.item-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.sku-badge {
    padding: 4px 9px;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    font-size: 0.76rem;
    font-weight: 800;
}

.item-name {
    min-width: 0;
    font-weight: 800;
    font-size: 1rem;
}

.variation {
    color: var(--text-secondary);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.item-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(74px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.item-metrics span,
.totals-grid span {
    display: block;
    margin-bottom: 3px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.item-metrics strong {
    font-size: 0.98rem;
    color: var(--text-primary);
}

.item-metrics strong.price,
.totals-grid strong {
    color: var(--success);
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    font: 800 1rem/1 "DM Sans", Arial, sans-serif;
    cursor: pointer;
}

.qty-btn:hover {
    border-color: var(--text-secondary);
    background: #303030;
}

.qty-value {
    min-width: 24px;
    color: var(--warning);
    font-size: 0.94rem;
    font-weight: 800;
    text-align: center;
}

.remove-item,
#clearAll {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font: 800 1.4rem/1 "DM Sans", Arial, sans-serif;
}

.remove-item {
    align-self: start;
}

.remove-item:hover,
#clearAll:hover {
    color: var(--error);
}

.list-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px 0;
    color: var(--text-secondary);
    font-size: 0.86rem;
}

#clearAll {
    font-size: 0.86rem;
}

.totals-block {
    margin-top: 18px;
}

.totals-label {
    margin-bottom: 10px;
}

.totals-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.totals-grid div {
    min-height: 104px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
}

.totals-grid strong {
    display: block;
    font-size: clamp(1.34rem, 3vw, 1.8rem);
    line-height: 1.1;
}

.totals-grid small {
    display: block;
    margin-top: 7px;
    color: #b8b8b8;
    font-size: 0.88rem;
    font-weight: 600;
}

@media (max-width: 720px) {
    .app-shell {
        width: min(100% - 24px, 860px);
        padding-top: 28px;
    }

    .panel {
        padding: 24px 18px;
    }

    .item-card,
    .totals-grid {
        grid-template-columns: 1fr;
    }

    .item-card {
        padding-right: 16px;
    }

    .item-actions {
        justify-content: space-between;
    }

    .item-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 440px) {
    .sku-entry {
        flex-direction: column;
    }

    .sku-entry button {
        width: 100%;
    }

    .item-metrics {
        grid-template-columns: 1fr;
    }
}
