:root {
    --primary: #f26622;
    /* Knuspr Brand Color */
    --bg: #f3f4f6;
    --text: #1f2937;
    --muted: #6b7280;
    --success: #10b981;
    --danger: #ef4444;
    --card-bg: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    overscroll-behavior-y: none;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

header {
    background: var(--primary);
    color: white;
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
    transition: padding 0.3s ease;
}

header.header-compact {
    padding: 0.5rem 1rem;
}

header.header-compact h1 {
    font-size: 1rem;
    gap: 0.5rem;
}

header.header-compact .header-logo {
    width: 28px;
    height: 28px;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: font-size 0.3s ease, gap 0.3s ease;
}

/* Views */
.view {
    display: none;
    padding: 1.5rem 1rem;
    flex: 1;
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* Login View */
.login-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-top: 2rem;
    text-align: center;
}

.login-card h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    text-align: left;
}

.login-card p {
    color: var(--muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: left;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(242, 102, 34, 0.2);
}

.header-logo {
    width: 50px;
    height: 50px;
    transition: width 0.3s ease, height 0.3s ease;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: #f9fafb;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.form-group-inline label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn:active {
    transform: scale(0.98);
}

.btn:hover {
    background: #e05e1f;
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-back {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    font-size: 0.9em;
    padding: 0.5rem 1rem;
}

.btn-back:hover {
    background: #f3f4f6;
}

/* Items View */
.items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.items-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress {
    background: #e5e7eb;
    color: var(--text);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.items-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-check-all {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--success);
    background: transparent;
    border: 1.5px solid var(--success);
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-check-all:hover {
    background: var(--success);
    color: white;
}

.btn-check-all:active {
    transform: scale(0.95);
}

.btn-check-all.btn-reset-all {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-check-all.btn-reset-all:hover {
    background: var(--primary);
    color: white;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 2rem;
    overflow-x: hidden;
}

.subtitle {
    color: var(--muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.swipe-container {
    position: relative;
    background: #d1d5db;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    touch-action: pan-y;
}

.swipe-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    font-weight: 600;
    color: white;
    font-size: 1rem;
    z-index: 1;
}

.bg-left {
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bg-right {
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.item-card {
    position: relative;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0s ease-out;
    will-change: transform;
    cursor: grab;
}

.item-card:active {
    cursor: grabbing;
}

.item-card.animating {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.item-card.static {
    margin-bottom: 0.75rem;
    opacity: 0.8;
}

.item-card.clickable {
    cursor: pointer;
    margin-bottom: 0.75rem;
}

.item-image {
    width: 50px;
    height: 50px;
    background: #f3f4f6;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.7rem;
    flex-shrink: 0;
}

.item-details {
    flex: 1;
    overflow: hidden;
    min-width: 0;
}

.item-details.with-action {
    display: flex;
    align-items: center;
    width: 100%;
}

.item-details .item-content {
    flex: 1;
    min-width: 0;
    padding-right: 0.5rem;
}

.item-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    color: var(--muted);
    font-size: 0.8rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: nowrap;
    align-items: center;
}

.item-amount {
    font-weight: 600;
    background: #f3f4f6;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
}

.amount-badge-high {
    display: inline-flex;
    align-items: center;
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    gap: 4px;
    letter-spacing: 0.5px;
}

.item-placeholder-img {
    width: 100%;
    height: 100%;
    background-color: #fceceb;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 600;
}

.item-img-full {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
}

.undo-btn {
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--text);
    flex-shrink: 0;
}

/* Delivered & Missing containers */
.status-section {
    margin-top: 1rem;
    display: none;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius);
}

.status-section.first {
    margin-top: 2rem;
}

.status-section summary {
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.status-section summary.delivered {
    color: var(--success);
}

.status-section summary.missing {
    color: var(--danger);
}

.status-items-wrapper {
    margin-top: 1rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--muted);
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-top: 1rem;
    display: none;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    color: var(--success);
}

.empty-state h3 {
    color: var(--text);
    margin-bottom: 0.5rem;
    font-size: 1.15rem;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1f2937;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Loader */
.loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    display: none;
    margin-right: 0.5rem;
}

.btn.loading .loader {
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Footer */
.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 0.7rem;
    color: var(--muted);
    border-top: 1px solid #e5e7eb;
    background: var(--card-bg);
    margin-top: auto;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.app-footer:hover {
    opacity: 1;
}

.build-info {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
}

/* Icons */
svg {
    display: block;
}