@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

/* OKR 서비스와 같은 색, 글꼴, 모서리 값을 쓴다. */
:root {
  --primary: #0a0a0a; --on-primary: #ffffff; --charcoal: #222222;
  --canvas: #ffffff; --surface: #f7f8fa; --surface-soft: #f2f3f5; --hairline: #e5e7eb; --hairline-soft: #eaecf0;
  --ink: #0a0a0a; --slate: #45515e; --steel: #5f5f5f; --muted: #a8aab2;
  --blue: #1d4ed8; --blue-bg: #e8effd;
  --green: #1ba673; --green-bg: #e8ffea; --yellow: #9a6b00; --yellow-bg: #fff4d6; --red: #d45656; --red-bg: #fdeeee;
  --font: Pretendard, "Noto Sans KR", "Malgun Gothic", sans-serif;
  --r-md: 8px; --r-xl: 16px; --r-full: 9999px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--charcoal); background: var(--canvas); word-break: keep-all; -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
a { color: var(--ink); }
h1 { margin: 0; font-size: 22px; font-weight: 700; color: var(--ink); }
h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.sub { color: var(--steel); font-size: 13px; }
.faint { color: var(--muted); }
p.sub { margin: 2px 0 0; }

/* 상단 내비게이션 */
.topnav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; min-height: 60px; padding: 8px 32px; background: var(--canvas); border-bottom: 1px solid var(--hairline-soft); flex-wrap: wrap; }
.topnav .brand { font-size: 17px; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.topnav nav { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.topnav nav a { display: inline-flex; align-items: center; height: 34px; padding: 0 16px; border-radius: var(--r-full); font-weight: 500; color: var(--steel); text-decoration: none; white-space: nowrap; }
.topnav nav a:hover { color: var(--ink); }
.topnav nav a.on { background: var(--primary); color: var(--on-primary); }
.topnav .user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--slate); white-space: nowrap; }

