/* ============================================================
   RashScan — Web App stylesheet
   Design system: warm cream / sage / deep forest green
   ============================================================ */

:root {
    --cream: #FAF7F2;
    --cream-deep: #F3EDE3;
    --white: #FFFFFF;
    --forest: #173B33;
    --forest-deep: #0F2B25;
    --sage: #3E7C6B;
    --sage-soft: #E4EDE8;
    --sage-mist: #EFF4F1;
    --ink: #1E2B27;
    --muted: #5C6B65;
    --faint: #8A968F;
    --amber: #D99A2B;
    --amber-soft: #F7EBD3;
    --coral: #D95E4C;
    --coral-soft: #F9E4E0;
    --line: #E7E0D4;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;

    --shadow-soft: 0 18px 44px -20px rgba(23, 59, 51, 0.22);
}

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

body {
    font-family: var(--font-body);
    background: var(--cream);
    color: var(--ink);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding-top: 72px;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; color: var(--forest); letter-spacing: -0.01em; line-height: 1.15; }

button { font-family: var(--font-body); }

.hidden { display: none !important; }

/* ---------- Navigation ---------- */

.app-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: rgba(250, 247, 242, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}

.app-nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: var(--forest);
    text-decoration: none;
}

.logo-img { width: 32px; height: 32px; border-radius: 9px; }

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

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--forest);
    background: transparent;
    border: 1.5px solid rgba(23, 59, 51, 0.22);
    border-radius: 999px;
    padding: 9px 18px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.18s ease;
}

.nav-btn:hover { border-color: var(--forest); background: rgba(23, 59, 51, 0.05); }

.nav-btn-secondary {
    border-color: transparent;
    color: var(--muted);
}

.nav-btn-secondary:hover { color: var(--forest); background: rgba(23, 59, 51, 0.05); border-color: transparent; }

/* ---------- Layout ---------- */

.app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 44px 24px 80px;
}

.view { display: none; animation: viewIn 0.35s ease; }
.view.active { display: block; }

@keyframes viewIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Scanner selection ---------- */

.select-head {
    text-align: center;
    max-width: 560px;
    margin: 20px auto 48px;
}

.select-head h1 { font-size: clamp(30px, 4.4vw, 42px); margin-bottom: 12px; }
.select-head p { color: var(--muted); font-size: 16.5px; }

.scanner-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 860px;
    margin: 0 auto;
}

.scanner-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 38px 34px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.scanner-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-soft);
    border-color: rgba(62, 124, 107, 0.4);
}

.scanner-icon {
    width: 58px; height: 58px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
}

.scanner-icon-rash { background: var(--sage-soft); color: var(--sage); }
.scanner-icon-product { background: var(--amber-soft); color: var(--amber); }

.scanner-card h2 { font-size: 23px; margin-bottom: 10px; }

.scanner-card > p {
    font-size: 15px;
    color: var(--muted);
    margin-bottom: 20px;
    flex: 1;
}

.scanner-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 26px;
}

.scanner-features span {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--sage);
    background: var(--sage-mist);
    border-radius: 999px;
    padding: 5px 12px;
}

.scanner-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    background: var(--forest);
    color: var(--cream);
    font-size: 15.5px;
    font-weight: 600;
    border: none;
    border-radius: 999px;
    padding: 14px 24px;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.scanner-btn:hover { background: var(--forest-deep); transform: translateY(-1px); }

.scanner-btn-alt {
    background: transparent;
    color: var(--forest);
    border: 1.5px solid rgba(23, 59, 51, 0.3);
}

.scanner-btn-alt:hover { background: rgba(23, 59, 51, 0.05); border-color: var(--forest); }

/* Stats */

.app-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    max-width: 720px;
    margin: 56px auto 0;
    border-top: 1px solid var(--line);
    padding-top: 36px;
}

.stat-item { text-align: center; border-left: 1px solid var(--line); padding: 0 14px; }
.stat-item:first-child { border-left: none; }

.stat-item h3 { font-size: 30px; }
.stat-item p { font-size: 13.5px; color: var(--muted); margin-top: 4px; }

/* ---------- Back button ---------- */

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 4px;
    margin-bottom: 22px;
    transition: color 0.15s ease, transform 0.15s ease;
}

.back-btn:hover { color: var(--forest); transform: translateX(-3px); }

