/* ============================================================
   LMQA Automation Priority Dashboard
   디자인: Claude의 따뜻한 미니멀 — cream/serif/coral
   ============================================================ */

:root {
  /* 컬러 — 따뜻한 미니멀 */
  --bg: #F5F2EA;
  --bg-soft: #EFEBE0;
  --surface: #FBF9F3;
  --surface-elev: #FFFFFF;
  --border: #E2DCCD;
  --border-strong: #C9C0A9;

  --ink: #1A1A1A;
  --ink-2: #3D3A33;
  --ink-3: #6B665B;
  --ink-4: #9A9482;

  /* 시그니처 — Claude coral */
  --accent: #D97757;
  --accent-soft: #F2C5B0;
  --accent-deep: #B85A3A;

  /* 우선순위 컬러 */
  --p0: #D97757;
  --p0-bg: rgba(217, 119, 87, 0.12);
  --p1: #C28A3E;
  --p1-bg: rgba(194, 138, 62, 0.12);
  --p2: #6B7B8E;
  --p2-bg: rgba(107, 123, 142, 0.10);
  --p3: #A39E91;
  --p3-bg: rgba(163, 158, 145, 0.10);

  /* 상태 컬러 */
  --status-todo: #9A9482;
  --status-progress: #C28A3E;
  --status-pilot: #4A7BA5;
  --status-live: #4A7C59;
  --status-hold: #B85A3A;

  /* 타이포 */
  --font-serif: "Tiempos Headline", "Source Serif Pro", "Noto Serif KR", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

  /* 간격 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* 그림자 — 매우 절제 */
  --sh-1: 0 1px 2px rgba(28, 24, 20, 0.04);
  --sh-2: 0 2px 8px rgba(28, 24, 20, 0.06);
  --sh-3: 0 8px 24px rgba(28, 24, 20, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { min-height: 100vh; }

a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Layout
   ============================================================ */
.shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 32px 80px;
}

@media (max-width: 720px) {
  .shell { padding: 20px 16px 60px; }
}

/* ============================================================
   Header
   ============================================================ */
.hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.hero__eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-weight: 600;
}

.hero__title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}

.hero__title em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}

.hero__lede {
  margin-top: 10px;
  max-width: 720px;
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1.6;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--ink-4);
}
.hero__meta b { color: var(--ink-2); font-weight: 600; margin-right: 4px; }

/* ============================================================
   KPI Cards
   ============================================================ */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.kpi:hover { box-shadow: var(--sh-2); }

.kpi__label {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

.kpi__value {
  margin-top: 8px;
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
}
.kpi__value--accent { color: var(--accent); }

.kpi__sub {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-4);
}

.kpi__progress {
  margin-top: 14px;
  height: 4px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
}
.kpi__progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 480ms ease;
}

/* ============================================================
   Section header
   ============================================================ */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 36px 0 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}
.section-head p {
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
}

/* ============================================================
   Charts row
   ============================================================ */
.charts {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 28px;
}
@media (max-width: 980px) {
  .charts { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
}

.panel__title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 14px;
  color: var(--ink);
}
.panel__sub {
  font-size: 12px;
  color: var(--ink-4);
  margin-top: -10px;
  margin-bottom: 16px;
}

/* Priority donut */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 22px;
}
.donut {
  --size: 140px;
  width: var(--size);
  height: var(--size);
  position: relative;
  flex-shrink: 0;
}
.donut svg { transform: rotate(-90deg); }
.donut__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.donut__center b {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}
.donut__center span {
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 4px;
}
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.donut-legend__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.donut-legend__row .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 10px;
}
.donut-legend__row .label { color: var(--ink-2); flex: 1; }
.donut-legend__row .label b { font-weight: 600; margin-right: 6px; }
.donut-legend__row .count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}

/* Bar chart */
.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 38px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.bar-row .name { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .track {
  height: 6px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
}
.bar-row .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  border-radius: 999px;
  transition: width 480ms ease;
}
.bar-row .num {
  text-align: right;
  font-family: var(--font-mono);
  color: var(--ink-3);
}

