:root {
    --primary: #059669;
    --primary-light: #10b981;
    --primary-dark: #047857;
    --secondary: #0ea5e9;
    --accent: #f59e0b;
    --background: #0f172a;
    --backgroundAlt: #1e293b;
    --surface: #1e293b;
    --surfaceHover: #334155;
    --text: #f8fafc;
    --textSecondary: #94a3b8;
    --textMuted: #64748b;
    --border: #334155;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --radius: 12px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: radial-gradient(ellipse at top, rgba(16, 185, 129, 0.15) 0%, transparent 60%);
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.auth-header p {
    color: var(--textSecondary);
    font-size: 0.9375rem;
}

.auth-form-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
}

.auth-form-container h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--textSecondary);
    font-size: 0.9375rem;
}

.auth-switch a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-icon.small {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--textSecondary);
}

.form-group input,
.form-group select {
    padding: 12px 14px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.2s;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group input::placeholder {
    color: var(--textMuted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    white-space: nowrap;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--gradient);
    color: white;
}

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

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:active {
    background: var(--surfaceHover);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-light);
    cursor: pointer;
    font-size: 0.8125rem;
    padding: 0;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--textMuted);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:active {
    background: var(--surfaceHover);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--textMuted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:active {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.btn-remove svg {
    width: 16px;
    height: 16px;
}

/* App Layout */
.app-page {
    display: flex;
    min-height: 100vh;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    align-items: center;
    gap: 12px;
    z-index: 100;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text);
    padding: 8px;
    cursor: pointer;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 200;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--textSecondary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s;
    font-size: 0.9375rem;
}

.nav-item:active {
    background: var(--surfaceHover);
    color: var(--text);
}

.nav-item.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary-light);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--surfaceHover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--textSecondary);
}

.user-avatar svg {
    width: 18px;
    height: 18px;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-details span {
    font-weight: 500;
    font-size: 0.875rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 24px;
}

.page {
    display: none;
    max-width: 600px;
    margin: 0 auto;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--textSecondary);
    font-size: 0.9375rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.stat-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }

.stat-icon svg {
    width: 22px;
    height: 22px;
}

.stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--textSecondary);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    gap: 16px;
}

.dashboard-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
}

.dashboard-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.top-list {
    list-style: none;
}

.top-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}

.top-list li:last-child {
    border-bottom: none;
}

.top-list li.empty {
    color: var(--textMuted);
    justify-content: center;
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Upload Card */
.upload-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

/* Scan Mode Selector */
.scan-mode-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.scan-mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--textSecondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.scan-mode-btn.active {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--primary);
    color: var(--primary-light);
}

/* Preview Grid */
.preview-container {
    margin-bottom: 12px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.preview-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
}

.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-thumb {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-container > .btn {
    display: block;
    width: 100%;
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:active {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.05);
}

.upload-area svg {
    width: 40px;
    height: 40px;
    color: var(--textMuted);
    margin-bottom: 12px;
}

.upload-text {
    color: var(--text);
    font-weight: 500;
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 0.8125rem;
    color: var(--textMuted);
}

.ocr-status {
    margin-top: 12px;
    padding: 10px;
    background: rgba(14, 165, 233, 0.1);
    border-radius: var(--radius);
    color: var(--secondary);
    text-align: center;
    font-size: 0.875rem;
}

/* Supermarket Card */
.supermarket-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.supermarket-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

/* Items Card */
.items-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

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

.items-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.items-empty {
    text-align: center;
    padding: 24px 16px;
    color: var(--textMuted);
    font-size: 0.9375rem;
}

.items-empty p {
    margin-bottom: 4px;
}

/* Item Card */
.item-card {
    background: var(--background);
    border-radius: var(--radius);
    padding: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.item-card.merged {
    border-color: var(--accent);
    animation: mergePulse 0.5s ease;
}

@keyframes mergePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); background: rgba(245, 158, 11, 0.1); }
    100% { transform: scale(1); }
}

.item-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.item-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.item-badge.ocr {
    background: rgba(14, 165, 233, 0.15);
    color: var(--secondary);
}

.item-badge.manual {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent);
}

.item-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.item-card-body input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9375rem;
}

.item-card-body input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

.item-row {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    gap: 8px;
    align-items: end;
}

.item-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-field label {
    font-size: 0.6875rem;
    color: var(--textMuted);
    text-transform: uppercase;
}

.item-field input {
    width: 100%;
    padding: 8px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9375rem;
    text-align: center;
}

.item-field input:focus {
    outline: none;
    border-color: var(--primary);
}

.item-field.total {
    text-align: right;
}

.item-field.total label {
    display: block;
}

.item-total {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-light);
    display: block;
    padding: 8px 0;
}

/* Summary Card */
.summary-card {
    background: var(--gradient);
    border-radius: var(--radius-lg);
    padding: 16px;
    color: white;
    margin-bottom: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.9375rem;
    opacity: 0.9;
}

.summary-row.total {
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    margin-top: 8px;
    padding-top: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    opacity: 1;
}

/* Actions Card */
.actions-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