/* ---------- Scanner views ---------- */

.scanner-content { max-width: 980px; margin: 0 auto; }

.scan-head { margin-bottom: 34px; }

.scan-head h1 { font-size: clamp(28px, 3.6vw, 38px); margin-bottom: 8px; }

.scanner-subtitle { color: var(--muted); font-size: 16px; }

.scan-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

/* Upload area */

.upload-area {
    background: var(--white);
    border: 2px dashed var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-area.drag-over {
    border-color: var(--sage);
    background: var(--sage-mist);
}

.upload-placeholder {
    padding: 46px 32px;
    text-align: center;
}

.upload-icon {
    width: 62px; height: 62px;
    border-radius: 18px;
    background: var(--sage-soft);
    color: var(--sage);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.upload-placeholder h3 { font-size: 20px; margin-bottom: 6px; }

.upload-placeholder > p { font-size: 14.5px; color: var(--muted); margin-bottom: 22px; }

.upload-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14.5px;
    font-weight: 600;
    background: var(--forest);
    color: var(--cream);
    border: 1.5px solid var(--forest);
    border-radius: 999px;
    padding: 11px 22px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.upload-btn:hover { background: var(--forest-deep); }

.upload-btn-secondary {
    background: transparent;
    color: var(--forest);
    border-color: rgba(23, 59, 51, 0.28);
}

.upload-btn-secondary:hover { background: rgba(23, 59, 51, 0.05); border-color: var(--forest); }

.upload-hint {
    margin-top: 20px;
    font-size: 12.5px;
    color: var(--faint);
}

.upload-preview {
    position: relative;
}

.upload-preview img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    display: block;
}

.remove-image {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(15, 43, 37, 0.75);
    color: var(--cream);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease;
}

.remove-image:hover { background: var(--coral); }

/* Photo tips */

.photo-tips {
    margin-top: 18px;
    background: var(--sage-mist);
    border-radius: var(--radius);
    padding: 18px 22px;
}

.tip-label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--sage);
    margin-bottom: 8px;
}

.photo-tips ul { list-style: none; }

.photo-tips li {
    font-size: 13.5px;
    color: var(--muted);
    padding: 3px 0 3px 18px;
    position: relative;
}

.photo-tips li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 12px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--sage);
}

/* Form */

.form-section {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 30px 28px;
}

.form-section h3 { font-size: 19px; margin-bottom: 22px; }

.form-group { margin-bottom: 20px; }
.form-group:last-child { margin-bottom: 0; }

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 8px;
}

.form-group label em { color: var(--coral); font-style: normal; }

.form-group .optional {
    font-weight: 500;
    color: var(--faint);
    font-size: 12.5px;
}

.form-group input[type="number"],
.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--ink);
    background: var(--cream);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 15px;
    transition: border-color 0.18s ease, background 0.18s ease;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--sage);
    background: var(--white);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--faint); }

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    background: var(--cream);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    cursor: pointer;
    font-weight: 500 !important;
    margin-bottom: 0 !important;
    transition: border-color 0.15s ease, background 0.15s ease;
    user-select: none;
}

.checkbox-label:hover { border-color: var(--sage); }

.checkbox-label:has(input:checked) {
    border-color: var(--sage);
    background: var(--sage-mist);
}

.checkbox-label input {
    accent-color: var(--sage);
    width: 16px; height: 16px;
    flex-shrink: 0;
}

.checkbox-label span { font-size: 14px; color: var(--ink); }

/* Analyze button */

.analyze-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 22px;
    background: var(--forest);
    color: var(--cream);
    font-size: 16.5px;
    font-weight: 600;
    border: none;
    border-radius: 999px;
    padding: 17px 28px;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.analyze-btn:hover:not(:disabled) { background: var(--forest-deep); transform: translateY(-1px); }

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

.analyze-note {
    text-align: center;
    font-size: 13px;
    color: var(--faint);
    margin-top: 12px;
}

/* Notes section (legacy support) */

.notes-section { margin-top: 20px; }

.notes-section label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.notes-section textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 15px;
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 15px;
}

/* ---------- Results ---------- */

.results-content { max-width: 720px; margin: 0 auto; }

.results-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.results-date {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--faint);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 14px;
}

.result-image-section {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: var(--shadow-soft);
}

.scan-image {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    display: block;
}

