/* Pretendard (동봉 — 오프라인/사내망에서도 동작) */
@font-face {
  font-family: 'Pretendard Variable';
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url('/fonts/PretendardVariable.woff2') format('woff2-variations');
}

:root {
  /* 밝고 차분한 업무용 톤 */
  --bg: #f7f8f9;
  --panel: #ffffff;
  --panel-2: #fafafa;
  --border: #e5e7eb;
  --border-strong: #d4d7dd;
  --text: #1a1d21;
  --text-2: #4b5563;
  --muted: #8b919b;
  /* MAGPIE 로고색. Pantone 485C 를 sRGB 로 옮긴 값 */
  --brand: #da291c;
  --brand-dark: #b8200f;
  --brand-weak: #fdf1ef;

  /* 강조색은 로고색 하나로 통일한다.
     선택된 회의, 활성 탭, 입력 포커스, 링크, 진행바가 모두 이 값을 쓴다.
     예전에는 그린이었는데 녹음 버튼만 로고색이라 화면에 두 강조색이 섞여 있었다. */
  --accent: var(--brand);
  --accent-dark: var(--brand-dark);
  --accent-weak: var(--brand-weak);
  --danger: #b4232a;
  --danger-weak: #fdf2f2;
  --warn: #8a6216;
  --warn-weak: #fdf8ec;
  --ok: var(--brand);
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
    'Segoe UI', 'Malgun Gothic', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* 버튼 — 평평하고 조용하게 */
button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 9px 16px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.ghost {
  background: #fff;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  font-weight: 500;
}
button.ghost:hover { background: var(--panel-2); border-color: var(--muted); color: var(--text); }
button.danger { background: var(--danger); border-color: var(--danger); }
button.danger:hover { background: #98191f; border-color: #98191f; }
button.sm { padding: 5px 11px; font-size: 12.5px; }

input, textarea, select {
  font-family: inherit;
  background: #fff;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  padding: 9px 11px;
  font-size: 14px;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
input::placeholder { color: #a8adb5; }

/* 로그인 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }

/* 상단바 */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.topbar h1 {
  font-size: 19.5px; /* 기본 15px 대비 30% 확대 */
  margin: 0; font-weight: 700; letter-spacing: -0.02em;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-logo { height: 22px; width: auto; display: block; flex-shrink: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

@keyframes rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* 외부 프로그램(윈도우 녹음기)이 녹음 중일 때 녹음 패널에 뜨는 영역.
   우리가 제어하지 않는 녹음이므로 버튼 없이 상태만 보여준다. */
.rec-external {
  margin-top: 18px; padding: 20px 16px;
  border: 1px solid #f0d6d7; border-radius: 10px;
  background: var(--danger-weak); text-align: center;
}
.rec-external-head {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 17px; font-weight: 700; color: var(--danger); letter-spacing: -0.01em;
}
.rec-external-head .rec-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--danger);
  margin: 0; flex-shrink: 0;
  animation: rec-pulse 1.6s ease-in-out infinite;
}
.rec-external-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-external-note {
  margin: 8px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5;
}
@media (prefers-reduced-motion: reduce) {
  .rec-external-head .rec-dot { animation: none; }
}

/* 녹음 중 잠긴 입력 — 비활성 상태가 눈에 보이도록 */
.rec-title-input:disabled,
.rec-select:disabled {
  background: #f6f7f8; color: var(--muted); cursor: not-allowed;
}
.upload-btn.is-disabled { opacity: 0.5; pointer-events: none; }

/* 로그인 화면 로고 */
.login-logo { height: 26px; width: auto; align-self: flex-start; margin-bottom: 4px; }

/* 레이아웃 */
.layout {
  display: grid;
  grid-template-columns: 310px 300px 1fr;
  gap: 14px;
  padding: 16px;
  height: calc(100vh - 55px);
}
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; height: auto; gap: 12px; padding: 12px; }
  .panel { max-height: none; }
  .record-panel { order: 1; }
  .list-panel { order: 2; }
  .detail-panel { order: 3; }
  button { padding: 12px 16px; font-size: 15px; }
  input, textarea, select { padding: 12px; font-size: 16px; } /* iOS 확대 방지 */
  .rec-timer { font-size: 38px; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  overflow: auto;
}
.panel h2 {
  font-size: 12px; margin: 0 0 14px; color: var(--muted);
  font-weight: 600; letter-spacing: 0.02em;
}

/* 녹음 패널 */
.rec-title-input { margin-bottom: 2px; }
.field-label { display: block; font-size: 12.5px; color: var(--text-2); margin: 14px 0 6px; font-weight: 500; }
.rec-select { appearance: none; background-image: none; }

/* 마이크 선택 + 입력 레벨 바 */
.level-bar {
  height: 6px; background: #eceef1; border-radius: 999px;
  overflow: hidden; margin: 8px 0 2px;
}
.level-fill {
  height: 100%; width: 0%; background: var(--accent);
  border-radius: 999px; transition: width 0.06s linear;
}
.level-fill.loud { background: var(--danger); }

.rec-timer {
  font-size: 32px; font-variant-numeric: tabular-nums; text-align: center;
  margin: 6px 0; font-weight: 600; letter-spacing: -0.02em; color: var(--text);
}
.rec-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); margin-right: 9px; vertical-align: middle;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.3; } }
.rec-controls { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

/* 녹음 시작 — 로고와 같은 색(Pantone 485C)으로 화면의 1순위 동작임을 알린다 */
#rec-start { background: var(--brand); border-color: var(--brand); }
#rec-start:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.rec-hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; min-height: 16px; line-height: 1.5; }
.rec-hint.left { text-align: left; margin-top: 6px; }

/* 파일 올리기 (모바일 1순위) */
.upload-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 22px 16px; margin: 14px 0 4px;
  border: 1px dashed var(--border-strong); border-radius: 10px;
  background: var(--panel-2); color: var(--text); cursor: pointer; text-align: center;
  transition: border-color 0.12s, background 0.12s;
}
.upload-btn:hover { border-color: var(--accent); background: var(--accent-weak); }
.upload-icon { font-size: 18px; color: var(--accent); line-height: 1.4; }
.upload-main { font-size: 15px; font-weight: 600; }
.upload-sub { font-size: 12px; color: var(--muted); }