/* Raw Text Section */
.raw-text-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.raw-text-section summary {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 500;
    color: var(--textSecondary);
}

.raw-text {
    padding: 0 16px 16px;
    font-size: 0.8125rem;
    color: var(--textMuted);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

/* Help Card */
.help-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.help-card h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--textSecondary);
}

.help-examples {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.help-example {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    flex-wrap: wrap;
}

.help-label {
    font-weight: 500;
    color: var(--textSecondary);
    min-width: 70px;
}

.help-example code {
    background: var(--background);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    color: var(--primary-light);
}

.help-desc {
    color: var(--textMuted);
    font-size: 0.75rem;
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 10px 14px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.search-box svg {
    width: 18px;
    height: 18px;
    color: var(--textMuted);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1rem;
}

.search-box input:focus {
    outline: none;
}

.search-box input::placeholder {
    color: var(--textMuted);
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.history-day {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

.history-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surfaceHover);
    border-bottom: 1px solid var(--border);
}

.history-date {
    font-weight: 600;
    font-size: 0.9375rem;
}

.history-day-total {
    font-weight: 700;
    color: var(--primary-light);
}

.history-day-items {
    padding: 8px;
}

.history-item {
    padding: 10px 12px;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.history-item:active {
    background: var(--surfaceHover);
}

.history-item-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.history-product {
    font-weight: 500;
    font-size: 0.9375rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-price {
    font-weight: 700;
    color: var(--primary-light);
    margin-left: 8px;
}

.history-item-details {
    display: flex;
    gap: 12px;
    font-size: 0.8125rem;
    color: var(--textMuted);
    margin-bottom: 6px;
}

.history-supermarket {
    color: var(--textSecondary);
}

.history-item-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.empty-state {
    text-align: center;
    color: var(--textMuted);
    padding: 40px 20px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

/* Settings */
.settings-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.settings-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.about-text {
    color: var(--textSecondary);
    font-size: 0.9375rem;
    margin-bottom: 8px;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.modal-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.9375rem;
    z-index: 2000;
    animation: toastIn 0.3s ease-out;
    max-width: 90%;
    text-align: center;
}

.toast-success {
    background: var(--success);
    color: white;
}

.toast-error {
    background: var(--error);
    color: white;
}

@keyframes toastIn {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Scrollbar */
.items-list::-webkit-scrollbar {
    width: 4px;
}

.items-list::-webkit-scrollbar-track {
    background: transparent;
}

.items-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* ===== DESKTOP LARGE (1200px+) ===== */
@media (min-width: 1200px) {
    .page {
        max-width: 720px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .item-row {
        grid-template-columns: 80px 1fr 100px auto;
    }
}

/* ===== TABLET (769px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
    }
    
    .page {
        max-width: 560px;
    }
}

/* ===== MOBILE (max-width: 768px) ===== */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 150;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding: 68px 16px 24px;
    }
    
    .page {
        max-width: 100%;
    }
    
    .page-header h1 {
        font-size: 1.375rem;
    }
    
    .page-header p {
        font-size: 0.875rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px;
        border-radius: var(--radius);
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }
    
    .stat-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .stat-value {
        font-size: 1.125rem;
    }
    
    .stat-label {
        font-size: 0.6875rem;
    }
    
    .item-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .item-field.total {
        grid-column: 1 / -1;
        text-align: left;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .upload-area {
        padding: 24px 16px;
    }
    
    .upload-area svg {
        width: 32px;
        height: 32px;
    }
    
    .scan-mode-btn {
        padding: 10px 10px;
        font-size: 0.75rem;
    }
    
    .scan-mode-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
    
    .history-item-main {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .history-item-details {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .search-box {
        padding: 8px 12px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-row {
        font-size: 0.875rem;
    }
    
    .summary-row.total {
        font-size: 1.125rem;
    }
    
    .modal-content {
        padding: 20px;
        max-width: 95%;
    }
    
    .price-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .price-history-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .timeline-item {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .timeline-date {
        width: auto;
    }
    
    .help-example {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .help-label {
        min-width: auto;
    }
    
    .nav-item {
        padding: 14px;
        font-size: 1rem;
    }
    
    .nav-item svg {
        width: 22px;
        height: 22px;
    }
    
    .sidebar-header {
        padding: 20px;
    }
    
    .sidebar-footer {
        padding: 16px;
    }
    
    .user-avatar {
        width: 40px;
        height: 40px;
    }
    
    .user-avatar svg {
        width: 20px;
        height: 20px;
    }
}

/* ===== SMALL MOBILE (max-width: 400px) ===== */
@media (max-width: 400px) {
    .main-content {
        padding: 64px 12px 16px;
    }
    
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .auth-form-container {
        padding: 16px;
    }
    
    .auth-header .logo {
        font-size: 1.25rem;
    }
    
    .btn-lg {
        padding: 12px 18px;
        font-size: 0.9375rem;
    }
    
    .item-row {
        grid-template-columns: 1fr;
    }
    
    .item-field input {
        text-align: left;
    }
    
    .scan-mode-selector {
        flex-direction: column;
    }
    
    .price-stats {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .price-stats .stat {
        padding: 8px;
    }
}
