/* ==========================================================================
   DESIGN TOKENS: the only place colors, font sizes and radii are defined;
   rules below use var() for them. Spacing and control heights are tokens
   where the value repeats (one-off layout sizes stay literal).
   Light values in :root, dark overrides in :root[data-theme=dark] (only
   tokens that already exist in :root). Apply a style guide by editing this
   block. Enforced by rnd-api/tests/style-tokens.test.mjs.
   ========================================================================== */
:root {
  color-scheme: light;
  /* Guide v3 six base tokens (DESIGN-GUIDE.md "색과 표면"): 배경, 주요, 본문, 보조, 구분선, 경고. */
  --surface:#FFFFFF;
  --accent:#1F4FD8;
  --text:#16171A;
  --muted:#6B6F76;
  --border:#E6E7EB;
  --warn:#C9302C;
  /* v3 secondary surfaces and the control border (inputs, checkboxes, secondary buttons). */
  --page-tint:#F4F6FD;
  --hover:#F6F8FD;
  --pressed:#F0F3FC;
  --control-border:#80858F;
  /* Text on the primary fill (primary button, inset pressed line). */
  --on-accent:#FFFFFF;
  /* Legacy names kept for the existing rules: page = page tint, tint = pressed/selected surface. */
  --bg:#F4F6FD;
  --accent-dark:#6E93FF;
  --tint:#F0F3FC;
  /* Drawer / dialog scrim (both themes). */
  --scrim:rgba(12, 19, 32, .56);
  /* Shadows: base (floating card), hover, overlay (menus, drawers, dialogs). */
  --shadow-1:0 4px 16px rgba(24, 40, 80, .08), 0 1px 4px rgba(24, 40, 80, .04);
  --shadow-2:0 8px 24px rgba(24, 40, 80, .12), 0 2px 8px rgba(24, 40, 80, .06);
  --shadow-3:0 16px 48px rgba(24, 40, 80, .20), 0 4px 12px rgba(24, 40, 80, .10);
  /* Tag palette, order 0-5 = 실험, 검토, 데이터, 산출물, 회의, 운영 (categories, initials, project dots). */
  --tag-0-bg:#E6EEFF;
  --tag-0-fg:#1744A4;
  --tag-1-bg:#F1E8FC;
  --tag-1-fg:#61329B;
  --tag-2-bg:#DDF5F2;
  --tag-2-fg:#0D625E;
  --tag-3-bg:#E5F4E8;
  --tag-3-fg:#296036;
  --tag-4-bg:#F8EED9;
  --tag-4-fg:#744F15;
  --tag-5-bg:#EAEFF6;
  --tag-5-fg:#424E69;
  /* Top bar: dark in both themes (never overridden in the dark block). */
  --bar-bg:#182130;
  --bar-fg:#F5F7FC;
  --bar-muted:#C5CFE0;
  --bar-accent:#A9BEFF;
  --bar-control:#8495AD;
  --bar-hover:#26354A;
  --bar-pressed:#334661;
  /* Focus ring: 2px accent + 2px offset (top bar: --bar-accent). */
  --focus-width:2px;
  --focus-offset:2px;
  /* Avatar sizes (card 24, activity/members 32, account 40, profile 72). */
  --avatar-sm:24px;
  --avatar-md:32px;
  --avatar-lg:40px;
  --avatar-xl:72px;
  /* Checklist badges and row separator */
  --line:#8885;
  --checklist-badge-warn:#C9302C;
  --checklist-badge-valid:#16171A;
  --checklist-badge-pending:#6B6F76;
  /* File expiry: outline labels, the expired marker (fill + on-fill text) and the expired row/warning tint */
  --expiry-warn:#C9302C;
  --expiry-on-warn:#FFFFFF;
  --expiry-warn-tint:#FDF2EF;
  --expiry-renewing:#1F4FD8;
  /* Whole-panel drop overlay: card background at 92% */
  --drop-overlay:rgb(255 255 255 / .92);
  /* Font sizes */
  --font-size-4xs:9px;
  --font-size-3xs:10px;
  --font-size-2xs:11px;
  --font-size-xs:12px;
  --font-size-sm:13px;
  --font-size-md:14px;
  --font-size-base:15px;
  --font-size-panel:16px;
  --font-size-lg:17px;
  --font-size-xl:18px;
  --font-size-2xl:20px;
  --font-size-3xl:22px;
  --font-size-5xl:24px;
  --font-size-4xl:26px;
  --font-size-6xl:32px;
  /* Radii (v3: card 12, drawer/modal 16, input/button 8, badge 4, avatar/dot 50%) */
  --radius-2xs:4px;
  --radius-xs:5px;
  --radius-sm:6px;
  --radius-md:7px;
  --radius-lg:8px;
  --radius-xl:10px;
  --radius-2xl:11px;
  --radius-3xl:12px;
  --radius-card:12px;
  --radius-drawer:16px;
  --radius-control:8px;
  --radius-badge:4px;
  --radius-round:50%;
  /* Spacing scale (padding, margin, gap) */
  --space-1:2px;
  --space-2:3px;
  --space-3:4px;
  --space-4:6px;
  --space-5:7px;
  --space-6:8px;
  --space-7:10px;
  --space-8:12px;
  --space-9:14px;
  --space-10:16px;
  --space-11:18px;
  --space-12:20px;
  --space-13:24px;
  --space-14:28px;
  /* Gap scale (C2c): vertical rhythm between panel sections and controls. */
  --sp-1:4px;
  --sp-2:8px;
  --sp-3:12px;
  --sp-4:16px;
  --sp-5:24px;
  /* Control heights (desktop / touch) */
  --control-height:36px;
  --control-height-touch:44px;
  font-family:
    Pretendard,
    "Pretendard Variable",
    -apple-system,
    BlinkMacSystemFont,
    "Apple SD Gothic Neo",
    "Noto Sans KR",
    "Malgun Gothic",
    system-ui,
    sans-serif;
  font-size: var(--font-size-base);
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}
:root[data-theme=dark] {
  color-scheme: dark;
  --surface:#121314;
  --accent:#6E93FF;
  --text:#E6E6E8;
  --muted:#9A9DA3;
  --border:#2A2C30;
  --warn:#FF6B66;
  --page-tint:#181B22;
  --hover:#191E27;
  --pressed:#202636;
  --control-border:#777F8C;
  --on-accent:#121314;
  --bg:#181B22;
  --tint:#202636;
  --shadow-1:0 4px 16px rgba(0, 0, 0, .28), 0 1px 4px rgba(0, 0, 0, .18);
  --shadow-2:0 8px 24px rgba(0, 0, 0, .36), 0 2px 8px rgba(0, 0, 0, .22);
  --shadow-3:0 16px 48px rgba(0, 0, 0, .58), 0 4px 12px rgba(0, 0, 0, .32);
  --tag-0-bg:#232F50;
  --tag-0-fg:#B8CCFF;
  --tag-1-bg:#39264E;
  --tag-1-fg:#DABEFF;
  --tag-2-bg:#133733;
  --tag-2-fg:#A1E4DB;
  --tag-3-bg:#213827;
  --tag-3-fg:#B9E4BE;
  --tag-4-bg:#3D321D;
  --tag-4-fg:#F2D593;
  --tag-5-bg:#2A3344;
  --tag-5-fg:#CAD5EA;
  --checklist-badge-warn:#FF6B66;
  --checklist-badge-valid:#E6E6E8;
  --checklist-badge-pending:#9A9DA3;
  --expiry-warn:#FF6B66;
  --expiry-on-warn:#121314;
  --expiry-warn-tint:#3a2419;
  --expiry-renewing:#6E93FF;
  --drop-overlay:rgb(18 19 20 / .92);
}
/* ======================= END DESIGN TOKENS ======================= */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-7);
  min-height: var(--control-height);
}
button:hover {
  background: var(--hover);
  border-color: var(--text);
}
button:disabled {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--border);
  box-shadow: none;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
