/* ── reset ── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans SC",sans-serif;
     background:#f0f4f8;color:#1a1a2e;line-height:1.6;min-height:100vh}

/* ── auth modal ── */
.modal{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.5);
       display:flex;align-items:center;justify-content:center;z-index:1000}
.modal-content{background:#fff;border-radius:16px;padding:2rem;width:90%;max-width:380px;
               box-shadow:0 20px 60px rgba(0,0,0,.2)}
.modal-content h2{font-size:1.4rem;margin-bottom:1.2rem;text-align:center;color:#0d47a1}
.modal-content input{display:block;width:100%;padding:.7rem .9rem;margin-bottom:.8rem;
                      border:1px solid #ddd;border-radius:8px;font-size:.95rem}
.modal-content input:focus{outline:none;border-color:#1a73e8;box-shadow:0 0 0 2px rgba(26,115,232,.15)}
.auth-toggle{text-align:center;font-size:.85rem;color:#666;margin-top:.8rem}
.auth-toggle a{color:#1a73e8;text-decoration:none;font-weight:600}
.auth-error{text-align:center;color:#c62828;font-size:.85rem;margin-top:.5rem;min-height:1.2em}

/* ── header ── */
header{background:linear-gradient(135deg,#1a73e8,#0d47a1);color:#fff;text-align:center;padding:1.5rem 1rem}
.header-row{display:flex;justify-content:space-between;align-items:center;max-width:900px;margin:0 auto}
.logo{font-size:2rem;font-weight:700;letter-spacing:2px}
.subtitle{font-size:.95rem;opacity:.85;margin-top:.2rem}

/* ── auth buttons ── */
.auth-buttons{display:flex;gap:.5rem}
.btn-header{padding:.45rem 1rem;border-radius:8px;border:1px solid rgba(255,255,255,.5);
            background:transparent;color:#fff;font-size:.85rem;cursor:pointer;transition:all .2s}
.btn-header:hover{background:rgba(255,255,255,.15)}
.btn-header.btn-register{background:rgba(255,255,255,.2);font-weight:600}
.user-info{display:flex;align-items:center;gap:.6rem;font-size:.9rem}
.user-info .btn-sm{background:rgba(255,255,255,.2);color:#fff;border:1px solid rgba(255,255,255,.4)}

/* ── feature section ── */
.feature-card h2{margin-bottom:1rem}
.feature-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:1rem;margin-bottom:1rem}
.feature-item{background:#f8fafc;border-radius:10px;padding:1rem;text-align:center}
.feature-icon{font-size:2rem;display:block;margin-bottom:.3rem}
.feature-item h3{font-size:.95rem;color:#0d47a1;margin-bottom:.3rem}
.feature-item p{font-size:.8rem;color:#666}
.feature-item.clickable{cursor:pointer;transition:transform .15s,box-shadow .15s}
.feature-item.clickable:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(26,115,232,.15);border-color:#1a73e8}
.feature-tip{text-align:center;font-size:.85rem;color:#1a73e8;background:#e8f0fe;padding:.6rem;border-radius:8px;cursor:pointer;transition:background .2s}
.feature-tip:hover{background:#d4e4fc}

/* ── layout ── */
main{max-width:900px;margin:0 auto;padding:1.5rem 1rem 3rem}
.card{background:#fff;border-radius:12px;padding:1.5rem;margin-bottom:1.5rem;box-shadow:0 2px 12px rgba(0,0,0,.06)}
.card h2{font-size:1.15rem;margin-bottom:1rem;color:#0d47a1}

/* ── upload ── */
.upload-area{border:2px dashed #bbb;border-radius:12px;padding:2.5rem 1rem;text-align:center;cursor:pointer;
             transition:border-color .2s,background .2s}
.upload-area:hover,.upload-area.dragover{border-color:#1a73e8;background:#e8f0fe}
.upload-icon{font-size:2.5rem;display:block;margin-bottom:.5rem}
.hint{font-size:.85rem;color:#888;margin-top:.3rem}
#uploadPreview{position:relative;display:inline-block;margin-top:.8rem}
#uploadPreview img{max-width:100%;max-height:300px;border-radius:8px;border:1px solid #ddd}
#btnClearUpload{position:absolute;top:4px;right:4px;background:rgba(0,0,0,.6);color:#fff;border:none;border-radius:6px;padding:4px 10px;cursor:pointer;font-size:.8rem}
.btn-primary{display:block;width:100%;margin-top:1rem;padding:.75rem;background:#1a73e8;color:#fff;
             border:none;border-radius:8px;font-size:1.05rem;font-weight:600;cursor:pointer;transition:background .2s}
.btn-primary:hover{background:#1557b0}
.btn-primary:disabled{background:#999;cursor:not-allowed}

/* ── spinner ── */
.spinner{text-align:center;margin-top:.8rem;color:#1a73e8;font-size:.95rem}
.bar{width:100%;height:3px;background:linear-gradient(90deg,#1a73e8,#64b5f6,#1a73e8);background-size:200% 100%;
     animation:shimmer 1.5s infinite;border-radius:2px;margin-top:.3rem}
@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}

/* ── report meta ── */
.meta{display:flex;flex-wrap:wrap;gap:.6rem 1.2rem;background:#f8fafc;padding:.8rem 1rem;border-radius:8px;margin-bottom:1rem;font-size:.95rem}
.meta span{color:#555}
.meta strong{color:#1a1a2e}

/* ── items table ── */
.items-table{width:100%;border-collapse:collapse;font-size:.9rem}
.items-table th{background:#f0f4f8;padding:.55rem .5rem;text-align:left;font-weight:600;color:#333;border-bottom:2px solid #ddd;white-space:nowrap}
.items-table td{padding:.5rem;border-bottom:1px solid #eee}
.items-table tr:hover td{background:#f8fafc}
.flag-up{color:#c62828;font-weight:700}
.flag-down{color:#1565c0;font-weight:700}
.flag-up::after{content:" ↑"}
.flag-down::after{content:" ↓"}

/* ── AI box ── */
.ai-box{background:#f8fafc;border-left:4px solid #1a73e8;padding:1rem 1.2rem;border-radius:0 8px 8px 0;font-size:.95rem;line-height:1.7}
.ai-box p{margin-bottom:.5rem}
.ai-box strong{color:#0d47a1}

/* ── back btn ── */
.btn-back{display:inline-block;padding:.5rem 1rem;margin-bottom:1rem;background:#f0f4f8;border:1px solid #ccc;border-radius:8px;cursor:pointer;font-size:.9rem;color:#333;transition:background .2s}
.btn-back:hover{background:#e0e0e0}

/* ── save prompt ── */
.save-prompt{position:fixed;bottom:0;left:0;width:100%;z-index:900;padding:0 1rem 1rem}
.save-prompt-inner{max-width:600px;margin:0 auto;background:#fff;border-radius:12px;padding:1rem 1.2rem;
                   box-shadow:0 -4px 20px rgba(0,0,0,.12);display:flex;align-items:center;gap:1rem;flex-wrap:wrap}
.save-prompt-inner p{flex:1;font-size:.9rem;color:#333;min-width:200px}
.save-prompt-btns{display:flex;gap:.5rem;align-items:center}

/* ── trend ── */
.trend-chart{background:#fff;border:1px solid #e0e0e0;border-radius:8px;padding:.8rem;margin-top:.8rem}
.trend-chart h4{margin-bottom:.4rem;color:#333;font-size:.95rem}
.trend-chart canvas{width:100%!important;height:auto!important;max-height:200px}

/* ── report list ── */
.report-list{display:flex;flex-direction:column;gap:.6rem}
.report-item{display:flex;justify-content:space-between;align-items:center;padding:.7rem 1rem;
             background:#f8fafc;border-radius:8px;cursor:pointer;transition:background .2s}
.report-item:hover{background:#e8f0fe}
.report-item .ri-left{flex:1}
.report-item .ri-type{font-weight:600;color:#0d47a1}
.report-item .ri-date{color:#666;font-size:.85rem}
.report-item .ri-summary{color:#555;font-size:.85rem;margin-top:.2rem}
.report-item .ri-delete{background:none;border:none;color:#c62828;cursor:pointer;font-size:.9rem;padding:.3rem .5rem;border-radius:4px}
.report-item .ri-delete:hover{background:#ffebee}
.report-empty{text-align:center;color:#999;padding:2rem}
.btn-sm{padding:.35rem .7rem;font-size:.8rem;border:1px solid #ccc;border-radius:6px;background:#fff;cursor:pointer}
.btn-sm:hover{background:#f0f0f0}

/* ── hidden ── */
.hidden{display:none!important}

/* ── footer ── */
footer{text-align:center;padding:1.5rem;color:#888;font-size:.85rem}

/* ── responsive ── */
@media(max-width:480px){
  .feature-grid{grid-template-columns:1fr}
  .save-prompt-inner{flex-direction:column;text-align:center}
  .save-prompt-btns{justify-content:center}
}