/* Quadrant scatter */
.scatter {
  position: relative;
  height: 220px;
  background:
    linear-gradient(to right, transparent 0%, transparent 50%, rgba(217, 119, 87, 0.06) 50%, rgba(217, 119, 87, 0.06) 100%),
    linear-gradient(to bottom, rgba(217, 119, 87, 0.06) 0%, rgba(217, 119, 87, 0.06) 50%, transparent 50%, transparent 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-top: 4px;
}
.scatter__axis-x, .scatter__axis-y {
  position: absolute;
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.scatter__axis-x { bottom: -22px; }
.scatter__axis-x.left { left: 4px; }
.scatter__axis-x.right { right: 4px; }
.scatter__axis-y { left: -8px; transform-origin: left; transform: rotate(-90deg); }
.scatter__axis-y.bottom { bottom: 4px; }
.scatter__axis-y.top { bottom: 100%; transform: rotate(-90deg) translateX(100%); }

.scatter__quadrant-label {
  position: absolute;
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
  font-weight: 600;
}

.scatter__dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, 50%);
  cursor: pointer;
  transition: transform 120ms ease;
  border: 1.5px solid transparent;
}
.scatter__dot:hover { transform: translate(-50%, 50%) scale(1.6); }
.scatter__dot--p0 { background: var(--p0); }
.scatter__dot--p1 { background: var(--p1); }
.scatter__dot--p2 { background: var(--p2); }
.scatter__dot--p3 { background: var(--p3); }

/* ============================================================
   Filters
   ============================================================ */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.filters__group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 120ms ease;
  user-select: none;
  font-family: var(--font-sans);
  font-weight: 500;
}
.chip:hover { border-color: var(--border-strong); }
.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface-elev);
  border-color: var(--ink);
}
.chip[data-priority="P0"][aria-pressed="true"] { background: var(--p0); border-color: var(--p0); }
.chip[data-priority="P1"][aria-pressed="true"] { background: var(--p1); border-color: var(--p1); }
.chip[data-priority="P2"][aria-pressed="true"] { background: var(--p2); border-color: var(--p2); }
.chip[data-priority="P3"][aria-pressed="true"] { background: var(--p3); border-color: var(--p3); }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.search input {
  border: 0;
  background: transparent;
  outline: none;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  width: 100%;
}
.search svg { color: var(--ink-4); flex-shrink: 0; }

.spacer { flex: 1; }

.filters__count {
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

/* ============================================================
   Task table
   ============================================================ */
.tasks {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.tasks__head {
  display: grid;
  grid-template-columns: 56px 80px 110px 1fr 100px 120px 100px;
  gap: 12px;
  padding: 12px 18px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-4);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.tasks__head button {
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  font-weight: inherit;
  cursor: pointer;
  text-align: left;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tasks__head button:hover { color: var(--ink-2); }
.tasks__head button[data-active="true"] { color: var(--accent-deep); }

.tasks__body { max-height: 720px; overflow-y: auto; }

.tasks__body::-webkit-scrollbar { width: 8px; }
.tasks__body::-webkit-scrollbar-track { background: var(--bg-soft); }
.tasks__body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

.task-row {
  display: grid;
  grid-template-columns: 56px 80px 110px 1fr 100px 120px 100px;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: center;
  cursor: pointer;
  transition: background 100ms ease;
}
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--bg-soft); }

.task-row .id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
}

.priority-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  width: fit-content;
}
.priority-pill[data-p="P0"] { background: var(--p0-bg); color: var(--p0); }
.priority-pill[data-p="P1"] { background: var(--p1-bg); color: var(--p1); }
.priority-pill[data-p="P2"] { background: var(--p2-bg); color: var(--p2); }
.priority-pill[data-p="P3"] { background: var(--p3-bg); color: var(--p3); }

.office-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  color: var(--ink-3);
  border: 1px solid var(--border);
  width: fit-content;
}

.task-row .task-title {
  color: var(--ink);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-row .task-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-4);
  display: flex;
  gap: 8px;
}
.task-row .task-meta span { white-space: nowrap; }