[contenteditable]:focus-visible {
  outline: var(--focus-width) solid var(--accent);
  outline-offset: var(--focus-offset);
}
a {
  color: var(--accent);
  overflow-wrap: anywhere;
}
h1,
h2,
h3,
p {
  margin: 0 0 var(--space-8);
}
h1 {
  font-size: var(--font-size-4xl);
  line-height: 1.4;
}
h2,
h3 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  line-height: 1.5;
}
small,
.hint {
  font-size: var(--font-size-sm);
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
img,
video {
  max-width: 100%;
  display: block;
}
button,
a,
input {
  touch-action: manipulation;
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-7);
}
textarea {
  min-height: 130px;
  resize: vertical;
}
.field {
  display: grid;
  gap: var(--space-4);
  margin: var(--space-8) 0;
}
.field span {
  font-size: var(--font-size-sm);
  color: var(--muted);
}
.bar {
  position: sticky;
  top: 0;
  height: 64px;
  background: var(--bar-bg);
  color: var(--bar-fg);
  border-bottom: 1px solid var(--bar-pressed);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-5);
  z-index: 10;
}
.bar-title {
  flex: none;
  white-space: nowrap;
  font-size: var(--font-size-xl);
  font-weight: 700;
}
.bar-title span,
#barMeta {
  font-size: var(--font-size-sm);
  color: var(--muted);
}
#navOpen,
#filesOpen {
  display: none;
}
.workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 760px) 300px;
  gap: var(--space-13);
  max-width: 1440px;
  padding: var(--space-13);
  margin: auto;
  align-items: start;
}
.left-panel,
.files-panel {
  position: sticky;
  top: 88px;
  max-height: calc(100dvh - 112px);
  overflow: auto;
  min-width: 0;
}
.left-panel {
  padding: var(--space-8);
}
.left-panel h2 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-14);
}
.left-panel nav button {
  width: 100%;
  text-align: left;
  background: var(--tint);
  color: var(--accent);
  border-color: transparent;
}
.panel-content h3 {
  font-size: var(--font-size-sm);
  color: var(--muted);
  margin: var(--space-14) 0 var(--space-9);
}
.person {
  display: flex;
  gap: var(--space-7);
  align-items: center;
  margin-bottom: var(--space-10);
  font-size: var(--font-size-sm);
}
.person small,
.c-who small {
  display: block;
}
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-round);
  background: var(--tint);
  color: var(--accent);
  flex-shrink: 0;
  font-size: var(--font-size-sm);
  font-weight: 600;
}
.alist {
  list-style: none;
  padding: 0;
  margin: 0;
}
.alist li {
  font-size: var(--font-size-sm);
  border-bottom: 1px solid var(--border);
  padding: var(--space-8) 0;
  overflow-wrap: anywhere;
}
.panel-footer {
  border-top: 1px solid var(--border);
  margin-top: var(--space-13);
  padding-top: var(--space-10);
  display: grid;
  gap: var(--space-8);
}
.who {
  font-size: var(--font-size-sm);
}
.center {
  min-width: 0;
  width: 100%;
  max-width: 760px;
  /* inline centering only: an auto block margin on a grid item centres it vertically in a tall row */
  margin: 0 auto;
}
.head {
  padding: var(--space-6) 0 var(--space-12);
}
.eyebrow {
  font-size: var(--font-size-xs);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-7);
}
.lede {
  color: var(--muted);
  font-size: var(--font-size-md);
}
.composer {
  background: var(--surface);
  padding: var(--space-9) var(--space-11);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-13);
  text-align: left;
  border-radius: var(--radius-3xl);
  color: var(--muted);
}
.composer b {
  background: var(--accent);
  color: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-6);
  font-size: var(--font-size-2xl);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--sp-5);
  position: relative;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-1);
}
.c-head {
  display: flex;
  align-items: center;
  gap: var(--space-7);
  margin-bottom: var(--space-12);
  position: relative;
}
.c-who {
  flex: 1;
  min-width: 0;
  font-size: var(--font-size-md);
}
.c-who small {
  font-size: var(--font-size-xs);
}
.type {
  font-size: var(--font-size-xs);
  border-radius: var(--radius-xs);
  background: var(--tint);
  color: var(--accent);
  padding: var(--space-2) var(--space-5);
  white-space: nowrap;
}
.kebab {
  font-size: var(--font-size-3xl);
  border: 0;
  padding: 0 var(--space-4);
}
.c-body {
  font-size: var(--font-size-base);
  line-height: 1.6;
  min-width: 0;
}
.c-body h3 {
  font-size: var(--font-size-xl);
  font-weight: 600;
}
.c-foot {
  display: flex;
  gap: var(--space-6);
  align-items: center;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: var(--space-9);
  margin-top: var(--space-11);
}
.c-foot button {
  font-size: var(--font-size-sm);
}
.rich p:last-child {
  margin-bottom: 0;
}
.rich pre {
  white-space: pre-wrap;
}
.rich blockquote {
  border-left: 3px solid var(--accent);
  margin-left: 0;
  padding-left: var(--space-10);
}
.img-wrap {
  margin: 0 -24px var(--space-9);
  overflow: hidden;
  background: var(--bg);
}
.img-wrap img,
.img-wrap video {
  width: 100%;
  max-height: 600px;
  object-fit: contain;
}
.img-wrap p,
.img-wrap button {
  margin: var(--space-8) var(--space-12);
}
.caption {
  font-size: var(--font-size-sm);
  color: var(--muted);
}
.placeholder {
  padding: 50px 0;
  text-align: center;
}
.mail-meta {
  font-family: ui-monospace, monospace;
  font-size: var(--font-size-xs);
  color: var(--muted);
}
.mail-full {
  white-space: pre-wrap;
}
.gap {
  display: grid;
  place-items: center;
  height: 44px;
}
.ins {
  padding: 0;
  width: 28px;
  min-height: 28px;
  border-radius: var(--radius-round);
  color: var(--muted);
}
.slot {
  border: 1px solid var(--accent);
  border-radius: var(--radius-3xl);
  padding: var(--space-12);
  background: var(--surface);
  margin: var(--space-10) 0;
}
.slot-pos {
  font-size: var(--font-size-xs);
  color: var(--muted);
}
.seg,
.tools {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin: var(--space-8) 0;
}
.seg button[aria-pressed=true],
.tabs button[aria-pressed=true] {
  color: var(--accent);
  background: var(--tint);
  border-color: var(--accent);
}
.editor {
  border: 1px solid var(--border);
  min-height: 150px;
  padding: var(--space-9);
  border-radius: var(--radius-md);
}
.solid {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent);
}
.draft {
  border-style: dashed;
  margin: var(--space-11) 0;
}
.draft h3 {
  color: var(--accent);
}
.reply-ref {
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-8);
}
.menu {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 9;
  width: 190px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
}
.menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
}
.files-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-3xl);
  padding: var(--space-10);
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-heading h2 {
  margin: 0;
}
.tabs {
  display: flex;
  gap: var(--space-1);
}
.tabs button {
  padding: 5px var(--space-5);
  font-size: var(--font-size-sm);
  border-color: transparent;
  flex: 1;
}
.file-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin: var(--space-8) 0;
}
.file-actions button {
  font-size: var(--font-size-xs);
}
.file-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 28px;
  gap: 0 var(--space-6);
  min-height: var(--control-height);
  padding: var(--space-4) var(--space-1);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.file-row svg {
  grid-row: 1/3;
  align-self: center;
}
.file-name {
  font-size: var(--font-size-sm);
  overflow-wrap: anywhere;
}
.file-row small {
  font-size: var(--font-size-2xs);
  grid-column: 2;
  color: var(--muted);
}
.row-menu {
  grid-column: 3;
  grid-row: 1/3;
  padding: 0;
  border: 0;
  align-self: center;
}
.file-row.selected,
.drop-target {
  background: var(--tint);
  outline: 1px solid var(--accent);
}
.file-row input {
  grid-column: 2;
  grid-row: 1;
  font-size: var(--font-size-sm);
}
.empty,
.drop-hint {
  font-size: var(--font-size-sm);
  color: var(--muted);
  text-align: center;
  padding: var(--space-13) var(--space-3);
}
.drop-hint {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-11) var(--space-4);
}
.drop-active {
  outline: 2px solid var(--accent);
}
#breadcrumbs {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  min-width: 0;
  position: relative;
}
#breadcrumbs > button {
  min-width: 0;
  max-width: 34%;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  font-size: var(--font-size-xs);
  border: 0;
  padding: var(--space-3);
}
#breadcrumbs > button + button:before {
  content: "/ ";
  color: var(--muted);
}
#breadcrumbs details button {
  display: block;
  background: var(--surface);
  max-width: 220px;
}
#breadcrumbs details[open] {
  position: absolute;
  top: 0;
  left: 60px;
  z-index: 2;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: var(--space-6);
}
.link-row {
  font-size: var(--font-size-sm);
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border);
}
.link-row button {
  font-size: var(--font-size-xs);
  display: block;
  margin-top: var(--space-4);
}
#uploadRows {
  list-style: none;
  padding: 0;
  max-height: 260px;
  overflow: auto;
}
#uploadRows li {
  font-size: var(--font-size-xs);
  margin: var(--space-8) 0;
  overflow-wrap: anywhere;
}
.upload-label {
  display: block;
}
.upload-retry {
  font-size: var(--font-size-xs);
  margin-top: var(--space-2);
}
.version-badge {
  font-weight: 600;
}
progress {
  width: 100%;
  height: 5px;
  accent-color: var(--accent);
}
#uploadSummary,
#fileError {
  font-size: var(--font-size-sm);
  overflow-wrap: anywhere;
}
.gate {
  max-width: 460px;
  margin: 9vh auto;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-3xl);
}
.slot-acts {
  display: flex;
  justify-content: flex-end;
}
.err {
  color: var(--text);
  font-size: var(--font-size-sm);
  margin-top: var(--space-8);
}
.drawer-close {
  display: none;
}
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: none;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-12);
  max-width: calc(100vw - 24px);
  width: max-content;
  font-size: var(--font-size-sm);
}
.toast.on {
  display: flex;
  gap: var(--space-8);
  align-items: center;
}
.toast button {
  color: var(--accent);
  white-space: nowrap;
}
dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-3xl);
  width: min(800px, calc(100vw - 24px));
  max-height: 85dvh;
  padding: var(--space-13);
}
dialog::backdrop {
  background: var(--scrim);
}
.dlg-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-8);
  align-items: center;
  margin-bottom: var(--space-12);
}
.dlg-head h2 {
  margin: 0;
}
.dlg-body {
  display: flex;
  gap: var(--space-13);
}
.vlist {
  padding: 0;
  list-style: none;
  min-width: 130px;
}
.vlist button {
  margin-bottom: var(--space-6);
}
.vview {
  min-width: 0;
  flex: 1;
}
.ro {
  color: var(--muted);
  font-size: var(--font-size-sm);
}
#fileDialogBody > button {
  margin: var(--space-4);
}
#fileDialogBody {
  overflow-wrap: anywhere;
}
.deleted-row {
  display: flex;
  gap: var(--space-7);
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border);
}
.deleted-row span {
  flex: 1;
}
.flash {
  outline: 2px solid var(--accent);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
#scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  border: 0;
  border-radius: 0;
  z-index: 30;
  width: 100%;
  height: 100%;
}
.drawer-open {
  overflow: hidden;
}
@media (max-width: 1023px) {
  .workspace {
    grid-template-columns: 56px minmax(0, 1fr);
    padding: var(--space-12) var(--space-10);
    gap: var(--space-10);
  }
  .left-panel:not(.is-open) {
    padding: var(--space-7) var(--space-3);
  }
  .left-panel:not(.is-open) > h2,
  .left-panel:not(.is-open) .panel-content,
  .left-panel:not(.is-open) .who,
  .left-panel:not(.is-open) #logoutBtn,
  .left-panel:not(.is-open) .theme-label,
  .left-panel:not(.is-open) nav span {
    display: none;
  }
  .left-panel:not(.is-open) nav button {
    text-align: center;
    font-size: var(--font-size-3xl);
  }
  .left-panel:not(.is-open) .panel-footer {
    border: 0;
  }
  .left-panel.is-open {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(320px, 90vw);
    max-height: 100dvh;
    background: var(--surface);
    z-index: 40;
    padding: var(--space-13);
    overflow: auto;
  }
  .left-panel.is-open .drawer-close {
    display: block;
    margin-left: auto;
    margin-bottom: var(--space-12);
  }
  #navOpen {
    display: block;
  }
}
@media (max-width: 1023px) {
  .workspace {
    grid-template-columns: 56px minmax(0, 1fr);
  }
  .files-panel {
    display: none;
  }
  .files-panel.is-open {
    display: flex;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(392px, 100vw);
    max-height: 100dvh;
    border-radius: 0;
    z-index: 40;
    overflow: auto;
  }
  .files-panel.is-open .drawer-close {
    display: block;
    margin-left: auto;
  }
  #filesOpen {
    display: block;
  }
  #barMeta {
    display: none;
  }
}
@media (max-width: 640px) {
  .bar {
    padding: 0 var(--space-8);
    gap: var(--sp-2);
    height: 56px;
  }
  .bar-title {
    font-size: var(--font-size-base);
  }
  .bar-title span {
    display: none;
  }
  .workspace {
    display: block;
    padding: var(--sp-3);
  }
  .left-panel {
    display: none;
  }
  .left-panel.is-open {
    display: block;
  }
  .head {
    padding: var(--space-3) 0 var(--space-10);
  }
  .head h1 {
    font-size: var(--font-size-5xl);
    line-height: 32px;
  }
  .eyebrow #threadId {
    display: none;
  }
  .card {
    padding: var(--space-10);
  }
  .img-wrap {
    margin-left: -16px;
    margin-right: -16px;
  }
  .c-head {
    gap: var(--space-6);
    flex-wrap: wrap;
  }
  .c-who small {
    font-size: var(--font-size-2xs);
  }
  .card .type {
    font-size: var(--font-size-2xs);
  }
  .avatar {
    width: 28px;
    height: 28px;
  }
  .slot {
    padding: var(--space-10);
  }
  .seg {
    gap: var(--sp-2);
  }
  .seg button {
    font-size: var(--font-size-sm);
    padding: var(--space-4) var(--space-6);
  }
  button {
    min-height: var(--control-height-touch);
  }
  .ins {
    min-height: 32px;
    width: 32px;
  }
  .gate {
    margin: var(--space-13) var(--space-8);
    padding: var(--space-13);
  }
  .dlg-body {
    display: block;
  }
  .vlist {
    display: flex;
    gap: var(--space-6);
    overflow: auto;
  }
  .vlist button {
    white-space: nowrap;
  }
  .toast {
    padding: var(--space-7) var(--space-8);
  }
  dialog {
    padding: var(--space-10);
  }
  .composer {
    font-size: var(--font-size-md);
  }
  .c-foot button {
    flex: 1;
  }
  .files-panel.is-open {
    padding: var(--space-10);
  }
  .bar button {
    font-size: var(--font-size-xs);
    flex-shrink: 0;
  }
}
@media (max-width: 320px) {
  .card {
    padding: var(--sp-3);
  }
  .card h3 {
    font-size: var(--font-size-xl);
  }
  .img-wrap {
    margin-left: -12px;
    margin-right: -12px;
  }
  .c-head .type {
    margin-left: auto;
  }
  .c-who {
    min-width: 130px;
  }
  .bar-title {
    font-size: var(--font-size-base);
  }
  .bar button {
    padding: var(--space-4);
  }
  .gate {
    padding: var(--space-12);
  }
  .workspace {
    padding: var(--sp-2);
  }
}
@media (pointer: coarse) {
  button {
    min-height: var(--control-height-touch);
  }
  .file-row {
    min-height: var(--control-height-touch);
  }
  .file-row .row-menu {
    min-width: 44px;
  }
  .file-row {
    grid-template-columns: 20px minmax(0, 1fr) 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
.image-card > .c-body:first-child > .img-wrap {
  margin-top: -24px;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.image-card > .c-head {
  margin-top: var(--space-10);
  margin-bottom: 0;
}
@media (max-width: 640px) {
  .image-card > .c-body:first-child > .img-wrap {
    margin-top: -16px;
  }
}
@media (max-width: 320px) {
  .image-card > .c-body:first-child > .img-wrap {
    margin-top: -12px;
  }
}
/* Compact desktop rows keep names and metadata on separate 18px lines. */
.file-row { padding: 0 var(--space-1); grid-template-rows: 18px 18px; }
.file-name, .file-row small { line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row input { grid-row: 1 / 3; height: var(--control-height); padding: var(--space-3); }
.file-row:has(input) small { visibility: hidden; }
@media (pointer: coarse) {
  .file-row { grid-template-rows: 22px 22px; }
  .file-name, .file-row small { line-height: 22px; }
  .file-row input { height: var(--control-height-touch); }
}
/* Project and consent additions use the same single-accent palette. */
#projects { display:grid; grid-template-columns:minmax(0,1fr); gap:var(--space-1); }
#docTypes [aria-pressed=true] { color:var(--accent); background:var(--tint); border-color:var(--border); }
#projectHeader { display:flex; flex-wrap:wrap; gap:var(--space-6); margin:var(--space-8) 0; align-items:center; }
.outline-chip { display:inline-block; border:1px solid var(--accent); color:var(--accent); border-radius:var(--radius-sm); padding:var(--space-1) var(--space-5); font-size:var(--font-size-xs); background:transparent; }
.watermark-hint { display:block; color:var(--muted); font-size:var(--font-size-xs); }
.file-row .personal-data, .file-row .watermark-hint { grid-column:2 / -1; }
.privacy-footer { padding:var(--space-10); text-align:center; font-size:var(--font-size-xs); color:var(--muted); overflow-wrap:anywhere; }
#consentDialog { width:100vw; max-width:none; height:100dvh; max-height:none; margin:0; border:0; border-radius:0; background:var(--bg); color:var(--text); padding:var(--space-13); }
.consent-content { max-width:640px; margin:8vh auto; }
#noticeText { white-space:pre-wrap; }
.consent-check { display:flex; gap:var(--space-8); align-items:flex-start; margin:var(--space-13) 0; }
.consent-check input { width:24px; height:24px; flex-shrink:0; }
#noticeAccept { min-height:var(--control-height-touch); }
/* C2: consent buttons side by side, same width (disabled 동의하고 계속 stays a visible button). */
.consent-actions { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:var(--space-6); }
.consent-actions button { min-height:var(--control-height-touch); overflow-wrap:anywhere; }
.skeleton { display:block; min-height:1.4em; border-radius:var(--radius-sm); background:var(--border); }
#noticeText.skeleton { min-height:8em; }
.btn-block { width:100%; }
/* C2: files served without a watermark ('원본' tag, confirm dialog). */
.original-tag { border:1px solid currentColor; border-radius:var(--radius-2xs); padding:0 var(--space-2); color:var(--muted); background:transparent; }
.original-confirm-name { display:flex; flex-wrap:wrap; gap:var(--space-3); align-items:center; overflow-wrap:anywhere; min-width:0; }
.original-confirm-file { min-width:0; overflow-wrap:anywhere; }
#consentExpiry { display:block; font-size:var(--font-size-xs); }
@media (min-width:641px) and (max-width:1023px) { .left-panel:not(.is-open) #consentExpiry { display:none; } }

/* Company document checklist: compact desktop rows, comfortable touch targets. */
#checklistPanel { margin: 0; min-width: 0; }
#checklistPanel summary { cursor:pointer; font-weight:600; }
.checklist-counts { display:block; font-size:var(--font-size-xs); font-weight:400; margin:var(--space-4) 0; }
.checklist-table { margin:var(--space-6) 0; }
.checklist-row { display:grid; grid-template-columns:minmax(90px,2fr) minmax(80px,1fr) minmax(9.5em,1fr) minmax(60px,1fr) 44px 72px; gap:var(--space-4); align-items:center; height:var(--control-height); border-bottom:1px solid var(--line); font-size:var(--font-size-xs); }
.checklist-row > * { min-width:0; }
.checklist-name { display:flex; align-items:center; gap:var(--space-3); overflow:hidden; }
.checklist-name > span,.checklist-action,.checklist-owner,.checklist-expiry { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
/* C2d-C: the date · D-N cell is never cut (guide: dates and D-N are not ellipsized). Its desktop track starts at 9.5em
   (fits 'YYYY-MM-DD · D-30' at the row's 12px), the card form (≤1023) gives it a max-content column. */
.checklist-expiry { min-width:max-content; }
.checklist-actions { display:flex; gap:var(--sp-2); }
#checklistPanel button { font-size:var(--font-size-2xs); padding:var(--space-2) var(--space-3); min-width:0; }
.checklist-badge { justify-self:start; white-space:nowrap; border:1px solid currentColor; border-radius:var(--radius-2xs); padding:1px var(--space-3); background:transparent; font-size:var(--font-size-2xs); }
.checklist-badge.expired,.checklist-badge.soon { color:var(--checklist-badge-warn); }
.checklist-badge.valid { border:0; color:var(--checklist-badge-valid); }
.checklist-badge.renewing,.checklist-badge.check { color:var(--checklist-badge-pending); }
.checklist-editor { display:flex; flex-wrap:wrap; gap:var(--space-6); padding:var(--space-8) 0; }
.checklist-editor label { display:flex; flex-direction:column; min-width:0; flex:1 1 120px; font-size:var(--font-size-xs); }
.checklist-editor input,.checklist-editor select { width:100%; min-width:0; }
@media (pointer:coarse) { .checklist-row { height:var(--control-height-touch); } #checklistPanel button { min-height:var(--control-height); } }
@media (max-width:640px) and (min-width:321px) {
  .checklist-row { grid-template-columns:minmax(45px,1.4fr) 75px 68px minmax(30px,1fr) 24px 52px; gap:var(--space-1); font-size:var(--font-size-3xs); }
  .checklist-badge { font-size:var(--font-size-4xs); padding:1px var(--space-1); } #checklistPanel button { font-size:var(--font-size-4xs); padding:var(--space-1); }
}
@media (max-width:320px) {
  .checklist-head { display:none; }
  .checklist-row { height:auto; min-height:76px; padding:var(--space-6) 0; grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"name badge" "expiry expiry" "action owner" "buttons buttons"; }
  .checklist-name { grid-area:name; } .checklist-badge { grid-area:badge; }
  .checklist-expiry { grid-area:expiry; } .checklist-action { grid-area:action; } .checklist-owner { grid-area:owner; }
  .checklist-actions { grid-area:buttons; justify-content:flex-end; }
}
@media (max-width:320px) {
  .checklist-row { grid-template-columns:max-content minmax(0,1fr) auto; grid-template-areas:"name name badge" "expiry action owner" "buttons buttons buttons"; }
}
/* Give the company checklist enough room in the existing folder pane. */
@media (min-width:1200px) {
  .workspace:has(#checklistPanel:not([hidden])) { grid-template-columns:180px minmax(0,1fr) minmax(540px,1.4fr); }
}
@media (min-width:1024px) and (max-width:1199px) {
  .workspace:has(#checklistPanel:not([hidden])) { grid-template-columns:176px minmax(0,1fr) 540px; }
}
/* Member admin dialog and invite set-password view (C1 S2): existing tokens only. */
#memberAdd { margin-top:var(--space-4); }
#memberDialog { width:min(560px, calc(100vw - 24px)); }
.member-status { font-size:var(--font-size-sm); margin:var(--space-8) 0; }
.member-list { list-style:none; padding:0; margin:0; }
.member-row { display:grid; gap:var(--space-3); padding:var(--space-8) 0; border-top:1px solid var(--border); overflow-wrap:anywhere; }
.member-head { display:flex; flex-wrap:wrap; gap:var(--space-6); align-items:center; }
.member-email, .member-meta { color:var(--muted); font-size:var(--font-size-xs); }
.member-acts { display:flex; flex-wrap:wrap; gap:var(--space-6); align-items:center; margin-top:var(--space-3); }
.member-confirm { flex-basis:100%; font-size:var(--font-size-sm); }
#setPasswordLogin { margin-top:var(--space-8); }
@media (max-width:640px), (pointer:coarse) {
  #memberForm input, #setPasswordForm input { min-height:var(--control-height-touch); }
}

/* C1 S3 file expiry and version history (tokens only; outline labels like the checklist badges). */
.expiry-labels { display:flex; flex-wrap:wrap; gap:var(--space-2); min-width:0; max-width:100%; }
.file-row .expiry-labels { grid-column:2 / -1; }
.expiry-chip { display:inline-block; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; border:1px solid currentColor; border-radius:var(--radius-2xs); padding:1px var(--space-3); background:transparent; font-size:var(--font-size-2xs); }
.expiry-chip.expiry-soon { color:var(--expiry-warn); }
.expiry-chip.expiry-renewing { color:var(--expiry-renewing); }
.expiry-chip.expiry-expired { color:var(--expiry-on-warn); background:var(--expiry-warn); border-color:var(--expiry-warn); font-weight:700; }
.file-row.expired { background:var(--expiry-warn-tint); }
.file-row.expired.selected { background:var(--tint); }
.expiry-warning { margin:var(--space-3) 0; padding:var(--space-3) var(--space-5); border:1px solid var(--expiry-warn); border-radius:var(--radius-sm); background:var(--expiry-warn-tint); color:var(--expiry-warn); font-weight:700; font-size:var(--font-size-sm); overflow-wrap:anywhere; }
.expiry-confirm-name { overflow-wrap:anywhere; }
.expiry-actions, .version-actions { display:flex; flex-wrap:wrap; gap:var(--sp-2); align-items:center; }
.expiry-editor { display:grid; gap:var(--space-4); margin:var(--space-6) 0; padding:var(--space-5); border:1px solid var(--border); border-radius:var(--radius-sm); min-width:0; }
.expiry-now { display:flex; flex-wrap:wrap; gap:var(--space-3); align-items:center; margin:0; }
.expiry-toggle { display:flex; gap:var(--space-3); align-items:center; }
.file-versions { margin:var(--space-6) 0; min-width:0; }
.file-versions h3 { font-size:var(--font-size-sm); margin:0 0 var(--space-3); }
.version-list { list-style:none; margin:0; padding:0; }
.version-row { display:flex; flex-wrap:wrap; justify-content:space-between; gap:var(--space-3); padding:var(--space-4) 0; border-bottom:1px solid var(--border); }
.version-meta { min-width:0; overflow-wrap:anywhere; }
.version-sha { font-size:var(--font-size-2xs); color:var(--muted); }
.version-note { color:var(--muted); }

/* C1 S3 요청 서류 목록 (per project): compact rows, tokens only, no new colors. Stacked at <=390px. */
#requestsPanel { margin: 0; min-width: 0; }
#requestsPanel h3 { margin: 0 0 var(--space-4); font-size: var(--font-size-xs); }
.request-row { display: grid; grid-template-columns: minmax(80px,2fr) auto minmax(70px,1fr) minmax(80px,2fr) auto; gap: var(--space-4); align-items: center; min-height: var(--control-height); border-bottom: 1px solid var(--line); font-size: var(--font-size-xs); }
.request-row > * { min-width: 0; }
.request-row.drop-target { outline: 1px dashed currentColor; outline-offset: -1px; }
.request-name, .request-due { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.request-status { justify-self: start; white-space: nowrap; border: 1px solid currentColor; border-radius: var(--radius-2xs); padding: 1px var(--space-3); background: transparent; font-size: var(--font-size-2xs); color: var(--checklist-badge-pending); }
.request-hint { font-size: var(--font-size-3xs); color: var(--checklist-badge-valid); }
.request-file { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.request-file-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.request-broken { font-size: var(--font-size-2xs); color: var(--checklist-badge-warn); }
.request-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: flex-end; }
#requestsPanel button { font-size: var(--font-size-2xs); padding: var(--space-2) var(--space-3); min-width: 0; min-height: var(--control-height); }
.request-add { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: var(--space-6) 0; }
.request-add input { flex: 1 1 120px; min-width: 0; min-height: var(--control-height); }
.request-message { font-size: var(--font-size-2xs); margin: 0; }
@media (pointer: coarse) {
  .request-row { min-height: var(--control-height-touch); }
  #requestsPanel button, .request-add input { min-height: var(--control-height-touch); }
}
@media (max-width: 390px) {
  .request-row { grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "name status" "due due" "file file" "actions actions"; padding: var(--space-4) 0; }
  .request-name { grid-area: name; } .request-status { grid-area: status; } .request-due { grid-area: due; }
  .request-file { grid-area: file; } .request-actions { grid-area: actions; }
}
/* C1 P10 운영 원칙·결정 기록: one compact card at the bottom of company-info folders (tokens only, no polish). */
.decisions-panel { margin: 0; padding: var(--space-8); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); min-width: 0; }
.decisions-panel h3 { margin: 0 0 var(--space-6); font-size: var(--font-size-sm); }
.decision-list { list-style: none; margin: 0; padding: 0; }
.decision { border-top: 1px solid var(--line); padding: var(--space-3) 0; min-width: 0; }
.decision:first-child { border-top: 0; }
.decisions-panel button { font-size: var(--font-size-2xs); padding: var(--space-2) var(--space-3); min-width: 0; }
.decisions-panel .decision-toggle { display: flex; align-items: baseline; gap: var(--space-4); width: 100%; min-width: 0; text-align: left; background: transparent; border: 0; padding: var(--space-3) 0; font-size: var(--font-size-xs); color: inherit; }
.decision-date { flex: none; border: 1px solid currentColor; border-radius: var(--radius-2xs); padding: 0 var(--space-3); font-size: var(--font-size-2xs); color: var(--muted); }
.decision-conclusion { min-width: 0; overflow-wrap: anywhere; }
.decision-reasons { margin: var(--space-3) 0; padding-left: var(--space-12); font-size: var(--font-size-xs); overflow-wrap: anywhere; }
.decision-actions, .decision-editor { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.decision-editor { padding: var(--space-6) 0; }
.decision-editor label { display: flex; flex-direction: column; flex: 1 1 100%; min-width: 0; font-size: var(--font-size-xs); }
.decision-editor input { width: 100%; min-width: 0; }
@media (pointer:coarse) { .decisions-panel button { min-height: var(--control-height); } }
/* 기록 (activity log): one list, a 4-column grid on desktop, two-line cards at <=480px. */
.num { font-variant-numeric: tabular-nums; }
.audit-tools { display: flex; flex-wrap: wrap; gap: var(--space-6); align-items: center; margin-bottom: var(--space-8); }
.audit-groups { display: flex; flex-wrap: wrap; gap: var(--space-3); min-width: 0; }
.audit-groups button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); outline: 1px solid var(--accent); }
.audit-actor { min-width: 0; max-width: 100%; }
.audit-actor select { max-width: 100%; min-height: var(--control-height); }
.audit-head, .audit-row { display: grid; grid-template-columns: 6.5em minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-6); align-items: center; }
.audit-head { font-size: var(--font-size-sm); color: var(--muted); padding: 0 var(--space-4) var(--space-3); border-bottom: 1px solid var(--border); }
.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-item { border-bottom: 1px solid var(--border); min-width: 0; }
.audit-row { width: 100%; min-height: var(--control-height); text-align: left; border: 0; border-radius: 0; padding: var(--space-3) var(--space-4); font-size: var(--font-size-sm); }
.audit-row > span { min-width: 0; overflow-wrap: anywhere; }
.audit-time { color: var(--muted); }
.audit-detail { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2) var(--space-6); margin: 0; padding: var(--space-3) var(--space-4) var(--space-6); font-size: var(--font-size-xs); color: var(--muted); }
.audit-detail dd { margin: 0; overflow-wrap: anywhere; }
.audit-empty { color: var(--muted); font-size: var(--font-size-sm); }
.audit-more { margin-top: var(--space-8); }
@media (pointer:coarse) { .audit-row { min-height: var(--control-height-touch); } }
@media (max-width:480px) {
  .audit-head { display: none; }
  .audit-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "who act" "time file"; align-items: start; gap: 0 var(--space-6); padding: var(--space-4); }
  .audit-who { grid-area: who; font-weight: 600; }
  .audit-act { grid-area: act; }
  .audit-time { grid-area: time; }
  .audit-file { grid-area: file; color: var(--muted); }
}

/* C2 F3 layout (behaviour/markup only; visual polish is a later design pass). */
/* Sidebar project rows: borderless; the open row has a 2px accent bar + accent text; long names ellipsis. */
#projects .project-row { position:relative; display:flex; align-items:baseline; min-width:0; width:100%; text-align:left; border:0; border-radius:0; background:transparent; color:var(--text); padding:var(--space-4) var(--space-6) var(--space-4) var(--space-8); }
#projects .project-row[aria-current=true] { color:var(--accent); }
#projects .project-row[aria-current=true]::before { content:""; position:absolute; left:0; top:var(--space-3); bottom:var(--space-3); width:2px; background:var(--accent); }
.project-name { flex:0 1 auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.project-meta { flex:none; color:var(--muted); font-size:var(--font-size-xs); white-space:nowrap; }
/* One filter row: 전체 / 사업계획서 / 신청서 / 기타 + the expiry chip at its end. */
#docTypes { flex-wrap:nowrap; gap:var(--sp-1); min-width:0; margin:0; overflow-x:auto; overflow-y:hidden; scrollbar-width:thin; }
#docTypes button { flex:0 0 auto; white-space:nowrap; font-size:var(--font-size-xs); padding:0 var(--space-4); border-color:var(--border); }
#docTypes .expiry-filter { margin-left:auto; }
/* Expired file names: secondary colour, never struck through (the '만료' badge stays). */
.file-name.is-expired { color:var(--muted); text-decoration:none; }
/* Whole-panel drop overlay with the centred '여기에 놓기' label; drops still reach the rows below. */
.files-panel { position:relative; }
.drop-overlay { display:none; position:absolute; inset:0; z-index:5; pointer-events:none; background:var(--drop-overlay); outline:2px dashed var(--accent); outline-offset:-6px; border-radius:inherit; place-items:center; }
.drop-overlay span { color:var(--accent); font-weight:600; }
.files-panel.drop-files .drop-overlay { display:grid; }
@media (min-width:1024px) { .files-panel { position:relative; } }
/* Request rows: dashed accent outline only on the row under the drag; '이 서류로 올리기' on hover/focus (always on touch). */
.request-row.drop-target { outline:2px dashed var(--accent); outline-offset:-2px; background:var(--tint); }
.request-upload { opacity:0; }
.request-row:hover .request-upload, .request-row:focus-within .request-upload, .request-row.drop-target .request-upload { opacity:1; }
@media (hover:none) { .request-upload { opacity:1; } }
/* Upload tray (placement and look are refined later). */
.upload-tray { margin:0; padding:var(--space-8); border:1px solid var(--border); border-radius:var(--radius-3xl); background:var(--surface); min-width:0; }
.upload-head { display:flex; align-items:center; justify-content:space-between; gap:var(--space-6); min-width:0; }
.upload-head h3 { margin:0; min-width:0; font-size:var(--font-size-sm); overflow-wrap:anywhere; }
.upload-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:var(--space-1) var(--space-4); }
.upload-name { grid-column:1 / -1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.upload-state { min-width:0; overflow-wrap:anywhere; }
.upload-row progress { grid-column:1 / -1; }
.upload-row.is-done .upload-state { color:var(--accent); }
.upload-row.is-failed { outline:1px solid var(--expiry-warn); outline-offset:var(--space-1); }
.upload-row.is-failed .upload-state { color:var(--expiry-warn); }
.upload-pct { color:var(--muted); }
.upload-cancel, .upload-retry { margin:0; font-size:var(--font-size-xs); }
/* Drawer and menu buttons are 44x44 touch targets on phones. */
@media (max-width:640px) {
  #navOpen, #filesOpen, .drawer-close { min-width:var(--control-height-touch); min-height:var(--control-height-touch); }
}
/* ≤480px: tables become two-line cards (line 1 name + status badge, line 2 date + meta), no horizontal scroll.
   The checklist also uses its card form in the ≤960px drawer, where its six columns do not fit. */
@media (max-width:1023px) {
  .checklist-head { display:none; }
  .checklist-row { height:auto; min-height:76px; padding:var(--space-6) 0; gap:var(--space-1) var(--space-4); font-size:var(--font-size-xs); grid-template-columns:max-content minmax(0,1fr) auto; grid-template-areas:"name name badge" "expiry action owner" "buttons buttons buttons"; }
  .checklist-name { grid-area:name; } .checklist-badge { grid-area:badge; font-size:var(--font-size-2xs); padding:1px var(--space-3); }
  .checklist-expiry { grid-area:expiry; } .checklist-action { grid-area:action; } .checklist-owner { grid-area:owner; }
  .checklist-actions { grid-area:buttons; justify-content:flex-end; }
  #checklistPanel button { font-size:var(--font-size-2xs); padding:var(--space-2) var(--space-3); }
}
/* Request rows are always the two-line card (+ an action line): the files panel is 300-360px wide at every
   breakpoint, too narrow for five columns. */
.request-row { grid-template-columns:max-content minmax(0,1fr) auto; grid-template-areas:"name name status" "due file file" "actions actions actions"; padding:var(--space-4) 0; }
.request-name { grid-area:name; } .request-status { grid-area:status; } .request-due { grid-area:due; }
.request-file { grid-area:file; justify-content:flex-end; } .request-actions { grid-area:actions; }
/* File rows with expiry labels: the badge joins the name on line 1, size/uploader/date stay on line 2. */
.file-row:has(> .expiry-labels) { grid-template-columns:20px minmax(0,1fr) auto 28px; }
.file-row:has(> .expiry-labels) > .expiry-labels { grid-column:3; grid-row:1; align-self:center; flex-wrap:nowrap; }
.file-row:has(> .expiry-labels) > small { grid-column:2 / 4; }
.file-row:has(> .expiry-labels) > .row-menu { grid-column:4; }
@media (pointer:coarse) { .file-row:has(> .expiry-labels) { grid-template-columns:20px minmax(0,1fr) auto 44px; } }

/* C2b: copy button, 응답 = comment list + inline composer. Touch targets 44px at every width. */
.card > .c-foot button { min-height:var(--control-height-touch); }
.copy-btn, .reply-btn { min-width:var(--control-height-touch); min-height:var(--control-height-touch); color:var(--muted); border:1px solid var(--border); background:transparent; }
.copy-btn:hover, .reply-btn:hover { color:var(--text); }
.clip-buffer { position:fixed; top:0; left:-10000px; width:1px; height:1px; opacity:0; pointer-events:none; }
.comments { margin:calc(-1 * var(--space-4)) 0 0 var(--space-12); padding:var(--space-3) 0 var(--space-3) var(--space-10); border-left:2px solid var(--line); color:var(--muted); font-size:var(--font-size-md); min-width:0; overflow-wrap:anywhere; }
.comment { padding:var(--space-2) 0 var(--space-4); }
.comment-meta { position:relative; display:flex; align-items:center; gap:var(--space-4); min-width:0; font-size:var(--font-size-xs); }
.comment-who { flex:1; min-width:0; overflow-wrap:anywhere; }
.comment-body { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.6; }
.kebab.comment-kebab { min-width:var(--control-height-touch); min-height:var(--control-height-touch); padding:0; font-size:var(--font-size-xl); color:var(--muted); }
.more-btn { min-height:var(--control-height-touch); min-width:var(--control-height-touch); border:0; padding:0 var(--space-4); color:var(--accent); font-size:var(--font-size-sm); }
.reply-composer { padding:var(--space-4) 0; min-width:0; }
.reply-input { display:block; width:100%; min-height:88px; resize:vertical; padding:var(--space-6) var(--space-7); border:1px solid var(--border); border-radius:var(--radius-md); background:var(--surface); color:var(--text); font-size:var(--font-size-md); line-height:1.6; }
.reply-input:focus-visible { outline:var(--focus-width) solid var(--accent); outline-offset:var(--focus-offset); }
.reply-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:var(--space-6); margin-top:var(--space-6); }
.reply-actions button { min-width:var(--control-height-touch); min-height:var(--control-height-touch); font-size:var(--font-size-sm); }
@media (max-width:640px) { .comments { margin-left:var(--space-4); padding-left:var(--space-8); } }

/* C2c files panel (300px column): one flex column whose sections are spaced only by the panel gap (--sp-3). */
#filesPanel > * { flex:0 0 auto; min-width:0; margin-block:0; }
#fileError:empty { display:none; }
/* 파일 선택 / 폴더 선택 and 새 폴더 / 삭제 기록: two equal columns, one line, one control height. */
#filesPanel > .file-actions { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:var(--sp-2); }
#filesPanel > .file-actions button { height:var(--control-height); min-width:0; padding:0 var(--space-4); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
@media (pointer:coarse) { #filesPanel > .file-actions button { height:var(--control-height-touch); } }
/* Folder rows: name only, vertically centred across both row tracks; the lock sits in the menu column, inside the row. */
.file-row[data-kind=folder] > .file-name { grid-row:1 / -1; align-self:center; }
.folder-lock { grid-column:3; grid-row:1 / -1; align-self:center; justify-self:center; line-height:1; font-size:var(--font-size-sm); }
/* C2c-B §2: one action row for every dialog/form with an action: last block, right-aligned,
   [취소][primary] in DOM order (tab order = visual order), always one line. */
.actions-row { display:flex; justify-content:flex-end; align-items:center; gap:var(--sp-2); flex-wrap:nowrap; flex:1 1 100%; min-width:0; margin-top:var(--sp-3); }
.actions-row > button { flex:0 1 auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.edit-hint { display:block; margin-top:var(--sp-3); color:var(--muted); font-size:var(--font-size-xs); }
/* Informational dialogs (history, log, preview, file detail, 삭제 기록): the single 닫기 sits top right. */
#preview > #previewClose { display:block; margin-left:auto; }
/* C2c-B §3: boxes never touch — sibling boxes (cards, buttons, chips, panels) are spaced by a container gap of at
   least --sp-2; joined groups opt out with [data-gap-ok] (see C2-DECISIONS §10). */
.checklist-tools { display:flex; flex-wrap:wrap; gap:var(--sp-2); }
/* C2c-B §1: buttons, tabs, chips/badges, form labels, meta lines and sidebar rows stay on one line; a long one ends
   in an ellipsis and app.js puts its full text in a title. The consent dialog is left exactly as it was. */
:is(button, [role=tab], summary, th, label, .outline-chip, .expiry-chip, .type, .version-badge, .original-tag, .checklist-badge, .request-status):not(#consentDialog *) { white-space:nowrap; }
.c-who b, .c-who small, .mail-meta, .comment-who, .version-meta, .audit-row > span, .deleted-row > span, .decision-conclusion, #projectHeader > .outline-chip { display:block; min-width:0; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.version-meta { flex:1 1 auto; }
.dlg-head > button, .upload-head > button { flex:none; }
.dlg-head h2 { min-width:0; overflow-wrap:anywhere; }
/* ≤1023px (rail): the open left drawer is position:fixed, so pin main and the files column to their tracks (otherwise
   auto-placement drops main into the 56px rail column while the drawer is open). */
@media (max-width:1023px) { .workspace > .center { grid-column:2; grid-row:1; } }
@media (min-width:1024px) { .workspace > .right-col { grid-column:3; grid-row:1; } }
/* 요청 서류 추가 (always-visible inline add row, nothing to cancel): its single primary sits at the right end. */
.request-add > button { margin-left:auto; }

/* ==========================================================================
   C2d guide v3 visual pass (DESIGN-GUIDE.md v3). Tokens only; later rules here refine the ones above.
   ========================================================================== */
/* Type scale: screen title 32/700/40 (≤640 24/700/32), card title 22/700/28 (≤640 18/700/24), panel title
   16/700/24, body 15/400/24, meta 13/400/20. Numbers (dates, sizes, 판, counts) use tabular figures. */
.head h1 { font-size:var(--font-size-6xl); font-weight:700; line-height:40px; margin:0; min-width:0; overflow-wrap:anywhere; }
.card .c-body h3 { font-size:var(--font-size-3xl); font-weight:700; line-height:28px; }
.panel-heading h2, .side-panel h2 { font-size:var(--font-size-panel); font-weight:700; line-height:24px; margin:0; }
.c-body { font-size:var(--font-size-base); line-height:24px; }
.num, .c-time, .project-meta, .file-row small, .version-meta, .audit-time, .expiry-chip, .checklist-expiry, .request-due, .upload-pct, .decision-date, #barMeta { font-variant-numeric:tabular-nums; }
footer.privacy-footer { font-size:var(--font-size-sm); }

/* Interaction states (guide "조작 상태"). Buttons: hover surface + body-colour control border; pressed surface;
   primary keeps its colour (hover shadow, 2px inset line while pressed); toggles/filters: 1px accent outline. */
button { border-color:var(--control-border); border-radius:var(--radius-control); }
button:active:not(:disabled) { background:var(--pressed); }
.solid, .solid:hover:not(:disabled) { background:var(--accent); color:var(--on-accent); border-color:var(--accent); }
.solid:hover:not(:disabled) { box-shadow:var(--shadow-2); }
.solid:active:not(:disabled) { background:var(--accent); box-shadow:inset 0 0 0 2px var(--on-accent); }
.seg button[aria-pressed=true], .tabs button[aria-pressed=true], .audit-groups button[aria-pressed=true] { background:var(--pressed); }
input, select, textarea, .editor { border-color:var(--control-border); border-radius:var(--radius-control); }
:is(input, select, textarea):hover:not(:disabled):not([readonly]) { border-color:var(--text); }
:is(input, select, textarea):disabled { background:var(--page-tint); color:var(--muted); }
:is(input, textarea)[readonly] { background:var(--page-tint); }
input[type=checkbox], input[type=radio] { accent-color:var(--accent); }
a:hover { text-decoration:underline; }
a:active { background:var(--pressed); }
/* Focus ring everywhere: 2px accent, 2px offset (top bar: #A9BEFF, see .bar below). */
:is(button, a, input, select, textarea, summary, [tabindex], [contenteditable], [role=tab]):focus-visible { outline:var(--focus-width) solid var(--accent); outline-offset:var(--focus-offset); }
/* Underline tabs (role=tablist / role=tab, aria-selected); see tabs() in app.js for the keyboard model. */
[role=tablist] { display:flex; gap:var(--sp-4); min-width:0; max-width:100%; overflow-x:auto; overflow-y:hidden; border-bottom:1px solid var(--border); scrollbar-width:thin; }
[role=tab] { flex:none; min-height:var(--control-height); padding:0 var(--sp-1); border:0; border-radius:0; background:transparent; color:var(--text); font-weight:600; box-shadow:inset 0 -2px 0 transparent; }
[role=tab]:hover:not([aria-disabled=true]) { background:var(--hover); border-color:transparent; }
[role=tab]:active:not([aria-disabled=true]) { background:var(--pressed); }
[role=tab][aria-selected=true] { color:var(--accent); font-weight:700; box-shadow:inset 0 -2px 0 var(--accent); }
[role=tab][aria-disabled=true] { color:var(--muted); font-weight:400; cursor:default; }
@media (max-width:640px), (pointer:coarse) { [role=tab] { min-height:var(--control-height-touch); } }

/* Tag palette (0-5 = 실험·검토·데이터·산출물·회의·운영): .pal-N is the bg/fg pair (tags, initials, rail
   letters); .dot.pal-N uses the text colour alone (8px project/folder dots). */
.pal-0 { background:var(--tag-0-bg); color:var(--tag-0-fg); }
.dot.pal-0 { background:var(--tag-0-fg); }
.pal-1 { background:var(--tag-1-bg); color:var(--tag-1-fg); }
.dot.pal-1 { background:var(--tag-1-fg); }
.pal-2 { background:var(--tag-2-bg); color:var(--tag-2-fg); }
.dot.pal-2 { background:var(--tag-2-fg); }
.pal-3 { background:var(--tag-3-bg); color:var(--tag-3-fg); }
.dot.pal-3 { background:var(--tag-3-fg); }
.pal-4 { background:var(--tag-4-bg); color:var(--tag-4-fg); }
.dot.pal-4 { background:var(--tag-4-fg); }
.pal-5 { background:var(--tag-5-bg); color:var(--tag-5-fg); }
.dot.pal-5 { background:var(--tag-5-fg); }
/* Category tags (server categories only; never invented): filled 12/600/16, 4px 8px, 4px radius; max 2 + '+N'. */
.tags { display:flex; flex-wrap:wrap; gap:var(--sp-2); min-width:0; }
.tag { display:inline-flex; align-items:center; max-width:100%; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:var(--font-size-xs); font-weight:600; line-height:16px; padding:var(--sp-1) var(--sp-2); border:0; border-radius:var(--radius-badge); }
.tag-more { background:transparent; color:var(--muted); box-shadow:inset 0 0 0 1px var(--border); }
button.tag { min-height:0; }
button.tag:hover:not(:disabled) { text-decoration:underline; }
button.tag:active:not(:disabled), button.tag[aria-pressed=true] { box-shadow:inset 0 0 0 1px currentColor; }
button.tag:disabled { background:var(--surface); color:var(--muted); }
/* Card kind badge (.type): neutral 1px outline, the colour palette is reserved for categories. */
.type { background:transparent; color:var(--muted); border:1px solid currentColor; border-radius:var(--radius-badge); padding:0 var(--sp-2); font-weight:600; line-height:20px; flex:none; }

/* Avatars: circle, 1px background-colour ring (top bar: --bar-control); 24px one letter, 32/40px two letters 12/700,
   72px 24/700. Photos fill with object-fit: cover. */
.avatar { display:inline-grid; place-items:center; flex:none; overflow:hidden; border:1px solid var(--surface); border-radius:var(--radius-round); font-size:var(--font-size-xs); font-weight:700; line-height:1; }
.avatar.avatar-sm { width:var(--avatar-sm); height:var(--avatar-sm); }
.avatar.avatar-md { width:var(--avatar-md); height:var(--avatar-md); }
.avatar.avatar-lg { width:var(--avatar-lg); height:var(--avatar-lg); }
.avatar.avatar-xl { width:var(--avatar-xl); height:var(--avatar-xl); font-size:var(--font-size-5xl); }
.avatar > img { display:block; width:100%; height:100%; object-fit:cover; }
.bar .avatar { border-color:var(--bar-control); }

/* Top bar: dark in both themes. Logo = site name, centre search, theme + 40px account avatar on the right. */
.bar-title span, .bar #barMeta { color:var(--bar-muted); font-size:var(--font-size-sm); font-weight:400; }
.bar #barMeta { flex:none; white-space:nowrap; }
.bar button { color:var(--bar-fg); background:transparent; border-color:var(--bar-control); }
.bar button:hover:not(:disabled) { background:var(--bar-hover); border-color:var(--bar-fg); }
.bar button:active:not(:disabled), .bar button[aria-expanded=true] { background:var(--bar-pressed); }
.bar :is(button, input, a):focus-visible { outline-color:var(--bar-accent); }
.bar .bar-icon { border-color:transparent; font-size:var(--font-size-xl); }
.bar .bar-icon:hover:not(:disabled) { border-color:var(--bar-fg); }
.bar-icon { display:grid; place-items:center; flex:none; width:var(--control-height-touch); min-width:var(--control-height-touch); height:var(--control-height-touch); min-height:var(--control-height-touch); padding:0; font-size:var(--font-size-xl); line-height:1; }
#navOpen { display:none; }
.bar-search { display:flex; flex:1 1 auto; min-width:0; max-width:480px; margin:0 auto; }
.bar-search input { min-height:var(--control-height); padding:0 var(--sp-3); background:var(--bar-bg); color:var(--bar-fg); border:1px solid var(--bar-control); border-radius:var(--radius-control); }
.bar-search input::placeholder { color:var(--bar-muted); }
.bar-search input:hover { border-color:var(--bar-fg); }
#searchOpen { display:none; }
.bar.has-query #searchOpen { color:var(--bar-accent); border-color:var(--bar-accent); }
.account { position:relative; flex:none; }
.bar .account-btn { display:grid; place-items:center; width:var(--control-height-touch); height:var(--control-height-touch); min-height:var(--control-height-touch); padding:0; border:0; border-radius:var(--radius-round); }
.account-menu { position:absolute; right:0; top:calc(100% + var(--sp-1)); z-index:20; display:grid; width:240px; max-width:calc(100vw - 16px); padding:var(--sp-1); background:var(--surface); color:var(--text); border:1px solid var(--border); border-radius:var(--radius-control); box-shadow:var(--shadow-3); }
.account-who { display:grid; min-width:0; padding:var(--sp-2) var(--sp-3); }
.account-who b, .account-who small { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.account-who small:empty { display:none; }
.account-expiry { margin:0; padding:0 var(--sp-3) var(--sp-2); border-bottom:1px solid var(--border); color:var(--muted); font-size:var(--font-size-sm); white-space:nowrap; }
.bar .account-menu button { width:100%; min-height:var(--control-height); padding:0 var(--sp-3); text-align:left; font-size:var(--font-size-md); color:var(--text); background:transparent; border:0; border-radius:var(--radius-control); }
.bar .account-menu button:hover:not(:disabled) { background:var(--hover); }
.bar .account-menu button:active:not(:disabled) { background:var(--pressed); }
.bar .account-menu :focus-visible { outline-color:var(--accent); outline-offset:calc(-1 * var(--focus-width)); }
.bar:not([data-view=app]) .app-only { display:none; }
#passwordBack { margin-bottom:var(--sp-3); }

/* Page, floating cards, panels. Cards: background token + 1px divider + 12px radius + base shadow (hover shadow when
   the card has a clickable title). Panels and drawers keep the 1px divider; menus/dialogs/drawers use the overlay
   shadow. */
.center { max-width:none; }
.head-row { display:flex; align-items:center; justify-content:space-between; gap:var(--sp-3); min-width:0; }
.head-row #filesOpen { flex:none; }
.card:has(.card-title-link):hover { box-shadow:var(--shadow-2); }
.card.draft { box-shadow:none; }
/* The meta row keeps ~160px for avatar + name (the role gives way first) before time, kind and ⋯ wrap to a second line (narrow phones, or the
   1024px column squeezed by the company checklist); nothing sticks out of the card. */
.c-head { gap:var(--sp-2); flex-wrap:wrap; }
.c-who { display:flex; align-items:center; gap:var(--sp-2); flex:1 1 160px; min-width:0; font-size:var(--font-size-base); }
.c-who > .c-name { flex:0 1 auto; font-weight:600; }
.c-who > .c-role { flex:0 1000 auto; }
.c-head > .kebab { margin-left:auto; }
.c-head > .c-time { flex:none; white-space:nowrap; font-size:var(--font-size-sm); line-height:20px; color:var(--muted); }
.c-who small { font-size:var(--font-size-sm); line-height:20px; }
.files-panel, .upload-tray, .decisions-panel, .gate { border-radius:var(--radius-card); }
dialog { border-radius:var(--radius-drawer); box-shadow:var(--shadow-3); }
.menu { border-radius:var(--radius-control); box-shadow:var(--shadow-3); }
.toast { box-shadow:var(--shadow-3); }
.composer { border:1px solid var(--border); border-radius:var(--radius-card); box-shadow:var(--shadow-1); }
.composer b { color:var(--on-accent); border-radius:var(--radius-control); }

/* Sidebar rows: 8px colour dot, hover surface + underlined name, selected = accent text + 2px left bar + pressed
   surface (aria-current). The rail letter (.rail-init) only shows in the 56px rail. */
#projects .project-row { align-items:center; }
#projects .project-row:hover:not(:disabled) { background:var(--hover); }
#projects .project-row:hover .project-name { text-decoration:underline; }
#projects .project-row:active:not(:disabled) { background:var(--pressed); }
#projects .project-row[aria-current=true] { background:var(--pressed); }
.dot { flex:none; width:8px; height:8px; margin-right:var(--sp-2); border-radius:var(--radius-round); }
.rail-init { display:none; flex:none; width:var(--avatar-sm); height:var(--avatar-sm); border-radius:var(--radius-round); font-size:var(--font-size-xs); font-weight:700; line-height:24px; text-align:center; }
/* File rows: hover surface + underlined name, pressed surface. */
.file-row:hover { background:var(--hover); }
.file-row:hover .file-name { text-decoration:underline; }
.file-row:active { background:var(--pressed); }

/* Stat boxes, counters, side panels (used by the right-column panels). */
.side-panel { min-width:0; padding:var(--sp-4); background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-card); }
.side-panel > h2 { margin-bottom:var(--sp-2); }
.stat-grid { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:var(--sp-2); }
.stat { display:grid; min-width:0; padding:var(--sp-2); border:1px solid var(--border); border-radius:var(--radius-control); background:var(--surface); }
.stat-label { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:var(--font-size-sm); line-height:20px; }
.stat-value { font-size:var(--font-size-5xl); font-weight:700; line-height:32px; font-variant-numeric:tabular-nums; }
.stat-value.is-warn { color:var(--warn); }
.counters { display:flex; align-items:center; gap:var(--sp-3); min-width:0; }
.counter { display:inline-flex; align-items:center; gap:var(--sp-1); flex:none; color:var(--muted); font-size:var(--font-size-sm); font-variant-numeric:tabular-nums; }
.counter svg { width:16px; height:16px; }
.feed-row { display:flex; align-items:center; gap:var(--sp-2); min-height:var(--control-height-touch); min-width:0; }

/* 기록·파일 검색: misses and the rows between results hide while a query is active. */
/* Never hidden: an open editor (card being edited, new-record slot, reply composer). */
[data-search-list].is-searching > :not([data-search]):not(.search-empty):not(.editing):not(.slot):not(:has(.reply-composer)), .search-miss { display:none !important; }
.thread.is-searching { display:grid; gap:var(--sp-3); }
.search-empty { margin:0; padding:var(--sp-3) 0; color:var(--muted); font-size:var(--font-size-sm); }

/* Right column: 공유 파일 then #sidePanels (Worker C panels). 3 columns: one sticky column under the top bar;
   ≤1023px: 공유 파일 is a drawer / bottom sheet and #sidePanels sits under the thread. */
.right-col { display:flex; flex-direction:column; gap:var(--sp-3); min-width:0; }
.side-panels { display:grid; gap:var(--sp-3); min-width:0; }
.side-panels:empty { display:none; }
/* 3 columns with the company checklist open (a detail view in the right column): the panels below fold away so
   the checklist keeps the column's full width (no scrollbar from the panels underneath). */
@media (min-width:1024px) { .workspace:has(#checklistPanel:not([hidden])) .side-panels { display:none; } }
@media (min-width:1024px) {
  .right-col { position:sticky; top:88px; max-height:calc(100dvh - 112px); overflow-y:auto; overflow-x:hidden; }
  .right-col > .files-panel { max-height:none; overflow:visible; top:auto; }
}
@media (min-width:1024px) and (max-width:1199px) {
  .workspace { grid-template-columns:176px minmax(0, 1fr) 264px; gap:var(--sp-4); padding:var(--sp-4); }
}
@media (max-width:1023px) {
  .workspace { padding:var(--sp-4); gap:var(--sp-4); }
  .workspace > .right-col { grid-column:2; grid-row:2; }
  .files-panel.is-open { box-shadow:var(--shadow-3); border-radius:var(--radius-drawer) 0 0 var(--radius-drawer); }
  .left-panel.is-open { box-shadow:var(--shadow-3); border-radius:0 var(--radius-drawer) var(--radius-drawer) 0; }
  #navOpen { display:grid; }
}
/* 56px rail (641-1023px): project first letters in 24px palette circles; full name in aria-label + title. */
@media (min-width:641px) and (max-width:1023px) {
  .left-panel:not(.is-open) .panel-content { display:block; }
  .left-panel:not(.is-open) .panel-content > :not(#projects) { display:none; }
  .left-panel:not(.is-open) #projects .project-row { justify-content:center; padding:var(--sp-1) 0; min-height:var(--control-height); }
  .left-panel:not(.is-open) #projects .project-row > :not(.rail-init) { display:none; }
  .left-panel:not(.is-open) #projects .rail-init { display:block; }
}
@media (max-width:640px) {
  .bar { padding:0 var(--sp-3); }
  .bar-search { display:none; }
  #searchOpen { display:grid; margin-left:auto; }
  .bar.search-open .bar-search { display:flex; position:absolute; left:0; right:0; top:100%; max-width:none; margin:0; padding:var(--sp-2) var(--sp-3); background:var(--bar-bg); border-bottom:1px solid var(--bar-pressed); }
  .bar-search input { min-height:var(--control-height-touch); }
  .card .c-body h3 { font-size:var(--font-size-xl); line-height:24px; }
  .files-panel.is-open { top:auto; left:0; right:0; bottom:0; width:100%; max-width:100%; max-height:88dvh; border-radius:var(--radius-drawer) var(--radius-drawer) 0 0; }
  .request-upload { opacity:1; min-height:var(--control-height-touch); }
}
@media (hover:none) { .request-upload { min-height:var(--control-height-touch); } }
@media (max-width:320px) {
  #barTheme { display:none; }
  .files-panel.is-open, .side-panel { padding:var(--sp-3); }
}

/* ==========================================================================
   C2d-C: API-backed UI (Worker C) — card title / tags / counters, 분류 picker, sort tabs, right-column panels,
   profile photo dialog. Tokens only; spacing 4/8/12/16/24.
   ========================================================================== */
/* Card title: 22/700/28 (≤640 18/700/24), at most two lines with an ellipsis; touch targets 44px tall. */
.card > .card-title { margin:0 0 var(--sp-2); min-width:0; font-size:var(--font-size-3xl); font-weight:700; line-height:28px; }
.card-title-link { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; color:var(--text); text-decoration:none; overflow-wrap:anywhere; }
.card-title-link:hover { text-decoration:underline; }
.card > .tags { margin-bottom:var(--sp-3); }
@media (max-width:640px) { .card > .card-title { font-size:var(--font-size-xl); line-height:24px; } }
@media (max-width:640px), (pointer:coarse) { .card-title-link { min-height:var(--control-height-touch); } }
/* Counters (응답 · 조회): 16px CSS-drawn icon + 13px tabular number, 4px inside, 12px between; left of the actions. */
.c-foot > .counters { margin-right:auto; }
.counter .num { line-height:20px; }
.ico { position:relative; display:inline-block; flex:none; width:16px; height:16px; }
.ico::before, .ico::after { content:""; position:absolute; box-sizing:border-box; }
.ico-replies::before { left:1px; top:2px; width:14px; height:10px; border:1.5px solid currentColor; border-radius:var(--radius-badge); }
.ico-replies::after { left:3px; top:11px; width:0; height:0; border-top:4px solid currentColor; border-right:4px solid transparent; }
.ico-views::before { left:0; top:3px; width:16px; height:10px; border:1.5px solid currentColor; border-radius:var(--radius-round); }
.ico-views::after { left:6px; top:6px; width:4px; height:4px; background:currentColor; border-radius:var(--radius-round); }
/* 분류 picker in the new-card slot / editor: toggle tags (aria-pressed, ✓ when on), 36px (touch 44px). */
.cat-pick { display:grid; gap:var(--sp-1); margin-top:var(--sp-3); min-width:0; }
.cat-label { color:var(--muted); font-size:var(--font-size-sm); line-height:20px; }
.cat-tags button.tag { min-height:var(--control-height); padding:0 var(--sp-3); }
.cat-tags button.tag[aria-pressed=true]::before { content:"✓"; margin-right:var(--sp-1); }
.cat-hint { color:var(--muted); font-size:var(--font-size-sm); line-height:20px; }
.cat-hint:empty { display:none; }
@media (max-width:640px), (pointer:coarse) { .cat-tags button.tag { min-height:var(--control-height-touch); } }
/* Sort tabs above the card list. */
.sort-tabs { margin:var(--sp-3) 0; }
/* Right-column panels. */
.side-list { display:grid; min-width:0; margin:0; padding:0; list-style:none; }
.side-note { margin:0; padding:var(--sp-2) 0; color:var(--muted); font-size:var(--font-size-sm); line-height:20px; }
.rank-tabs { margin-bottom:var(--sp-2); }
.rank-row { display:flex; align-items:center; gap:var(--sp-2); min-width:0; border-bottom:1px solid var(--border); }
.rank-row:last-child { border-bottom:0; }
.rank-title { display:block; flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text); font-size:var(--font-size-base); line-height:35px; text-decoration:none; }
.rank-title:hover { text-decoration:underline; }
.rank-row > .counters { flex:none; }
.feed-text, .top-text { display:grid; flex:1 1 auto; min-width:0; }
.feed-line { display:flex; align-items:baseline; gap:var(--sp-2); min-width:0; font-size:var(--font-size-base); line-height:24px; }
.feed-line.feed-sub { color:var(--muted); font-size:var(--font-size-sm); line-height:20px; }
.feed-who, .feed-target, .top-name, .top-title { flex:0 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.feed-who { font-weight:600; }
.feed-act, .feed-time { flex:none; white-space:nowrap; }
.feed-act { color:var(--muted); }
.top-row { display:flex; align-items:center; gap:var(--sp-2); min-width:0; min-height:var(--control-height-touch); }
.top-name { font-size:var(--font-size-base); line-height:24px; }
.top-title { color:var(--muted); font-size:var(--font-size-sm); line-height:20px; }
.top-count { flex:none; color:var(--muted); font-size:var(--font-size-sm); white-space:nowrap; }
.side-head { display:flex; align-items:baseline; justify-content:space-between; gap:var(--sp-2); min-width:0; margin-bottom:var(--sp-2); }
.side-head > h2 { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.side-range { flex:none; color:var(--muted); font-size:var(--font-size-sm); white-space:nowrap; }
@media (max-width:640px), (pointer:coarse) { .rank-title { line-height:44px; } }
/* 프로필 사진 dialog: 72px preview, 사진 선택 / 사진 삭제, hint, error, [취소][저장]. */
#photoDialog { width:min(420px, calc(100vw - 24px)); }
.photo-body { display:flex; align-items:center; gap:var(--sp-4); min-width:0; margin:var(--sp-4) 0; }
.photo-controls { display:grid; gap:var(--sp-2); min-width:0; }
.photo-buttons { display:flex; flex-wrap:wrap; gap:var(--sp-2); }
.photo-hint { margin:0; color:var(--muted); font-size:var(--font-size-sm); line-height:20px; }
@media (max-width:640px), (pointer:coarse) { .photo-buttons button { min-height:var(--control-height-touch); } }
