/*
 * Filestation 컴포넌트
 * tokens.css 다음에 불러온다. 모든 색, 크기, 글꼴은 토큰만 참조한다.
 * 클래스 접두사: fs-   변형: fs-x--variant   상태: is-*
 */

/* ================= 기본 ================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fs-bg);
  color: var(--fs-label);
  font: var(--fs-text-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: keep-all;               /* 한글 단어 단위 줄바꿈 */
  overflow-wrap: anywhere;
}
:focus-visible { outline: 3px solid var(--fs-focus-ring); outline-offset: 1px; border-radius: var(--fs-radius-sm); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }

.fs-large-title { font: var(--fs-text-large-title); letter-spacing: var(--fs-tracking-tight); }
.fs-title-1     { font: var(--fs-text-title-1); letter-spacing: var(--fs-tracking-tight); }
.fs-title-2     { font: var(--fs-text-title-2); }
.fs-title-3     { font: var(--fs-text-title-3); }
.fs-headline    { font: var(--fs-text-headline); }
.fs-body        { font: var(--fs-text-body); }
.fs-callout     { font: var(--fs-text-callout); }
.fs-subhead     { font: var(--fs-text-subhead); }
.fs-footnote    { font: var(--fs-text-footnote); }
.fs-caption-1   { font: var(--fs-text-caption-1); }
.fs-caption-2   { font: var(--fs-text-caption-2); }
.fs-secondary   { color: var(--fs-label-2); }
.fs-tertiary    { color: var(--fs-label-3); }
.fs-danger-text { color: var(--fs-danger); }
.fs-num         { font-variant-numeric: tabular-nums; }
.fs-truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* 파일명 가운데 줄임 (Finder 방식): "아주 긴 파일 이름…검토의견.hwp"
   앞부분만 줄어들고, 이름 끝 몇 글자와 확장자는 늘 보인다. */
.fs-midname { display: flex; min-width: 0; max-width: 100%; overflow: hidden; white-space: nowrap; }
.fs-midname__a { flex: 0 1 auto; min-width: 1.5em; overflow: hidden; text-overflow: ellipsis; }
.fs-midname__b { flex: 0 0 auto; white-space: pre; }

/* ================= 아이콘 (Lucide 계열 선 아이콘) ================= */
.fs-icon {
  width: var(--fs-icon); height: var(--fs-icon); flex: none;
  stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.fs-icon--sm { width: 16px; height: 16px; }
.fs-icon--lg { width: 28px; height: 28px; stroke-width: 1.6; }

/* ================= 파일 형식 아이콘 ================= */
/* <span class="fs-file" data-kind="pdf" style="--size:32px"><span>PDF</span></span> */
.fs-file {
  --size: var(--fs-file-icon-list);
  --kind: var(--fs-type-other);
  position: relative; flex: none;
  width: calc(var(--size) * 0.78); height: var(--size);
  border-radius: calc(var(--size) * 0.08);
  background:
    linear-gradient(225deg, transparent calc(var(--size) * 0.22), var(--fs-type-paper) 0) ;
  box-shadow: inset 0 0 0 1px var(--fs-type-paper-edge);
  display: inline-flex; align-items: flex-end; justify-content: center;
  padding-bottom: calc(var(--size) * 0.12);
}
.fs-file::before {                      /* 접힌 모서리 */
  content: ""; position: absolute; top: 0; right: 0;
  width: calc(var(--size) * 0.22); height: calc(var(--size) * 0.22);
  background: linear-gradient(225deg, transparent 50%, var(--fs-type-paper-edge) 50%);
  border-bottom-left-radius: calc(var(--size) * 0.04);
}
.fs-file > span {                       /* 형식 띠 */
  background: var(--kind); color: #fff;
  font: 700 calc(var(--size) * 0.2)/1 var(--fs-font-sans);
  letter-spacing: 0.02em;
  padding: calc(var(--size) * 0.05) calc(var(--size) * 0.07);
  border-radius: calc(var(--size) * 0.05);
  max-width: 92%; overflow: hidden;
}
/* 작은 크기(목록 보기 18px)에서는 글자 대신 색 띠만 */
.fs-file.fs-file--mini > span { font-size: 0; width: 70%; height: 4px; padding: 0; }
.fs-file[data-kind="hwp"]     { --kind: var(--fs-type-hwp); }
.fs-file[data-kind="doc"]     { --kind: var(--fs-type-doc); }
.fs-file[data-kind="xls"]     { --kind: var(--fs-type-xls); }
.fs-file[data-kind="ppt"]     { --kind: var(--fs-type-ppt); }
.fs-file[data-kind="pdf"]     { --kind: var(--fs-type-pdf); }
.fs-file[data-kind="image"]   { --kind: var(--fs-type-image); }
.fs-file[data-kind="video"]   { --kind: var(--fs-type-video); }
.fs-file[data-kind="audio"]   { --kind: var(--fs-type-audio); }
.fs-file[data-kind="archive"] { --kind: var(--fs-type-archive); }
.fs-file[data-kind="text"]    { --kind: var(--fs-type-text); }

/* 폴더 */
.fs-folder {
  --size: var(--fs-file-icon-list);
  position: relative; flex: none; display: inline-block;
  width: var(--size); height: calc(var(--size) * 0.8);
  margin-top: calc(var(--size) * 0.1);
  background: var(--fs-type-folder);
  border-radius: calc(var(--size) * 0.07) calc(var(--size) * 0.1) calc(var(--size) * 0.1) calc(var(--size) * 0.1);
}
.fs-folder::before {                    /* 탭 */
  content: ""; position: absolute; left: 0; top: calc(var(--size) * -0.1);
  width: 42%; height: calc(var(--size) * 0.2);
  background: var(--fs-type-folder-tab);
  border-radius: calc(var(--size) * 0.07) calc(var(--size) * 0.07) 0 0;
}
.fs-folder::after {                     /* 앞면 */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 80%;
  background: var(--fs-type-folder);
  border-radius: calc(var(--size) * 0.06) calc(var(--size) * 0.06) calc(var(--size) * 0.1) calc(var(--size) * 0.1);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.35) inset;
  filter: brightness(1.08);
}
.fs-folder.is-drop-target { outline: 3px solid var(--fs-accent); outline-offset: 3px; }