.rec-or {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 4px; color: var(--muted); font-size: 12px;
}
.rec-or::before, .rec-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.upload-progress {
  height: 4px; background: var(--border); border-radius: 999px;
  overflow: hidden; margin-top: 12px;
}
.upload-bar { height: 100%; width: 0%; background: var(--accent); transition: width 0.2s; }

/* 회의 목록 */
.list { display: flex; flex-direction: column; gap: 6px; }
.list-item {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: #fff;
  transition: border-color 0.12s, background 0.12s;
}
.list-item:hover { border-color: var(--border-strong); background: var(--panel-2); }
.list-item.active { border-color: var(--accent); background: var(--accent-weak); }
.list-item .li-title { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; line-height: 1.4; }
.list-item .li-meta {
  font-size: 11.5px; color: var(--muted);
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
}

.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
  white-space: nowrap; font-weight: 500;
}
.badge.created { background: #f1f2f4; color: var(--text-2); }
.badge.transcribing, .badge.summarizing { background: var(--warn-weak); color: var(--warn); }
.badge.done { background: var(--accent-weak); color: var(--ok); }
.badge.failed { background: var(--danger-weak); color: var(--danger); }

/* 상세 */
.detail-empty {
  color: var(--muted); display: grid; place-items: center;
  height: 100%; min-height: 120px; font-size: 13px;
}
.detail-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 6px;
}
.detail-header h2 {
  margin: 0; font-size: 19px; color: var(--text);
  font-weight: 700; letter-spacing: -0.02em; cursor: pointer;
}
.detail-actions { display: flex; gap: 6px; flex-shrink: 0; }
.detail audio { width: 100%; margin: 14px 0; height: 36px; }