main { max-width: 1600px; margin: 0 auto; padding: 24px 32px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head.second { margin-top: 32px; }
.crumb { margin: 0 0 12px; }
.legend { margin: 12px 4px 0; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 18px; border-radius: var(--r-full); border: 1px solid var(--hairline); background: var(--canvas); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.sm { height: 28px; padding: 0 12px; font-size: 12px; }
.btn.toggle[aria-pressed="true"] { background: var(--red-bg); border-color: var(--red); color: var(--red); }

/* 보기 전환, 탭 */
.seg-tabs, .tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-tabs a, .tabs button { display: inline-flex; align-items: center; height: 36px; padding: 0 18px; border-radius: var(--r-full); border: 1px solid var(--hairline); background: var(--canvas); color: var(--steel); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.seg-tabs a.on, .tabs button[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.tabs { margin: 0 0 12px; }

/* 카드 */
.card { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-xl); padding: 20px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.empty { padding: 28px 16px; text-align: center; color: var(--steel); }

/* 필터 */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--slate); }
select, input, textarea { font: inherit; color: var(--ink); }
.filters select, .cal-bar select { height: 30px; padding: 0 8px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--canvas); }

/* 현황: 프로세스 보드 */
.board-wrap { overflow-x: auto; padding-bottom: 4px; }
.board { display: grid; grid-template-columns: repeat(9, minmax(132px, 1fr)); gap: 6px; min-width: 1240px; }
.phase-span { padding: 2px 6px 6px; font-size: 12px; font-weight: 700; color: var(--slate); border-bottom: 2px solid var(--primary); }
.col { background: var(--surface); border-radius: 12px; padding: 8px; min-height: 300px; }
.col-head { padding: 2px 4px 8px; }
.col-head b { font-size: 14px; color: var(--ink); }
.col-head .n { float: right; font-size: 13px; font-weight: 700; color: var(--slate); }
.col-head .sub { font-size: 12px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kcard { display: block; padding: 10px; margin-bottom: 6px; background: var(--canvas); border: 1px solid var(--hairline); border-radius: 10px; text-decoration: none; color: var(--charcoal); }
.kcard:hover { border-color: var(--ink); }
.kcard.late { border-color: var(--red); }
.kcard b { display: block; font-size: 14px; color: var(--ink); }
.kcard span { display: block; font-size: 12px; }
.kcard .tag { color: var(--steel); }
.kcard .tag.warn { color: var(--yellow); font-weight: 600; }
.kcard .do { margin: 6px 0; font-size: 13px; line-height: 1.4; color: var(--ink); }
.kcard .meta { color: var(--steel); }
.late-line { color: var(--red); font-weight: 600; }
.closed { margin-top: 12px; font-size: 13px; color: var(--steel); }
.closed summary, .later summary { cursor: pointer; font-weight: 600; }

/* 일정 종류 색: 오픈일, 오픈 후 일정, 고객 접점, 내부 작업 */
.k-open { --k: #0a0a0a; --kbg: #0a0a0a; --kfg: #ffffff; }
.k-after { --k: #1d4ed8; --kbg: #e8effd; --kfg: #1d3fa8; }
.k-external { --k: #b97a00; --kbg: #fff4d6; --kfg: #6b4a00; }
.k-internal { --k: #8e8e93; --kbg: #f2f3f5; --kfg: #45515e; }
.kinds { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.kind { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: var(--r-full); border: 1px solid var(--hairline); background: var(--canvas); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.kind::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--hairline); }
.kind[aria-pressed="true"] { color: var(--ink); border-color: var(--steel); }
.kind[aria-pressed="true"]::before { background: var(--k); }

/* 캘린더 */
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav b { font-size: 16px; min-width: 96px; text-align: center; }
.cal { border: 1px solid var(--hairline); border-radius: var(--r-xl); overflow: hidden; }
.dow, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dow div { padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--steel); background: var(--surface); border-bottom: 1px solid var(--hairline); }
.day { min-height: 112px; padding: 4px; border-right: 1px solid var(--hairline-soft); border-bottom: 1px solid var(--hairline-soft); }
.day:nth-child(7n) { border-right: 0; }
.day.out { background: var(--surface); }
.day.out .dnum { color: var(--muted); }
.dnum { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; margin-bottom: 2px; font-size: 12px; font-weight: 600; color: var(--slate); }
.day.today .dnum { border-radius: 50%; background: var(--primary); color: var(--on-primary); }
.ev { display: block; width: 100%; margin-bottom: 2px; padding: 2px 6px; border: 0; border-radius: 5px; background: var(--kbg); color: var(--kfg); font: inherit; font-size: 12px; line-height: 1.45; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ev b { font-weight: 700; }
.ev.done { opacity: .45; text-decoration: line-through; }
.ev.late { background: var(--red-bg); color: var(--red); }
.more { border: 0; background: transparent; padding: 0 6px; font: inherit; font-size: 12px; color: var(--steel); cursor: pointer; }
.daylist .ev { white-space: normal; padding: 6px 10px; margin-bottom: 4px; font-size: 13px; }

/* 타임라인 */
.tl { --name: 220px; border: 1px solid var(--hairline); border-radius: var(--r-xl); overflow: hidden; }
.tl-row { display: grid; grid-template-columns: var(--name) minmax(0, 1fr); border-bottom: 1px solid var(--hairline-soft); }
.tl-row.head { background: var(--surface); font-size: 12px; font-weight: 600; color: var(--steel); border-bottom: 1px solid var(--hairline); }
.tl-name { padding: 10px 12px; border-right: 1px solid var(--hairline-soft); }
.tl-name a { font-weight: 700; text-decoration: none; }
.tl-track { position: relative; min-height: 52px; }
.months div { position: absolute; top: 0; bottom: 0; padding: 10px 8px; border-left: 1px solid var(--hairline); }
.tl-body { position: relative; }
.tl-body .tl-row:last-of-type { border-bottom: 0; }
.bar { position: absolute; top: 22px; height: 8px; border-radius: var(--r-full); }
.bar.pre { background: var(--hairline); }
.bar.post { background: #bfd0f7; }
.mark { position: absolute; top: 19px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--k); border: 2px solid var(--canvas); }
.mark.k-open { top: 16px; width: 20px; height: 20px; margin-left: -10px; z-index: 2; }
.mark em { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 11px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.mark.done { opacity: .35; }
.mark.late { background: var(--red); }
.tl-today { position: absolute; top: 0; bottom: 0; left: calc(var(--name) + (100% - var(--name)) * var(--x) / 100); width: 0; border-left: 2px solid var(--red); pointer-events: none; }
.tl-today span { position: absolute; top: 2px; left: 4px; font-size: 11px; font-weight: 700; color: var(--red); white-space: nowrap; }

/* 고객사 상세 */
.hero { display: flex; gap: 32px; align-items: center; flex-wrap: wrap; }
.hero-viz { width: 170px; text-align: center; flex: none; }
.hero-viz .house { width: 170px; height: 99px; }
.hero-pct { font-size: 26px; font-weight: 700; line-height: 1.2; color: var(--ink); }
.hero-body { flex: 1; min-width: 280px; }
.now { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 24px; margin: 16px 0 0; }
.now dt, .info dt { font-size: 12px; font-weight: 600; color: var(--steel); }
.now dd { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.stepper { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; margin-bottom: 12px; }
.stepper button { padding: 10px 8px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--canvas); font: inherit; text-align: left; cursor: pointer; color: var(--steel); }
.stepper b { display: block; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper span { font-size: 12px; }
.stepper .done { background: var(--surface-soft); }
.stepper .done b { color: var(--steel); }
.stepper .cur { border-color: var(--blue); background: var(--blue-bg); }
.stepper .cur span { color: var(--blue); font-weight: 600; }
.stepper .none b, .stepper .none span { color: var(--muted); }
.stepper button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--primary); }
.conv-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin: 4px 0 16px; }
.conv-steps div { padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-soft); font-size: 13px; color: var(--muted); }
.conv-steps span { display: inline-block; margin-right: 6px; font-weight: 700; }
.conv-steps .done { color: var(--steel); }
.conv-steps .cur { background: var(--yellow-bg); color: var(--yellow); font-weight: 700; }
.info { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 24px; margin: 0; }
.info dd { margin: 0; color: var(--ink); min-height: 21px; }

/* 태스크 줄 */
.trow { display: grid; grid-template-columns: 64px minmax(0, 1fr) 150px 130px; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--hairline-soft); }
.todo .trow, .later .trow { grid-template-columns: minmax(0, 1fr) 150px 130px; }
.trow b { font-weight: 600; color: var(--ink); }
.trow .dt { font-size: 13px; color: var(--slate); }
.trow .ac { display: flex; gap: 4px; justify-content: flex-end; }
.trow.is-done b, .trow.is-done .sub, .trow.is-done .dt { color: var(--muted); }
.card.todo.late { border-color: var(--red); }
.card.todo.late h2 { color: var(--red); }

/* 상태 표시 */
.pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: var(--r-full); font-size: 12px; font-weight: 600; background: var(--surface-soft); color: var(--slate); white-space: nowrap; }
.pill.cur { background: var(--primary); color: var(--on-primary); }
.pill.done { color: var(--muted); }
.pill.doing { background: var(--blue-bg); color: var(--blue); }
.pill.g { background: var(--green-bg); color: var(--green); }
.pill.y { background: var(--yellow-bg); color: var(--yellow); }
.pill.r, .pill.late { background: var(--red-bg); color: var(--red); }

/* 표 (판정 지표, 리포트, 관리) */
.table-wrap { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--r-xl); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--hairline-soft); text-align: left; vertical-align: top; }
th { background: var(--surface); font-weight: 600; color: var(--slate); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.nw { white-space: nowrap; }
td.num, th.num { text-align: center; white-space: nowrap; }
td.wide { min-width: 220px; }

/* 입력 */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: 13px; font-weight: 600; color: var(--slate); }
.field input, .field select, .field textarea { height: 38px; padding: 0 12px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--canvas); width: 100%; }
.field textarea { height: 76px; padding: 8px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); outline: 1px solid var(--blue); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.error { color: var(--red); font-size: 13px; min-height: 20px; margin-top: 8px; }

