:root {
    --progress-bg: linear-gradient(180deg, #edf3ff 0%, #f7f9fd 38%, #f5f7fb 100%);
    --progress-shell-shadow: 0 22px 50px rgba(51, 65, 85, 0.12);
    --progress-card-shadow: 0 14px 28px rgba(148, 163, 184, 0.18);
    --progress-border-strong: rgba(148, 163, 184, 0.22);
    --progress-text-strong: #0f172a;
    --progress-text-muted: #64748b;
    --progress-surface: rgba(255, 255, 255, 0.88);
    --progress-panel: #ffffff;
    --progress-accent: #2563eb;
    --progress-accent-soft: rgba(37, 99, 235, 0.08);
    --progress-success: #059669;
    --progress-success-soft: rgba(5, 150, 105, 0.12);
    --progress-warning: #d97706;
    --progress-warning-soft: rgba(217, 119, 6, 0.14);
    --progress-danger: #dc2626;
    --progress-danger-soft: rgba(220, 38, 38, 0.12);
    --progress-radius: 1.2rem;
}

body {
    min-height: 100vh;
    background: var(--progress-bg);
    color: var(--progress-text-strong);
}

#app {
    min-height: 100vh;
}

.progress-app {
    min-height: 100vh;
    padding: 1rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}

.progress-shell {
    width: min(100%, 35rem);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.progress-card,
.progress-hero {
    border: 1px solid var(--progress-border-strong);
    border-radius: var(--progress-radius);
    backdrop-filter: blur(16px);
    box-shadow: var(--progress-card-shadow);
}

.progress-hero {
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 36%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.84));
    padding: 1rem;
}

.hero-back {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.28);
    color: var(--progress-text-strong);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
}

.hero-back:hover {
    background: #fff;
}

.hero-back-icon {
    line-height: 1;
}

.hero-copy {
    margin-top: 1rem;
}

.hero-eyebrow {
    display: inline-flex;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--progress-accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-copy h1 {
    margin-top: 0.9rem;
    font-size: 1.9rem;
    line-height: 1.15;
    color: var(--progress-text-strong);
}

.hero-copy p {
    margin-top: 0.75rem;
    font-size: 0.96rem;
    line-height: 1.7;
    color: var(--progress-text-muted);
}

.hero-quick-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.hero-switch-btn {
    flex: 1 1 0;
}

.progress-card {
    background: var(--progress-surface);
    padding: 1rem;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
}

.section-head h2 {
    font-size: 1.1rem;
    line-height: 1.25;
}

.section-head p {
    margin-top: 0.35rem;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--progress-text-muted);
}

.section-badge {
    flex: 0 0 auto;
    padding: 0.42rem 0.7rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--progress-text-muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.entry-tabs {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
}

.entry-tab {
    width: 100%;
    min-height: 4.9rem;
    padding: 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.9);
    text-align: left;
    color: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.entry-tab:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(37, 99, 235, 0.28);
}

.entry-tab.active {
    border-color: rgba(37, 99, 235, 0.45);
    background: rgba(37, 99, 235, 0.08);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.08);
}

.entry-tab.disabled,
.entry-tab:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.entry-tab-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
}

.entry-tab-text {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--progress-text-muted);
}

.entry-panel {
    margin-top: 1rem;
}

.upload-dropzone {
    border: 1.5px dashed rgba(37, 99, 235, 0.28);
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.14), transparent 32%),
        #fff;
    border-radius: 1.1rem;
    padding: 1.2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: rgba(37, 99, 235, 0.55);
    transform: translateY(-1px);
}

.upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 1rem;
    background: var(--progress-accent-soft);
    color: var(--progress-accent);
    font-size: 1.5rem;
    font-weight: 700;
}

.upload-title {
    margin-top: 0.95rem;
    font-size: 1rem;
    font-weight: 700;
}