/* ================= 표시 ================= */
.fs-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--fs-unread); flex: none; display: inline-block; }
.fs-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--fs-radius-full);
  background: var(--fs-red); color: #fff; font: 600 12px/1 var(--fs-font-sans);
  font-variant-numeric: tabular-nums;
}
.fs-badge--accent { background: var(--fs-accent); }
.fs-badge--neutral { background: var(--fs-fill); color: var(--fs-label-2); }
.fs-tag {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px;
  border-radius: var(--fs-radius-xs); background: var(--fs-fill-3); color: var(--fs-label-2);
  font: var(--fs-text-caption-1); font-weight: 500;
}
.fs-tag--danger { background: color-mix(in srgb, var(--fs-danger) 14%, transparent); color: var(--fs-danger); }

/* ================= 버튼 ================= */
.fs-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--fs-control-h); padding: 0 14px; border-radius: var(--fs-radius-md);
  font: var(--fs-text-body); font-weight: 500; white-space: nowrap;
  background: var(--fs-fill-3); color: var(--fs-accent);
  transition: background var(--fs-dur-fast) var(--fs-ease), opacity var(--fs-dur-fast);
}
.fs-btn:hover { background: var(--fs-fill-2); }
.fs-btn:active { opacity: 0.6; }
.fs-btn:disabled, .fs-btn.is-disabled { color: var(--fs-label-3); background: var(--fs-fill-4); pointer-events: none; }
.fs-btn--filled { background: var(--fs-accent); color: var(--fs-label-on-accent); }
.fs-btn--filled:hover { background: var(--fs-accent-pressed); }
.fs-btn--tinted { background: var(--fs-accent-tint); color: var(--fs-accent); }
.fs-btn--plain { background: none; padding: 0 6px; }
.fs-btn--plain:hover { background: var(--fs-fill-4); }
.fs-btn--danger { color: var(--fs-danger); }
.fs-btn--filled.fs-btn--danger { background: var(--fs-danger); color: #fff; }
.fs-btn--lg { height: var(--fs-control-h-lg); border-radius: var(--fs-radius-lg); font: var(--fs-text-headline); padding: 0 20px; }
.fs-btn--block { display: flex; width: 100%; }
.fs-btn--icon { width: var(--fs-control-h); padding: 0; }
.fs-btn--icon.fs-btn--plain { width: var(--fs-hit); height: var(--fs-hit); }

/* ================= 입력 ================= */
.fs-field {
  display: flex; align-items: center; gap: 8px;
  height: var(--fs-control-h-lg); padding: 0 14px; border-radius: var(--fs-radius-md);
  background: var(--fs-fill-3); color: var(--fs-label);
}
.fs-field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: var(--fs-text-body); }
.fs-field input::placeholder { color: var(--fs-label-3); }
.fs-field:focus-within { box-shadow: 0 0 0 3px var(--fs-focus-ring); }
.fs-field.is-error { box-shadow: 0 0 0 1.5px var(--fs-danger); }
.fs-field-msg { font: var(--fs-text-footnote); color: var(--fs-danger); margin: 6px 4px 0; }
.fs-field--compact { height: var(--fs-control-h); border-radius: var(--fs-radius-sm); padding: 0 8px; background: var(--fs-bg); box-shadow: inset 0 0 0 1px var(--fs-separator); }

