* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Pretendard", "Malgun Gothic", -apple-system, sans-serif;
  background: #f4f5f7; color: #1f2328; line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom);
}
.hidden { display: none !important; }
.error { color: #c0392b; font-size: 13px; margin-top: 6px; }
.muted { color: #7a828c; font-size: 13px; }
.center { text-align: center; padding: 24px 0; }

#login-view { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.login-box { background: #fff; border: 1px solid #e1e4e8; border-radius: 12px; padding: 32px 24px; width: 100%; max-width: 340px; }
.login-box h1 { font-size: 18px; margin-bottom: 18px; text-align: center; }
.login-box input { width: 100%; margin-bottom: 10px; }
.login-box button { width: 100%; }

#app-view { max-width: 720px; margin: 0 auto; padding: 14px 12px 60px; }
header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 0 2px; }
header h1 { font-size: 19px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; padding: 0 2px; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 20px; background: #e1e4e8; }
.badge.on { background: #d3f2df; color: #1a7f42; }
.badge.off { background: #eceff2; color: #7a828c; }

.card { background: #fff; border: 1px solid #e1e4e8; border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 15px; margin-bottom: 8px; }

#add-box summary {
  cursor: pointer; font-weight: 600; font-size: 15px; color: #2d6cdf;
  list-style: none; -webkit-tap-highlight-color: transparent;
}
#add-box summary::before { content: "+ "; }
#add-box[open] summary { margin-bottom: 12px; }
#add-box form { display: flex; flex-direction: column; gap: 10px; }

label { display: flex; flex-direction: column; font-size: 12px; color: #57606a; gap: 4px; }
input {
  border: 1px solid #d0d7de; border-radius: 8px; padding: 11px 12px;
  font-size: 16px; /* iOS 자동 확대 방지 */
  width: 100%; background: #fff;
}
input:focus { outline: 2px solid #b6d4fe; border-color: #4a89dc; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; gap: 8px; }
.form-actions button { flex: 1; }

button {
  border: none; border-radius: 8px; padding: 11px 16px; font-size: 15px; cursor: pointer;
  background: #2d6cdf; color: #fff; -webkit-tap-highlight-color: transparent;
}
button:active { opacity: .85; }
button.ghost { background: #fff; color: #57606a; border: 1px solid #d0d7de; }
button.small { padding: 7px 12px; font-size: 13px; border-radius: 7px; }
button.danger { color: #b03a2e; border-color: #ecc9c4; }

/* 도메인 카드 */
.dcard { background: #fff; border: 1px solid #e1e4e8; border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.dcard.overdue-meeting { border-left: 4px solid #b03a2e; }
.dc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.dc-name { font-weight: 700; font-size: 16px; word-break: break-all; }
.dc-meta { font-size: 13px; color: #7a828c; margin-bottom: 6px; }
.dc-person { font-size: 14px; margin-bottom: 2px; }
.dc-memo { font-size: 13px; color: #57606a; margin-top: 4px; white-space: pre-wrap; }
.dc-meeting { font-size: 13px; margin-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dc-address { font-size: 13px; color: #57606a; margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dist-badge { font-size: 12px; padding: 2px 8px; border-radius: 20px; background: #eef1f4; color: #57606a; font-weight: 600; }
.dist-badge.near { background: #d3f2df; color: #1a7f42; }
.dist-badge.err { background: #fde3e0; color: #b03a2e; font-weight: 400; }
.map-link { font-size: 12px; color: #2d6cdf; text-decoration: none; border: 1px solid #d0d7de; border-radius: 6px; padding: 1px 8px; }
.meet-badge { font-size: 12px; padding: 2px 8px; border-radius: 20px; background: #fde3e0; color: #b03a2e; font-weight: 600; }
.dc-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.dc-actions button { flex: 1 1 auto; min-width: 72px; }

.dday { font-weight: 700; padding: 3px 10px; border-radius: 6px; white-space: nowrap; font-size: 14px; }
.dday.d-expired { background: #4d4d4d; color: #fff; }
.dday.d-5  { background: #fde3e0; color: #b03a2e; }
.dday.d-10 { background: #fef0dd; color: #b06000; }
.dday.d-20 { background: #fdf7d8; color: #8a7500; }
.dday.d-30 { background: #ddebfd; color: #2258bb; }
.dday.d-ok { background: #eef1f4; color: #57606a; }
.dday.d-err { background: #fde3e0; color: #b03a2e; font-weight: 400; font-size: 12px; }

#alert-list { list-style: none; }
#alert-list li { padding: 5px 0; border-bottom: 1px solid #f0f2f4; font-size: 13px; }
#alert-list li:last-child { border-bottom: none; }

@media (min-width: 600px) {
  #app-view { padding-top: 24px; }
  #add-box form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  #add-box form .row2, #add-box form .form-actions, #add-box form .error { grid-column: 1 / -1; }
  .form-actions button { flex: 0 0 auto; min-width: 120px; }
  .dc-actions button { flex: 0 0 auto; }
}