.upload-text {
    margin-top: 0.55rem;
    color: var(--progress-text-muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

#qr-input {
    display: none;
}

.manual-label {
    display: inline-block;
    margin-bottom: 0.55rem;
    font-size: 0.9rem;
    font-weight: 700;
}

.manual-input {
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: rgba(255, 255, 255, 0.96);
    color: var(--progress-text-strong);
    font: inherit;
    line-height: 1.6;
    resize: vertical;
    min-height: 8rem;
}

.manual-input:focus {
    outline: 2px solid rgba(37, 99, 235, 0.18);
    border-color: rgba(37, 99, 235, 0.45);
}

.manual-note {
    margin-top: 0.6rem;
    color: var(--progress-text-muted);
    font-size: 0.82rem;
    line-height: 1.55;
}

.entry-actions,
.result-actions {
    margin-top: 0.9rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.entry-primary-btn,
.entry-secondary-btn {
    min-height: 3rem;
    padding: 0.85rem 1rem;
    flex: 1 1 0;
    border-radius: 0.95rem;
    font-weight: 700;
}

.entry-secondary-btn,
.detail-action-btn {
    background: rgba(248, 250, 252, 0.96);
}

.inline-feedback {
    margin-top: 1rem;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.inline-feedback strong {
    display: block;
    font-size: 0.94rem;
}

.inline-feedback p {
    margin-top: 0.25rem;
    color: var(--progress-text-muted);
    font-size: 0.84rem;
    line-height: 1.55;
}

.loading-card {
    background: rgba(37, 99, 235, 0.08);
}

.feedback-spinner {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.18);
    border-top-color: var(--progress-accent);
    animation: progress-spin 0.8s linear infinite;
    flex: 0 0 auto;
    margin-top: 0.15rem;
}

.feedback-icon {
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    flex: 0 0 auto;
    margin-top: 0.05rem;
}

.error-card {
    background: rgba(254, 242, 242, 0.96);
    border-color: rgba(248, 113, 113, 0.28);
}

.error-card .feedback-icon {
    background: rgba(220, 38, 38, 0.12);
    color: var(--progress-danger);
}

.result-stack {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.result-panel {
    background: var(--progress-panel);
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    padding: 1rem;
    box-shadow: 0 10px 24px rgba(148, 163, 184, 0.12);
}

.summary-main {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
}

.summary-copy h3,
.detail-head h3 {
    margin-top: 0.3rem;
    font-size: 1.08rem;
    line-height: 1.35;
}

.summary-copy p {
    margin-top: 0.45rem;
    color: var(--progress-text-muted);
    font-size: 0.84rem;
    line-height: 1.55;
}

.summary-label,
.result-label,
.deep-link-label {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--progress-text-muted);
    letter-spacing: 0.02em;
}

.status-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.15rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
}

.status-waiting {
    background: var(--progress-warning-soft);
    color: var(--progress-warning);
}

.status-processing {
    background: rgba(37, 99, 235, 0.12);
    color: var(--progress-accent);
}

.status-completed {
    background: var(--progress-success-soft);
    color: var(--progress-success);
}

.status-error {
    background: var(--progress-danger-soft);
    color: var(--progress-danger);
}

.progress-topline {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.75rem;
}

.progress-topline .status-pill {
    margin-bottom: 0.1rem;
}

.progress-topline strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 2rem;
    line-height: 1;
}