/* 노션 저장 상태 */
.notion-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 8px 0; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel-2); font-size: 13px; color: var(--text-2);
}
.notion-row a { color: var(--accent); text-decoration: none; font-weight: 500; }
.notion-row a:hover { text-decoration: underline; }
.notion-row.ok { background: var(--accent-weak); border-color: #d3e3d9; }
.notion-row.fail { background: var(--danger-weak); border-color: #f0d6d7; }
.notion-row.fail span { color: var(--danger); }

/* 탭 */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 18px 0 14px; }
.tab {
  padding: 8px 14px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; font-size: 13.5px; font-weight: 500;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* 회의록 본문 */
.md { font-size: 14px; color: var(--text); }
.md h1, .md h2, .md h3 { margin: 20px 0 8px; font-weight: 700; letter-spacing: -0.01em; }
.md h1 { font-size: 18px; }
.md h2 { font-size: 15.5px; }
.md h3 { font-size: 14px; }
.md h1:first-child, .md h2:first-child { margin-top: 0; }
.md ul { padding-left: 18px; margin: 8px 0; }
.md li { margin: 3px 0; }
.md p { margin: 8px 0; }
.md code {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; font-size: 12.5px;
}
.md table {
  border-collapse: collapse; width: 100%; margin: 12px 0;
  font-size: 13px; display: block; overflow-x: auto;
}
.md th, .md td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.md th { background: var(--panel-2); font-weight: 600; }

/* 전사 */
.seg {
  display: flex; gap: 12px; padding: 7px 0;
  border-bottom: 1px solid var(--border); font-size: 13.5px; line-height: 1.6;
}
.seg:last-child { border-bottom: 0; }
.seg-time {
  color: var(--accent); font-variant-numeric: tabular-nums;
  white-space: nowrap; cursor: pointer; min-width: 48px; font-size: 12.5px; padding-top: 2px;
}
.seg-time:hover { text-decoration: underline; }
.transcript-plain { white-space: pre-wrap; font-size: 13.5px; line-height: 1.7; }

/* 처리 중 */
.processing {
  display: flex; align-items: center; gap: 9px;
  color: var(--warn); font-size: 13px; padding: 10px 12px;
  background: var(--warn-weak); border: 1px solid #f0e4c8;
  border-radius: var(--radius); margin: 10px 0;
}
.spinner {
  width: 12px; height: 12px; border: 2px solid currentColor;
  border-top-color: transparent; border-radius: 50%;
  animation: spin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 플로팅 바 (우측 하단에 떠 있는 1자형 녹음 컨트롤) ── */
.float-body {
  margin: 0; padding: 0; background: transparent; overflow: hidden;
  height: 100vh; user-select: none; -webkit-user-select: none;
}
.float-bar {
  display: flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 8px 0 10px;
  background: #fff; border: 1px solid var(--border-strong);
  border-radius: 23px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  margin: 3px;
}
.float-logo { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }

.float-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.float-label {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.float-label.err { color: var(--danger); font-weight: 500; }
.float-label .rec-dot { width: 7px; height: 7px; margin-right: 6px; }
.float-label .rec-dot.paused { background: var(--muted); animation: none; }

.float-level { height: 3px; background: #eceef1; border-radius: 999px; overflow: hidden; }
.float-level span {
  display: block; height: 100%; width: 0%;
  background: var(--accent); border-radius: 999px; transition: width 0.06s linear;
}
.float-level span.loud { background: var(--danger); }

/* 아이콘 버튼 */
.fbtn {
  width: 32px; height: 32px; padding: 0; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--border-strong);
  background: #fff; color: var(--text-2); cursor: pointer;
}
.fbtn:hover { background: var(--panel-2); color: var(--text); }
.fbtn.rec { border-color: var(--danger); color: var(--danger); }
.fbtn.rec:hover { background: var(--danger-weak); }
.fbtn.stop { border-color: var(--danger); color: #fff; background: var(--danger); }
.fbtn.stop:hover { background: #98191f; border-color: #98191f; }
.fbtn.ghosticon { border-color: transparent; color: var(--muted); }
.fbtn.ghosticon:hover { border-color: var(--border); color: var(--text-2); }

/* 정지 후 확인 줄 */
.float-ask {
  display: flex; align-items: center; gap: 6px;
  margin: 0 4px 4px; padding: 7px 10px;
  background: #fff; border: 1px solid var(--border-strong);
  border-radius: 12px; font-size: 12px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.13);
}
.float-ask span { flex: 1; min-width: 0; color: var(--text-2); }
.fbtn-text {
  padding: 4px 10px; font-size: 12px; border-radius: 6px;
  background: var(--accent); border: 1px solid var(--accent); color: #fff; cursor: pointer;
}
.fbtn-text.ghost { background: #fff; border-color: var(--border-strong); color: var(--text-2); }

/* 확인 팝업 */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(26, 29, 33, 0.35);
  display: grid; place-items: center; padding: 20px;
}
.modal-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; max-width: 380px; width: 100%;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10);
}
.modal-title { margin: 0 0 8px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.modal-msg { margin: 0 0 20px; font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
