:root {
    --bg-main: #f4f6fa;
    --panel-white: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --accent-indigo: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --accent-success: #10b981;
    --radius-m: 16px;
    --radius-s: 12px;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-main);
    color: var(--text-dark);
    padding-bottom: 90px;
}

.app-header {
    background: var(--panel-white);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header .logo {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-dark);
}

.app-header .logo span {
    color: #4f46e5;
}

.header-badge {
    background: #e0e7ff;
    color: #4338ca;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
}

.app-container {
    padding: 16px;
}

.tab-content {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.tab-content.active {
    display: flex;
}

.neo-card {
    background: var(--panel-white);
    border-radius: var(--radius-m);
    padding: 18px;
    box-shadow: var(--shadow-card);
    border: 1px solid #f1f5f9;
}

.neo-card h2 {
    font-size: 0.95rem;
    margin: 0 0 14px 0;
    color: var(--text-muted);
}

#reader-wrapper {
    background: #000;
    border-radius: var(--radius-s);
    overflow: hidden;
    position: relative;
    border: 2px solid #e2e8f0;
    height: 200px;
}

.viewport {
    width: 100%;
    height: 100%;
    position: relative;
}

.viewport video,
.viewport canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.scan-laser-line {
    position: absolute;
    top: 50%;
    left: 5%;
    width: 90%;
    height: 2px;
    background-color: #ef4444;
    z-index: 10;
    transform: translateY(-50%);
}

.scan-guide-frame {
    position: absolute;
    top: 24%;
    right: 8%;
    bottom: 24%;
    left: 8%;
    z-index: 9;
    border: 2px solid rgba(255, 255, 255, 0.82);
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.22);
    pointer-events: none;
}

.input-wrapper {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.input-wrapper input {
    flex: 3;
    height: 48px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-s);
    padding: 0 14px;
    font-size: 16px;
    background: #f8fafc;
}

#add-manual-btn {
    flex: 1;
    background: var(--text-dark);
    color: white;
    border: none;
    font-weight: 600;
    border-radius: var(--radius-s);
    cursor: pointer;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-success);
    border-radius: 50%;
}

.product-display-box {
    background: #f8fafc;
    border-radius: var(--radius-s);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.prod-main-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.prod-avatar {
    width: 65px;
    height: 65px;
    object-fit: contain;
    background: white;
    border-radius: var(--radius-s);
    border: 1px solid #e2e8f0;
}

.prod-meta-title-display {
    font-weight: 700;
    font-size: 1rem;
}

.prod-meta-jan {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.toggle-trigger-btn {
    width: 100%;
    height: 38px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-blue-light {
    background: #e0e7ff;
    color: #4338ca;
}

.btn-gray-light {
    background: #f1f5f9;
    color: var(--text-dark);
    margin-top: 4px;
}

.accordion-zone {
    display: none;
    padding: 10px;
    border-radius: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    margin-top: 4px;
}

.accordion-zone.open {
    display: block;
}

.detail-grid-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.form-field label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.form-field input,
.form-field textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.9rem;
    background: #f8fafc;
}

.history-title-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-text-danger {
    background: none;
    border: none;
    color: #ef4444;
    font-weight: 600;
    cursor: pointer;
}

.modern-history-card {
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: var(--radius-s);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #cbd5e1;
    cursor: pointer;
    margin-bottom: 8px;
}

.btn-submit-all {
    width: 100%;
    height: 52px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-m);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.pop-settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.price-input-container input {
    height: 40px;
    width: 120px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 0 10px;
}

.pop-settings select {
    height: 40px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: white;
    padding: 0 8px;
}

.btn-gradient {
    background: var(--accent-gradient);
    color: white;
    border: none;
    font-weight: 600;
    border-radius: 8px;
    height: 44px;
    cursor: pointer;
}

.pop-preview-box {
    background: #f1f5f9;
    padding: 16px;
    border-radius: var(--radius-s);
    margin-top: 14px;
}

.pop-out {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    color: black;
}

.pop-out.pop-staff {
    border: 2px dashed #94a3b8;
}

.pop-out.pop-donki {
    background: #ffea00;
    border: 4px solid #e60012;
}

.pop-out.pop-donki .p-t {
    font-size: 1.2rem;
    font-weight: 900;
    background: #000;
    color: #ffea00;
    padding: 4px;
}

.pop-out.pop-donki .p-p {
    font-size: 2.2rem;
    font-weight: 900;
    color: #e60012;
}

.pop-out.pop-super {
    border: 3px double #000;
}

.pop-out.pop-super .p-t {
    font-size: 1.1rem;
    font-weight: bold;
    border-bottom: 2px solid #000;
    text-align: left;
}

.pop-out.pop-super .p-p {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: right;
    color: #e60012;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: rgba(255, 255, 255, 0.94);
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    width: 45%;
    cursor: pointer;
}

.nav-item.active {
    color: #4f46e5;
}

.nav-icon {
    font-size: 1.2rem;
}

.nav-label {
    font-size: 0.75rem;
    font-weight: 600;
}

.scan-flash {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    opacity: 0;
    pointer-events: none;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 15px 0;
}

@media print {
    body * {
        visibility: hidden;
    }

    #pop-preview-area,
    #pop-preview-area * {
        visibility: visible;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}