:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3f9;
  --text: #111827;
  --muted: #4b5563;
  --border: #dde3ee;
  --primary: #2563eb;
  --primary-ink: #ffffff;
  --primary-soft: #e6eefe;
  --ok: #047857;
  --ok-soft: #e3f6ee;
  --warn: #a15c00;
  --warn-soft: #fff3dc;
  --danger: #b91c1c;
  --danger-soft: #fde8e8;
  --focus: #1d4ed8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 2px 8px rgba(16, 24, 40, 0.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #1f2630;
    --text: #e6edf3;
    --muted: #a5b0bd;
    --border: #2d3540;
    --primary: #5b8def;
    --primary-ink: #0b1220;
    --primary-soft: #1b2a47;
    --ok: #4ccf9a;
    --ok-soft: #12302a;
    --warn: #f0b85a;
    --warn-soft: #3a2c12;
    --danger: #f28b8b;
    --danger-soft: #3d1a1a;
    --focus: #8fb2ff;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; color: var(--text); text-decoration: none; }
.brand img { border-radius: 7px; }
.brand-wrap { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tagline { font-size: 0.88rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 14px; border-left: 1px solid var(--border); }
@media (max-width: 640px) {
  .topbar-inner { height: auto; min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
  .brand-wrap { flex-direction: column; align-items: flex-start; gap: 2px; }
  .tagline { padding-left: 38px; border-left: 0; font-size: 0.8rem; white-space: normal; }
}

.pill { font-size: 0.85rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }

main.wrap { padding-top: 52px; padding-bottom: 32px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: minmax(0, 1fr); } }

.onboard { display: flex; flex-direction: column; gap: 16px; border-color: var(--primary); background: linear-gradient(180deg, var(--primary-soft), var(--surface) 70%); }
.onboard-text p { color: var(--muted); max-width: 60ch; }
.guide { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.guide p, .guide ol { color: var(--muted); margin: 6px 0 0; }

.banner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-color: var(--primary); }
.eyebrow { margin: 0 0 2px; font-size: 0.8rem; color: var(--primary); font-weight: 600; }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1.6fr; gap: 12px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }

.btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; min-height: 40px;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 12px; min-height: 34px; font-size: 0.9rem; }
.btn.lg { padding: 12px 22px; font-size: 1.05rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; text-decoration: underline; cursor: pointer; }

form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, legend { font-weight: 600; font-size: 0.92rem; padding: 0; }
input[type="text"], input[type="url"], input[type="number"], input[type="date"], input[type="time"], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; width: 100%; min-height: 42px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 2px solid var(--primary-soft); }
.num { width: 88px !important; }
.check { display: inline-flex; gap: 6px; align-items: center; }
.check input { width: 18px; height: 18px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 0.88rem; cursor: pointer; min-height: 32px; }
.chip:hover { border-color: var(--primary); }

