/* SafeKids */
:root {
  --bg: #f4f5fb; --card: #ffffff; --text: #1d2033; --muted: #6b7086; --line: #e7e8f0; --soft: #f0f1f8;
  --primary: #5b5bf7; --primary-soft: #ececfe; --primary-text: #4545d6;
  --red: #e5484d; --red-soft: #fdecec; --amber: #f2a20d; --amber-soft: #fff4dd; --green: #17a673; --green-soft: #e3f6ee;
  --shadow: 0 1px 2px rgba(20, 22, 50, .04), 0 4px 16px rgba(20, 22, 50, .05);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101219; --card: #181b25; --text: #e9eaf2; --muted: #9a9eb3; --line: #272b3a; --soft: #1f2330;
    --primary: #7b7bff; --primary-soft: #26285a; --primary-text: #a9a9ff;
    --red-soft: #3a1d22; --amber-soft: #3a2e14; --green-soft: #13352a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  letter-spacing: -.01em;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
h2 { margin: 0 0 .8rem; font-size: 1.08rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
code { background: var(--soft); padding: 2px 6px; border-radius: 6px; font-size: .9em; word-break: break-all; }
.ic { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hint { color: var(--muted); font-size: .85rem; margin: .8rem 0 0; }
.center { text-align: center; }
.m0 { margin: 0; }
.mt { margin-top: 12px; }
.grow { flex: 1; min-width: 0; }

/* layout */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.brand .ic { color: var(--primary); width: 24px; height: 24px; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; }
.nav a { position: relative; display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.nav a:hover { background: var(--soft); text-decoration: none; color: var(--text); }
.nav a.on { color: var(--primary-text); background: var(--primary-soft); }
.dot { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; font-style: normal; font-weight: 700; }
.container { max-width: 1120px; margin: 0 auto; padding: 24px 16px 80px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 2px 0 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0 12px; }
.section-head h2 { margin: 0; }
.back { display: inline-block; margin-bottom: 10px; color: var(--muted); font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.narrow-card { max-width: 560px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.grid .card { margin: 0; }
.grid-2-1 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-2-1 .card { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap, .wrap { flex-wrap: wrap; }
.gap { gap: 12px; } .gap-s { gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* form */
input, select, button, textarea { font: inherit; color: inherit; }
input, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type=radio], input[type=checkbox] { width: auto; }
input.num { width: 84px; }
input.num.s { width: 64px; padding: 5px 8px; }
input[type=time] { width: auto; }
select { width: auto; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 600; font-size: .9rem; }
.field.inline > span { font-size: .8rem; color: var(--muted); font-weight: 500; }
.field-err, .check-msg.bad { color: var(--red); font-size: .82rem; }
.check-msg { font-size: .82rem; min-height: 0; }
.check-msg.good { color: var(--green); }
.pw { position: relative; }
.pw input { padding-right: 56px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .82rem; padding: 6px; }
.with-unit { display: inline-flex; align-items: center; gap: 6px; }
.with-unit em { font-style: normal; color: var(--muted); font-size: .85rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; color: var(--text); }
.btn:hover { border-color: var(--primary); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); background: var(--red-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--soft); color: var(--text); }
.btn.s { padding: 5px 10px; font-size: .85rem; border-radius: 8px; }
.btn.s .ic { width: 15px; height: 15px; }
.btn.lg { padding: 13px 18px; font-size: 1rem; }
.btn.block { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 16px; position: sticky; bottom: 12px; }

/* pills, avatar */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill .ic { width: 13px; height: 13px; }
.pill.xs { padding: 1px 8px; font-size: .74rem; }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: #b97500; }
.pill.green { background: var(--green-soft); color: var(--green); }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.avatar { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--av); color: #fff; font-weight: 800; font-size: 1.15rem; }

/* alerts & toasts */
.alert { padding: 12px 14px; border-radius: 12px; font-size: .9rem; margin-bottom: 4px; }
.alert-err { background: var(--red-soft); color: var(--red); }
.alert-info { background: var(--primary-soft); color: var(--primary-text); }
.alert .btn { margin-left: 8px; }
.toasts { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: #1d2033; color: #fff; box-shadow: 0 8px 30px rgba(0,0,0,.18); animation: toast-in .25s ease-out; pointer-events: auto; transition: opacity .3s, transform .3s; }
.toast .ic { color: #6ee7b7; }
.toast-err { background: #b4232a; }
.toast-err .ic { color: #fff; }
.toast.hide { opacity: 0; transform: translateY(-8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* auth */
body.bare { background: radial-gradient(1200px 600px at 10% -10%, #dcdcff 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #ffe3f1 0, transparent 60%), var(--bg); min-height: 100vh; }
@media (prefers-color-scheme: dark) { body.bare { background: radial-gradient(1200px 600px at 10% -10%, #23245a 0, transparent 60%), var(--bg); } }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-wrap { width: 100%; max-width: 920px; display: grid; grid-template-columns: 1fr 420px; gap: 40px; align-items: center; }
.auth-hero h1 { font-size: 2.4rem; margin: 12px 0 8px; }
.auth-hero p { color: var(--muted); font-size: 1.05rem; }
.logo-big { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--primary); color: #fff; box-shadow: 0 10px 30px rgba(91,91,247,.35); }
.logo-big .ic { width: 34px; height: 34px; }
.auth-card { padding: 28px; margin: 0; }
.auth-card h2 { font-size: 1.35rem; margin-bottom: 4px; }
.auth-card > .muted { margin: 0 0 16px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 20px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.steps { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.steps b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--soft); border: 1px solid var(--line); font-size: .85rem; }
.steps li.on { color: var(--text); font-weight: 700; }
.steps li.on b { background: var(--primary); border-color: var(--primary); color: #fff; }
.steps li.done b { background: var(--green); border-color: var(--green); color: #fff; }
.success-big { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--green-soft); color: var(--green); margin-bottom: 12px; }
.success-big .ic { width: 32px; height: 32px; }

/* segmented & tabs */
.seg { display: flex; background: var(--soft); padding: 4px; border-radius: 12px; margin-bottom: 18px; }
.seg a { flex: 1; text-align: center; white-space: nowrap; padding: 8px 10px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.seg.small { margin: 0; }
.seg.small a { padding: 4px 12px; font-size: .85rem; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { display: flex; align-items: center; gap: 6px; padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.on { color: var(--primary-text); border-color: var(--primary); }

/* dashboard */
.onboarding { background: linear-gradient(135deg, var(--primary-soft), var(--card)); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.checklist li .ic { color: var(--muted); }
.checklist li.done { color: var(--muted); text-decoration: line-through; }
.checklist li.done .ic { color: var(--green); }
.attention { border-color: color-mix(in srgb, var(--amber) 50%, var(--line)); }
.attention h2 .ic { color: var(--amber); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list li:first-child { border-top: 0; padding-top: 0; }
.quote { display: block; color: var(--text); font-style: italic; margin-top: 2px; }

.child-card { display: flex; flex-direction: column; gap: 14px; }
.child-head { display: flex; align-items: center; gap: 12px; color: var(--text); }
.child-head:hover { text-decoration: none; }
.child-head h3 { margin-bottom: 3px; }
.chev { font-size: 1.6rem; color: var(--muted); }
.child-body { display: flex; align-items: center; gap: 18px; }
.child-actions { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.child-actions .btn { flex: 1; padding: 8px 10px; font-size: .88rem; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: .92rem; }
.kv span { color: var(--muted); }
.mini { list-style: none; padding: 8px 0 0; margin: 8px 0 0; border-top: 1px dashed var(--line); font-size: .85rem; }
.mini li { display: flex; justify-content: space-between; gap: 8px; }
.mini li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-card { border-style: dashed; }
.add-card h3 { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.add-way { padding: 14px; border-radius: 12px; background: var(--soft); margin-bottom: 10px; }
.add-way p { margin: 4px 0 10px; }
.add-way summary { cursor: pointer; }
.add-way[open] summary { margin-bottom: 12px; }
.copy-box { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); padding: 8px 8px 8px 12px; border-radius: 10px; }
.copy-box code { flex: 1; background: none; padding: 0; font-size: .95rem; font-weight: 700; }

/* ring gauge */
.ring { --p: 0; --c: var(--primary); flex: none; width: 128px; height: 128px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--soft) 0); }
.ring.danger { --c: var(--red); }
.ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring strong { font-size: 1.05rem; line-height: 1.2; }
.ring small { color: var(--muted); font-size: .75rem; }
.today-card { display: flex; align-items: center; gap: 24px; }
.today-card.kid .ring { width: 160px; height: 160px; }
.today-card.kid .ring > div { width: 132px; height: 132px; }
.today-card.kid .ring strong { font-size: 1.3rem; }

/* week chart */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; text-align: center; }
.week .col { height: 110px; display: flex; align-items: flex-end; justify-content: center; background: var(--soft); border-radius: 10px; overflow: hidden; }
.week .col span { width: 100%; background: color-mix(in srgb, var(--primary) 55%, transparent); border-radius: 8px 8px 0 0; }
.week .today .col span { background: var(--primary); }
.week small { display: block; font-size: .78rem; }
.week .today small:first-of-type { color: var(--primary-text); font-weight: 700; }

/* app list */
.app-list { list-style: none; margin: 0; padding: 0; }
.app-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.app-list li:first-child { border-top: 0; }
.app-ic { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-text); font-weight: 800; }
.bar { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: 5px 0 3px; }
.bar span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.rule-quick { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.limit-group { display: inline-flex; gap: 4px; }
.empty { text-align: center; padding: 28px 10px; color: var(--muted); }
.empty .ic { width: 36px; height: 36px; opacity: .5; }
.empty p { margin: 8px 0 0; }

/* time settings */
.presets { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.days { display: flex; flex-direction: column; gap: 8px; }
.day-row { display: grid; grid-template-columns: 44px auto 1fr auto; gap: 16px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.day-row.weekend .wd { color: var(--red); }
.day-row.changed { border-color: var(--primary); background: var(--primary-soft); }
.wd { font-size: 1.1rem; text-align: center; }
.human { min-height: 1em; font-size: .78rem; }

/* apps settings */
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; }
.mode input { display: none; }
.mode.on { border-color: var(--primary); background: var(--primary-soft); }
.mode span { font-size: .88rem; }
.rule-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rule-add input[name=identifier] { flex: 2; min-width: 180px; }
.rule-add input[name=display_name] { flex: 1; min-width: 140px; }
.rule-list { list-style: none; margin: 14px 0 0; padding: 0; }
.rule-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.rule-list li .pill { min-width: 70px; justify-content: center; }
.rule-list small { display: block; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.danger-zone { border-color: var(--red-soft); }

/* devices */
.device-list { list-style: none; margin: 0; padding: 0; }
.device-list li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.device-list li:first-child { border-top: 0; padding-top: 0; }
.dev-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--soft); color: var(--muted); }
.dev-ic.on { background: var(--green-soft); color: var(--green); }
.inline-edit { display: flex; gap: 4px; align-items: center; margin-bottom: 4px; }
.inline-edit input { border-color: transparent; padding: 4px 8px; font-weight: 700; width: auto; max-width: 260px; }
.inline-edit input:hover { border-color: var(--line); }
.howto { padding-left: 20px; margin: 0 0 16px; }
.howto li { margin-bottom: 14px; }
.howto p { margin: 4px 0 0; color: var(--muted); }
.howto .copy-box { margin-top: 8px; }

/* kid request */
.chips { display: flex; gap: 8px; }
.chip { flex: 1; }
.chip input { display: none; }
.chip span { display: block; text-align: center; padding: 12px; border: 2px solid var(--line); border-radius: 12px; font-weight: 700; cursor: pointer; }
.chip input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }

/* responsive */
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; gap: 20px; max-width: 440px; }
  .auth-hero { text-align: center; }
  .auth-hero h1 { font-size: 1.9rem; }
  .steps { align-items: center; }
  .grid-2-1 { grid-template-columns: 1fr; }
  .day-row { grid-template-columns: 36px 1fr; }
  .day-row .field:nth-of-type(2) { grid-column: 2; }
  .day-row [data-copy-day] { grid-column: 2; justify-self: start; }
  .mode-pick { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .nav a span { display: none; }
  .container { padding-top: 16px; }
  h1 { font-size: 1.35rem; }
  .card { padding: 16px; }
  .grid { grid-template-columns: 1fr; }
  .today-card { flex-direction: column; align-items: stretch; text-align: left; }
  .today-card .ring { align-self: center; }
  .child-body { flex-direction: column; align-items: stretch; }
  .child-body .ring { align-self: center; }
  .rule-quick { width: 100%; }
  .list li form { width: 100%; }
}
.cmd-block { margin: 10px 0 14px; }
.cmd-block .copy-box { margin-top: 6px; align-items: flex-start; }
.cmd-block .copy-box code { font-size: .78rem; font-weight: 500; white-space: pre-wrap; word-break: break-all; }
.toast-info { background: #2b2d7a; }
.toast-info .ic { color: #b3b3ff; }
.toast-sticky { cursor: pointer; }
.toast-link { color: #fff; font-weight: 700; text-decoration: underline; margin-left: 6px; white-space: nowrap; }
.visits li { align-items: flex-start; }
.visits .time { min-width: 42px; padding-top: 2px; font-variant-numeric: tabular-nums; }
.visits .block-line { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }
.visits li.blocked strong { color: var(--red); }
input[type=date] { width: auto; }
textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: inherit; font: inherit; resize: vertical; }
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.switch-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.switch-row input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--primary); }
.switch-row small { display: block; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 8px; }
.cat { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.cat input { margin-top: 3px; accent-color: var(--primary); }
.cat small { display: block; font-size: .8rem; }
.cat:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.chip span small { font-weight: 500; }
.auth-wrap.single { grid-template-columns: minmax(0, 440px); justify-content: center; }
.notif-list li.unread { background: var(--primary-soft); margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
.notif-list li.urgent strong { color: var(--red); }
.notif-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--soft); color: var(--primary-text); flex: none; }
.notif-list li.urgent .notif-ic { background: var(--red-soft); color: var(--red); }
.channel { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 8px; }
.channel form { margin: 0; }
.preset-card { border-color: var(--primary); background: linear-gradient(135deg, var(--primary-soft), var(--card)); }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.preset { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); display: flex; flex-direction: column; }
.preset p { flex: 1; margin: 6px 0 12px; }
.weekday-pick { display: inline-flex; gap: 4px; }
.weekday-pick input { display: none; }
.weekday-pick span { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; font-weight: 600; font-size: .85rem; }
.weekday-pick input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.stat-card b { font-size: 1.35rem; }
.stat-card .up { color: var(--red); font-size: .85rem; font-weight: 600; }
.stat-card .down { color: var(--green); font-size: .85rem; font-weight: 600; }
.stat-card.warn { border-color: var(--red); }
.suggest { border-color: var(--amber); }
.grid-2-1.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .grid-2-1.even { grid-template-columns: 1fr; } }
.cat-limit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.cat-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.new-items { border-color: var(--primary); }
.tip { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }

/* 디지털 약속서 (WO-14) */
.promise-list { margin: 4px 0 14px; padding: 12px 14px 12px 34px; background: var(--soft); border-radius: 12px; line-height: 1.7; }
.promise-list li::marker { color: var(--primary); font-weight: 700; }
.promise-card { border: 2px solid var(--primary); }

/* 해야 할 일 */
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-list li { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.todo-list li:last-child { border-bottom: 0; }
.todo-list li.done .grow { color: var(--muted); text-decoration: line-through; }
.todo-check { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); background: transparent; color: #fff; font-weight: 800; cursor: pointer; display: grid; place-items: center; }
.todo-list li.done .todo-check { background: var(--green); border-color: var(--green); }
.ok-text { color: var(--green); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- 섹션 바로가기 (긴 화면) */
section.card[id], section.card { scroll-margin-top: 76px; }
.toc-layout.has-toc { display: grid; grid-template-columns: 188px minmax(0, 1fr); gap: 20px; align-items: start; }
.toc { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.toc .toc-title { font-size: .72rem; font-weight: 700; color: var(--muted); padding: 4px 10px 6px; letter-spacing: .02em; }
.toc a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc a:hover { text-decoration: none; background: var(--soft); color: var(--text); }
.toc a.on { background: var(--primary-soft); color: var(--primary-text); }
.toc-body > .narrow-card { max-width: 720px; }
@media (max-width: 960px) {
  .toc-layout.has-toc { display: block; }
  .toc { top: 58px; z-index: 5; flex-direction: row; overflow-x: auto; scrollbar-width: none; margin-bottom: 12px; padding: 6px; border-radius: 12px; }
  .toc .toc-title { display: none; }
  .toc a { flex: none; padding: 6px 12px; }
}

/* 접는 고급 설정 */
details.more { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; }
details.more > summary { cursor: pointer; font-weight: 700; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '▸ '; color: var(--muted); }
details.more[open] > summary::before { content: '▾ '; }

/* 요일별 사용 시간: 표 형태 */
.days { gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.day-head { display: grid; grid-template-columns: 44px 260px 1fr auto; gap: 16px; padding: 8px 14px; background: var(--soft); font-size: .78rem; font-weight: 600; color: var(--muted); }
.days .day-row { grid-template-columns: 44px 260px 1fr auto; border: 0; border-radius: 0; border-top: 1px solid var(--line); padding: 8px 14px; }
.days .day-row .field.inline > span:first-child { display: none; }
.days .day-row .field.inline:first-of-type { flex-direction: row; align-items: center; gap: 10px; }
.days .day-row .human { min-height: 0; }
@media (max-width: 860px) {
  .day-head { display: none; }
  .days .day-row { grid-template-columns: 36px 1fr; }
  .days .day-row .field.inline > span:first-child { display: block; }
}

/* 안내 줄 */
.tip > span { flex: 1; }
.routine-grid { align-items: start; }
@media (max-width: 860px) {
  .days .day-row { gap: 8px 12px; padding: 10px 12px; }
  .days .day-row .field.inline .row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; }
  .days .day-row input[type=time] { width: 100%; min-width: 0; padding: 8px; }
  .days .day-row [data-copy-day] { padding: 4px 0; }
}

/* ---------------------------------------------------------------- 아이 화면 (내 시간) */
.kid-hero { display: flex; align-items: center; gap: 28px; border-left: 6px solid var(--primary); }
.kid-hero.tone-green { border-left-color: var(--green); }
.kid-hero.tone-amber { border-left-color: var(--amber); }
.kid-hero.tone-red { border-left-color: var(--red); }
.kid-hero .ring { width: 168px; height: 168px; }
.kid-hero .ring > div { width: 138px; height: 138px; }
.kid-hero .ring strong { font-size: 1.35rem; }
.hero-title { font-size: 1.45rem; margin: 0 0 4px; }
.stat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.stat-chips > * { display: flex; flex-direction: column; padding: 8px 12px; background: var(--soft); border-radius: 10px; min-width: 104px; color: inherit; }
.stat-chips > a:hover { text-decoration: none; background: var(--primary-soft); }
.stat-chips small { font-size: .74rem; color: var(--muted); }
.stat-chips b { font-size: .98rem; }
.kid-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.kid-grid.single { grid-template-columns: minmax(0, 1fr); }
.kid-grid > .card, .kid-col > .card:last-child { margin-bottom: 0; }
.kid-col { display: flex; flex-direction: column; gap: 16px; }
.kid-col > .card { margin: 0; }
.req-wait { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 12px; background: var(--amber-soft); color: #8a5a00; }
.req-history { list-style: none; margin: 0; padding: 0; }
.req-history li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: .9rem; }
details.fold > summary { list-style: none; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { display: inline; margin: 0; }
details.fold > summary::after { content: '펼치기 ▾'; float: right; color: var(--muted); font-size: .85rem; margin-top: 4px; }
details.fold[open] > summary::after { content: '접기 ▴'; }
.card .bar + .todo-list { margin-top: 6px; }
@media (max-width: 860px) {
  .kid-grid { grid-template-columns: minmax(0, 1fr); }
  .kid-hero { flex-direction: column; align-items: stretch; text-align: left; }
  .kid-hero .ring { align-self: center; }
  .hero-title { font-size: 1.25rem; }
}
@media (prefers-color-scheme: dark) { .req-wait { color: #f5c46b; } }
@media (max-width: 560px) {
  .stat-chips { display: grid; grid-template-columns: 1fr 1fr; }
  .stat-chips > * { min-width: 0; }
  .kid-hero .ring { width: 136px; height: 136px; }
  .kid-hero .ring > div { width: 110px; height: 110px; }
  .kid-hero .ring strong { font-size: 1.1rem; }
  .kid-hero .row .btn, .kid-hero .row form { flex: 1 1 100%; }
  .kid-hero .row form .btn { width: 100%; }
}

/* ---------------------------------------------------------------- 제목 아이콘 배지 */
.ti { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--primary-soft);
      font-size: 17px; line-height: 1; font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif; font-weight: 400; }
.ti.green { background: var(--green-soft); }
.ti.amber { background: var(--amber-soft); }
.ti.red { background: var(--red-soft); }
.ti.pink { background: color-mix(in srgb, #ec4899 14%, transparent); }
h2 .ti { margin-right: 2px; }
details.fold > summary h2 { display: inline-flex; }
.toc a .toc-ic { display: inline-block; width: 22px; font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif; }
.notif-ic.emoji { font-size: 18px; line-height: 1; font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif; }
.kv > span:first-child, .stat-chips small { white-space: nowrap; }

/* 프로필 사진 */
.avatar.photo { padding: 0; overflow: hidden; background: var(--soft); }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xl { width: 88px; height: 88px; border-radius: 26px; font-size: 2.2rem; }
.avatar-editor { display: flex; align-items: center; gap: 18px; margin-top: 12px; }
.avatar-editor .stack-s { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
/* 로그인 화면: 기억된 사람 */
.login-face { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.login-face h2 { font-size: 1.35rem; }

/* 모은 시간 */
.bank-big { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 8px; }
.bank-big b { font-size: 2rem; color: var(--amber); }

/* ---------------------------------------------------------------- 사용 현황 */
.period-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.period-seg { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; }
.period-seg a { padding: 6px 14px; border-radius: 8px; color: var(--muted); font-weight: 700; font-size: .9rem; }
.period-seg a.on { background: var(--card); color: var(--primary-text); box-shadow: var(--shadow); }
.period-seg a:hover { text-decoration: none; }
.period-nav { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.period-nav b { font-size: 1.05rem; min-width: 150px; text-align: center; }
.period-nav .disabled { opacity: .35; pointer-events: none; }
.period-pick input { padding: 6px 8px; }
.period-range { flex: 1; }
.period-bar > .btn:last-child { margin-left: auto; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-grid .stat-card { margin: 0; }
.stat-charts { align-items: start; }
.stat-charts .span-all { grid-column: 1 / -1; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 190px; padding-top: 8px; }
.bars.dense { gap: 2px; }
.bar-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 3px; color: inherit; }
.bar-col:hover { text-decoration: none; }
.bar-col .col { position: relative; flex: 1; width: 100%; max-width: 38px; display: flex; align-items: flex-end; background: var(--soft); border-radius: 6px; overflow: hidden; }
.bar-col .col > span { display: block; width: 100%; background: var(--primary); border-radius: 6px 6px 0 0; }
.bar-col.over .col > span { background: var(--red); }
.bar-col.today .col { outline: 2px solid var(--primary); outline-offset: 1px; }
.bar-col.future .col { opacity: .35; }
.bar-col:hover .col > span { filter: brightness(1.15); }
.bar-col .limit { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed var(--amber); z-index: 1; }
.bar-col small { font-size: .7rem; line-height: 1.1; white-space: nowrap; }
.bar-col small.we { color: var(--red); }
.bars.dense .bar-col small { font-size: .62rem; }
.trend .bar-col .col > span { background: var(--green); }
.trend .bar-col.today .col > span { background: var(--primary); }
.legend { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; }
.legend.over { background: var(--red); }
.legend.limit { border-top: 2px dashed var(--amber); height: 0; width: 14px; border-radius: 0; }
.more-item { display: none; }
.show-all .more-item { display: flex; }
@media (max-width: 860px) {
  .period-bar > .btn:last-child { margin-left: 0; }
  .bars { height: 150px; }
}.period-step { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
@media (max-width: 560px) {
  .period-bar { gap: 10px; }
  .period-seg { width: 100%; }
  .period-seg a { flex: 1; text-align: center; }
  .period-step { width: 100%; justify-content: space-between; }
  .period-nav b { min-width: 0; }
}

/* 비상 코드 */
.code-sheet { border: 2px dashed var(--line); border-radius: 12px; padding: 14px 18px; margin: 10px 0 12px; }
.code-sheet ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px 18px; margin: 10px 0 0; padding-left: 22px; }
.code-sheet code { font-size: 1.15rem; font-weight: 700; letter-spacing: .06em; }
@media print {
  body.print-codes * { visibility: hidden; }
  body.print-codes .code-sheet, body.print-codes .code-sheet * { visibility: visible; }
  body.print-codes .code-sheet { position: absolute; left: 0; top: 0; width: 100%; border-color: #999; }
}
/* ---------------------------------------------------------------- 사이트 관리 */
.site-notice { background: var(--amber-soft); color: #8a5a00; text-align: center; padding: 8px 16px; font-size: .9rem; font-weight: 600; border-bottom: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { .site-notice { color: #f5c46b; } }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .78rem; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--soft); }
.avatar.s { width: 32px; height: 32px; border-radius: 10px; font-size: .85rem; }
.admin-actions { display: flex; flex-direction: column; gap: 8px; }
.admin-actions .btn[disabled] { opacity: .5; cursor: default; }
.text-red { color: var(--red); }
.mono { font-family: Consolas, monospace; letter-spacing: .05em; font-size: 1.1rem; }
.narrow-card.wide { max-width: 760px; }

/* 공룡수학·공룡타자 자동 체크 */
.stack-cards { display: flex; flex-direction: column; gap: 16px; }
.stack-cards > .card { margin: 0; }
.todo-check.auto { display: grid; place-items: center; font-size: 15px; background: var(--green-soft); border-color: transparent; cursor: default; }
.todo-list li.auto .grow small { text-decoration: none; display: inline-block; }
.auto-fields { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.todo-period { flex-basis: 100%; }
/* 공지 */
.notice-list li .notice-ic { font-size: 1.15rem; width: 1.6em; text-align: center; }
.notice-list li a.grow { color: inherit; text-decoration: none; min-width: 0; }
.notice-list li.unread b { color: var(--primary); }
.notice-list li.on { background: var(--soft); border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.notice-body { line-height: 1.8; font-size: 1.02rem; word-break: keep-all; overflow-wrap: anywhere; }
.notice-card h2 .right { margin-left: auto; font-weight: 500; }
.notice-card h2 { display: flex; align-items: center; }
/* 공룡 사이트 연결: 사이트마다 따로 로그인 */
.dino-links { list-style: none; margin: 0 0 10px; padding: 0; }
.dino-links > li { padding: 10px 0; border-top: 1px solid var(--line); }
.dino-links > li:first-child { border-top: 0; }
.dino-head { display: flex; align-items: center; gap: 8px; font-size: .92rem; }
.dino-login { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.dino-login input { flex: 1 1 120px; min-width: 0; }
.dino-links details.more summary { font-size: .82rem; margin-top: 6px; }
.dino-actions { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
/* [🔓 연동 해제] 옆 [🔄 다른 아이디로 바꾸기]: 같은 버튼 모양·높이, 펼치면 아래 줄 전체 */
.dino-actions > form { display: flex; }
.dino-swap > summary { list-style: none; }
.dino-swap > summary::-webkit-details-marker { display: none; }
.dino-swap[open] { flex-basis: 100%; }
.dino-swap[open] > summary { border-color: var(--primary); color: var(--primary); }
.dino-swap[open] > .dino-sso { margin-top: 10px; }
.dino-ways, .dino-actions details .dino-sso { margin-top: 8px; }
.dino-sso { display: flex; gap: 6px; flex-wrap: wrap; }
.dino-ways > small, .dino-actions details > small { display: block; margin-top: 4px; }
/* ---------------------------------------------------------------- 해야 할 일 · 미션 */
#todos .section-head .btn { margin-left: auto; }
.text-amber { color: #b97500; }
.todo-group { font-size: .95rem; margin: 18px 0 6px; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); }
.todo-item:first-child { border-top: 0; }
.todo-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 800; font-size: .85rem; color: var(--muted); margin-top: 1px; }
.todo-item.todo .todo-mark { border-color: var(--amber); }
.todo-item.done .todo-mark { background: var(--green); border-color: var(--green); color: #fff; }
.todo-item.done .todo-title strong { color: var(--muted); }
.todo-item.off { opacity: .55; }
.todo-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.todo-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: .76rem; background: var(--soft); color: var(--muted); white-space: nowrap; }
.tag.gold { background: var(--amber-soft); color: #b97500; }
.tag.blue { background: var(--primary-soft); color: var(--primary-text); }
.tag.red { background: var(--red-soft); color: var(--red); }
.todo-acts { display: flex; gap: 2px; flex: none; }
.todo-others { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.todo-others > summary { cursor: pointer; font-weight: 700; font-size: .92rem; color: var(--muted); }

.todo-builder { margin-top: 22px; padding: 18px; border-radius: 14px; background: var(--soft); scroll-margin-top: 80px; }
.todo-builder h3 { margin: 0 0 12px; font-size: 1.05rem; }
.todo-step { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.step-title { font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.step-title b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .78rem; }
details.todo-step > summary.step-title { margin: 0; cursor: pointer; list-style: none; }
details.todo-step > summary::-webkit-details-marker { display: none; }
details.todo-step[open] > summary { margin-bottom: 4px; }
.type-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.type-tiles input, .seg input { display: none; }
.type-tiles span { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.type-tiles i { font-style: normal; font-size: 1.3rem; }
.type-tiles small { color: var(--muted); font-size: .76rem; line-height: 1.35; }
.type-tiles input:checked + span { border-color: var(--primary); background: var(--primary-soft); }
.todo-title-input { width: 100%; }
.idea-chips, .day-presets, .bonus-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.idea-chips { margin-top: 8px; }
.chip-btn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 99px; padding: 4px 11px; font-size: .8rem; cursor: pointer; }
.chip-btn:hover { border-color: var(--primary); color: var(--primary-text); }
.auto-goal { margin-top: 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.auto-goal p { flex-basis: 100%; margin: 4px 0 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex-wrap: wrap; }
.seg span { display: block; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: .88rem; }
.seg label + label span { border-left: 1px solid var(--line); }
.seg input:checked + span { background: var(--primary); color: #fff; }
.days-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.todo-step p[data-repeat-help] { margin: 10px 0 0; }
.bonus-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.todo-submit { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 4px; }
.todo-preview { flex: 1; min-width: 200px; font-size: .88rem; color: var(--primary-text); background: var(--card); border: 1px dashed var(--primary); border-radius: 10px; padding: 10px 12px; }
@media (max-width: 640px) {
  .type-tiles { grid-template-columns: 1fr; }
  .todo-item { flex-wrap: wrap; }
  .todo-acts { margin-left: 38px; }
}
/* ---------------------------------------------------------------- 사용 시간 탭 */
.pill.blue { background: var(--primary-soft); color: var(--primary-text); }
.time-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.time-stats > div { background: var(--soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.time-stats small { color: var(--muted); font-size: .8rem; }
.time-stats b { font-size: 1.15rem; }
.time-stats .warn b { color: var(--red); }
.time-stats .tag { align-self: flex-start; margin-top: 2px; }
.small-seg span { padding: 6px 12px; font-size: .82rem; }
#time-days .section-head .seg { margin-left: auto; }
.presets .chip-btn { font-size: .8rem; }
.simple-days { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.simple-day { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.simple-head b { font-size: 1.02rem; }
.simple-label { font-size: .8rem; color: var(--muted); font-weight: 700; margin-top: 4px; }
.limit-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.free-list { list-style: none; margin: 10px 0; padding: 0; }
.free-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.free-list li:first-child { border-top: 0; }
.free-ic { font-size: 1.2rem; }
.free-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.free-add input[name=value] { flex: 1 1 260px; min-width: 0; }
.mode-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; flex-basis: 100%; }
.mode-tiles .btn { flex-direction: column; align-items: flex-start; gap: 2px; white-space: normal; text-align: left; padding: 10px 12px; }
.mode-tiles i { font-style: normal; font-size: 1.3rem; }
.mode-tiles small { color: var(--muted); font-weight: 500; font-size: .76rem; }
@media (max-width: 720px) {
  .time-stats { grid-template-columns: 1fr 1fr; }
  .simple-days, .mode-tiles { grid-template-columns: 1fr; }
}
/* ---------------------------------------------------------------- 사용 시간 탭 (하위 탭) */
.today-card { padding-top: 18px; padding-bottom: 18px; }
.today-main { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.today-remain { display: flex; flex-direction: column; gap: 4px; flex: 1 1 320px; }
.today-remain > b { font-size: 2rem; line-height: 1.1; letter-spacing: -.02em; }
.today-remain.warn > b { color: var(--red); }
.today-remain .bar { max-width: 420px; }
.today-quick { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; padding: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.subtabs a { flex: 1 1 140px; text-align: center; padding: 10px 12px; border-radius: 10px; font-weight: 700; color: var(--muted); text-decoration: none; white-space: nowrap; }
.subtabs a:hover { background: var(--soft); color: var(--text); }
.subtabs a.on { background: var(--primary); color: #fff; }
.subtabs em { font-style: normal; font-size: .72rem; padding: 1px 7px; border-radius: 99px; background: var(--soft); color: var(--muted); margin-left: 4px; }
.subtabs a.on em { background: rgba(255,255,255,.25); color: #fff; }
.sub-panel > .card + .card { margin-top: 14px; }
.plain-list { list-style: none; margin: 10px 0; padding: 0; }
.plain-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.plain-list li:first-child { border-top: 0; }
.form-box { margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--soft); display: flex; flex-direction: column; gap: 10px; }
.form-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-label { width: 44px; font-size: .82rem; font-weight: 700; color: var(--muted); flex: none; }
.form-line input[name=label] { flex: 1 1 220px; }
.mode-tiles .btn.on { border-color: var(--primary); background: var(--primary-soft); }
.setting-rows { display: flex; flex-direction: column; margin: 10px 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); cursor: pointer; }
.setting-row:first-child { border-top: 0; }
.setting-row > span:first-child { display: flex; flex-direction: column; }
.setting-row small { font-size: .78rem; }
.setting-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); }
@media (max-width: 640px) {
  .today-quick { align-items: flex-start; }
  .subtabs a { flex-basis: 40%; }
}
/* ---------------------------------------------------------------- 기기 기록 (날짜별) */
.ev-days { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.ev-day { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ev-day > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 11px 14px; cursor: pointer; list-style: none; background: var(--soft); }
.ev-day > summary::-webkit-details-marker { display: none; }
.ev-day > summary::before { content: '▸'; color: var(--muted); margin-right: -4px; }
.ev-day[open] > summary::before { content: '▾'; }
.ev-date { flex: 1; }
.ev-sum { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ev-list { list-style: none; margin: 0; padding: 4px 14px 8px; }
.ev-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.ev-list li:first-child { border-top: 0; }
.ev-time { width: 86px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.ev-count { color: var(--primary-text); font-size: .8rem; margin-left: 4px; }
@media (max-width: 640px) {
  .ev-list li { flex-wrap: wrap; }
  .ev-time { width: auto; }
}
/* 하루 시간: 요약 · 저장 막대 */
.days-summary { background: var(--primary-soft); color: var(--primary-text); border-radius: 12px; padding: 12px 14px; margin: 6px 0 10px; line-height: 1.7; font-size: .92rem; }
.days-summary.per-day { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 14px; line-height: 1.6; }
.days-save .dirty-note { display: none; color: var(--primary-text); font-weight: 600; font-size: .88rem; margin-right: auto; }
#days-form.dirty .days-save { position: sticky; bottom: 12px; z-index: 5; background: var(--card); border: 1px solid var(--primary); border-radius: 14px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(30, 40, 90, .15); display: flex; align-items: center; }
#days-form.dirty .dirty-note { display: inline; }
/* ---------------------------------------------------------------- 사용 현황: 알아두면 좋은 점 */
.insight-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.insight { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border-left: 4px solid var(--line); background: var(--soft); flex-wrap: wrap; }
.insight.alert { border-left-color: var(--red); background: var(--red-soft); }
.insight.watch { border-left-color: var(--amber); background: var(--amber-soft); }
.insight.good { border-left-color: var(--green); background: var(--green-soft); }
.insight-ic { font-size: 1.4rem; flex: none; }
.insight .grow { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.insight small { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.insight-empty { margin: 8px 0 0; padding: 14px; border-radius: 12px; background: var(--green-soft); color: var(--green); font-weight: 600; }

.auto-goal .wide-field { flex-basis: 100%; }
.auto-goal .wide-field select { max-width: 100%; }

/* 부모↔아이 메시지 (0.4.6) */
.msg-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.msg-layout.solo { grid-template-columns: 1fr; max-width: 760px; margin: 0 auto; }
.msg-side { padding: 16px 10px; position: sticky; top: 76px; }
.msg-side h2 { padding: 0 8px; }
.msg-threads { display: flex; flex-direction: column; gap: 2px; }
.msg-thread { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 12px; color: var(--text); }
.msg-thread:hover { background: var(--soft); text-decoration: none; }
.msg-thread.on { background: var(--primary-soft); }
.msg-thread .avatar { width: 40px; height: 40px; border-radius: 13px; font-size: 1rem; }
.msg-thread .grow { display: flex; flex-direction: column; }
.msg-thread small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-thread-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.msg-side-note { padding: 8px 8px 0; margin: 8px 0 0; border-top: 1px solid var(--line); }
.msg-chat { display: flex; flex-direction: column; padding: 0; height: calc(100vh - 120px); min-height: 460px; position: relative; overflow: hidden; }
.msg-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.msg-head .avatar { width: 40px; height: 40px; border-radius: 13px; font-size: 1rem; }
.msg-family { background: var(--primary-soft); font-size: 1.3rem !important; }
.msg-title { font-size: 1.1rem; }
.msg-back { display: none; font-size: 1.6rem; line-height: 1; padding: 0 6px 0 0; color: var(--muted); }
.msg-scroll { flex: 1; overflow-y: auto; padding: 14px 18px; background: var(--bg); overscroll-behavior: contain; }
.msg-more { display: block; margin: 0 auto 10px; }
.msg-empty { text-align: center; padding: 40px 10px; }
.msg-day { text-align: center; margin: 14px 0 8px; font-size: .78rem; color: var(--muted); }
.msg-day::before, .msg-day::after { content: ""; display: inline-block; width: 40px; height: 1px; background: var(--line); vertical-align: middle; margin: 0 10px; }
.msg-row { display: flex; gap: 8px; margin-top: 10px; align-items: flex-start; }
.msg-row.grouped { margin-top: 3px; }
.msg-row.theirs.grouped { padding-left: 44px; }
.msg-row.mine { flex-direction: row-reverse; }
.msg-av { width: 36px; height: 36px; border-radius: 12px; font-size: .95rem; }
.msg-col { display: flex; flex-direction: column; max-width: min(72%, 520px); }
.msg-row.mine .msg-col { align-items: flex-end; }
.msg-name { font-size: .78rem; color: var(--muted); margin: 0 0 3px 2px; font-weight: 600; }
.msg-line { display: flex; align-items: flex-end; gap: 6px; }
.msg-row.mine .msg-line { flex-direction: row-reverse; }
.msg-bubble { padding: 9px 13px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; line-height: 1.45; }
.msg-row.theirs .msg-bubble { border-top-left-radius: 6px; }
.msg-row.mine .msg-bubble { background: var(--primary); border-color: var(--primary); color: #fff; border-top-right-radius: 6px; }
.msg-row.ally .msg-bubble { background: var(--primary-soft); border-color: transparent; }
.msg-row.grouped .msg-bubble { border-radius: 16px; }
.msg-bubble.deleted { background: transparent !important; color: var(--muted) !important; border: 1px dashed var(--line) !important; font-style: italic; font-size: .88rem; }
.msg-bubble.flagged { box-shadow: 0 0 0 2px var(--red); }
.msg-bubble.sticker { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 16px; min-width: 88px; background: var(--card) !important; color: var(--text) !important; border: 1px solid var(--line) !important; border-radius: 20px !important; }
.msg-glyph { font-size: 2.2rem; line-height: 1.1; color: var(--primary-text); font-family: "Segoe UI Symbol", "Malgun Gothic", sans-serif; }
.msg-cap { font-size: .8rem; font-weight: 700; color: var(--muted); }
.msg-meta { display: flex; flex-direction: column; align-items: flex-end; font-size: .72rem; color: var(--muted); white-space: nowrap; gap: 1px; }
.msg-row.theirs .msg-meta { align-items: flex-start; }
.msg-unread { color: var(--amber); font-weight: 800; }
.msg-read { color: var(--primary-text); font-weight: 600; }
.msg-del { border: 0; background: none; padding: 0; color: var(--muted); font-size: .72rem; cursor: pointer; text-decoration: underline; }
.msg-new-pill { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); border: 0; border-radius: 99px; padding: 6px 14px; background: var(--primary); color: #fff; font-weight: 700; box-shadow: var(--shadow); cursor: pointer; }
.msg-compose { border-top: 1px solid var(--line); padding: 10px 14px 12px; background: var(--card); }
.msg-presets { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.msg-chip { flex: none; border: 1px solid var(--line); background: var(--soft); color: var(--text); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.msg-chip:hover { border-color: var(--primary); color: var(--primary-text); }
.msg-stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; padding: 4px 0 10px; }
.msg-sticker { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); cursor: pointer; font: inherit; }
.msg-sticker:hover { border-color: var(--primary); background: var(--primary-soft); }
.msg-sticker .msg-glyph { font-size: 1.6rem; }
.msg-sticker small { font-size: .72rem; color: var(--muted); font-weight: 600; }
.msg-form { display: flex; gap: 8px; align-items: flex-end; }
.msg-form textarea { flex: 1; resize: none; min-height: 42px; max-height: 140px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font: inherit; background: var(--bg); color: var(--text); line-height: 1.4; }
.msg-form textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.msg-sticker-toggle { font-size: 1.3rem; padding: 6px 10px; }
.msg-hint { display: flex; justify-content: space-between; gap: 10px; font-size: .75rem; color: var(--muted); padding-top: 4px; min-height: 1.2em; }
.msg-status.err, .msg-count.err { color: var(--red); font-weight: 600; }
.msg-noscript { padding: 6px 0; border-bottom: 1px solid var(--line); }
.msg-btn { position: relative; }
.msg-btn .dot { position: absolute; top: -6px; right: -6px; }
.msg-card .msg-mini { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.msg-mini li { display: flex; gap: 8px; align-items: baseline; padding: 8px 12px; border-radius: 12px; background: var(--soft); }
.msg-mini li.mine { background: var(--primary-soft); }
.msg-mini li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-msg .dot { margin-left: 2px; }
.msg-layout > * { min-width: 0; }
/* 좁은 화면: 메뉴가 하나 늘어서(메시지) 넘치지 않게 — 메뉴만 가로로 밀어 보기, 아주 좁으면 글자 로고 숨김 */
@media (max-width: 560px) {
  .topbar-in { gap: 8px; padding: 8px 10px; }
  .brand { flex: none; }
  .nav { gap: 0; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: 8px 9px; }
}
@media (max-width: 440px) { .brand-text { display: none; } }
@media (max-width: 760px) {
  .msg-layout { grid-template-columns: 1fr; }
  .msg-layout.picked .msg-side { display: none; }
  .msg-layout.auto .msg-chat { display: none; }
  .msg-side { position: static; }
  .msg-back { display: block; }
  .msg-chat { height: calc(100vh - 90px); border-radius: 12px; }
  .msg-col { max-width: 82%; }
}