.image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 43, 37, 0.18), transparent 45%);
    pointer-events: none;
}

.assessment-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 34px 32px;
    margin-bottom: 20px;
}

.assessment-header { margin-bottom: 16px; }

.ai-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sage);
    background: var(--sage-soft);
    border-radius: 999px;
    padding: 6px 14px;
}

.condition-name {
    font-size: clamp(26px, 3.4vw, 34px);
    margin-bottom: 10px;
}

.condition-description {
    font-size: 15.5px;
    color: var(--muted);
    margin-bottom: 8px;
}

.product-brand {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--sage);
    margin-bottom: 12px;
}

/* Metrics */

.metrics-container {
    display: flex;
    align-items: stretch;
    gap: 22px;
    margin-top: 26px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}

.metric-item { flex: 1; min-width: 0; }

.metric-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 7px;
}

.metric-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 10px;
}

.metric-bar {
    height: 6px;
    border-radius: 999px;
    background: var(--cream-deep);
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.8s ease;
}

.metric-divider { width: 1px; background: var(--line); }

.status-badge {
    display: inline-block;
    font-size: 14px;
    font-weight: 700;
    border-radius: 999px;
    padding: 8px 18px;
    margin-top: 4px;
}

/* Safety rating (product) */

.safety-rating-container { margin: 18px 0; }

.safety-rating {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    border-radius: 999px;
    padding: 10px 24px;
}

.safety-icon { font-size: 19px; }

/* Info cards */

.info-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 26px 28px;
    margin-bottom: 16px;
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 15px;
}

.info-card-header h3 { font-size: 18px; }

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

.info-list li {
    font-size: 15px;
    color: var(--ink);
    padding: 7px 0 7px 26px;
    position: relative;
    border-bottom: 1px solid var(--cream-deep);
}

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

.info-list li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 16px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--sage);
}

.warning-card { border-color: rgba(217, 94, 76, 0.35); background: #FDF6F4; }

.warning-card .info-list li::before { background: var(--coral); }

/* Ingredients */

.ingredients-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.ingredient-tag {
    font-size: 13px;
    font-weight: 600;
    color: var(--sage);
    background: var(--sage-mist);
    border-radius: 999px;
    padding: 7px 15px;
}

.ingredient-tag.caution { color: #9A6B14; background: var(--amber-soft); }
.ingredient-tag.high, .ingredient-tag.avoid { color: #A93F2F; background: var(--coral-soft); }

.skin-types { display: flex; flex-wrap: wrap; gap: 9px; }

.skin-type-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--forest);
    background: var(--sage-soft);
    border-radius: 999px;
    padding: 7px 16px;
}

/* Disclaimer card */

.disclaimer-card {
    display: flex;
    gap: 16px;
    background: var(--cream-deep);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin: 24px 0;
}

.disclaimer-icon { font-size: 20px; flex-shrink: 0; }

.disclaimer-content h4 {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 700;
    color: var(--forest);
    margin-bottom: 4px;
}

.disclaimer-content p { font-size: 13.5px; color: var(--muted); line-height: 1.55; }

/* Result actions */

.result-actions {
    display: flex;
    gap: 14px;
    margin-top: 26px;
}

.action-btn {
    flex: 1;
    font-size: 15.5px;
    font-weight: 600;
    border-radius: 999px;
    padding: 15px 24px;
    cursor: pointer;
    transition: all 0.18s ease;
    border: 1.5px solid transparent;
}

.action-btn.primary {
    background: var(--forest);
    color: var(--cream);
}

.action-btn.primary:hover { background: var(--forest-deep); transform: translateY(-1px); }

.action-btn.secondary {
    background: transparent;
    color: var(--forest);
    border-color: rgba(23, 59, 51, 0.28);
}

.action-btn.secondary:hover { border-color: var(--forest); background: rgba(23, 59, 51, 0.04); }

/* ---------- History ---------- */

.history-content { max-width: 720px; margin: 0 auto; }

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

.history-header h1 { font-size: clamp(28px, 3.6vw, 36px); }

.clear-history-btn {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--coral);
    background: transparent;
    border: 1.5px solid rgba(217, 94, 76, 0.35);
    border-radius: 999px;
    padding: 9px 18px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.clear-history-btn:hover { background: var(--coral); color: var(--white); border-color: var(--coral); }

.history-tabs {
    display: inline-flex;
    gap: 6px;
    background: var(--cream-deep);
    border-radius: 999px;
    padding: 5px;
    margin-bottom: 26px;
}

.history-tab {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: none;
    border-radius: 999px;
    padding: 9px 22px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.history-tab.active {
    background: var(--forest);
    color: var(--cream);
}

.history-list { display: grid; gap: 14px; }

.history-item {
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 20px 16px 16px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    color: var(--faint);
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
    border-color: rgba(62, 124, 107, 0.4);
}

.history-image {
    width: 66px; height: 66px;
    border-radius: 14px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--cream-deep);
}

.history-image img { width: 100%; height: 100%; object-fit: cover; }

.history-info { flex: 1; min-width: 0; }

.history-info h3 {
    font-size: 17px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-info p { font-size: 13px; color: var(--faint); }

.history-confidence {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--sage);
    margin-top: 4px;
}

.empty-history {
    text-align: center;
    padding: 70px 20px;
    color: var(--faint);
}

.empty-history svg { margin: 0 auto 18px; opacity: 0.4; }

.empty-history h3 { font-size: 21px; margin-bottom: 6px; }

.empty-history p { font-size: 14.5px; }

/* ---------- Camera modal ---------- */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(15, 43, 37, 0.6);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show { display: flex; }

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: min(680px, 100%);
    overflow: hidden;
    animation: viewIn 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 26px;
    border-bottom: 1px solid var(--line);
}

