:root {
  color-scheme: light;
  --bg: #f3f6fa;
  --card: #ffffff;
  --surface: #f7f9fc;
  --surface-strong: #eef3f8;
  --line: #dce4ed;
  --line-strong: #c8d3df;
  --ink: #18243a;
  --mut: #657188;
  --accent: #245bc7;
  --accent-strong: #1848aa;
  --accent-soft: #eaf1ff;
  --on-accent: #ffffff;
  --on-warn: #ffffff;
  --on-ok: #ffffff;
  --brand: #8a3c16;
  --brand-soft: #f7eee9;
  --warn: #a65a09;
  --danger: #c53232;
  --ok: #147a4d;
  --shadow-xs: 0 1px 2px rgba(23, 38, 64, 0.04);
  --shadow-sm: 0 8px 22px rgba(23, 38, 64, 0.06);
  --shadow-md: 0 18px 48px rgba(16, 31, 54, 0.16);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  --whoBgL: 42%;
  --whoBgA: 13%;
  --whoTxS: 70%;
  --whoTxL: 34%;
  --whoBdL: 45%;
  --logo-bg: transparent;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101720;
    --card: #18222d;
    --surface: #141d27;
    --surface-strong: #202c39;
    --line: #2b3948;
    --line-strong: #3b4a5b;
    --ink: #edf2f8;
    --mut: #9aa8b8;
    --accent: #79a8ff;
    --accent-strong: #9bbdff;
    --accent-soft: #1c3153;
    --on-accent: #0e1b2d;
    --on-warn: #18140f;
    --on-ok: #0d1b15;
    --brand: #d79265;
    --brand-soft: #34251f;
    --warn: #f2aa61;
    --danger: #ff7d7d;
    --ok: #58d093;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 10px 26px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 22px 56px rgba(0, 0, 0, 0.42);
    --whoBgL: 55%;
    --whoBgA: 18%;
    --whoTxS: 75%;
    --whoTxL: 70%;
    --whoBdL: 62%;
    --logo-bg: #fff;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101720;
  --card: #18222d;
  --surface: #141d27;
  --surface-strong: #202c39;
  --line: #2b3948;
  --line-strong: #3b4a5b;
  --ink: #edf2f8;
  --mut: #9aa8b8;
  --accent: #79a8ff;
  --accent-strong: #9bbdff;
  --accent-soft: #1c3153;
  --on-accent: #0e1b2d;
  --on-warn: #18140f;
  --on-ok: #0d1b15;
  --brand: #d79265;
  --brand-soft: #34251f;
  --warn: #f2aa61;
  --danger: #ff7d7d;
  --ok: #58d093;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 10px 26px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 22px 56px rgba(0, 0, 0, 0.42);
  --whoBgL: 55%;
  --whoBgA: 18%;
  --whoTxS: 75%;
  --whoTxL: 70%;
  --whoBdL: 62%;
  --logo-bg: #fff;
}

html {
  min-width: 320px;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% -12%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 31rem),
    var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  letter-spacing: -0.012em;
}

::selection {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 200;
  padding: 9px 13px;
  border-radius: 9px;
  color: #fff;
  background: var(--accent-strong);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.16s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* App chrome */
.app-header {
  position: sticky;
  top: 0;
  z-index: 45;
  padding: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  box-shadow: 0 1px 0 rgba(17, 35, 62, 0.02);
  backdrop-filter: blur(18px) saturate(140%);
}

.app-header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(100%, 1540px);
  min-height: 62px;
  margin: 0 auto;
  padding: 8px 28px;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.app-brand .logo {
  width: auto;
  height: 34px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--logo-bg);
}

.brand-divider {
  width: 1px;
  height: 26px;
  margin: 0 13px;
  background: var(--line);
}

.brand-context {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-context b {
  font-size: 13px;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.brand-context span {
  margin-top: 3px;
  color: var(--mut);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.header-date {
  color: var(--mut);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid color-mix(in srgb, var(--ok) 24%, var(--line));
  border-radius: 999px;
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 7%, var(--card));
  font-size: 11.5px;
  font-weight: 700;
}

.header-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 12%, transparent);
  content: "";
}

.header-status.is-busy {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
}

.header-status.is-error {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--card));
}

main {
  width: min(100%, 1540px);
  max-width: none;
  margin: 0 auto;
  padding: 16px 28px 64px;
}

