* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f7f7f5;
  color: #1a1a1a;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: #f7f7f5; }
.screen { min-height: 100vh; }

/* ---- login ---- */
#screen-login { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box {
  width: 100%; max-width: 340px; background: white; border-radius: 12px;
  padding: 32px 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); text-align: center;
}
.brand { font-size: 28px; font-weight: 700; color: #1F3864; }
.brand-sub { font-size: 13px; color: #666; margin-bottom: 24px; }
.login-box input {
  width: 100%; padding: 12px; margin-bottom: 12px; border: 1px solid #d1d1cc;
  border-radius: 8px; font-size: 15px;
}
.hint { font-size: 11px; color: #999; margin-top: 12px; }
.error-text { color: #C0392B; font-size: 13px; margin-top: 8px; min-height: 16px; }

/* ---- top bar & tabs ---- */
.topbar {
  background: #1F3864; color: white; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-weight: 700; font-size: 16px; }
.topbar-user { font-size: 11px; opacity: 0.8; }
.tabs {
  display: flex; overflow-x: auto; background: white; border-bottom: 1px solid #e5e5e0;
  position: sticky; top: 52px; z-index: 9;
}
.tab-btn {
  flex: none; padding: 12px 14px; font-size: 13px; border: none; background: none;
  color: #888; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab-btn.active { color: #1F3864; font-weight: 600; border-bottom-color: #1F3864; }
.content { padding: 12px; }

/* ---- cards & fields ---- */
.card {
  background: white; border-radius: 10px; padding: 16px; margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.card-title { font-weight: 600; font-size: 14px; margin-bottom: 10px; color: #1F3864; }
.field-label { display: block; font-size: 11px; color: #888; margin: 10px 0 4px; }
select, input[type=text], input[type=number], textarea {
  width: 100%; padding: 10px; border: 1px solid #d1d1cc; border-radius: 8px; font-size: 14px;
  background: white;
}
textarea { resize: vertical; }

/* ---- buttons ---- */
.btn-primary {
  width: 100%; background: #1F3864; color: white; border: none; border-radius: 8px;
  padding: 13px; font-size: 15px; font-weight: 600; margin-top: 12px;
}
.btn-secondary {
  width: 100%; background: #E6F1FB; color: #1F3864; border: 1px solid #B5D4F4;
  border-radius: 8px; padding: 12px; font-size: 14px; font-weight: 600;
}
.btn-ghost {
  background: none; border: 1px solid #d1d1cc; border-radius: 8px; padding: 8px 12px;
  color: #444; font-size: 13px; margin-top: 8px;
}
.btn-link { background: none; border: none; color: #1F3864; font-size: 13px; padding: 8px 0; text-align: left; }
.result-buttons { display: flex; gap: 8px; margin-top: 8px; }
.btn-result {
  flex: 1; padding: 12px; border-radius: 8px; border: 1px solid #d1d1cc; background: white;
  font-size: 14px; font-weight: 600; color: #555;
}
.btn-result.pass-active { background: #0F6E56; color: white; border-color: #0F6E56; }
.btn-result.fail-active { background: #C0392B; color: white; border-color: #C0392B; }

.or-divider { text-align: center; font-size: 11px; color: #aaa; margin: 12px 0 4px; }
.level-badge span { display: inline-block; font-size: 11px; padding: 3px 8px; border-radius: 6px; margin-top: 6px; }
.level-Critical { background: #FCEBEB; color: #791F1F; }
.level-Major { background: #FAEEDA; color: #633806; }
.level-Minor { background: #F1EFE8; color: #444441; }

#ncr-box { background: #FCEBEB; border-radius: 8px; padding: 10px; margin-top: 10px; }
.msg-text { font-size: 13px; margin-top: 8px; min-height: 16px; }
.msg-ok { color: #0F6E56; }
.msg-err { color: #C0392B; }

/* ---- recent list ---- */
.recent-list .item { padding: 8px 0; border-bottom: 1px solid #eee; font-size: 13px; }
.recent-list .item:last-child { border-bottom: none; }
.recent-title { font-weight: 600; }
.recent-sub { color: #888; font-size: 11px; }
.badge-pass { color: #0F6E56; font-weight: 600; }
.badge-fail { color: #C0392B; font-weight: 600; }

/* ---- reports ---- */
.range-buttons { display: flex; gap: 8px; margin-bottom: 12px; }
.btn-range { flex: 1; padding: 8px; border-radius: 8px; border: 1px solid #d1d1cc; background: white; font-size: 13px; }
.btn-range.active { background: #1F3864; color: white; border-color: #1F3864; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.stat-card { background: white; border-radius: 10px; padding: 12px; }
.stat-value { font-size: 22px; font-weight: 700; color: #1F3864; }
.stat-label { font-size: 11px; color: #888; margin-top: 2px; }
.pareto-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #eee; font-size: 13px; }

/* ---- tables ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { text-align: left; color: #888; font-weight: 600; padding: 6px 4px; border-bottom: 1px solid #ddd; }
.data-table td { padding: 6px 4px; border-bottom: 1px solid #eee; }

/* ---- lookup timeline ---- */
.timeline-item { border-left: 3px solid #ccc; padding: 8px 0 8px 10px; margin-bottom: 8px; }
.timeline-item.pass { border-left-color: #0F6E56; }
.timeline-item.fail { border-left-color: #C0392B; }

#qr-reader { margin-top: 10px; border-radius: 8px; overflow: hidden; }

.category-buttons { display: flex; gap: 8px; margin-top: 8px; }
.btn-category {
  flex: 1; padding: 14px 8px; border-radius: 8px; border: 1px solid #d1d1cc; background: white;
  font-size: 14px; font-weight: 700; color: #1F3864; text-align: center; line-height: 1.5;
}
.btn-category span { display: block; font-size: 11px; font-weight: 400; color: #888; }
.btn-category.active { background: #1F3864; color: white; border-color: #1F3864; }
.btn-category.active span { color: #cfd9e8; }

.field-row { margin-bottom: 10px; }
.field-row-label { font-size: 12px; color: #555; margin-bottom: 4px; font-weight: 600; }
.field-group-label { font-size: 11px; color: #1F3864; font-weight: 700; text-transform: uppercase; margin: 12px 0 6px; }

.text-xs-box { font-size: 11px; background: #FAEEDA; color: #633806; border: 1px solid #F0997B; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; flex-wrap: wrap; gap: 8px; }