/* 검색 필드 + 검색 토큰 */
.fs-search {
  display: flex; align-items: center; gap: 6px;
  height: var(--fs-search-h); padding: 0 8px; border-radius: var(--fs-radius-md);
  background: var(--fs-fill-3); color: var(--fs-label-2);
}
.fs-search input { flex: 1; min-width: 40px; border: 0; background: none; outline: none; font: var(--fs-text-body); color: var(--fs-label); }
.fs-search input::placeholder { color: var(--fs-label-2); }
.fs-search:focus-within { box-shadow: 0 0 0 3px var(--fs-focus-ring); background: var(--fs-bg-elevated); }
.fs-token {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--fs-radius-xs);
  background: var(--fs-accent); color: var(--fs-label-on-accent);
  font: var(--fs-text-caption-1); font-weight: 600; white-space: nowrap;
}
.fs-search mark, .fs-hl { background: none; color: inherit; font-weight: 700; text-decoration: underline; text-decoration-color: var(--fs-accent); text-underline-offset: 2px; }

/* ================= 선택 컨트롤 ================= */
/* 세그먼트 */
.fs-seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: calc(var(--fs-radius-sm) + 2px); background: var(--fs-fill-3); }
.fs-seg > button {
  flex: 1; min-height: calc(var(--fs-control-h) - 4px); padding: 0 12px; border-radius: var(--fs-radius-sm);
  font: var(--fs-text-subhead); font-weight: 500; color: var(--fs-label); white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.fs-seg > button[aria-pressed="true"] { background: var(--fs-bg-elevated); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px var(--fs-separator); font-weight: 600; }
.fs-seg--block { display: flex; }

/* 선택 동그라미 (iOS 선택 모드) */
.fs-check {
  width: 22px; height: 22px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  box-shadow: inset 0 0 0 1.5px var(--fs-label-3);
}
.fs-check.is-on { background: var(--fs-accent); box-shadow: none; }
.fs-check.is-on::after { content: ""; width: 10px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }

/* 스위치 */
.fs-switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--fs-fill); position: relative; cursor: pointer; transition: background var(--fs-dur) var(--fs-ease); flex: none; margin: 0; }
.fs-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); transition: transform var(--fs-dur) var(--fs-ease-spring); }
.fs-switch:checked { background: var(--fs-green); }
.fs-switch:checked::after { transform: translateX(20px); }