.workspace-nav {
  position: sticky;
  top: 72px;
  z-index: 34;
  display: flex;
  align-items: center;
  min-height: 50px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 15px;
  background: color-mix(in srgb, var(--card) 93%, transparent);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px) saturate(130%);
}

.tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
  margin: 0;
  padding: 5px;
  border: 0;
}

.tab {
  min-height: 40px;
  margin: 0;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  color: var(--mut);
  font-weight: 680;
  letter-spacing: -0.01em;
}

.tab:hover {
  color: var(--ink);
  background: var(--surface);
}

.tab.on {
  color: var(--accent);
  border: 0;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent);
}

/* 화면 제목 줄 — 한 줄에 제목·설명·저장보기. 큰 제목과 장식은 두지 않습니다:
   하루 종일 보는 화면에서 위쪽 140px가 매번 같은 말을 하고 있었습니다. */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 16px 4px 12px;
}

.page-title {
  display: flex;
  flex: 1 1 320px;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.page-kicker {
  margin-bottom: 7px;
  color: var(--brand);
  font-size: 10.5px;
  font-weight: 780;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-head h1,
.page-head h2 {
  flex: none;
  margin: 0;
  font-size: 20px;
  font-weight: 760;
  line-height: 1.3;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.page-head p {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--mut);
  font-size: 12.5px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Controls and surfaces */
.card {
  border-color: var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow-xs);
}

.toolbar-card {
  margin-bottom: 14px !important;
  border-color: color-mix(in srgb, var(--accent) 10%, var(--line));
  background: color-mix(in srgb, var(--card) 96%, var(--accent-soft));
  box-shadow: var(--shadow-sm);
}

.toolbar-card > .bar:last-child,
.toolbar-card > .bar:only-child {
  border-bottom: 0;
}

.bar {
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
}

.filter-label {
  flex: none;
  color: var(--mut);
  font-size: 11.5px;
  font-weight: 700;
}

input,
select,
textarea {
  min-height: 39px;
  border-color: var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--card);
  box-shadow: inset 0 1px 1px rgba(19, 37, 62, 0.025);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: var(--focus);
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--mut) 88%, var(--ink) 12%);
  opacity: 1;
}

button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  color: var(--on-accent);
  background: var(--accent);
  font-weight: 680;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 24%, transparent);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease, transform 0.15s ease;
}

button:hover {
  opacity: 1;
}

button:not([class]):hover,
button.primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 20%, transparent);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0) !important;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

button:disabled {
  box-shadow: none;
  transform: none !important;
}

button.ghost {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  box-shadow: none;
}

button.ghost:hover {
  border-color: color-mix(in srgb, var(--danger) 18%, var(--line));
  background: color-mix(in srgb, var(--danger) 7%, transparent);
}

button.ghost.quiet:hover {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface-strong);
}

button.danger:hover {
  background: color-mix(in srgb, var(--danger) 84%, #000);
}

button.secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}

button.secondary:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
  background: var(--accent-soft);
  box-shadow: var(--shadow-xs);
}

.seg {
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.seg button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
}

.seg button:hover {
  color: var(--ink);
  background: var(--card);
  transform: none;
}

.seg button.on {
  color: var(--accent);
  background: var(--card);
  box-shadow: 0 1px 4px rgba(18, 37, 64, 0.1), inset 0 0 0 1px var(--line);
}

label {
  gap: 6px;
  color: var(--mut);
  font-size: 11.5px;
  font-weight: 680;
}

/* 체크박스·라디오를 품은 라벨은 가로줄입니다. 기본 label이 세로 쌓임(제목 위, 입력칸
   아래)이라, 인라인으로 display:flex만 준 라벨은 상자가 글 위에 홀로 떠 있었습니다 —
   설정의 "내 카드만 / 사무소 전체"와 카드 상세의 "표기 통일" 체크가 그렇게 보였습니다. */
label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]) {
  flex-direction: row;
}

.box {
  border-radius: 12px;
}

/* 시스템 경고 띠 — 머리글 바로 아래, 탭과 무관하게 섭니다.
   위험색을 쓰되 본문은 잉크색으로 둡니다. 긴 문장이 통째로 빨가면 읽히지 않습니다. */
.sys-alert {
  padding: 10px 24px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  background: color-mix(in srgb, var(--danger) 11%, var(--card));
  border-bottom: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line));
}

