:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #dfe4ec;
  --text: #1b2330;
  --muted: #6b7686;
  --accent: #1a5fb4;
  --accent-soft: #e8f0fb;
  --warn: #c24a00;
  --warn-soft: #fff1e6;
  --danger: #b3261e;
  --ok: #1a7f4b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 50, .08), 0 6px 18px rgba(20, 30, 50, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Pretendard', 'Malgun Gothic', '맑은 고딕', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }

header.top {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
header.top h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: -.3px; }
header.top .spacer { flex: 1; }
header.top nav a { color: var(--muted); font-size: 14px; margin-left: 14px; }
header.top nav a:hover { color: var(--accent); }

.wrap { max-width: 1400px; margin: 0 auto; padding: 20px; }

button, .btn {
  font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); padding: 9px 14px; transition: .12s;
  display: inline-flex; align-items: center; gap: 6px;
}
button:hover, .btn:hover { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #17539c; color: #fff; }
.btn-danger { color: var(--danger); border-color: #f0c9c6; }
.btn-danger:hover { background: #fdeceb; color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 13px; }

input[type=text], input[type=password], input[type=date], textarea, select {
  font: inherit; width: 100%; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.field { margin-bottom: 14px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }

.meeting-list { display: flex; flex-direction: column; gap: 6px; }
.meeting-item {
  display: flex; align-items: center; gap: 14px; min-width: 0;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
}
.meeting-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.meeting-item h3 {
  margin: 0; font-size: 15px; color: var(--text); font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46%;
}
.meeting-item .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meeting-item .grow { flex: 1; min-width: 0; }
@media (max-width: 700px) {
  .meeting-item { flex-wrap: wrap; gap: 6px 10px; }
  .meeting-item h3 { max-width: 100%; width: 100%; }
}
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.badge.gray { background: #eef0f4; color: var(--muted); }
.badge.ok { background: #e6f5ed; color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

/* 작업 화면 3단 구성 */
.workspace { display: grid; grid-template-columns: 190px minmax(340px, 1.1fr) minmax(360px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .workspace { grid-template-columns: 1fr; } }

.thumbs { display: flex; flex-direction: column; gap: 10px; max-height: 78vh; overflow-y: auto; }
@media (max-width: 1100px) { .thumbs { flex-direction: row; overflow-x: auto; } }
.thumb { border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--panel); cursor: pointer; position: relative; flex: 0 0 auto; }
.thumb.active { border-color: var(--accent); }
.thumb img { width: 100%; display: block; aspect-ratio: 4/3; object-fit: cover; }
.thumb .n { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; }
.thumb .st { position: absolute; bottom: 4px; right: 4px; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(255,255,255,.9); }

.viewer { position: relative; background: #21262e; border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 300px; }
.viewer img { max-width: 100%; max-height: 72vh; display: block; }
.viewer canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

.editor { display: flex; flex-direction: column; gap: 10px; }
.editor textarea { min-height: 26vh; max-height: 42vh; font-family: 'D2Coding', 'Consolas', 'Malgun Gothic', monospace; font-size: 14px; line-height: 1.75; resize: vertical; }

.issues { display: flex; flex-direction: column; gap: 8px; max-height: 26vh; overflow-y: auto; }
.issue { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 14px; }
.issue:hover { border-color: var(--accent); }
.issue .from { color: var(--warn); font-weight: 700; }
.issue .to { color: var(--ok); font-weight: 700; }
.issue .why { color: var(--muted); font-size: 12px; flex: 1; }
.issue.kind-broken { background: var(--warn-soft); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 13px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); background: var(--panel); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #212936; color: #fff; padding: 11px 18px; border-radius: 999px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.err { background: var(--danger); }

.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.btn .spinner { border-color: rgba(26,95,180,.3); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.login-box { max-width: 360px; margin: 14vh auto; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
code { background: #eef0f4; padding: 1px 5px; border-radius: 4px; font-size: 13px; }

/* 모달 */
.modal { position: fixed; inset: 0; background: rgba(15,20,30,.55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--panel); border-radius: var(--radius); padding: 22px; max-width: 380px; width: 100%; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal-box img { border: 1px solid var(--line); border-radius: 8px; }
.modal-box .field { text-align: left; }

/* 좁은 화면 대응 */
@media (max-width: 700px) {
  header.top { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  header.top h1 { font-size: 15px; }
  header.top nav { width: 100%; display: flex; gap: 12px; }
  header.top nav a { margin: 0; }
  .wrap { padding: 12px; }
  .card-body { padding: 14px; }
  .editor textarea { min-height: 34vh; }
  .viewer img { max-height: 50vh; }
  button, .btn { padding: 11px 14px; }
}

/* 새 회의 만들기 폼: 회의명은 넓게, 참석자는 두 줄, 버튼은 두 행을 합쳐 세로로 길게 */
.new-meeting {
  display: grid;
  grid-template-columns: minmax(0, 3fr) 180px 190px;
  grid-template-areas:
    "title     date      submit"
    "attendees attendees submit";
  gap: 12px;
  align-items: start;
}
.new-meeting .field { margin: 0; }
.new-meeting .f-title { grid-area: title; }
.new-meeting .f-date { grid-area: date; }
.new-meeting .f-attendees { grid-area: attendees; }
.new-meeting .f-attendees textarea { resize: vertical; min-height: 62px; line-height: 1.5; }
.new-meeting .f-submit {
  grid-area: submit;
  align-self: stretch;
  justify-content: center;
  text-align: center;
  font-size: 15px;
  line-height: 1.45;
  margin-top: 21px;   /* 옆 칸의 라벨 높이만큼 내려 입력칸과 윗선을 맞춘다 */
}

@media (max-width: 760px) {
  .new-meeting {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "title     title"
      "date      date"
      "attendees attendees"
      "submit    submit";
  }
  .new-meeting .f-submit { margin-top: 0; padding: 14px; }
}

/* 회의 요약은 접을 수 있게: 검토 중에는 접어 두고 세로 공간을 본문·검증에 쓴다 */
.fold > summary { list-style: none; cursor: pointer; padding: 12px 18px; display: flex; align-items: center; gap: 10px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: '▾'; color: var(--muted); transition: .15s; }
.fold:not([open]) > summary::before { transform: rotate(-90deg); }
.fold > summary h2 { margin: 0; font-size: 15px; font-weight: 700; }
.fold > summary .spacer { flex: 1; }
.fold[open] > summary { border-bottom: 1px solid var(--line); }

/* 세로가 짧은 노트북(1366x768 등)에서는 검증 패널이 한 화면에 들어오도록 더 압축한다 */
@media (max-height: 850px) {
  .editor textarea { min-height: 19vh; max-height: 30vh; }
  .issues { max-height: 19vh; }
  .workspace .card-head { padding: 8px 14px; }
  .viewer img { max-height: 52vh; }
  .toolbar { margin-bottom: 8px; }
}