/* ================= 진행 ================= */
.fs-progress { height: 4px; border-radius: 2px; background: var(--fs-fill-2); overflow: hidden; }
.fs-progress > i { display: block; height: 100%; width: var(--value, 0%); background: var(--fs-accent); border-radius: inherit; transition: width var(--fs-dur) linear; }
.fs-progress.is-error > i { background: var(--fs-danger); }
.fs-ring { --value: 0; width: 18px; height: 18px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--fs-accent) calc(var(--value) * 1%), var(--fs-fill) 0);
  -webkit-mask: radial-gradient(circle, transparent 5px, #000 5.5px); mask: radial-gradient(circle, transparent 5px, #000 5.5px); }

/* ================= 목록 (iOS) ================= */
.fs-section-header {
  padding: var(--fs-space-5) calc(var(--fs-gutter) + var(--fs-space-4)) 6px;
  font: var(--fs-text-footnote); color: var(--fs-label-2);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.fs-section-header--plain { padding-inline: var(--fs-gutter); font: var(--fs-text-headline); color: var(--fs-label); }
.fs-section-footer { padding: 6px calc(var(--fs-gutter) + var(--fs-space-4)) 0; font: var(--fs-text-footnote); color: var(--fs-label-2); }

.fs-list { list-style: none; margin: 0; padding: 0; background: var(--fs-bg); }
.fs-list--inset { margin: 0 var(--fs-gutter); border-radius: var(--fs-radius-md); overflow: hidden; background: var(--fs-bg-grouped-cell); }

.fs-row {
  position: relative; display: flex; align-items: center; gap: var(--fs-space-3);
  min-height: var(--fs-row-h); padding: 6px var(--fs-space-4);
  color: var(--fs-label); text-decoration: none; cursor: default;
  transition: background var(--fs-dur-fast);
}
.fs-row--detail { min-height: var(--fs-row-h-detail); }
.fs-row + .fs-row::before {             /* 들여쓴 구분선 */
  content: ""; position: absolute; top: 0; right: 0; left: var(--sep-inset, var(--fs-space-4));
  border-top: 0.5px solid var(--fs-separator);
}
.fs-row--with-icon { --sep-inset: calc(var(--fs-space-4) + var(--fs-file-icon-list) + var(--fs-space-3)); }
.fs-row:active, .fs-row.is-pressed { background: var(--fs-fill-4); }
.fs-row.is-selected { background: var(--fs-accent-tint); }
.fs-row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fs-row__title { font: var(--fs-text-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-row__sub { font: var(--fs-text-footnote); color: var(--fs-label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-row__value { font: var(--fs-text-body); color: var(--fs-label-2); white-space: nowrap; }
.fs-row__chevron { color: var(--fs-label-3); width: 14px; height: 14px; stroke-width: 2.4; }
.fs-row--action { justify-content: center; color: var(--fs-accent); }
.fs-row--destructive { justify-content: center; color: var(--fs-danger); }
.fs-row__lead-dot { width: 9px; margin-right: -4px; display: inline-flex; }

/* 밀어서 동작 */
.fs-swipe { position: relative; overflow: hidden; }
.fs-swipe__actions { position: absolute; inset: 0 0 0 auto; display: flex; }
.fs-swipe__actions > button { width: 84px; color: #fff; font: var(--fs-text-subhead); font-weight: 600; background: var(--fs-danger); }
.fs-swipe__content { background: inherit; position: relative; transform: translateX(var(--offset, 0)); transition: transform var(--fs-dur) var(--fs-ease-spring); }

/* ================= 아이콘 보기 ================= */
.fs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: var(--fs-space-5) var(--fs-space-2); padding: var(--fs-space-3) var(--fs-gutter);
}
.fs-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; padding: 4px; border-radius: var(--fs-radius-md); }
.fs-cell__icon { position: relative; height: calc(var(--fs-file-icon-grid) + 4px); display: grid; place-items: end center; padding: 2px; border-radius: var(--fs-radius-sm); }
.fs-cell__icon .fs-dot { position: absolute; top: 0; right: -2px; box-shadow: 0 0 0 2px var(--fs-bg); }
.fs-cell__name { font: var(--fs-text-footnote); font-weight: 500; line-height: 1.25; max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding: 0 4px; border-radius: var(--fs-radius-xs); }
.fs-cell__meta { font: var(--fs-text-caption-2); color: var(--fs-label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fs-cell.is-selected .fs-cell__icon { background: var(--fs-fill-3); }
.fs-cell.is-selected .fs-cell__name { background: var(--fs-selection); color: var(--fs-label-on-accent); }

/* ================= 목록 보기 표 (Finder) ================= */
.fs-table { width: 100%; border-collapse: collapse; font: var(--fs-text-body); table-layout: fixed; }
.fs-table th {
  height: 26px; padding: 0 8px; text-align: left; white-space: nowrap;
  font: var(--fs-text-caption-1); font-weight: 500; color: var(--fs-label-2);
  border-bottom: 0.5px solid var(--fs-separator); position: sticky; top: 0; background: var(--fs-bg);
}
.fs-table th + th { box-shadow: inset 1px 0 0 var(--fs-fill-3); }
.fs-table th[aria-sort] { color: var(--fs-label); font-weight: 600; }
.fs-table th[aria-sort="ascending"]::after { content: " ⌃"; }
.fs-table th[aria-sort="descending"]::after { content: " ⌄"; }
.fs-table th.is-num, .fs-table td.is-num { text-align: right; font-variant-numeric: tabular-nums; }
.fs-table td { height: var(--fs-row-h); padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fs-label); }
.fs-table td.is-meta { color: var(--fs-label-2); }
.fs-table tbody tr:nth-child(even) td { background: var(--fs-bg-row-alt); }
.fs-table tbody tr.is-selected td { background: var(--fs-selection); color: var(--fs-label-on-accent); }
.fs-table tbody tr.is-selected td.is-meta { color: color-mix(in srgb, var(--fs-label-on-accent) 80%, transparent); }
.fs-table tbody tr.is-selected-inactive td { background: var(--fs-selection-inactive); }
.fs-table tbody tr.is-drop-target td { background: var(--fs-accent-tint); box-shadow: inset 0 0 0 2px var(--fs-accent); }
.fs-table tbody tr.is-dim td { opacity: 0.45; }
.fs-name { display: flex; align-items: center; gap: 6px; min-width: 0; padding-left: calc(var(--depth, 0) * 16px); }
.fs-name > :last-child { overflow: hidden; text-overflow: ellipsis; }
.fs-disclosure { width: 12px; flex: none; color: var(--fs-label-2); font-size: 9px; text-align: center; transition: transform var(--fs-dur-fast); }
.fs-disclosure.is-open { transform: rotate(90deg); }

/* ================= 내비게이션 바 (iOS) ================= */
.fs-navbar { padding: 0 var(--fs-gutter); background: var(--fs-bg); position: relative; z-index: var(--fs-z-bar); }
.fs-navbar__row { height: var(--fs-navbar-h); display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 calc(var(--fs-space-2) * -1); }
.fs-navbar__back { display: inline-flex; align-items: center; gap: 2px; color: var(--fs-accent); font: var(--fs-text-body); height: var(--fs-hit); padding: 0 4px; max-width: 45%; }
.fs-navbar__back .fs-icon { width: 24px; height: 24px; stroke-width: 2.2; margin-left: -4px; }
.fs-navbar__title { font: var(--fs-text-headline); position: absolute; left: 50%; transform: translateX(-50%); max-width: 50%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-navbar__actions { display: flex; align-items: center; gap: 4px; margin-left: auto; color: var(--fs-accent); }
.fs-navbar__large { font: var(--fs-text-large-title); letter-spacing: var(--fs-tracking-tight); margin: 2px 0 var(--fs-space-2); text-wrap: balance; }
.fs-navbar .fs-search { margin-bottom: var(--fs-space-2); }

/* ================= 탭 바 / 하단 도구 막대 (iOS) ================= */
.fs-tabbar {
  display: flex; justify-content: space-around; align-items: flex-start;
  height: calc(var(--fs-tabbar-h) + var(--fs-bottom-gap));
  padding: 6px 0 var(--fs-bottom-gap);
  flex: none;
  background: var(--fs-bg-bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--fs-separator);
}
.fs-tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 72px; color: var(--fs-label-2); font: 500 calc(10px * var(--fs-text-scale, 1))/1.2 var(--fs-font-sans); }
.fs-tab .fs-icon { width: 26px; height: 26px; stroke-width: 1.7; }
.fs-tab[aria-current="page"] { color: var(--fs-accent); }
.fs-tab .fs-badge { position: absolute; top: -3px; left: calc(50% + 6px); min-width: 17px; height: 17px; font-size: 11px; }
.fs-bottombar {
  display: flex; justify-content: space-around; align-items: center; height: calc(var(--fs-tabbar-h) + var(--fs-bottom-gap));
  padding-bottom: var(--fs-bottom-gap); flex: none;
  background: var(--fs-bg-bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--fs-separator); color: var(--fs-accent);
}
.fs-bottombar > button { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; font: 500 10px/1.2 var(--fs-font-sans); min-width: var(--fs-hit); }
.fs-bottombar > button.is-danger { color: var(--fs-danger); }
.fs-bottombar > button:disabled { color: var(--fs-label-3); }

/* ================= 데스크톱 창 구조 (Finder) ================= */
.fs-window { display: flex; height: 100%; min-height: 0; background: var(--fs-bg); }
.fs-sidebar {
  width: var(--fs-sidebar-w); flex: none; overflow-y: auto;
  padding: var(--fs-space-3) var(--fs-space-2);
  background: var(--fs-bg-sidebar); border-right: 0.5px solid var(--fs-separator);
  font: var(--fs-text-body);
}
.fs-sidebar__heading { font: var(--fs-text-caption-1); font-weight: 700; color: var(--fs-label-3); padding: var(--fs-space-3) 8px 4px; }
.fs-sidebar__heading:first-child { padding-top: 0; }
.fs-side-item {
  display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 calc(8px + var(--depth, 0) * 14px);
  border-radius: var(--fs-radius-sm); color: var(--fs-label); width: 100%; text-align: left;
}
.fs-side-item .fs-icon { color: var(--fs-accent); width: 16px; height: 16px; }
.fs-side-item .fs-folder { --size: 16px; }
.fs-side-item .fs-disclosure { margin-left: -4px; }
.fs-side-item > .fs-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-side-item:hover { background: var(--fs-fill-4); }
.fs-side-item[aria-current="true"] { background: var(--fs-fill-2); font-weight: 600; }
.fs-side-item.is-drop-target { background: var(--fs-accent-tint); box-shadow: inset 0 0 0 2px var(--fs-accent); }

.fs-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fs-toolbar {
  height: var(--fs-navbar-h); flex: none; display: flex; align-items: center; gap: var(--fs-space-2);
  padding: 0 var(--fs-space-3); border-bottom: 0.5px solid var(--fs-separator); background: var(--fs-bg);
}
.fs-toolbar__nav { display: flex; color: var(--fs-label-2); }
.fs-toolbar__nav button:disabled { color: var(--fs-label-4); }
.fs-toolbar__title { font: var(--fs-text-title-3); margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fs-toolbar .fs-search { width: 220px; }
.fs-toolbar .fs-btn--plain { color: var(--fs-label-2); }

.fs-scopebar {
  display: flex; align-items: center; gap: 4px; height: 32px; flex: none; padding: 0 var(--fs-space-3);
  border-bottom: 0.5px solid var(--fs-separator); font: var(--fs-text-callout); color: var(--fs-label-2);
}
.fs-scopebar button { height: 22px; padding: 0 9px; border-radius: var(--fs-radius-sm); color: var(--fs-label); font: inherit; }
.fs-scopebar button[aria-pressed="true"] { background: var(--fs-fill-2); font-weight: 600; }

.fs-content { flex: 1; min-height: 0; overflow: auto; position: relative; }

.fs-pathbar {
  height: 24px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 var(--fs-space-3);
  border-top: 0.5px solid var(--fs-separator); background: var(--fs-bg-sidebar);
  font: var(--fs-text-caption-1); color: var(--fs-label-2); white-space: nowrap; overflow: hidden;
}
.fs-pathbar a, .fs-pathbar button { color: inherit; text-decoration: none; padding: 1px 4px; border-radius: var(--fs-radius-xs); display: inline-flex; align-items: center; gap: 4px; }
.fs-pathbar a:hover, .fs-pathbar button:hover { background: var(--fs-fill-3); color: var(--fs-label); }
.fs-pathbar .fs-folder { --size: 12px; }
.fs-pathbar__sep { color: var(--fs-label-3); }
.fs-pathbar__status { margin-left: auto; }

.fs-inspector {
  width: var(--fs-inspector-w); flex: none; overflow-y: auto; padding: var(--fs-space-5) var(--fs-space-4);
  border-left: 0.5px solid var(--fs-separator); background: var(--fs-bg);
  display: flex; flex-direction: column; gap: var(--fs-space-3);
}
.fs-inspector__preview { display: grid; place-items: center; padding: var(--fs-space-4) 0; }
.fs-inspector__name { font: var(--fs-text-headline); text-align: center; overflow-wrap: anywhere; }
.fs-inspector__kind { font: var(--fs-text-footnote); color: var(--fs-label-2); text-align: center; margin-top: -8px; }
.fs-kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font: var(--fs-text-callout); }
.fs-kv dt { color: var(--fs-label-2); text-align: right; white-space: nowrap; }
.fs-kv dd { margin: 0; overflow-wrap: anywhere; }

/* ================= 메뉴 ================= */
/* iOS 컨텍스트 메뉴 */
.fs-menu {
  min-width: 250px; max-width: 290px; padding: 0; overflow: hidden;
  background: var(--fs-bg-elevated); border-radius: var(--fs-radius-lg); box-shadow: var(--fs-shadow-popover);
  font: var(--fs-text-body);
}
.fs-menu__item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--fs-space-4);
  width: 100%; min-height: 44px; padding: 0 var(--fs-space-4); text-align: left; color: var(--fs-label);
}
.fs-menu__item + .fs-menu__item { box-shadow: inset 0 0.5px 0 var(--fs-separator); }
.fs-menu__item:hover, .fs-menu__item.is-active { background: var(--fs-fill-4); }
.fs-menu__item .fs-icon { width: 20px; height: 20px; }
.fs-menu__item.is-danger { color: var(--fs-danger); }
.fs-menu__item:disabled, .fs-menu__item.is-disabled { color: var(--fs-label-3); }
.fs-menu__hint { font: var(--fs-text-caption-1); color: var(--fs-label-3); }
.fs-menu__gap { height: 8px; background: var(--fs-fill-4); }
/* macOS 메뉴 (데스크톱 우클릭, 드롭 메뉴, 트레이) */
.fs-menu--mac { min-width: 220px; padding: 5px; border-radius: var(--fs-radius-sm); font: var(--fs-text-body);
  background: color-mix(in srgb, var(--fs-bg-elevated) 92%, transparent);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); }
.fs-menu--mac .fs-menu__item { min-height: 24px; padding: 0 10px; border-radius: 4px; box-shadow: none; }
.fs-menu--mac .fs-menu__item .fs-icon { width: 15px; height: 15px; }
.fs-menu--mac .fs-menu__item:hover, .fs-menu--mac .fs-menu__item.is-active { background: var(--fs-accent); color: var(--fs-label-on-accent); }
.fs-menu--mac .fs-menu__item:hover .fs-menu__hint, .fs-menu--mac .fs-menu__item.is-active .fs-menu__hint { color: inherit; opacity: 0.8; }
.fs-menu--mac .fs-menu__item.is-disabled:hover { background: none; color: var(--fs-label-3); }
.fs-menu--mac .fs-menu__gap { height: 1px; margin: 5px 8px; background: var(--fs-separator); }
.fs-menu__section { font: var(--fs-text-caption-1); font-weight: 600; color: var(--fs-label-3); padding: 4px 10px 2px; }

/* ================= 경고창 ================= */
.fs-alert {
  width: 270px; border-radius: var(--fs-radius-lg); overflow: hidden; text-align: center;
  background: var(--fs-bg-elevated); box-shadow: var(--fs-shadow-popover);
}
.fs-alert__body { padding: var(--fs-space-5) var(--fs-space-4) var(--fs-space-4); display: flex; flex-direction: column; gap: 4px; }
.fs-alert__title { font: var(--fs-text-headline); }
.fs-alert__message { font: var(--fs-text-footnote); color: var(--fs-label); }
.fs-alert__extra { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 0 var(--fs-space-4) var(--fs-space-3); font: var(--fs-text-footnote); }
.fs-alert__actions { display: flex; border-top: 0.5px solid var(--fs-separator); }
.fs-alert__actions--stack { flex-direction: column; }
.fs-alert__actions > button { flex: 1; min-height: 44px; color: var(--fs-accent); font: var(--fs-text-body); }
.fs-alert__actions > button + button { box-shadow: inset 0.5px 0 0 var(--fs-separator); }
.fs-alert__actions--stack > button + button { box-shadow: inset 0 0.5px 0 var(--fs-separator); }
.fs-alert__actions > button.is-default { font-weight: 600; }
.fs-alert__actions > button.is-danger { color: var(--fs-danger); }
/* compact에서는 macOS 경고창처럼 넓고 버튼이 오른쪽 */
@media (min-width: 768px) and (pointer: fine) {
  :root:not([data-density="regular"]) .fs-alert { width: 300px; padding: var(--fs-space-5) var(--fs-space-4) var(--fs-space-4); }
  :root:not([data-density="regular"]) .fs-alert__body { padding: 0 0 var(--fs-space-4); }
  :root:not([data-density="regular"]) .fs-alert__actions { border: 0; gap: 8px; }
  :root:not([data-density="regular"]) .fs-alert__actions > button { min-height: 28px; border-radius: var(--fs-radius-sm); background: var(--fs-fill-3); box-shadow: none; }
  :root:not([data-density="regular"]) .fs-alert__actions > button.is-default { background: var(--fs-accent); color: var(--fs-label-on-accent); }
}
:root[data-density="compact"] .fs-alert { width: 300px; padding: var(--fs-space-5) var(--fs-space-4) var(--fs-space-4); }
:root[data-density="compact"] .fs-alert__body { padding: 0 0 var(--fs-space-4); }
:root[data-density="compact"] .fs-alert__actions { border: 0; gap: 8px; }
:root[data-density="compact"] .fs-alert__actions > button { min-height: 28px; border-radius: var(--fs-radius-sm); background: var(--fs-fill-3); box-shadow: none; }
:root[data-density="compact"] .fs-alert__actions > button.is-default { background: var(--fs-accent); color: var(--fs-label-on-accent); }
:root .fs-density-compact .fs-alert { width: 300px; padding: var(--fs-space-5) var(--fs-space-4) var(--fs-space-4); }
:root .fs-density-compact .fs-alert__body { padding: 0 0 var(--fs-space-4); }
:root .fs-density-compact .fs-alert__actions { border: 0; gap: 8px; }
:root .fs-density-compact .fs-alert__actions > button { min-height: 28px; border-radius: var(--fs-radius-sm); background: var(--fs-fill-3); box-shadow: none; }
:root .fs-density-compact .fs-alert__actions > button.is-default { background: var(--fs-accent); color: var(--fs-label-on-accent); }
/* 영역을 regular로 강제하면 iOS 경고창으로 되돌린다 */
:root .fs-density-regular .fs-alert { width: 270px; padding: 0; }
:root .fs-density-regular .fs-alert__body { padding: var(--fs-space-5) var(--fs-space-4) var(--fs-space-4); }
:root .fs-density-regular .fs-alert__actions { border-top: 0.5px solid var(--fs-separator); gap: 0; }
:root .fs-density-regular .fs-alert__actions > button { min-height: 44px; border-radius: 0; background: none; }
:root .fs-density-regular .fs-alert__actions > button + button { box-shadow: inset 0.5px 0 0 var(--fs-separator); }
:root .fs-density-regular .fs-alert__actions--stack > button + button { box-shadow: inset 0 0.5px 0 var(--fs-separator); }
:root .fs-density-regular .fs-alert__actions > button.is-default { background: none; color: var(--fs-accent); }

/* ================= 시트 / 팝오버 ================= */
.fs-scrim { position: absolute; inset: 0; background: var(--fs-scrim); z-index: var(--fs-z-sheet); }
.fs-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: calc(var(--fs-z-sheet) + 1);
  background: var(--fs-bg-elevated); border-radius: var(--fs-radius-lg) var(--fs-radius-lg) 0 0;
  box-shadow: var(--fs-shadow-sheet); padding: 6px 0 calc(var(--fs-space-5) + env(safe-area-inset-bottom, 0px));
  max-height: 92%; overflow: auto;
}
.fs-sheet--grouped { background: var(--fs-bg-grouped); }
.fs-sheet__grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--fs-label-4); margin: 0 auto var(--fs-space-2); }
.fs-sheet__header { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--fs-gutter) var(--fs-space-3); }
.fs-sheet__header h2 { margin: 0; font: var(--fs-text-headline); }
.fs-popover {
  background: var(--fs-bg-elevated); border-radius: var(--fs-radius-lg); box-shadow: var(--fs-shadow-popover);
  padding: var(--fs-space-3); min-width: 260px;
}