/* dual progress bar — auto vs risk */
.score-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-4);
  font-family: var(--font-mono);
}
.score-cell .row { display: flex; align-items: center; gap: 6px; }
.score-cell .row b { font-weight: 600; color: var(--ink-2); width: 26px; text-align: right; }
.score-cell .bar {
  flex: 1;
  height: 4px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
}
.score-cell .bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
}
.score-cell .bar--auto > i { background: var(--accent); }
.score-cell .bar--risk > i { background: linear-gradient(90deg, #4A7C59, var(--p0)); }

/* status select */
.status-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--font-sans);
  color: var(--ink-2);
  cursor: pointer;
  width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='%239A9482' d='M0 0l4 5 4-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 24px;
}
.status-select[data-st="todo"]      { color: var(--status-todo); }
.status-select[data-st="progress"]  { color: var(--status-progress); }
.status-select[data-st="pilot"]     { color: var(--status-pilot); }
.status-select[data-st="live"]      { color: var(--status-live); border-color: var(--status-live); background-color: rgba(74,124,89,0.06); }
.status-select[data-st="hold"]      { color: var(--status-hold); }

/* approach pill */
.approach {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 500;
}

/* ============================================================
   Detail drawer
   ============================================================ */
.drawer-bg {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 12, 0.32);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  backdrop-filter: blur(2px);
}
.drawer-bg[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}
.drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(560px, 92vw);
  height: 100vh;
  background: var(--surface-elev);
  border-left: 1px solid var(--border);
  z-index: 60;
  transform: translateX(100%);
  transition: transform 200ms ease;
  display: flex;
  flex-direction: column;
  box-shadow: var(--sh-3);
}
.drawer[data-open="true"] { transform: translateX(0); }

.drawer__head {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
}
.drawer__close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--bg-soft);
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
}
.drawer__close:hover { background: var(--border); }

.drawer__id { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }
.drawer__title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 8px 0 14px;
  color: var(--ink);
}
.drawer__pills { display: flex; gap: 8px; flex-wrap: wrap; }

.drawer__body {
  padding: 24px 26px;
  overflow-y: auto;
  flex: 1;
}

.drawer__row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.drawer__row .key { color: var(--ink-4); font-size: 12px; letter-spacing: 0.02em; text-transform: uppercase; padding-top: 1px; }
.drawer__row .val { color: var(--ink); }

.score-block {
  margin-top: 24px;
  padding: 18px;
  background: var(--bg-soft);
  border-radius: var(--r-md);
}
.score-block h4 {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 12px;
}
.score-meter {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.score-meter__row {
  display: grid;
  grid-template-columns: 82px 1fr 36px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.score-meter__row .label { color: var(--ink-3); }
.score-meter__row .num { font-family: var(--font-mono); font-weight: 600; text-align: right; color: var(--ink); }
.score-meter__row .track { height: 6px; background: var(--surface-elev); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.score-meter__row .fill { height: 100%; border-radius: 999px; }
.score-meter__row .fill--auto { background: var(--accent); }
.score-meter__row .fill--risk { background: linear-gradient(90deg, #4A7C59 0%, #C28A3E 50%, var(--p0) 100%); }
.score-meter__row .fill--impact { background: linear-gradient(90deg, var(--accent-soft), var(--accent-deep)); }

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-elev);
  border: 1px solid var(--border);
  color: var(--ink-3);
}

.notes-area {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  resize: vertical;
  background: var(--surface);
  outline: none;
}
.notes-area:focus { border-color: var(--accent); }

.drawer__foot {
  padding: 16px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}
.btn {
  background: var(--ink);
  color: var(--surface-elev);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
}
.btn--ghost { background: transparent; color: var(--ink-2); border-color: var(--border-strong); }
.btn:hover { opacity: 0.92; }

/* ============================================================
   Empty state
   ============================================================ */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-4);
  font-size: 14px;
}

/* footer */
.foot {
  margin-top: 50px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-4);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* responsive — task rows collapse to cards */
@media (max-width: 980px) {
  .tasks__head { display: none; }
  .task-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 16px;
  }
  .task-row > .row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
}
