*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Noto Sans SC', 'DM Sans', system-ui, sans-serif; background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%); min-height: 100vh; color: #1a202c; }

.container { max-width: 960px; margin: 0 auto; padding: 20px; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* Card */
.card { background: #fff; border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,0.06); padding: 24px; }
.card-sm { padding: 16px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; text-decoration: none; }
.btn-primary { background: #1E3A5F; color: #fff; }
.btn-primary:hover { background: #2D5A87; }
.btn-secondary { background: #e2e8f0; color: #4a5568; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Input */
.input { width: 100%; padding: 10px 14px; border: 2px solid #e2e8f0; border-radius: 10px; font-size: 14px; transition: border-color .2s; font-family: inherit; }
.input:focus { outline: none; border-color: #1E3A5F; }
.select { width: 100%; padding: 10px 14px; border: 2px solid #e2e8f0; border-radius: 10px; font-size: 14px; font-family: inherit; background: #fff; cursor: pointer; }
.select:focus { outline: none; border-color: #1E3A5F; }
label { display: block; font-size: 13px; font-weight: 600; color: #4a5568; margin-bottom: 4px; }

/* Header */
.header { text-align: center; margin-bottom: 24px; }
.header h1 { font-size: 22px; color: #1E3A5F; }
.header p { font-size: 13px; color: #718096; margin-top: 4px; }

/* Auth form */
.auth-box { max-width: 400px; margin: 60px auto; }
.auth-box .card { padding: 32px; }
.auth-box h2 { font-size: 20px; margin-bottom: 20px; text-align: center; }
.form-group { margin-bottom: 14px; }
.auth-switch { text-align: center; margin-top: 14px; font-size: 13px; color: #718096; }
.auth-switch a { color: #1E3A5F; cursor: pointer; text-decoration: underline; }

/* Dashboard */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.dashboard-header h2 { font-size: 18px; }
.user-info { font-size: 13px; color: #718096; display: flex; align-items: center; gap: 12px; }
.user-info .logout { color: #dc2626; cursor: pointer; font-size: 13px; }

/* Cards list */
.card-item { border: 2px solid #e2e8f0; border-radius: 12px; padding: 16px; margin-bottom: 12px; transition: border-color .2s; }
.card-item:hover { border-color: #1E3A5F; }
.card-item .card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.card-item .bank-name { font-size: 16px; font-weight: 700; color: #1E3A5F; }
.card-item .card-name { font-size: 13px; color: #718096; }
.card-item .card-dates { display: flex; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.card-item .date-tag { font-size: 13px; color: #4a5568; background: #f7fafc; padding: 4px 10px; border-radius: 6px; }
.card-item .date-tag strong { color: #1E3A5F; }
.card-item .rules { font-size: 12px; color: #718096; }
.card-item .rules span { display: block; margin-top: 2px; }
.card-item .card-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Add card form */
.add-card-form { margin-top: 16px; padding: 20px; background: #f8fafc; border-radius: 12px; border: 1px solid #e2e8f0; }
.add-card-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rule-preview { font-size: 12px; color: #718096; padding: 8px 10px; background: #fff; border-radius: 6px; margin-top: 4px; border: 1px solid #e2e8f0; }

/* Tabs */
.tabs { display: flex; gap: 2px; margin-bottom: 20px; background: #e2e8f0; border-radius: 10px; padding: 2px; }
.tab { flex: 1; padding: 8px; text-align: center; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; background: transparent; color: #718096; transition: all .2s; }
.tab.active { background: #fff; color: #1E3A5F; box-shadow: 0 1px 4px rgba(0,0,0,.06); }

/* Feedback */
.feedback-item { border-bottom: 1px solid #f0f0f0; padding: 10px 0; font-size: 13px; }
.feedback-item:last-child { border-bottom: none; }
.feedback-item .fb-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.fb-type-zb { background: #dbeafe; color: #1d4ed8; }
.fb-type-cp { background: #fef3c7; color: #b45309; }
.fb-status { font-size: 11px; color: #718096; }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: #a0aec0; }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* Toast */
.toast { position: fixed; top: 20px; right: 20px; padding: 12px 20px; border-radius: 10px; font-size: 14px; color: #fff; z-index: 999; animation: slideIn .3s ease; max-width: 360px; }
.toast-success { background: #22c55e; }
.toast-error { background: #ef4444; }
.toast-info { background: #1E3A5F; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Responsive */
@media (max-width: 600px) {
  .container { padding: 12px; }
  .card { padding: 16px; }
  .auth-box { margin: 30px auto; }
  .add-card-form .form-row { grid-template-columns: 1fr; }
  .card-item .card-dates { flex-direction: column; gap: 4px; }
  .dashboard-header { flex-direction: column; align-items: flex-start; }
}

/* Error message */
.error-msg { color: #dc2626; font-size: 13px; margin-top: 4px; }

/* Modal overlay for rule reference */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-content { background: #fff; border-radius: 16px; padding: 24px; max-width: 700px; width: 100%; max-height: 80vh; overflow-y: auto; }
.modal-content h3 { font-size: 16px; margin-bottom: 12px; }
.modal-content table { width: 100%; font-size: 12px; border-collapse: collapse; table-layout: fixed; }
.modal-content th, .modal-content td { text-align: left; padding: 6px 4px; border-bottom: 1px solid #f0f0f0; word-break: keep-all; white-space: nowrap; }
.modal-content th { color: #718096; font-weight: 600; }
.modal-content td:nth-child(3) { white-space: normal; word-break: break-word; }
.modal-close { float: right; cursor: pointer; font-size: 20px; color: #718096; }

/* Link to jjklab */
.footer-brand { text-align: center; margin-top: 24px; font-size: 12px; color: #a0aec0; }
.footer-brand a { color: #1E3A5F; text-decoration: none; }