*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
body{font-family:-apple-system,BlinkMacSystemFont,'Malgun Gothic','맑은 고딕',sans-serif;background:#f0f2f5;color:#1a1a2e;line-height:1.5;padding-bottom:120px;-webkit-font-smoothing:antialiased}
.header{background:linear-gradient(135deg,#0f3460,#16213e);color:#fff;padding:20px 16px;text-align:center;position:sticky;top:0;z-index:100;box-shadow:0 2px 12px rgba(0,0,0,0.3)}
.header h1{font-size:20px;font-weight:700;letter-spacing:-0.5px}
.header p{font-size:12px;opacity:0.7;margin-top:4px}
.container{max-width:500px;margin:0 auto;padding:16px}
.tab-nav{display:flex;gap:6px;margin-bottom:16px;background:#fff;border-radius:14px;padding:6px;box-shadow:0 1px 4px rgba(0,0,0,0.08)}
.tab-btn{flex:1;padding:10px 4px;border:none;border-radius:10px;font-size:13px;font-weight:600;cursor:pointer;background:transparent;color:#888;transition:all 0.2s}
.tab-btn.active{background:#0f3460;color:#fff}
.tab-content{display:none}.tab-content.active{display:block}
.card{background:#fff;border-radius:16px;padding:20px;margin-bottom:14px;box-shadow:0 1px 6px rgba(0,0,0,0.06)}
.card-title{font-size:15px;font-weight:700;color:#0f3460;margin-bottom:14px;display:flex;align-items:center;gap:8px}
.card-title .icon{font-size:18px}
.input-group{margin-bottom:12px}
.input-group label{display:block;font-size:12px;font-weight:600;color:#666;margin-bottom:6px}
.input-row{display:flex;gap:8px}
input[type="text"],input[type="number"],select,textarea{width:100%;padding:11px 14px;border:2px solid #e8e8e8;border-radius:10px;font-size:14px;outline:none;transition:border-color 0.2s;background:#fff;color:#1a1a2e;font-family:inherit}
textarea{resize:vertical;min-height:50px;font-size:13px}
input:focus,select:focus,textarea:focus{border-color:#0f3460}
input::placeholder,textarea::placeholder{color:#bbb}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:12px 20px;border:none;border-radius:10px;font-size:14px;font-weight:600;cursor:pointer;transition:all 0.2s;width:100%}
.btn-primary{background:#0f3460;color:#fff}.btn-primary:active{background:#0a2647;transform:scale(0.98)}
.btn-success{background:#1a9a5c;color:#fff}.btn-success:active{background:#148a50}
.btn-danger{background:#e74c3c;color:#fff}.btn-danger:active{background:#c0392b}
.btn-outline{background:#fff;color:#0f3460;border:2px solid #0f3460}
.btn-kakao{background:#FEE500;color:#3C1E1E}.btn-kakao:active{background:#F0D800}
.btn-share{background:#8e44ad;color:#fff}.btn-share:active{background:#7d3c98}
.btn-sm{padding:8px 14px;font-size:12px;width:auto}
.btn-xs{padding:5px 10px;font-size:11px;width:auto;border-radius:8px}
.btn-receipt{background:#8e44ad;color:#fff;font-size:12px;padding:6px 12px;width:auto;border-radius:8px}
.btn-receipt:active{background:#7d3c98}
.member-tags{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.member-tag{display:inline-flex;align-items:center;gap:6px;padding:8px 14px;border-radius:20px;font-size:13px;font-weight:500;background:#e8f0fe;color:#0f3460;cursor:pointer}
.member-tag .bank-info{font-size:10px;color:#888;margin-left:2px}
.member-tag .remove{width:18px;height:18px;border-radius:50%;background:rgba(0,0,0,0.15);color:#fff;border:none;font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center}
.checkbox-grid{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.check-tag{padding:10px 16px;border-radius:20px;font-size:13px;font-weight:500;background:#f0f0f0;color:#888;cursor:pointer;transition:all 0.15s;user-select:none;border:2px solid transparent}
.check-tag.selected{background:#0f3460;color:#fff;border-color:#0f3460}
.check-tag:active{transform:scale(0.95)}
.radio-tag{padding:10px 16px;border-radius:20px;font-size:13px;font-weight:500;background:#f0f0f0;color:#888;cursor:pointer;transition:all 0.15s;user-select:none;border:2px solid transparent}
.radio-tag.selected{background:#e74c3c;color:#fff;border-color:#e74c3c}
.round-card{background:#fff;border-radius:16px;padding:18px;margin-bottom:12px;box-shadow:0 1px 6px rgba(0,0,0,0.06);border-left:4px solid #0f3460}
.round-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}
.round-number{font-size:16px;font-weight:700;color:#0f3460}
.round-summary{font-size:12px;color:#888}
.round-detail{font-size:13px;color:#555;margin-top:6px;line-height:1.8}
.round-detail strong{color:#0f3460}
.round-actions{display:flex;gap:8px;margin-top:12px;flex-wrap:wrap}
.result-row{display:flex;justify-content:space-between;align-items:center;padding:10px 0;border-bottom:1px solid #f0f0f0;font-size:13px}
.result-row:last-child{border-bottom:none}
.transfer-card{background:linear-gradient(135deg,#ffecd2,#fcb69f);border-radius:12px;padding:14px;margin-bottom:8px;font-size:13px}
.transfer-main{display:flex;align-items:center}
.transfer-arrow{margin:0 10px;font-weight:700;color:#e74c3c}
.transfer-amount{margin-left:auto;font-weight:700;color:#c0392b}
.transfer-account{font-size:11px;color:#6b5430;margin-top:8px;padding-top:8px;border-top:1px dashed #ddb;cursor:pointer;display:flex;align-items:center;gap:6px}
.transfer-account:active{opacity:0.6}
.transfer-account .copy-hint{font-size:10px;color:#0f3460;font-weight:600;background:#e8f0fe;padding:2px 6px;border-radius:4px}
.empty-state{text-align:center;padding:40px 20px;color:#aaa}
.empty-state .icon{font-size:48px;margin-bottom:12px}
.empty-state p{font-size:14px}
.modal-overlay{display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.5);z-index:200;align-items:flex-end;justify-content:center}
.modal-overlay.show{display:flex}
.modal{background:#fff;border-radius:20px 20px 0 0;padding:24px 20px 40px;width:100%;max-width:500px;max-height:90vh;overflow-y:auto;animation:slideUp 0.3s ease}
@keyframes slideUp{from{transform:translateY(100%)}to{transform:translateY(0)}}
.modal-title{font-size:17px;font-weight:700;color:#0f3460;margin-bottom:20px;text-align:center}
.toast{position:fixed;bottom:30px;left:50%;transform:translateX(-50%);background:#333;color:#fff;padding:12px 24px;border-radius:10px;font-size:13px;font-weight:500;z-index:300;opacity:0;transition:opacity 0.3s;pointer-events:none;max-width:90%;text-align:center}
.toast.show{opacity:1}
.select-all-row{display:flex;justify-content:flex-end;margin-bottom:4px}
.select-all-btn{font-size:12px;color:#0f3460;background:none;border:none;cursor:pointer;font-weight:600;text-decoration:underline;padding:4px 0}
.per-person{margin-top:12px;padding:10px 14px;background:#e8f0fe;border-radius:10px;font-size:14px;font-weight:600;color:#0f3460;text-align:center}
.amount-plus{color:#1a9a5c}.amount-minus{color:#e74c3c}
.person-detail-card{background:#fff;border-radius:14px;padding:16px;margin-bottom:10px;box-shadow:0 1px 4px rgba(0,0,0,0.05);border:1px solid #f0f0f0}
.person-name-row{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.person-name{font-size:15px;font-weight:700;color:#1a1a2e}
.person-total{font-size:14px;font-weight:700}
.person-rounds{font-size:12px;color:#888;line-height:1.8}
.person-rounds span{display:inline-block;background:#f5f5f5;padding:2px 8px;border-radius:6px;margin:2px 4px 2px 0}
.person-paid{margin-top:8px;padding:8px 12px;background:#e8f8f0;border-radius:8px;font-size:12px;color:#1a9a5c;font-weight:600}
.btn-group{display:flex;gap:8px}.btn-group .btn{flex:1}
.btn-group-vertical{display:flex;flex-direction:column;gap:8px}
.payer-block{background:#f9f9f9;border:1px solid #eee;border-radius:12px;padding:14px;margin-bottom:10px}
.payer-block-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.payer-block-title{font-size:13px;font-weight:600;color:#333}
.adjust-row{display:flex;align-items:center;gap:8px;padding:8px 0;border-bottom:1px solid #f5f5f5;font-size:13px}
.adjust-row:last-child{border-bottom:none}
.adjust-name{flex:0 0 60px;font-weight:600;color:#333}
.adjust-input{width:90px;padding:8px 10px;font-size:13px;text-align:right}
.adjust-label{font-size:11px;color:#999;flex:1}
.info-box{background:#e8f0fe;border-radius:10px;padding:12px;font-size:12px;color:#0f3460;text-align:center;margin-bottom:14px}
.view-mode-banner{background:linear-gradient(135deg,#1a9a5c,#148a50);color:#fff;padding:14px 16px;border-radius:12px;margin-bottom:14px;text-align:center;font-size:13px;font-weight:600}

.receipt-upload-area{border:2px dashed #ccc;border-radius:12px;padding:16px;text-align:center;cursor:pointer;transition:border-color 0.2s;margin-top:8px}
.receipt-upload-area:active{border-color:#0f3460}
.receipt-upload-area .icon{font-size:28px;margin-bottom:6px}
.receipt-upload-area p{font-size:12px;color:#888}
.receipt-thumbs{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.receipt-thumb{position:relative;display:inline-block}
.receipt-thumb img{width:80px;height:80px;object-fit:cover;border-radius:10px;border:1px solid #eee}
.receipt-thumb .remove-receipt{position:absolute;top:-6px;right:-6px;width:22px;height:22px;border-radius:50%;background:#e74c3c;color:#fff;border:none;font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center}
.receipt-thumb .upload-status{position:absolute;bottom:2px;left:2px;right:2px;text-align:center;font-size:9px;padding:2px;border-radius:0 0 8px 8px}
.receipt-thumb .status-uploading{background:rgba(255,193,7,0.9);color:#333}
.receipt-thumb .status-done{background:rgba(26,154,92,0.9);color:#fff}
.receipt-thumb .status-fail{background:rgba(231,76,60,0.9);color:#fff}

.receipt-viewer{display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.9);z-index:600;flex-direction:column;align-items:center;justify-content:center;padding:20px}
.receipt-viewer.show{display:flex}
.receipt-viewer img{max-width:100%;max-height:70vh;border-radius:8px;object-fit:contain}
.receipt-viewer .close-btn{position:absolute;top:20px;right:20px;width:40px;height:40px;border-radius:50%;background:rgba(255,255,255,0.2);color:#fff;border:none;font-size:24px;cursor:pointer;display:flex;align-items:center;justify-content:center}
.receipt-viewer .nav-info{color:#fff;font-size:13px;margin-top:12px;opacity:0.7}
.receipt-nav{display:flex;gap:12px;margin-top:12px}
.receipt-nav button{padding:8px 20px;border-radius:8px;border:none;background:rgba(255,255,255,0.2);color:#fff;font-size:13px;font-weight:600;cursor:pointer}
.receipt-nav button:active{background:rgba(255,255,255,0.3)}

#captureArea{background:#fff;padding:28px 20px 24px}
#captureArea .capture-header{text-align:center;margin-bottom:20px;padding-bottom:16px;border-bottom:2px solid #0f3460}
#captureArea .capture-header h2{font-size:18px;color:#0f3460;font-weight:800}
#captureArea .capture-header .date{font-size:11px;color:#999;margin-top:4px}
#captureArea .capture-section{margin-bottom:18px}
#captureArea .capture-section-title{font-size:13px;font-weight:700;color:#0f3460;margin-bottom:10px;padding-left:10px;border-left:3px solid #0f3460}
#captureArea .capture-row{display:flex;justify-content:space-between;align-items:center;padding:7px 0;font-size:12px;border-bottom:1px solid #f0f0f0}
#captureArea .capture-row:last-child{border-bottom:none}
#captureArea .capture-transfer{background:#FFF8F0;border-radius:8px;padding:10px 14px;margin-bottom:6px;font-size:13px;font-weight:600}
#captureArea .capture-transfer .main-row{display:flex;align-items:center}
#captureArea .capture-transfer .arrow{margin:0 8px;color:#e74c3c;font-weight:800}
#captureArea .capture-transfer .amt{margin-left:auto;color:#c0392b;font-weight:800}
#captureArea .capture-transfer .acct{font-size:10px;color:#886;margin-top:4px}
#captureArea .capture-person{background:#f8f9fa;border-radius:8px;padding:10px 12px;margin-bottom:6px}
#captureArea .capture-person-name{display:flex;justify-content:space-between;align-items:center;font-size:13px;font-weight:700;margin-bottom:4px}
#captureArea .capture-person-detail{font-size:11px;color:#888}
#captureArea .capture-footer{text-align:center;margin-top:16px;padding-top:12px;border-top:1px solid #eee;font-size:10px;color:#bbb}

.preview-overlay{display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.85);z-index:500;flex-direction:column;align-items:center;justify-content:center;padding:20px}
.preview-overlay.show{display:flex}
.preview-overlay img{max-width:100%;max-height:60vh;border-radius:12px;box-shadow:0 4px 24px rgba(0,0,0,0.4)}
.preview-buttons{margin-top:20px;display:flex;gap:10px;width:100%;max-width:360px}
.preview-buttons .btn{flex:1}
.loading-overlay{display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(255,255,255,0.9);z-index:400;align-items:center;justify-content:center;flex-direction:column}
.loading-overlay.show{display:flex}
.spinner{width:40px;height:40px;border:4px solid #e8e8e8;border-top-color:#0f3460;border-radius:50%;animation:spin 0.8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.loading-overlay p{margin-top:12px;font-size:13px;color:#666}

/* ★ 프리셋 선택 카드 */
.preset-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:16px}
.preset-card{background:#fff;border:2px solid #e8e8e8;border-radius:14px;padding:16px 12px;text-align:center;cursor:pointer;transition:all 0.2s}
.preset-card:active{transform:scale(0.97)}
.preset-card.selected{border-color:#0f3460;background:#e8f0fe}
.preset-card .preset-icon{font-size:32px;margin-bottom:8px}
.preset-card .preset-name{font-size:14px;font-weight:700;color:#1a1a2e}
.preset-card .preset-desc{font-size:11px;color:#888;margin-top:4px}

/* === Phase 4: Expert Tip & Related Calculators === */
.expert-tip {
  background: #f0f4ff;
  border-left: 4px solid #4F46E5;
  border-radius: 8px;
  padding: 1.5rem 2rem;
  margin: 2rem 0;
}
.expert-tip h2 {
  font-size: 1.1rem;
  color: #3730a3;
  margin-bottom: 0.75rem;
}
.expert-tip p { color: #374151; line-height: 1.7; margin-bottom: 0.5rem; }

.related-calculators { padding: 2rem 0; }
.related-calculators h2 {
  font-size: 1.2rem;
  color: #111827;
  margin-bottom: 1rem;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 0.5rem;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  list-style: none;
  padding: 0;
}
.related-grid a {
  display: block;
  padding: 0.6rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #4F46E5;
  text-decoration: none;
  transition: background 0.2s, box-shadow 0.2s;
}
.related-grid a:hover { background: #eff6ff; box-shadow: 0 2px 6px rgba(79,70,229,0.15); }

/* === Footer Nav === */
.site-footer { background: #1e1b4b; color: #e0e7ff; padding: 2.5rem 1.5rem; margin-top: 3rem; }
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-brand { font-size: 0.9rem; margin-bottom: 1.5rem; opacity: 0.7; }
.footer-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.5rem; }
.footer-group strong { display: block; font-size: 0.85rem; color: #a5b4fc; margin-bottom: 0.5rem; }
.footer-group a { display: block; font-size: 0.82rem; color: #c7d2fe; text-decoration: none; padding: 0.15rem 0; }
.footer-group a:hover { color: #fff; }