/* 로그인 */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login .card { margin-top: 20px; }
.login .form { grid-template-columns: 1fr; }

/* 모달, 알림 */
#modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; background: rgba(10,10,10,.35); overflow-y: auto; }
#modal[hidden] { display: none; }
.dialog { width: 100%; max-width: 640px; background: var(--canvas); border-radius: var(--r-xl); padding: 24px; box-shadow: rgba(36,36,36,.08) 0 12px 16px -4px; }
.dialog .sub { margin-bottom: 16px; }
#toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 60; padding: 10px 20px; border-radius: var(--r-full); background: var(--primary); color: var(--on-primary); font-weight: 500; }
#toast[hidden] { display: none; }
.secret { font-family: Consolas, monospace; font-size: 16px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md); user-select: all; }

@media (max-width: 900px) {
  .topnav { padding: 8px 16px; gap: 12px; }
  main { padding: 16px 16px 48px; }
  .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .conv-steps { grid-template-columns: 1fr; }
  .trow, .todo .trow, .later .trow { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .trow .ac { justify-content: flex-start; }
  .day { min-height: 72px; }
  .tl { --name: 120px; }
}

/* 진척 표현 그림의 움직임. OKR 서비스와 같은 값. */
.viz svg .a-bob, .viz svg .a-pop, .viz svg .a-rise, .viz svg .a-flick, .viz svg .a-crawl, .viz svg .a-blink, .viz svg .a-knit { transform-box: fill-box; transform-origin: center; }
.a-bob { animation: v-bob .7s ease-in-out infinite alternate; }
.a-pop { animation: v-pop .5s cubic-bezier(.175,.885,.32,1.275) both; }
.a-rise { animation: v-rise 1.8s linear infinite; }
.a-flick { animation: v-flick .18s ease-in-out infinite alternate; transform-origin: top center !important; }
.a-crawl { animation: v-crawl .3s ease-in-out infinite alternate; }
.a-blink { animation: v-blink .8s ease-in-out infinite alternate; }
.a-knit { animation: v-knit .5s ease-in-out infinite alternate; }
.a-fall { animation: v-fall 1.6s linear infinite; }
.a-spin { animation: v-spin .35s linear infinite; }
.viz svg .a-fall, .viz svg .a-spin { transform-box: view-box; }
@keyframes v-fall { 0% { transform: translateY(-10px); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(130px); opacity: 0; } }
@keyframes v-spin { from { transform: translateY(-10px); } to { transform: translateY(10px); } }
@keyframes v-bob { from { transform: translateY(-2px); } to { transform: translateY(2px); } }
@keyframes v-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes v-rise { 0% { transform: translateY(6px); opacity: 0; } 40% { opacity: .8; } 100% { transform: translateY(-14px); opacity: 0; } }
@keyframes v-flick { from { transform: scaleY(.7); } to { transform: scaleY(1.2); } }
@keyframes v-crawl { from { transform: translateY(-2px) rotate(-6deg); } to { transform: translateY(2px) rotate(6deg); } }
@keyframes v-blink { from { opacity: .3; } to { opacity: 1; } }
@keyframes v-knit { from { transform: translateY(-3px) rotate(-8deg); } to { transform: translateY(3px) rotate(8deg); } }

/* 화면 길이가 달라져도 좌우 폭이 흔들리지 않게 세로 스크롤 자리를 항상 둔다 */
html { overflow-y: scroll; scrollbar-gutter: stable; }

/* 진척 표현 */
.viz svg { display: block; width: 100%; height: auto; }
.hero-viz select { margin-top: 8px; width: 100%; height: 30px; padding: 0 8px; border: 1px solid var(--hairline); border-radius: var(--r-full); background: var(--canvas); font-size: 12px; font-weight: 600; }
.viz-line { margin: 6px 0 0; font-size: 15px; font-weight: 600; color: var(--ink); }

/* 누르면 상세가 열리는 줄 */
.trow[data-open], .trow.drow { cursor: pointer; margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 10px; }
.trow[data-open]:hover, .trow.drow:hover { background: var(--surface); }
.chev { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; font-size: 12px; font-weight: 600; color: var(--steel); }
.chev::after { content: "›"; margin-left: 4px; font-size: 16px; line-height: 1; }

/* 태스크 상세 팝업 */
.dialog.wide { max-width: 720px; }
.dialog h3, .form-sec { grid-column: 1 / -1; margin: 18px 0 6px; font-size: 13px; font-weight: 700; color: var(--slate); }
.form-sec { margin: 10px 0 -4px; padding-top: 12px; border-top: 1px solid var(--hairline-soft); }
.form-sec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.dlg-state { margin: 6px 0 14px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; margin: 0; padding: 14px 16px; background: var(--surface); border-radius: 12px; }
.kv dt, .krows dt, .def-sum dt { font-size: 12px; font-weight: 600; color: var(--steel); }
.kv dd { margin: 0; color: var(--ink); }
.note { margin: 0; white-space: pre-wrap; color: var(--ink); }
.logs { list-style: none; margin: 0; padding: 0; }
.logs li { display: grid; grid-template-columns: 130px 110px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-top: 1px solid var(--hairline-soft); font-size: 13px; }
.logs li span { color: var(--steel); }
.logs li b { font-weight: 600; }

/* 고객사 정보 */
.info-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 4px 10px; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.info-grid .card { margin: 0; }
.krows { margin: 0; }
.krows > div { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--hairline-soft); }
.krows dd { margin: 0; color: var(--ink); font-weight: 500; }
.card.narrow { max-width: 880px; }