.sys-alert b {
  color: var(--danger);
}

/* 검색이 카드 밖(메일 본문·메모·할 일·첨부명)에서 맞았을 때 그 토막. 한 줄로 자릅니다. */
.kc-hit {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--mut);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kc-hit mark {
  padding: 0 1px;
  border-radius: 3px;
  color: inherit;
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}

/* 첨부 한 벌 — 미리보기 링크와 그 옆의 작은 내려받기 화살표 */
.att-g {
  display: inline-flex;
  align-items: stretch;
}

.att-g .att.dl {
  margin-left: 2px;
  padding-left: 6px;
  padding-right: 6px;
}

.pill,
.due,
.todo-src {
  border-radius: 999px;
}

.tst {
  color: var(--on-warn);
}

.mh-av {
  color: #fff;
  background: hsl(var(--avh, 212) 45% 30%);
}

.who {
  color: var(--ink);
}

.empty {
  margin: 4px 0;
  padding: 50px 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 74%, transparent);
  line-height: 1.7;
}

.empty small {
  display: inline-block;
  margin-top: 5px;
}

/* Tables */
.scroll {
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.scroll::-webkit-scrollbar,
.board::-webkit-scrollbar {
  height: 9px;
  width: 9px;
}

.scroll::-webkit-scrollbar-thumb,
.board::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--line-strong);
  background-clip: padding-box;
}

th {
  padding: 11px 14px;
  border-bottom-color: var(--line);
  color: var(--mut);
  background: var(--surface);
  font-size: 10.5px;
  font-weight: 760;
  letter-spacing: 0.06em;
}

td {
  padding: 12px 14px;
  border-bottom-color: var(--line);
}

tbody tr td {
  transition: background 0.12s ease;
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--accent) 3.5%, var(--card));
}

/* Dashboard */
.sum-g {
  gap: 16px;
  margin-bottom: 16px;
}

.sum-g .card {
  min-width: 0;
  box-shadow: var(--shadow-sm);
}

.sum-h {
  align-items: center;
  gap: 9px;
  padding: 15px 18px;
}

.sum-h::before {
  width: 4px;
  height: 17px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.sum-h b {
  font-size: 14px;
  font-weight: 760;
}

.sum-r {
  width: 100%;
  min-height: 46px;
  padding: 10px 18px;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: var(--card);
  box-shadow: none;
  text-align: left;
}

.sum-r:hover {
  background: color-mix(in srgb, var(--accent) 4%, var(--card));
}

.sum-n > * {
  min-height: 86px;
  padding: 15px 12px;
  border-radius: 0;
  box-shadow: none;
}

.sum-n > *:hover {
  background: var(--surface);
  box-shadow: none;
  transform: none;
}

.sum-n b {
  font-size: 24px;
  font-weight: 760;
  letter-spacing: -0.04em;
}

.sum-st > button {
  min-height: 72px;
  border-radius: 0;
  box-shadow: none;
}

.sum-st > button:hover {
  color: var(--ink);
  background: var(--surface);
  box-shadow: none;
  transform: none;
}

.sum-ok {
  padding: 20px 18px;
}

.sum-ok::before {
  display: inline-grid;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  place-items: center;
  border-radius: 50%;
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
  font-size: 12px;
  font-weight: 800;
  content: "✓";
}

/* Kanban and task boards */
.board {
  gap: 14px;
  padding: 2px 2px 14px;
  scroll-snap-type: x proximity;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.col {
  min-height: 240px;
  overflow: hidden;
  scroll-snap-align: start;
  border-color: var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.col.over {
  border-color: var(--accent);
  box-shadow: var(--focus);
}

.col-h {
  min-height: 48px;
  padding: 12px 13px;
  border-bottom-color: var(--line);
  border-radius: 16px 16px 0 0;
  background: color-mix(in srgb, var(--card) 90%, var(--surface));
  font-size: 12.5px;
  font-weight: 760;
}

.col-h::before {
  width: 6px;
  height: 6px;
  margin-right: 2px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 72%, var(--mut));
  content: "";
}

.col-h .n {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 10.5px;
}

.col-b {
  gap: 9px;
  padding: 10px;
}

.col-b:empty::after {
  display: grid;
  min-height: 76px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--mut);
  font-size: 11px;
  content: "아직 항목이 없습니다";
}

.kc,
.todo-board .tdo {
  border-color: var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 3px 10px rgba(20, 38, 65, 0.055);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.kc {
  padding: 12px;
}

.kc-open {
  margin: -12px;
  padding: 12px;
  border-radius: 11px;
}

.kc:hover,
.todo-board .tdo:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: var(--card);
  box-shadow: 0 9px 22px rgba(20, 38, 65, 0.1);
  transform: translateY(-1px);
}

.kc:focus-visible,
.kc-open:focus-visible,
.tdo:focus-visible,
.tdo-open:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: var(--focus);
}

