/* Shorts-board — 주인의 Sns-board(딜봇 대시보드)와 같은 디자인 말씨: 무채색, 얇은 선, 큰 여백, 휴대폰 먼저.
   색은 :root 토큰만 쓴다 (Sns-board app.css 와 같은 값). 이모지 없이 선 아이콘(SVG)만. */
:root {
  color-scheme: light dark;
  --bg: #f6f7f9; --card: #fff; --line: #e5e7eb; --text: #111827; --sub: #6b7280; --muted: #8a919c;
  --ac: #111827; --ac-on: #fff; --ac-ink: #374151; --ac-soft: #f3f4f6;
  --red: #b91c1c; --red-soft: #fef2f2; --or: #b45309; --or-soft: #fff7e6; --gr: #15803d; --gr-soft: #ecfdf3;
  --grey: #f3f4f6; --tile: #f9fafb; --field: #fff; --fline: #d1d5db; --toast: #111827; --bd: rgba(17, 24, 39, .45);
  --chart: #4a6fa5; --chart-hi: #2f4f7f; --focus: #6b7280;
  --top: env(safe-area-inset-top, 0px); --bot: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #111318; --card: #1a1d23; --line: #2c3038; --text: #f3f4f6; --sub: #a1a7b3; --muted: #868c98;
    --ac: #f3f4f6; --ac-on: #111827; --ac-ink: #d1d5db; --ac-soft: #262a31;
    --red: #f87171; --red-soft: #3a1d1f; --or: #fbbf24; --or-soft: #3a2e17; --gr: #4ade80; --gr-soft: #16301f;
    --grey: #262a31; --tile: #20242a; --field: #111318; --fline: #3a3f48; --toast: #000; --bd: rgba(0, 0, 0, .6);
    --chart: #8aa9d6; --chart-hi: #c3d4ee; --focus: #9ca3af;
  }
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #111318; --card: #1a1d23; --line: #2c3038; --text: #f3f4f6; --sub: #a1a7b3; --muted: #868c98;
  --ac: #f3f4f6; --ac-on: #111827; --ac-ink: #d1d5db; --ac-soft: #262a31;
  --red: #f87171; --red-soft: #3a1d1f; --or: #fbbf24; --or-soft: #3a2e17; --gr: #4ade80; --gr-soft: #16301f;
  --grey: #262a31; --tile: #20242a; --field: #111318; --fline: #3a3f48; --toast: #000; --bd: rgba(0, 0, 0, .6);
  --chart: #8aa9d6; --chart-hi: #c3d4ee; --focus: #9ca3af;
}
:root[data-theme=light] { color-scheme: light; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: anywhere;
  overscroll-behavior-y: contain; -webkit-tap-highlight-color: transparent;
  padding: calc(56px + var(--top)) 0 calc(80px + var(--bot));
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
body.bare { padding-top: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-appearance: none; appearance: none; }
a { color: var(--ac-ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── 머리 (제목 · 밝기 · 새로고침) ── */
.hd {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  height: calc(56px + var(--top));
  padding: var(--top) max(16px, env(safe-area-inset-right), calc((100% - 688px) / 2)) 0 max(16px, env(safe-area-inset-left), calc((100% - 688px) / 2));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.hd h1 { font-size: 19px; font-weight: 700; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.hd .back { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 44px; margin-left: -8px; color: var(--text); text-decoration: none; }
.thm {
  border: 1px solid var(--line); background: var(--card); color: var(--ac-ink); font-size: 13px; font-weight: 600;
  height: 30px; padding: 0 12px; border-radius: 999px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
}
.rf { border: 0; background: none; color: var(--ac-ink); font-size: 15px; font-weight: 600; min-height: 44px; padding: 0 4px; }

#view { max-width: 720px; margin: 0 auto; padding: 12px 16px 24px; outline: 0; }
#view > h1 { display: none; } /* 화면 제목은 머리에 보인다 */
h2 { font-size: 13px; font-weight: 600; color: var(--sub); margin: 22px 2px 8px; }
.muted { color: var(--sub); font-size: 14px; }
.spacer { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row > a { font-size: 14px; font-weight: 600; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }

/* ── 카드 ── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px 14px; margin: 0 0 12px; min-width: 0;
}
.card > b:first-child, .card .row > b { font-size: 16px; font-weight: 650; }
a > .card { color: var(--text); }
a:has(> .card) { text-decoration: none; display: block; }
a > .card::after { content: ""; }

/* 알약 표시 */
.badge {
  display: inline-block; flex: none; font-size: 12px; font-weight: 600; line-height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--grey); color: var(--ac-ink); white-space: nowrap; vertical-align: middle;
}
.badge.ok { background: var(--gr-soft); color: var(--gr); }
.badge.warn { background: var(--red-soft); color: var(--red); }
.badge.hot { background: var(--or-soft); color: var(--or); }

/* 단추 */
button {
  min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text);
  padding: 0 14px; font-size: 14px; font-weight: 600;
}
button.primary { background: var(--ac); border-color: var(--ac); color: var(--ac-on); min-height: 48px; font-size: 15px; padding: 0 16px; }
button.danger { background: var(--card); color: var(--red); border-color: var(--line); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  display: block; width: 100%; min-height: 48px; border: 1px solid var(--fline); border-radius: 10px; background: var(--field);
  padding: 10px 12px; font-size: 16px;
}
input:focus, select:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
select.inline { width: auto; min-height: 44px; padding: 0 34px 0 12px; font-size: 15px; font-weight: 600; }
label { font-size: 14px; color: var(--sub); }
form label { display: grid; gap: 6px; }
form.grid2 button { align-self: end; }

/* 데모 안내 */
.demo-banner {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin: 0 0 12px; font-size: 14px; color: var(--sub);
}
.demo-banner::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--or); flex: none; align-self: flex-start; margin-top: 7px; }
.demo-banner span { line-height: 1.5; }
.demo-banner b { color: var(--text); }

/* ── 할 일 ── */
.todo { display: flex; gap: 12px; align-items: flex-start; }
.todo .ico { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--grey); color: var(--ac-ink); display: flex; align-items: center; justify-content: center; }
.todo.warn .ico { background: var(--red-soft); color: var(--red); }
.todo .t { font-size: 16px; font-weight: 650; line-height: 1.35; }
.todo .d { color: var(--sub); font-size: 14px; margin-top: 2px; }
.todo.warn .d { color: var(--red); }
.acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.acts a { text-decoration: none; }
.acts .muted { font-size: 13px; }
.card.todo.warn { border-color: var(--line); }

/* ── 숫자 칸 ── */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
@media (min-width: 600px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.kpi .l { color: var(--sub); font-size: 12px; margin: 0 0 4px; }
.kpi .v { font-size: 22px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.kpi .c { font-size: 12px; font-weight: 700; margin-top: 2px; }
.up { color: var(--gr); }
.down { color: var(--red); }
.kpi .c.muted { color: var(--muted); font-weight: 500; }

/* 기간 고르기 (Sns-board seg) */
.seg {
  display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 3px; background: var(--grey);
  border-radius: 11px; padding: 3px; margin: 12px 0 14px;
}
.seg button { min-height: 40px; border: 0; border-radius: 9px; background: none; font-size: 14px; font-weight: 600; color: var(--sub); padding: 0 4px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--line); }

/* ── 그래프 ── */
.chart { position: relative; width: 100%; padding: 12px 10px 6px; }
.chart svg { display: block; width: 100%; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart rect.b { fill: var(--chart); opacity: .85; }
.chart rect.b.sel { fill: var(--chart-hi); opacity: 1; }
.chart .tip { font-size: 13px; color: var(--sub); padding: 0 4px 6px; }
.chart .tip b { color: var(--text); font-variant-numeric: tabular-nums; }
.chart line.mark { stroke: var(--or); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart path.mark-head { fill: var(--or); }

/* ── 목록 줄 ── */
.metric { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 40px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.card > .metric:first-child, .card > .muted + .metric, .tip-box > .metric:first-of-type { border-top: 0; }
.metric > span:last-child, .metric > b { text-align: right; font-variant-numeric: tabular-nums; }
.metric.bad, .metric.bad span { color: var(--red); font-weight: 600; }
.tip-box { background: var(--tile); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }
.tip-box.warnbox { background: var(--red-soft); border-color: transparent; }
.tip-box > b:first-child, .tip-box > .t { font-weight: 650; }

.grid2 { display: grid; gap: 10px; }
@media (min-width: 700px) { .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .grid2 > .card { margin: 0; } }

/* 진행 막대 */
.bar { height: 6px; border-radius: 99px; background: var(--grey); overflow: hidden; margin: 8px 0; }
.bar span { display: block; height: 100%; background: var(--ac); border-radius: 99px; }
.bar.stack { display: flex; height: 10px; }
.bar.stack span { border-radius: 0; background: var(--chart); }
.bar.stack span.fixed { background: var(--ac); }

/* 접기 */
details { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 4px; }
details.card { border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; min-height: 44px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; list-style: none; font-size: 15px; font-weight: 600; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 20px; transition: transform .15s; }
details[open] > summary::after { transform: rotate(90deg); }
label.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); color: var(--text); font-size: 15px; }
label.check input { width: 22px; height: 22px; min-height: 0; flex: 0 0 22px; margin-top: 1px; accent-color: var(--ac); padding: 0; }

/* 켜기/끄기 스위치 */
.switch { position: relative; width: 50px; height: 30px; flex: 0 0 50px; }
.switch input { opacity: 0; width: 0; height: 0; min-height: 0; }
.switch span { position: absolute; inset: 0; background: var(--fline); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ac); }
.switch input:checked + span::before { transform: translateX(20px); background: var(--ac-on); }
.switch input:disabled + span { opacity: .45; cursor: not-allowed; }

pre.code { white-space: pre-wrap; word-break: break-word; background: var(--tile); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0 0 12px; }

/* ── 아래 탭 (Sns-board 와 같음) ── */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(64px + var(--bot)); padding: 0 env(safe-area-inset-right) var(--bot) env(safe-area-inset-left);
  background: var(--card); border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; position: relative; }
.tabs a.active { color: var(--text); }
.tabs .bdg { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ac); color: var(--ac-on); font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
@media (min-width: 760px) {
  .tabs { padding-left: calc(50% - 300px); padding-right: calc(50% - 300px); }
  #view { padding-top: 20px; }
}

/* ── 로그인 ── */
.login { max-width: 360px; margin: 14vh auto 0; text-align: center; padding: 0 16px; }
.login .logo { width: 64px; height: 64px; border-radius: 16px; }
.login h1 { display: block !important; font-size: 22px; margin: 16px 0 4px; }
.login form { display: grid; gap: 10px; margin-top: 24px; }

/* 알림 */
#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(76px + var(--bot)); z-index: 60; max-width: 560px; margin: 0 auto;
  background: var(--toast); color: #fff; border-radius: 12px; padding: 13px 16px; font-size: 15px; min-height: 48px;
  box-shadow: 0 4px 14px rgba(17, 24, 39, .18); animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: .4; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* 메뉴 줄 (Sns-board .mr) */
.card.menu { padding: 0 14px; }
.mr { display: flex; align-items: center; min-height: 60px; border-top: 1px solid var(--line); text-decoration: none; color: var(--text); gap: 10px; }
.mr:first-child { border-top: 0; }
.mr span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mr b { font-size: 16px; font-weight: 600; }
.mr small { font-size: 13px; color: var(--sub); }
.mr::after { content: "›"; color: var(--muted); font-size: 22px; }

/* 영상 미리보기 (세로 9:16) */
.video-card { margin-top: 10px; display: flex; justify-content: center; }
.video-card video { width: 100%; max-width: 360px; aspect-ratio: 9 / 16; background: #000; border-radius: 12px; }

/* 영상 분석 */
.hero { font-size: 15px; color: var(--sub); margin: 12px 0 10px; }
.hero b { font-size: 22px; color: var(--text); font-variant-numeric: tabular-nums; }
.small { font-size: 12px; }
.kpis.scroll { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.kpis.scroll .kpi { flex: 0 0 72%; max-width: 260px; scroll-snap-align: start; }
@media (min-width: 600px) { .kpis.scroll .kpi { flex: 1 1 0; max-width: none; } }
.chart .legend { display: flex; gap: 14px; font-size: 12px; color: var(--sub); padding: 0 4px 4px; }
.chart .legend .sw { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--chart); vertical-align: middle; margin-right: 6px; }
.chart .legend .sw.dash { border-top: 2px dashed var(--muted); }
.chart path.mine { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart path.usual { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart text.lab { font-size: 11px; font-weight: 600; fill: var(--text); }
.chart text.lab.muted { fill: var(--muted); font-weight: 500; }
.chart line.cross { stroke: var(--sub); stroke-width: 1; stroke-dasharray: 2 3; }
.chart circle.dot { fill: var(--chart); stroke: var(--card); stroke-width: 2; }
.hbar { display: grid; grid-template-columns: minmax(0, 9em) 1fr 3em; gap: 10px; align-items: center; min-height: 34px; font-size: 14px; }
.hbar .hl { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .ht { height: 8px; background: var(--grey); border-radius: 4px; overflow: hidden; }
.hbar .ht i { display: block; height: 100%; background: var(--chart); border-radius: 4px; }
.hbar .hv { text-align: right; color: var(--sub); font-variant-numeric: tabular-nums; }
.card.menu.inner { margin: 10px 0 0; border: 0; padding: 0; background: transparent; }