/* 정의 관리 */
.stepper.ten { grid-template-columns: repeat(10, minmax(0, 1fr)); }
.def-sum { display: flex; gap: 32px; margin: 0; }
.def-sum dd { margin: 0; color: var(--ink); font-weight: 500; }
.trow.drow { grid-template-columns: 64px minmax(0, 1fr) 220px 70px; }
.tid { font-family: Consolas, monospace; font-size: 12px; color: var(--steel); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0; }
.chip { display: inline-flex; padding: 1px 8px; border-radius: var(--r-full); background: var(--surface-soft); font-size: 12px; font-weight: 600; color: var(--slate); }
.chip.own { background: var(--primary); color: var(--on-primary); }
.chip.trk { background: var(--yellow-bg); color: var(--yellow); }
.chip.ext { background: var(--blue-bg); color: var(--blue); }

@media (max-width: 900px) {
  .info-grid, .kv { grid-template-columns: 1fr; }
  .stepper.ten { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trow.drow { grid-template-columns: minmax(0, 1fr); }
  .krows > div { grid-template-columns: 120px minmax(0, 1fr); }
  .logs li { grid-template-columns: 1fr; gap: 0; }
}

/* 현황과 고객사 목록의 도구 줄: 범위 전환, 담당, 지연만 보기 */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 14px; }
.scope { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--surface-soft); }
.scope button { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-weight: 600; color: var(--steel); cursor: pointer; white-space: nowrap; }
.scope button b { font-weight: 700; color: var(--muted); }
.scope button[aria-selected="true"] { background: var(--canvas); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.scope button[aria-selected="true"] b { color: var(--ink); }
.tools { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.who-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--steel); }
.who-pick select { height: 34px; padding: 0 28px 0 12px; border: 1px solid var(--hairline); border-radius: var(--r-full); background: var(--canvas); font-weight: 600; }
.switch { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--steel); cursor: pointer; }
.switch i { position: relative; width: 34px; height: 20px; border-radius: var(--r-full); background: var(--hairline); transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--canvas); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.switch[aria-checked="true"] { color: var(--red); }
.switch[aria-checked="true"] i { background: var(--red); }
.switch[aria-checked="true"] i::after { left: 16px; }
.switch b { min-width: 20px; padding: 0 6px; border-radius: var(--r-full); background: var(--surface-soft); color: var(--slate); font-size: 12px; text-align: center; }
.switch[aria-checked="true"] b { background: var(--red-bg); color: var(--red); }
.search { height: 34px; width: 260px; max-width: 100%; padding: 0 14px; border: 1px solid var(--hairline); border-radius: var(--r-full); background: var(--canvas); }
a.trow { text-decoration: none; color: inherit; }
a.trow.done-row:first-child { border-top: 0; }

