:root {
  --bg: #f5f6f8; --card: #ffffff; --text: #1d2129; --muted: #6b7280; --line: #e3e6ea;
  --accent: #1f6feb; --accent-soft: #e8f0fe; --danger: #d93025; --danger-soft: #fdecea;
  --ok: #188038; --ok-soft: #e6f4ea; --warn: #b06000; --warn-soft: #fef3e0;
  --rec: #e53935; --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --card: #1b1e24; --text: #e7e9ec; --muted: #9aa1ab; --line: #2c3038;
    --accent: #5b9dff; --accent-soft: #1d2b44; --danger: #ff6b5e; --danger-soft: #3a1f1d;
    --ok: #5cc982; --ok-soft: #173224; --warn: #f0b04f; --warn-soft: #3a2c14; --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
#app { max-width: 760px; margin: 0 auto; padding: 12px 16px 24px; }
.loading { color: var(--muted); text-align: center; margin-top: 40vh; }
h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 0 0 8px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }

/* 상단 줄 */
.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-height: 40px; }
.topbar h1 { flex: 1; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { text-decoration: none; font-size: 15px; padding: 6px 4px; white-space: nowrap; }

/* 카드 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card h2 { display: flex; align-items: center; gap: 8px; }
.card h2 .grow { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }

/* 버튼 */
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 12px; cursor: pointer; white-space: nowrap; min-height: 38px; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.big { padding: 12px 16px; font-size: 16px; min-height: 48px; flex: 1; }
.btn.rec { background: var(--rec); border-color: var(--rec); color: #fff; }
.btn.small { padding: 4px 9px; min-height: 30px; font-size: 13px; border-radius: 8px; }
.iconbtn { border: 0; background: none; cursor: pointer; font-size: 18px; padding: 4px 8px; color: var(--muted); }

/* 입력 */
.field { display: block; margin-bottom: 10px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); min-height: 40px;
}
.input:focus, .editor:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }

/* 안건·메모 편집기 */
.editor { min-height: 90px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow-wrap: anywhere; }
.editor:empty::before { content: attr(data-placeholder); color: var(--muted); }
.editor p, .editor div { margin: 0 0 4px; }
.editor ul, .editor ol { margin: 4px 0; padding-left: 22px; }
.toolbar { display: flex; gap: 4px; margin-bottom: 6px; }
.toolbar button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; min-width: 34px; height: 30px; cursor: pointer; }
.saved { font-size: 12px; color: var(--muted); font-weight: normal; }

/* 회의 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a.item { display: block; padding: 12px 2px; color: inherit; text-decoration: none; }
.item .title { font-weight: 600; overflow-wrap: anywhere; }
.item .meta { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.item .line { font-size: 13px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; -webkit-overflow-scrolling: touch; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 5px 12px; white-space: nowrap; cursor: pointer; font-size: 14px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }

/* 녹음 */
.recbar { display: flex; gap: 8px; }
.recording-now { margin-top: 10px; padding: 12px; border-radius: 10px; background: var(--danger-soft); }
.recording-now .clock { font-size: 26px; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--rec); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--rec); margin-right: 6px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.reccard { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; background: var(--card); }
.reccard .head { display: flex; align-items: center; gap: 6px; }
.reccard .head .grow { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reccard audio { width: 100%; margin: 8px 0; height: 40px; }
.reccard .actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.status { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); margin: 8px 0; font-size: 14px; }
.status.err { background: var(--danger-soft); color: var(--danger); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-top: 8px; align-items: center; }
.tabs button { border: 0; background: none; padding: 8px 10px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .grow { flex: 1; }
.transcript { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow-y: auto; padding: 10px 2px 2px; font-size: 14px; margin: 0; font-family: inherit; }
textarea.transcript-edit { width: 100%; min-height: 260px; margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 14px; }

/* 마크다운 요약 */
.md { overflow-wrap: anywhere; }
.md h1, .md h2, .md h3 { font-size: 16px; margin: 14px 0 6px; }
.md ul, .md ol { padding-left: 20px; margin: 4px 0; }
.md p { margin: 4px 0; }
.actionlist { list-style: none; padding: 0; margin: 8px 0; }
.actionlist li { display: flex; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.actionlist input { margin-top: 4px; width: 18px; height: 18px; flex: none; }

/* 할 일 */
.task { display: flex; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.task:last-child { border-bottom: 0; }
.task input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.task .body { flex: 1; min-width: 0; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .detail { font-size: 13px; color: var(--muted); white-space: pre-wrap; margin-top: 4px; overflow-wrap: anywhere; }
.task select { padding: 2px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: 13px; }
.overdue { color: var(--danger); font-weight: 600; }

/* 표 */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; }
.table th { color: var(--muted); font-weight: 500; font-size: 13px; }
.scroll-x { overflow-x: auto; }
.big-number { font-size: 26px; font-weight: 700; }
code.addr { display: block; padding: 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); overflow-wrap: anywhere; font-size: 14px; }

/* 하단 메뉴 */
#nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
#nav a { flex: 1; text-align: center; padding: 6px 0 8px; font-size: 12px; color: var(--muted); text-decoration: none; }
#nav a span { display: block; font-size: 19px; line-height: 1.3; }
#nav a.on { color: var(--accent); font-weight: 600; }

/* 업로드 대기함 */
#tray { position: fixed; left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); max-width: 744px; margin: 0 auto; z-index: 20;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 18px rgba(0,0,0,.18); padding: 10px 12px; max-height: 50vh; overflow-y: auto; }
#tray .titem { padding: 8px 0; border-bottom: 1px solid var(--line); }
#tray .titem:last-child { border-bottom: 0; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom)); background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; max-width: calc(100vw - 32px); }
#toast.on { opacity: .95; }

.login { max-width: 360px; margin: 14vh auto 0; }