.seg, .days { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.seg label, .days label { position: relative; }
.seg input, .days input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span, .days span {
  display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 6px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-weight: 600; font-size: 0.92rem;
}
.days span { min-width: 42px; padding: 6px 0; }
.seg input:checked + span, .days input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.seg input:focus-visible + span, .days input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
#interval-box, #weekly-days { margin-top: 10px; }

.time { width: 150px !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* 등록 폼 구역: 제목·알림 시점·반복·재알림·메모를 구분선과 제목으로 나눈다 */
form#reminder-form { gap: 0; }
.sec { display: flex; flex-direction: column; gap: 8px; border: 0; margin: 0; min-width: 0; padding: 16px 0; border-top: 1px solid var(--border); }
.sec:first-child { border-top: 0; padding-top: 0; }
.sec-title { font-weight: 700; font-size: 0.98rem; padding: 0; margin-bottom: 2px; color: var(--text); }
fieldset.sec > legend.sec-title { float: left; width: 100%; margin-bottom: 8px; }
fieldset.sec > legend.sec-title + * { clear: both; }
#reminder-form > .notice { margin-top: 4px; }
#reminder-form > .row { margin-top: 12px; }

.mode-panel { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); transition: border-color .15s, background .15s; }
.mode-panel + .mode-panel { margin-top: 8px; }
.mode-panel.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.mode-opt { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.95rem; cursor: pointer; }
.mode-opt small { font-weight: 400; font-size: 0.82rem; }
.mode-opt input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.mode-body { display: flex; flex-direction: column; gap: 8px; padding: 10px 0 0 26px; }
.mode-body[hidden] { display: none; }
.field.inline { gap: 4px; }
#reserve-box > .row { align-items: flex-start; }
.field.inline > span, .field.inline > label > span { font-weight: 500; font-size: 0.85rem; color: var(--muted); }
.field.inline input[type="date"] { width: 160px; }
.field.inline input:disabled { opacity: 0.5; }
#repeat-once[hidden] { display: none; }

details.limits summary { cursor: pointer; font-weight: 600; color: var(--muted); }
details.limits summary h2 { display: inline; font-size: 1.05rem; color: var(--text); }
details.limits ul { color: var(--muted); padding-left: 20px; margin: 12px 0 0; }
details.limits li + li { margin-top: 6px; }

.notice { margin: 0; font-size: 0.85rem; color: var(--muted); background: var(--surface-2); padding: 10px 12px; border-radius: 10px; }
.error { margin: 0; color: var(--danger); font-weight: 600; min-height: 0; }
.error:empty { display: none; }
.muted { color: var(--muted); }
.sm-text { font-size: 0.85rem; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.item.paused { opacity: 0.7; }
.item-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.item-title { font-weight: 700; overflow-wrap: anywhere; }
.item-meta { font-size: 0.88rem; color: var(--muted); }
.item-next { font-size: 0.9rem; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: 0.78rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--danger-soft); color: var(--danger); }
.empty { color: var(--muted); text-align: center; padding: 24px 0; margin: 0; }

.checks { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 16px; }
.checks dt { color: var(--muted); }
.checks dd { margin: 0; overflow-wrap: anywhere; }
.sub { font-size: 0.95rem; margin-bottom: 8px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; min-width: 120px; }
.table th { color: var(--muted); font-weight: 600; }

.footer { color: var(--muted); font-size: 0.85rem; padding-top: 8px; padding-bottom: 40px; }
.footer p { margin: 4px 0; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0; }
.footer-nav a { color: var(--muted); }

/* 소개·가이드 등 글 콘텐츠 */
.article { line-height: 1.75; }
.article h1 { margin-bottom: 8px; }
.article h2 { margin: 28px 0 8px; font-size: 1.2rem; }
.article > h2:first-child, .article > p:first-child + h1 { margin-top: 0; }
.article h3 { margin: 20px 0 6px; font-size: 1.02rem; }
.article p, .article li { color: var(--text); }
.article p { margin: 8px 0; }
.article ul, .article ol { padding-left: 22px; margin: 8px 0; }
.article li + li { margin-top: 4px; }
.article .lead { color: var(--muted); font-size: 1.02rem; }
.article .back { margin: 0 0 12px; font-size: 0.9rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 16px 0 4px; }
.feature { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; }
.feature h3 { margin: 0 0 4px; font-size: 0.98rem; }
.feature p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.6; }
.more-links { margin-top: 16px !important; font-weight: 600; }
.faq dt { font-weight: 700; margin-top: 18px; }
.faq dd { margin: 6px 0 0; }
.page-main { max-width: 820px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 600;
  max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

/* 계정(로그인) */
.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account { display: flex; align-items: center; gap: 8px; min-width: 0; }
.account-email { font-size: 0.85rem; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.google-btn { gap: 8px; background: var(--surface); }
.google-btn svg { flex: none; }
.account { position: relative; }
.login-tip {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 6;
  font-size: 0.8rem; line-height: 1.4; color: var(--text); white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px 10px; box-shadow: var(--shadow); pointer-events: none;
}
.login-tip::before {
  content: ""; position: absolute; top: -6px; right: 22px; width: 10px; height: 10px;
  background: var(--surface); border-left: 1px solid var(--border); border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
#login-btn[hidden] + .login-tip { display: none; }
.login-hint { margin: 14px 0 0; font-size: 0.88rem; color: var(--muted); background: var(--surface-2); padding: 10px 12px; border-radius: 10px; }
#limit-note { margin-bottom: 10px; color: var(--warn); background: var(--warn-soft); }
#list-count.full { color: var(--warn); font-weight: 700; }
@media (max-width: 640px) {
  .account-email { display: none; }
  .login-tip { white-space: normal; width: max-content; max-width: calc(100vw - 32px); }
  .topbar-right { gap: 6px; }
  .topbar-right .pill { display: none; }
}