/* 고객사 목록 */
.card.list { padding: 6px 12px; }
.crow { display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(200px, 1.2fr) minmax(220px, 2fr) 150px 170px 60px; gap: 20px; align-items: center; padding: 14px 8px; border-top: 1px solid var(--hairline-soft); border-radius: 10px; text-decoration: none; color: var(--charcoal); }
.crow:first-child { border-top: 0; }
.crow:hover { background: var(--surface); }
.crow b { font-size: 15px; color: var(--ink); }
.crow .c-do { color: var(--ink); }
.mini { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; margin-bottom: 5px; }
.mini i { height: 8px; border-radius: var(--r-full); background: var(--surface-soft); }
.mini i.done { background: var(--primary); }
.mini i.cur { background: var(--blue); }
.mini i.cur.late { background: var(--red); }
.mini i.none { background: transparent; box-shadow: inset 0 0 0 1px var(--hairline); }

/* 고객사 상세의 지연 표시 */
.pill.big { padding: 4px 12px; font-size: 13px; vertical-align: middle; margin-left: 8px; }
.late-box { margin-bottom: 12px; padding: 14px 20px 6px; border: 1px solid var(--red); border-radius: var(--r-xl); background: var(--red-bg); }
.late-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.late-head b { font-size: 16px; color: var(--red); }
.late-head span { font-size: 13px; color: #8a3a3a; }
.late-box .trow { border-top-color: #f3caca; }
.late-box .trow[data-open]:hover { background: #fbdede; }
.late-box .days { font-size: 16px; font-weight: 700; color: var(--red); white-space: nowrap; }
.trow.is-late { background: var(--red-bg); }
.trow.is-late[data-open]:hover { background: #fbdede; }
.trow.is-late .dt { color: var(--ink); font-weight: 600; }
.stepper button { position: relative; }
.stepper .has-late { border-color: var(--red); }
.stepper em { position: absolute; top: 8px; right: 8px; padding: 1px 7px; border-radius: var(--r-full); background: var(--red); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; }

@media (max-width: 900px) {
  .crow { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .crow .chev { display: none; }
}

/* 양식, 첨부 자료, 메일 템플릿 */
.files { display: flex; flex-direction: column; gap: 6px; }
.files.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.file { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--canvas); text-decoration: none; color: var(--charcoal); }
a.file:hover { border-color: var(--ink); }
.file b { font-weight: 600; color: var(--ink); }
.file a { text-decoration: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.file a:hover b { text-decoration: underline; }
.file > b { flex: 1; min-width: 0; }
.file span { font-size: 12px; color: var(--steel); white-space: nowrap; }
.attach { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0 6px; }
.attach input:not([type="file"]) { height: 30px; padding: 0 10px; border: 1px solid var(--hairline); border-radius: var(--r-md); flex: 1; min-width: 140px; }
.attach label.btn { cursor: pointer; }
.mail { padding: 14px 16px; border-radius: 12px; background: var(--surface); }
.mail > .sub { margin: 0 0 10px; }
.mail-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--hairline); }
.mail-text { flex: 1; min-width: 0; }
.mail pre { margin: 2px 0 0; font: inherit; white-space: pre-wrap; color: var(--ink); }
.mail mark { background: var(--yellow-bg); color: var(--yellow); font-weight: 600; border-radius: 4px; padding: 0 2px; }
.mail-item { border-top: 1px solid var(--hairline-soft); padding: 10px 0; }
.mail-item summary { display: flex; gap: 12px; align-items: baseline; cursor: pointer; }
.mail-item .mail { margin-top: 10px; }
.dialog.wide { max-height: 84vh; overflow-y: auto; }

/* 보고서 (인쇄용 화면) */
.seg-tabs a.report-link { border-color: var(--ink); color: var(--ink); margin-left: 10px; }
.hero-body { position: relative; }
.report-btn { position: absolute; top: 0; right: 0; }
.report { max-width: 1000px; margin: 0 auto; color: #111; }
.report-actions { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 20px; }
.r-head { padding-bottom: 14px; margin-bottom: 20px; border-bottom: 2px solid #111; }
.r-brand { font-size: 13px; font-weight: 700; color: var(--steel); }
.r-head h1 { font-size: 24px; margin: 4px 0; }
.r-head p { margin: 0; font-size: 13px; color: var(--steel); }
.report section { margin-bottom: 24px; }
.report h2 { font-size: 15px; margin: 0 0 8px; }
.r-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.r-stats div { padding: 12px 14px; border: 1px solid #cfd3d8; border-radius: 8px; font-size: 12px; color: var(--steel); }
.r-stats b { display: block; font-size: 20px; line-height: 1.3; color: #111; word-break: break-all; }
.r-stats .bad b, b.bad { color: var(--red); }
.r-now { margin: 10px 0 0; font-size: 14px; }
.r-now b { margin-right: 8px; }
.rt { width: 100%; border-collapse: collapse; font-size: 12px; }
.rt th, .rt td { border: 1px solid #cfd3d8; padding: 6px 8px; text-align: left; vertical-align: top; }
.rt th { background: #f2f3f5; font-weight: 700; white-space: nowrap; }
.rt td:first-child, .rt th:first-child { text-align: center; white-space: nowrap; width: 36px; }
.r-empty { text-align: center !important; color: var(--steel); }
.r-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border-top: 1px solid #cfd3d8; border-left: 1px solid #cfd3d8; font-size: 12px; }
.r-kv > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); border-right: 1px solid #cfd3d8; border-bottom: 1px solid #cfd3d8; }
.r-kv dt { padding: 6px 8px; background: #f2f3f5; font-weight: 700; }
.r-kv dd { margin: 0; padding: 6px 8px; }
.r-foot { margin-top: 28px; padding-top: 10px; border-top: 1px solid #cfd3d8; font-size: 11px; color: var(--steel); }

@media print {
  @page { size: A4; margin: 14mm 12mm; }
  html { overflow: visible; }
  body { font-size: 10.5pt; }
  .topnav, .report-actions, #toast, #modal { display: none !important; }
  main { max-width: none; padding: 0; }
  .report { max-width: none; }
  .report section { break-inside: auto; }
  .report h2 { break-after: avoid; }
  .rt tr, .r-kv > div, .r-stats div { break-inside: avoid; }
  .rt thead { display: table-header-group; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.file label.btn, .page-head label.btn { cursor: pointer; }
.field textarea.tall { height: 300px; }
.mail-item summary .btn { margin-left: auto; }

/* 메일 작성 창 */
.dialog.wider { max-width: 1040px; max-height: 88vh; overflow-y: auto; }
.compose { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; margin-top: 8px; }
.compose h3 { margin: 8px 0 10px; }
.c-fields .field, .c-out .field { margin-bottom: 10px; }
.c-out textarea { height: 340px; line-height: 1.6; }
@media (max-width: 900px) { .compose { grid-template-columns: 1fr; } }

/* 양식과 자료 줄의 높이를 모두 같게: 이름은 한 줄로 자르고, 격자에서는 이름 아래에 정보를 둔다 */
.file { min-height: 48px; }
.file b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file > a:first-child { display: block; min-width: 0; }
.files.grid { grid-auto-rows: 1fr; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.files.grid .file { flex-direction: column; align-items: stretch; justify-content: center; gap: 2px; min-height: 64px; padding: 10px 14px; }
.files.grid .file > b { flex: none; }
.file a.btn, .file label.btn, .file button.btn { flex: none; }
.check { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--slate); }
.c-out > .sub { margin: 0 0 12px; }