.modal-header h2 { font-size: 20px; }

.modal-close {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--cream-deep);
    color: var(--muted);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.modal-close:hover { background: var(--coral-soft); color: var(--coral); }

.camera-container {
    background: var(--forest-deep);
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-container video { width: 100%; height: 100%; object-fit: cover; }

.camera-controls {
    display: flex;
    justify-content: center;
    gap: 14px;
    padding: 20px 26px;
}

.camera-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 15px;
    font-weight: 600;
    background: var(--forest);
    color: var(--cream);
    border: 1.5px solid var(--forest);
    border-radius: 999px;
    padding: 12px 28px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.camera-btn:hover { background: var(--forest-deep); }

.camera-btn-secondary {
    background: transparent;
    color: var(--forest);
    border-color: rgba(23, 59, 51, 0.28);
}

.camera-btn-secondary:hover { background: rgba(23, 59, 51, 0.05); }

/* ---------- Disclaimer footer ---------- */

.disclaimer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 44px;
}

.disclaimer p {
    background: var(--cream-deep);
    border-radius: var(--radius);
    padding: 18px 22px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
}

.disclaimer strong { color: var(--forest); }

/* ---------- Toasts ---------- */

.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translate(-50%, 80px);
    z-index: 300;
    background: var(--forest);
    color: var(--cream);
    font-size: 14.5px;
    font-weight: 500;
    border-radius: 999px;
    padding: 13px 26px;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 16px 40px -12px rgba(15, 43, 37, 0.45);
    max-width: min(90vw, 480px);
    text-align: center;
}

.toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

.toast-success { background: var(--sage); }
.toast-error { background: var(--coral); }

/* ---------- Loading overlay ---------- */

#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(250, 247, 242, 0.92);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
    max-width: 340px;
    padding: 24px;
}

.loading-spinner {
    width: 52px; height: 52px;
    margin: 0 auto 22px;
    border-radius: 50%;
    border: 4px solid var(--sage-soft);
    border-top-color: var(--sage);
    animation: spin 0.9s linear infinite;
}

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

.loading-message {
    font-size: 15.5px;
    font-weight: 500;
    color: var(--forest);
    white-space: pre-line;
    line-height: 1.6;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
    .scan-columns { grid-template-columns: 1fr; }
    .scanner-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .app-container { padding: 28px 18px 60px; }
    .nav-btn span { display: none; }
    .metrics-container { flex-direction: column; gap: 18px; }
    .metric-divider { width: 100%; height: 1px; }
    .result-actions { flex-direction: column; }
    .checkbox-group { grid-template-columns: 1fr; }
    .app-stats { grid-template-columns: 1fr; gap: 22px; }
    .stat-item { border-left: none; }
    .history-header { flex-wrap: wrap; gap: 12px; }
    .upload-placeholder { padding: 36px 20px; }
}