.kc .cust {
  padding-right: 28px;
  font-size: 14px;
  font-weight: 760;
}

.kc .bl {
  margin-top: 3px;
}

/* 핵심 낱말 칩. 요약 문장이 서던 자리입니다 — 문장은 카드를 열어야 읽히고,
   보드에서 읽히는 것은 낱말입니다. 다섯 개까지라 두 줄을 넘지 않습니다. */
.kc-kws {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}

.kc-kw {
  max-width: 100%;
  padding: 1px 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  color: var(--mut);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.kc .mt {
  gap: 7px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.kuni {
  margin: 7px 0 2px;
  padding: 4px 7px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--ok) 8%, transparent);
}

.kstale {
  margin: 4px 0 2px;
  padding: 4px 7px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--warn) 10%, transparent);
}

.etb-mini {
  margin: 6px 0 1px;
}

.kc-arch {
  top: 7px;
  right: 7px;
  min-height: 25px;
  border-radius: 7px;
  box-shadow: var(--shadow-xs);
}

.kc.arch,
.kc.is-test,
.todo-board .col[data-state="done"] .tdo {
  opacity: 1;
}

.kc.arch {
  background: var(--surface);
}

.who {
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 700;
}

.tdo {
  padding: 11px 15px;
}

.tdo:hover,
.rp:hover {
  background: color-mix(in srgb, var(--accent) 4%, var(--card));
}

.tdo:not(.movable):hover {
  background: transparent;
}

.tdo-open:hover,
.tdo-check:hover {
  background: color-mix(in srgb, var(--accent) 6%, var(--card));
}

/* Dialogs and messages */
#modal,
#nmodal,
#tmodal,
#etmodal,
#mmodal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 48px 20px;
  background: rgba(7, 14, 24, 0.6);
  backdrop-filter: blur(8px);
}

#modal.hide,
#nmodal.hide,
#tmodal.hide,
#etmodal.hide,
#mmodal.hide {
  display: none;
}

/* 다른 카드에 합치기 — 카드 상세(#modal) 위에 겹쳐 뜨므로 그보다 위에 둡니다. */
#mmodal {
  z-index: 70;
}

.sheet {
  max-height: calc(100vh - 96px);
  overflow: auto;
  border-color: color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}

.sh-h {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 18px 20px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(14px);
}

.sh-s {
  padding: 18px 20px;
}