.progress-status {
    color: var(--progress-text-muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.progress-track {
    width: 100%;
    height: 1rem;
    margin-top: 1rem;
    border-radius: 999px;
    background: rgba(226, 232, 240, 0.92);
    overflow: hidden;
}

.progress-meter {
    height: 100%;
    border-radius: inherit;
    transition: width 0.35s ease;
}

.progress-meter.waiting {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.progress-meter.processing {
    background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.progress-meter.completed {
    background: linear-gradient(90deg, #059669, #34d399);
}

.progress-meter.error {
    background: linear-gradient(90deg, #dc2626, #f87171);
}

.progress-tip {
    margin-top: 0.85rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--progress-text-muted);
}

.detail-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
}

.detail-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.detail-action-btn {
    min-height: 2.5rem;
    padding: 0.65rem 0.9rem;
    border-radius: 0.85rem;
}

.detail-grid {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
}

.detail-item {
    padding: 0.8rem;
    border-radius: 0.95rem;
    background: rgba(248, 250, 252, 0.94);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.detail-item span {
    display: block;
    font-size: 0.74rem;
    color: var(--progress-text-muted);
}

.detail-item strong {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.88rem;
    line-height: 1.45;
    word-break: break-word;
}

.deep-link-card {
    margin-top: 1rem;
    padding: 0.9rem;
    border-radius: 0.95rem;
    background: rgba(241, 245, 249, 0.9);
}

.deep-link-value {
    margin-top: 0.55rem;
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--progress-text-strong);
    word-break: break-all;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.deep-link-value.expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.empty-state {
    margin-top: 1rem;
    padding: 1.2rem 1rem;
    border-radius: 1rem;
    background: #fff;
    border: 1px dashed rgba(148, 163, 184, 0.26);
    text-align: left;
}

.empty-state-icon {
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.08);
    color: var(--progress-accent);
    font-size: 1.15rem;
    font-weight: 700;
}

.empty-state h3 {
    margin-top: 0.8rem;
    font-size: 1.05rem;
}

.empty-state p {
    margin-top: 0.45rem;
    color: var(--progress-text-muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

.empty-state-list {
    margin-top: 0.9rem;
    padding-left: 1.15rem;
    color: var(--progress-text-muted);
    font-size: 0.86rem;
    line-height: 1.7;
}

.empty-state-actions {
    margin-top: 1rem;
}

.scanner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 2000;
}

.scanner-container {
    width: min(100%, 31rem);
    background: #ffffff;
    border-radius: 1.2rem;
    overflow: hidden;
    box-shadow: var(--progress-shell-shadow);
}

.scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.scanner-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.scanner-subtitle {
    margin-top: 0.35rem;
    color: var(--progress-text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.scanner-close {
    min-width: 2.6rem;
    min-height: 2.6rem;
    border: none;
    border-radius: 0.85rem;
    background: rgba(241, 245, 249, 0.9);
    color: var(--progress-text-strong);
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
}

.scanner-body {
    padding: 1rem;
}

.scanner-viewfinder {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 1rem;
    background: #020617;
}

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

.scanner-frame {
    position: absolute;
    inset: 12%;
    pointer-events: none;
}

.scanner-corner {
    position: absolute;
    width: 1.35rem;
    height: 1.35rem;
    border-color: #60a5fa;
    border-style: solid;
}

.scanner-corner-tl {
    top: 0;
    left: 0;
    border-width: 3px 0 0 3px;
}

.scanner-corner-tr {
    top: 0;
    right: 0;
    border-width: 3px 3px 0 0;
}

.scanner-corner-bl {
    bottom: 0;
    left: 0;
    border-width: 0 0 3px 3px;
}

.scanner-corner-br {
    right: 0;
    bottom: 0;
    border-width: 0 3px 3px 0;
}

.scanner-line {
    position: absolute;
    top: 16%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #93c5fd, transparent);
    box-shadow: 0 0 18px rgba(147, 197, 253, 0.8);
    animation: scan-line 2.2s ease-in-out infinite;
}

.scanner-tips {
    margin-top: 0.85rem;
    color: var(--progress-text-muted);
    font-size: 0.84rem;
    line-height: 1.55;
}

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

@keyframes scan-line {
    0%,
    100% {
        top: 14%;
    }
    50% {
        top: 82%;
    }
}

@media (max-width: 640px) {
    .progress-app {
        padding: 0.85rem;
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
    }

    .hero-copy h1 {
        font-size: 1.65rem;
    }

    .entry-tabs {
        grid-template-columns: 1fr;
    }

    .summary-main,
    .detail-head,
    .progress-topline {
        flex-direction: column;
        align-items: flex-start;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .entry-actions,
    .result-actions,
    .detail-actions,
    .hero-quick-actions {
        flex-direction: column;
    }

    .entry-primary-btn,
    .entry-secondary-btn,
    .detail-action-btn,
    .hero-switch-btn {
        width: 100%;
    }

    .scanner-overlay {
        padding: 0.7rem;
    }
}

@media (min-width: 900px) {
    .progress-app {
        padding: 1.4rem;
    }

    .progress-shell {
        width: min(100%, 38rem);
    }
}
