* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", Roboto, sans-serif; background: #f4f6f9; color: #222; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #1e3a8a; color: #fff; position: sticky; top: 0; z-index: 50; }
.topbar .logo { color: #fff; font-weight: 700; text-decoration: none; font-size: 18px; }
.topbar .user-info { font-size: 14px; opacity: 0.9; margin-left: auto; margin-right: 12px; }
.topbar .logout-btn { color: #fff; background: rgba(255,255,255,0.15); padding: 6px 10px; border-radius: 6px; text-decoration: none; font-size: 13px; }
.container { max-width: 720px; margin: 0 auto; padding: 16px; padding-bottom: 96px; }
h2 { margin: 8px 0 16px; font-size: 22px; }
h3 { margin: 18px 0 10px; font-size: 16px; color: #444; }

.dashboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { background: #fff; padding: 14px 12px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); text-align: center; }
.stat-card.warn .stat-num { color: #b45309; }
.stat-num { font-size: 22px; font-weight: 700; color: #1e3a8a; }
.stat-label { font-size: 12px; color: #666; margin-top: 4px; }

.active-users-card { background:#fff; border-radius:10px; padding:12px 14px; margin-bottom:16px; box-shadow:0 1px 3px rgba(0,0,0,0.08); }
.au-head { display:flex; align-items:center; gap:8px; margin-bottom:8px; font-weight:600; font-size:14px; color:#333; }
.au-dot { width:8px; height:8px; border-radius:50%; background:#10b981; box-shadow:0 0 0 3px rgba(16,185,129,0.18); display:inline-block; }
.au-title { flex:1; }
.au-count { color:#666; font-weight:500; font-size:13px; }
.au-empty { color:#999; font-size:13px; }
.au-list { display:flex; flex-wrap:wrap; gap:6px; }
.au-chip { background:#eef6f1; color:#065f46; border:1px solid #c8ebd9; border-radius:999px; padding:4px 10px; font-size:13px; }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.menu-card { display: flex; flex-direction: column; align-items: center; justify-content: center; background: #fff; border-radius: 12px; padding: 18px 8px; text-decoration: none; color: #222; box-shadow: 0 1px 3px rgba(0,0,0,0.06); min-height: 96px; }
.menu-card:active { background: #eef; }
.menu-icon { font-size: 32px; margin-bottom: 6px; }
.menu-label { font-size: 13px; font-weight: 600; text-align: center; }

.form-card { background: #fff; padding: 16px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 12px; }
.form-card label { display: block; margin-top: 12px; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: #333; }
.form-card input, .form-card select { width: 100%; min-height: 56px; padding: 10px 12px; font-size: 16px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; }
.form-card input[readonly] { background: #f1f5f9; color: #555; }
.form-card.readonly input { background: #f1f5f9; color: #555; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input, .row > select { flex: 1; }

.qty-row { display: flex; align-items: center; gap: 8px; }
.qty-row input { flex: 1; text-align: center; font-size: 20px; font-weight: 700; }
.btn-qty { width: 56px; height: 56px; font-size: 22px; border-radius: 8px; border: 1px solid #cbd5e1; background: #f1f5f9; cursor: pointer; }

.btn { display: inline-block; padding: 12px 16px; font-size: 15px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; text-decoration: none; text-align: center; }
.btn-primary { background: #1e3a8a; color: #fff; border-color: #1e3a8a; }
.btn-primary:active { background: #1e40af; }
.btn-cancel { background: #e5e7eb; color: #333; }
.btn-warn { background: #b45309; color: #fff; }
.btn-icon { width: 56px; height: 56px; padding: 0; font-size: 22px; background: #f1f5f9; border: 1px solid #cbd5e1; }
.btn-small { padding: 6px 10px; font-size: 13px; background: #e5e7eb; }
.btn.block { display: block; width: 100%; margin-top: 16px; min-height: 56px; font-weight: 600; }

.info-box { background: #eff6ff; padding: 12px; border-radius: 8px; margin-top: 12px; line-height: 1.7; font-size: 14px; }
.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.alert.error { background: #fee2e2; color: #991b1b; }
.muted { color: #666; }
.small { font-size: 13px; }
.hidden { display: none !important; }
.center { text-align: center; }

.auth-card { background: #fff; padding: 24px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin: 40px auto; max-width: 420px; }
.auth-card h2 { text-align: center; margin-bottom: 16px; }
.auth-card label { display: block; margin-top: 12px; font-weight: 600; font-size: 14px; }
.auth-card input { width: 100%; min-height: 48px; padding: 8px 12px; font-size: 15px; border: 1px solid #cbd5e1; border-radius: 8px; margin-top: 4px; }
.auth-links { margin-top: 16px; text-align: center; }
.auth-links a { color: #1e3a8a; text-decoration: none; font-size: 14px; }

.search-row { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.search-row.wrap { flex-wrap: wrap; }
.search-row input, .search-row select { flex: 1; min-width: 100px; min-height: 44px; padding: 8px 10px; font-size: 14px; border: 1px solid #cbd5e1; border-radius: 6px; }

.hint { font-size: 12px; color: #666; margin: 0 0 8px; line-height: 1.5; }
.bulk-ok { margin-top: 10px; padding: 10px; background: #ecfdf5; color: #065f46; border-radius: 6px; font-size: 13px; }
.bulk-err { margin-top: 10px; padding: 10px; background: #fef2f2; color: #991b1b; border-radius: 6px; font-size: 13px; }
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 16px; }
.table-scroll .table { margin-bottom: 0; }
.table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; margin-bottom: 16px; }
.table th, .table td { padding: 8px; border-bottom: 1px solid #e5e7eb; text-align: left; }
.table th { background: #f8fafc; font-weight: 700; font-size: 12px; color: #555; }
.table td input { width: 100%; padding: 4px 6px; font-size: 13px; border: 1px solid #cbd5e1; border-radius: 4px; }

.card { background: #fff; padding: 16px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 12px; }

.home-btn { position: fixed; right: 16px; bottom: 16px; width: 56px; height: 56px; background: #1e3a8a; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); text-decoration: none; z-index: 40; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal.hidden { display: none; }
.modal-content { background: #fff; padding: 20px; border-radius: 12px; max-width: 420px; width: 92%; }
.modal-content.scanner { max-width: 480px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; }
.modal-body { margin-bottom: 16px; line-height: 1.6; }
.modal-body.success { color: #166534; }
.modal-body.error { color: #991b1b; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
#scanner-region { width: 100%; min-height: 300px; }

dialog { padding: 20px; border: none; border-radius: 12px; max-width: 420px; width: 90%; }
dialog::backdrop { background: rgba(0,0,0,0.4); }
#alias-list { padding: 0; list-style: none; }
#alias-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eee; }

@media (max-width: 480px) {
  .dashboard { grid-template-columns: repeat(2, 1fr); }
  .menu-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .menu-card { min-height: 86px; padding: 14px 4px; }
  .menu-icon { font-size: 28px; }
  .menu-label { font-size: 12px; }
  .table { font-size: 12px; }
  .table th, .table td { padding: 6px 4px; }
}

@media print {
  .topbar, .home-btn, .modal, .btn { display: none !important; }
}