.stage-switch {
  display: grid;
  grid-template-columns: auto minmax(150px, 220px);
  align-items: center;
  justify-content: start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.stage-switch select {
  min-height: 36px;
}

.x {
  display: inline-grid;
  width: 34px;
  min-height: 34px;
  padding: 0;
  place-items: center;
  border-radius: 9px;
  box-shadow: none;
}

.x:hover {
  color: var(--ink);
  background: var(--surface-strong);
}

#toast {
  border: 1px solid color-mix(in srgb, #fff 20%, transparent);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  color: var(--on-ok);
  white-space: normal;
  overflow-wrap: anywhere;
}

body.dialog-open {
  overflow: hidden;
}

.todo .x,
.rt-x {
  visibility: visible;
  opacity: 0;
  pointer-events: none;
}

.todo:hover .x,
.todo:focus-within .x,
.todo .x:focus-visible,
.rt-r:hover .rt-x,
.rt-r:focus-within .rt-x,
.rt-x:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Settings and report density */
.settings-section-title {
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
}

.rp-s {
  letter-spacing: -0.025em;
}

.rp-auto,
.rp-memo-box,
.mh,
.note,
.etb-grid > div,
.ref-t {
  border-radius: 11px;
}

.rc thead th,
.rc tbody th {
  background: var(--surface);
}

/* Operations page */
.ops-main {
  width: min(100%, 1360px);
}

.ops-main .page-head {
  padding-top: 22px;
}

.ops-main .card {
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.ops-section-label {
  margin: 24px 2px 11px;
  color: var(--mut);
  font-size: 11px;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ops-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--mut);
  background: var(--card);
  font-size: 12px;
  font-weight: 680;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
}

.ops-back:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.ops-card-link {
  color: var(--ink);
  font-weight: 720;
  text-decoration-color: color-mix(in srgb, var(--accent) 36%, transparent);
  text-underline-offset: 3px;
}

.ops-card-link:hover {
  color: var(--accent);
}

.ops-header-actions {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-left: auto;
}

.ops-grid {
  gap: 12px;
  margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ops-c {
  position: relative;
  overflow: hidden;
  min-height: 116px;
  padding: 17px 18px;
  border-color: var(--line);
  border-radius: 15px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.ops-c::after {
  position: absolute;
  right: -20px;
  bottom: -30px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  content: "";
}

.ops-c .k {
  font-size: 11px;
  font-weight: 740;
  letter-spacing: 0.03em;
}

.ops-c .v {
  margin-top: 7px;
  font-size: 25px;
  font-weight: 780;
  letter-spacing: -0.045em;
}

.ops-c .s {
  position: relative;
  z-index: 1;
  margin-top: 5px;
  line-height: 1.5;
}

.ops-c.warn,
.ops-c.bad {
  border-left-width: 4px;
}

.ops-c.good {
  border-left: 4px solid color-mix(in srgb, var(--ok) 55%, var(--line));
}

.ops-cost-grid .ops-c {
  min-height: 102px;
  background: color-mix(in srgb, var(--card) 94%, var(--surface));
  box-shadow: var(--shadow-xs);
}

.ops-h {
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 13px 17px;
}

.ops-h > b {
  font-size: 13.5px;
  font-weight: 760;
}

.ops-h > span {
  flex: 1 1 300px;
  min-width: 0;
  line-height: 1.5;
}

.ops-h > button {
  flex: none;
}

.ops-a {
  padding: 14px 16px;
  border-radius: 13px;
  line-height: 1.7;
  box-shadow: var(--shadow-xs);
}

.ops-alert-list {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
}

.ops-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow-xs);
  font-size: 12.5px;
  line-height: 1.65;
}

.ops-alert-badge {
  min-width: 42px;
  padding: 2px 7px;
  border-radius: 999px;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
}

.ops-alert.tone-danger {
  border-color: color-mix(in srgb, var(--danger) 34%, var(--line));
  background: color-mix(in srgb, var(--danger) 5%, var(--card));
}

.ops-alert.tone-danger .ops-alert-badge {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 11%, transparent);
}

.ops-alert.tone-warn {
  border-color: color-mix(in srgb, var(--warn) 34%, var(--line));
  background: color-mix(in srgb, var(--warn) 5%, var(--card));
}

.ops-alert.tone-warn .ops-alert-badge {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 11%, transparent);
}

.ops-alert.tone-info .ops-alert-badge {
  color: var(--accent);
  background: var(--accent-soft);
}

