:root {
  color-scheme: light;
  --navy-950: #071c49;
  --navy-900: #0b2c67;
  --navy-800: #123d83;
  --blue-600: #246bfd;
  --blue-100: #eaf2ff;
  --ink-950: #111827;
  --ink-700: #344054;
  --ink-500: #667085;
  --line: #d9e0ea;
  --line-soft: #e9edf3;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --success: #0a9b68;
  --warning: #d97706;
  --hold: #64748b;
  --danger: #c2413b;
  --shadow: 0 14px 40px rgba(12, 35, 78, 0.09);
  --radius-lg: 18px;
  --radius-md: 12px;
  --font: "Pretendard Variable", Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: #eef2f7; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink-950);
  background: var(--surface);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.app-header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  color: #fff;
  background:
    radial-gradient(circle at 76% -50%, rgba(62, 126, 255, 0.35), transparent 45%),
    linear-gradient(115deg, #061a45 0%, #0c2c67 58%, #071f53 100%);
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 10px;
  background: rgba(255,255,255,.10);
  font-weight: 800;
  letter-spacing: -.03em;
}
.brand-title { margin: 0; font-size: 24px; line-height: 1; letter-spacing: -.04em; }
.account-chip { font-size: 13px; color: rgba(255,255,255,.78); }
.link-button { padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.link-button:hover { background: rgba(255,255,255,.10); color: #fff; }

.board-shell {
  display: grid;
  grid-template-columns: 352px minmax(0, 1fr);
  min-height: calc(100vh - 72px);
}

.task-sidebar {
  position: relative;
  padding: 28px 24px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}

.new-task-button {
  width: 100%;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius-md);
  color: #fff;
  background: linear-gradient(135deg, var(--navy-900), #0a347a);
  box-shadow: 0 8px 20px rgba(9, 45, 108, .18);
  font-size: 17px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
.new-task-button:hover { filter: brightness(1.06); }
.new-task-button:focus-visible,
.decision-button:focus-visible,
.file-link:focus-visible,
.task-card:focus-visible,
.link-button:focus-visible { outline: 3px solid rgba(36,107,253,.28); outline-offset: 2px; }
.plus { font-size: 26px; line-height: 1; font-weight: 350; }

.task-list { display: grid; gap: 8px; margin-top: 22px; }
.task-card {
  display: block;
  padding: 17px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: .16s ease;
}
.task-card:hover { background: #f3f6fb; }
.task-card.is-selected { border-color: #d6e4ff; background: var(--blue-100); box-shadow: inset 3px 0 var(--blue-600); }
.task-card-title { margin: 0 0 10px; font-size: 15px; line-height: 1.5; font-weight: 760; word-break: keep-all; }
.task-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink-500); font-size: 12px; }

.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 720; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-received { color: var(--blue-600); }
.status-working { color: var(--warning); }
.status-review { color: #7255d9; }
.status-done { color: var(--success); }
.status-hold { color: var(--hold); }

.empty-list {
  margin-top: 22px;
  padding: 28px 18px;
  border: 1px dashed #ccd5e3;
  border-radius: var(--radius-md);
  color: var(--ink-500);
  text-align: center;
  font-size: 14px;
  line-height: 1.7;
}

.detail-pane { min-width: 0; padding: 34px clamp(26px, 4vw, 64px) 56px; background: var(--surface); }
.detail-inner { width: 100%; max-width: 1120px; margin: 0 auto; }
.detail-title { margin: 0; font-size: clamp(26px, 3vw, 38px); line-height: 1.28; letter-spacing: -.045em; word-break: keep-all; }
.detail-header-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; color: var(--ink-500); font-size: 13px; }

.section { margin-top: 30px; }
.section-title { margin: 0 0 11px; font-size: 15px; letter-spacing: -.02em; }
.instruction-box {
  padding: 19px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--ink-700);
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}

.file-list { display: grid; gap: 8px; }
.file-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.file-link {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
}
.file-link:hover { border-color: #b6c8e7; background: #fbfdff; }
.file-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; background: #eef4ff; color: var(--blue-600); font-size: 12px; font-weight: 800; }
.file-name { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.file-size { color: var(--ink-500); font-size: 12px; white-space: nowrap; }
.file-view-link {
  min-width: 92px;
  display: grid;
  place-items: center;
  padding: 0 14px;
  border: 1px solid #b8c9e5;
  border-radius: 10px;
  color: var(--navy-800);
  background: #f4f8ff;
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
}
.file-view-link:hover { border-color: var(--blue-600); background: #eaf2ff; }

.timeline { position: relative; display: grid; gap: 14px; padding-left: 72px; }
.timeline::before { content: ""; position: absolute; top: 24px; bottom: 24px; left: 25px; width: 1px; background: var(--line); }
.report-card { position: relative; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; box-shadow: 0 4px 16px rgba(24,39,75,.035); }
.report-avatar { position: absolute; left: -72px; top: 5px; width: 50px; height: 50px; display: grid; place-items: center; border: 4px solid #fff; border-radius: 50%; background: var(--navy-800); color: #fff; font-size: 12px; font-weight: 800; z-index: 1; }
.report-avatar.is-representative { background: #8a3ffc; }
.report-top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.report-author { font-weight: 800; }
.report-kind { display: inline-flex; margin-left: 7px; padding: 3px 7px; border-radius: 999px; color: #345; background: #edf2f7; font-size: 11px; font-weight: 700; }
.report-round { display: inline-flex; margin-left: 5px; padding: 3px 7px; border-radius: 999px; color: #2759a5; background: #edf4ff; font-size: 11px; font-weight: 760; }
.report-time { color: var(--ink-500); font-size: 12px; white-space: nowrap; }
.report-summary { margin: 10px 0 0; color: #26344c; font-weight: 650; line-height: 1.72; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-details { margin-top: 11px; border-top: 1px solid var(--line-soft); }
.report-details summary { width: fit-content; padding: 11px 0 2px; color: #48627f; font-size: 12px; font-weight: 740; cursor: pointer; }
.report-details[open] summary { color: var(--navy-800); }
.report-content { margin: 8px 0 0; color: var(--ink-700); line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-files { margin-top: 12px; }

.final-groups { display: grid; gap: 14px; }
.final-group { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fbfcff; }
.final-group-title { display: flex; align-items: center; gap: 9px; margin: 0 0 10px; font-size: 15px; }
.latest-badge { padding: 3px 7px; border-radius: 999px; color: #087a53; background: #e6f7f0; font-size: 11px; }

.decision-panel { margin-top: 32px; padding: 22px; border: 1px solid #cad4e4; border-radius: var(--radius-lg); background: linear-gradient(180deg,#fbfdff,#f6f9fd); }
.decision-title { margin: 0; font-size: 17px; }
.decision-help { margin: 6px 0 0; color: var(--ink-500); font-size: 13px; line-height: 1.6; }
.decision-note { width: 100%; min-height: 82px; margin-top: 14px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 9px; resize: vertical; }
.decision-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.decision-button { min-height: 50px; border-radius: 9px; background: #fff; font-weight: 800; cursor: pointer; }
.decision-approve { border: 1px solid var(--navy-900); color: #fff; background: var(--navy-900); }
.decision-revise { border: 1px solid #f0a120; color: #bf6a00; background: #fffaf0; }
.decision-hold { border: 1px solid #aeb7c5; color: #586274; }
.decision-revoke-form { margin-top: 14px; }
.decision-revoke { width: 100%; min-height: 44px; border: 1px solid #e2aaa6; color: var(--danger); background: #fff7f6; }
.decision-revoke:hover { border-color: var(--danger); background: #fff0ee; }

.empty-detail { min-height: calc(100vh - 190px); display: grid; place-items: center; text-align: center; }
.empty-detail-card { max-width: 500px; padding: 44px 34px; }
.empty-detail-icon { width: 64px; height: 64px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 20px; background: var(--blue-100); color: var(--blue-600); font-size: 28px; }
.empty-detail h2 { margin: 0; font-size: 23px; letter-spacing: -.035em; }
.empty-detail p { margin: 10px 0 0; color: var(--ink-500); line-height: 1.7; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: #f5f7fb; }
.login-brand { display: flex; flex-direction: column; justify-content: flex-end; padding: clamp(36px,8vw,110px); color: #fff; background: radial-gradient(circle at 35% 20%,#1d58b7,transparent 45%),linear-gradient(145deg,#061945,#0d367a); }
.login-brand h1 { margin: 0; max-width: 560px; font-size: clamp(34px,5vw,62px); line-height: 1.1; letter-spacing: -.055em; }
.login-brand p { max-width: 540px; margin: 20px 0 0; color: rgba(255,255,255,.76); line-height: 1.75; }
.login-form-wrap { display: grid; place-items: center; padding: 28px; }
.login-card { width: min(420px,100%); padding: 34px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow); }
.login-card h2 { margin: 0 0 8px; font-size: 24px; }
.login-card > p { margin: 0 0 24px; color: var(--ink-500); }
.field { display: grid; gap: 7px; margin-top: 15px; }
.field label { font-size: 13px; font-weight: 750; }
.field input, .field textarea { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.field textarea { min-height: 140px; resize: vertical; }
.primary-button { width: 100%; min-height: 48px; margin-top: 22px; border: 0; border-radius: 9px; color: #fff; background: var(--navy-900); font-weight: 800; cursor: pointer; }

.modal { width: min(640px, calc(100% - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: var(--radius-lg); box-shadow: 0 24px 80px rgba(7,25,61,.26); }
.modal::backdrop { background: rgba(7, 21, 48, .58); backdrop-filter: blur(3px); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 21px 24px; border-bottom: 1px solid var(--line-soft); }
.modal-header h2 { margin: 0; font-size: 20px; }
.modal-close { width: 36px; height: 36px; border: 0; border-radius: 9px; background: #f0f3f8; font-size: 21px; cursor: pointer; }
.modal-body { padding: 22px 24px 26px; overflow-y: auto; }
.upload-help { margin: 7px 0 0; color: var(--ink-500); font-size: 12px; line-height: 1.5; }
.flash-stack { position: fixed; top: 84px; right: 22px; z-index: 20; display: grid; gap: 8px; }
.flash { max-width: 390px; padding: 12px 15px; border: 1px solid; border-radius: 10px; background: #fff; box-shadow: var(--shadow); font-size: 13px; }
.flash-error { border-color: #f0b4af; color: #9f2823; }
.flash-success { border-color: #9fd9c3; color: #087a53; }
.connection-alert { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; padding: 12px 14px; border: 1px solid #f3c28b; border-radius: 9px; color: #8b4b06; background: #fff9f0; font-size: 13px; line-height: 1.55; }
.retry-button { min-height: 38px; padding: 0 13px; border: 1px solid #d98b2d; border-radius: 8px; color: #7a4105; background: #fff; font-weight: 780; white-space: nowrap; cursor: pointer; }

.viewer-page { background: #f2f5fa; }
.viewer-brand { color: inherit; text-decoration: none; }
.markdown-shell { width: min(1040px, calc(100% - 36px)); margin: 28px auto 60px; }
.viewer-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.viewer-toolbar h2 { margin: 8px 0 0; font-size: clamp(20px, 3vw, 28px); overflow-wrap: anywhere; }
.viewer-back { color: var(--navy-800); font-size: 13px; font-weight: 750; text-decoration: none; }
.viewer-download { padding: 11px 14px; border: 1px solid var(--navy-900); border-radius: 9px; color: #fff; background: var(--navy-900); font-size: 13px; font-weight: 780; text-decoration: none; white-space: nowrap; }
.markdown-body { padding: clamp(24px, 5vw, 58px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow); color: #253047; font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { color: var(--ink-950); line-height: 1.35; letter-spacing: -.035em; }
.markdown-body h1 { padding-bottom: 14px; border-bottom: 1px solid var(--line); font-size: clamp(28px, 4vw, 40px); }
.markdown-body h2 { margin-top: 2em; font-size: 25px; }
.markdown-body h3 { margin-top: 1.7em; font-size: 20px; }
.markdown-body a { color: #135cca; }
.markdown-body img { max-width: 100%; height: auto; border-radius: 10px; }
.markdown-body blockquote { margin-left: 0; padding: 8px 18px; border-left: 4px solid #8fb3ef; color: var(--ink-700); background: #f6f9ff; }
.markdown-body pre { max-width: 100%; padding: 16px; border-radius: 10px; background: #111827; color: #e5e7eb; overflow-x: auto; }
.markdown-body code { padding: 2px 5px; border-radius: 5px; background: #eef2f7; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92em; }
.markdown-body pre code { padding: 0; background: transparent; }
.markdown-body table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.markdown-body th, .markdown-body td { padding: 9px 12px; border: 1px solid var(--line); text-align: left; }
.markdown-body th { background: #f4f7fb; }

@media (max-width: 840px) {
  .app-header { height: 64px; padding: 0 18px; }
  .brand-title { font-size: 20px; }
  .account-chip { display: none; }
  .board-shell { display: block; min-height: calc(100vh - 64px); }
  .task-sidebar { padding: 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .new-task-button { min-height: 50px; }
  .task-list { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 2px; }
  .task-card { min-width: min(286px, 84vw); border: 1px solid var(--line-soft); background: #fff; scroll-snap-align: start; }
  .empty-list { margin-top: 14px; padding: 18px; }
  .detail-pane { padding: 26px 18px 42px; }
  .section { margin-top: 24px; }
  .timeline { padding-left: 56px; }
  .timeline::before { left: 20px; }
  .report-avatar { left: -56px; width: 42px; height: 42px; border-width: 3px; font-size: 10px; }
  .report-top { display: block; }
  .report-time { display: block; margin-top: 5px; }
  .decision-panel { padding: 18px; }
  .decision-actions { grid-template-columns: 1fr; }
  .connection-alert { align-items: stretch; flex-direction: column; }
  .retry-button { width: 100%; }
  .file-entry { grid-template-columns: 1fr; }
  .file-view-link { min-height: 42px; }
  .login-page { grid-template-columns: 1fr; }
  .login-brand { min-height: 230px; padding: 34px 26px; }
  .login-brand p { display: none; }
  .login-form-wrap { padding: 22px 18px; }
  .login-card { padding: 26px 22px; }
  .markdown-shell { width: min(100% - 24px, 1040px); margin-top: 18px; }
  .viewer-toolbar { display: grid; align-items: start; }
  .viewer-download { justify-self: start; }
  .markdown-body { padding: 24px 19px; border-radius: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