/* 동작 버튼 묶음 (파일 정보 시트) */
.fs-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--fs-space-2); padding: 0 var(--fs-gutter) var(--fs-space-4); }
.fs-actions > button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 62px; border-radius: var(--fs-radius-md); background: var(--fs-bg-grouped-cell); color: var(--fs-accent); font: var(--fs-text-caption-1); font-weight: 500; }
.fs-actions > button.is-danger { color: var(--fs-danger); }
.fs-actions > button:disabled { color: var(--fs-label-3); }

/* ================= 상태 ================= */
.fs-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--fs-space-2); padding: var(--fs-space-10) var(--fs-gutter); color: var(--fs-label-2); }
.fs-empty__title { font: var(--fs-text-title-3); color: var(--fs-label); }
.fs-empty__text { font: var(--fs-text-subhead); max-width: 30ch; }
.fs-empty .fs-btn { margin-top: var(--fs-space-2); }

.fs-dropzone {
  position: absolute; inset: var(--fs-space-2); border-radius: var(--fs-radius-lg);
  border: 2px dashed var(--fs-accent); background: var(--fs-accent-tint);
  display: grid; place-items: center; color: var(--fs-accent); font: var(--fs-text-headline); pointer-events: none;
}
.fs-drag-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: var(--fs-radius-sm); background: var(--fs-bg-elevated); box-shadow: var(--fs-shadow-drag); font: var(--fs-text-callout); }
.fs-drag-ghost .fs-badge { background: var(--fs-red); }

.fs-banner {                           /* 앱 안 알림 배너 / 토스트 */
  display: flex; align-items: center; gap: var(--fs-space-3); padding: var(--fs-space-3) var(--fs-space-4);
  background: color-mix(in srgb, var(--fs-bg-elevated) 90%, transparent); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  border-radius: var(--fs-radius-xl); box-shadow: var(--fs-shadow-popover); font: var(--fs-text-subhead);
}
.fs-banner__title { font: var(--fs-text-headline); }

.fs-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; background: var(--fs-gray); color: #fff; font: 600 14px/1 var(--fs-font-sans); }
.fs-avatar--lg { width: 56px; height: 56px; font-size: 22px; }