.ops-alert code {
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .app-header-inner,
  main {
    padding-right: 20px;
    padding-left: 20px;
  }

  .workspace-nav {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .workspace-nav::-webkit-scrollbar {
    display: none;
  }

  .page-head {
    align-items: flex-start;
  }
}

@media (max-width: 700px) {
  .app-header-inner {
    min-height: 56px;
    padding: 6px 14px;
  }

  .app-brand .logo {
    height: 34px;
    padding-left: 4px;
  }

  .brand-divider,
  .brand-context,
  .header-date {
    display: none;
  }

  .header-status {
    padding: 0 9px;
    font-size: 10.5px;
  }

  main {
    padding: 15px 14px 56px;
  }

  .workspace-nav {
    top: 64px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    overflow: hidden;
    margin: 0 -2px;
    border-radius: 13px;
  }

  .tabs {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(max-content, 1fr));
    gap: 2px;
    padding: 5px 6px 4px;
    border-bottom: 1px solid var(--line);
  }

  .tabs::-webkit-scrollbar {
    height: 5px;
  }

  .tabs::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: var(--line-strong);
  }

  .tab {
    min-height: 38px;
    padding: 0 10px;
    font-size: 12.5px;
    white-space: nowrap;
  }

  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px !important;
  }

  /* 카드 상세의 할 일 줄 — 좁은 화면에서는 글이 첫 줄을 다 쓰고, 마감일·삭제는
     다음 줄로 내려옵니다. 한 줄에 다 세우면 글이 60px 폭에 여섯 줄로 접혔습니다. */
  .todo {
    flex-wrap: wrap;
    min-height: 48px;
    align-items: center;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .todo .tb {
    flex: 1 1 60%;
    min-width: 0;
  }

  .todo .due-in {
    margin-left: auto;
  }

  .todo input[type="checkbox"],
  .tdo-check > input[type="checkbox"],
  .who-once input[type="checkbox"] {
    width: 22px;
    min-width: 22px;
    height: 22px;
    min-height: 22px;
    margin-top: 0;
  }

  .tdo,
  .todo-board .tdo {
    min-height: 52px;
    padding-top: 11px;
    padding-bottom: 11px;
  }

  .kc-arch {
    min-width: 54px;
    min-height: 44px;
    padding: 0 10px;
    opacity: 1;
  }

  .kc .cust {
    padding-right: 72px;
  }

  .kc.pick {
    padding-left: 42px;
  }

  .kc-pick-hit {
    width: 44px;
    height: 44px;
  }

  .kc-pick {
    width: 22px;
    height: 22px;
  }

  .col-pick,
  .todo .x,
  .rt-x {
    min-width: 44px;
    min-height: 44px;
  }

  /* 제목·설명은 세로로, 저장보기는 그 오른쪽에. 단추 하나뿐이면 같은 줄에 서고,
     셀렉트까지 펴지면 다음 줄로 내려옵니다. */
  .page-head {
    gap: 6px 10px;
    padding: 12px 2px 10px;
  }

  .page-title {
    flex: 1 1 200px;
    flex-direction: column;
    gap: 2px;
  }

  .page-head h1,
  .page-head h2 {
    font-size: 19px;
    white-space: normal;
  }

  .bar {
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }

  .bar > input:not([type="date"]),
  .bar > select {
    flex: 1 1 100% !important;
    width: 100% !important;
  }

  .filter-label {
    display: flex;
    align-items: center;
  }

  .sum-g {
    grid-template-columns: minmax(0, 1fr);
  }

  .sum-r .cu {
    max-width: 40%;
  }

  .board {
    grid-template-columns: repeat(var(--cols, 5), minmax(82vw, 1fr));
  }

  .todo-board {
    display: flex;
    justify-content: flex-start !important;
  }

  .todo-board .col {
    flex: 0 0 82vw;
  }

  .sheet {
    max-height: calc(100vh - 28px);
    border-radius: 16px;
  }

  #modal,
  #nmodal,
  #tmodal,
  #etmodal,
  #mmodal {
    align-items: flex-start;
    padding: 14px 10px;
  }

  .sh-h,
  .sh-s {
    padding-right: 16px;
    padding-left: 16px;
  }

  .ops-header-actions #stamp {
    display: none;
  }

  .ops-header-actions {
    min-width: 0;
    gap: 7px;
  }

  .ops-header-actions button,
  .ops-back {
    min-height: 44px;
  }

  .ops-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-c {
    min-height: 108px;
    padding: 14px;
  }

  .ops-c .v {
    font-size: 21px;
  }

  .ops-h {
    align-items: flex-start;
    gap: 7px 8px;
  }

  .ops-h > span {
    flex-basis: 100%;
    order: 3;
  }

  #pickbar {
    bottom: max(12px, env(safe-area-inset-bottom));
    flex-wrap: wrap;
    justify-content: center;
  }

  .ops-h > button {
    width: 100%;
    margin-left: 0 !important;
  }
}

@media (max-width: 430px) {
  .tabs {
    grid-template-columns: repeat(5, minmax(58px, 1fr));
  }

  .tab {
    padding-right: 7px;
    padding-left: 7px;
    font-size: 11.5px;
  }

  .header-status {
    width: 30px;
    padding: 0;
    justify-content: center;
    font-size: 0;
  }

  .ops-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ops-main .page-head .ops-back {
    width: 100%;
    justify-content: center;
  }

  .ops-alert {
    grid-template-columns: minmax(0, 1fr);
  }

  .ops-alert-badge {
    justify-self: start;
  }
}

@media (hover: none), (pointer: coarse) {
  .kc-arch,
  .todo .x,
  .rt-x {
    opacity: 1;
    pointer-events: auto;
  }

  .kc-arch,
  .x,
  .rt-x,
  button.ghost {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
