/* ==========================================================================
   Purl — 관리 UI
   sufly 디자인 시스템 준수
     · 박스 외곽선 / box-shadow 금지 (floating 만 .shadow-floating)
     · left-border 금지, 선택 상태는 배경 틴트
     · 최소 12px, 기본 텍스트 #111
     · active/선택은 블루가 아니라 #111 / 옅은 그레이 rgba(17,17,17,0.04)
     · 인풋·셀렉트·텍스트영역은 하단선만
     · 영역 분리는 흰 ↔ 옅은 회색 면 대비
     · 이모지 금지 → lucide 인라인 SVG
   ========================================================================== */

/* --------------------------------------------------------------------------
   Pretendard 는 fonts/pretendard.css 에서 불러온다 (dynamic subset · 자체 호스팅).
   각 페이지가 app.css 보다 먼저 link 하므로 여기서 @import 하지 않는다.
   -------------------------------------------------------------------------- */

:root {
    /* 면 (surface) */
    --white:      #ffffff;
    --gray-50:    #f8f9fa;
    --tint-2:     rgba(17, 17, 17, 0.02);
    --tint-4:     rgba(17, 17, 17, 0.04);
    --tint-6:     rgba(17, 17, 17, 0.06);
    --tint-8:     rgba(17, 17, 17, 0.08);
    --page:       #f8f9fa;

    /* 텍스트 */
    --fg:         #111111;
    --fg-title:   #111827;
    --gray-400:   #9ca3af;
    --gray-500:   #6b7280;
    --gray-600:   #4b5563;
    --fg-th:      rgba(17, 17, 17, 0.45);

    /* 브랜드 */
    --primary:    #1e1e5a;   /* navy — 버튼·accent 채움 */
    --accent:     #316ff6;   /* 브랜드 강조·picker 선택일 전용 */
    --cyan:       #4fd3f1;
    --pink:       #ff1277;

    /* 시맨틱 */
    --green-50:  #ecfdf5; --green-100: #d1fae5; --green-600: #059669; --green-700: #047857;
    --red-50:    #fef2f2; --red-100:   #fee2e2; --red-600:   #dc2626;
    --amber-100: #fef3c7; --amber-700: #b45309;
    --blue-100:  #dbeafe; --blue-700:  #1d4ed8;
    --purple-100:#f3e8ff; --purple-700:#7e22ce;
    --orange-100:#ffedd5; --orange-700:#c2410c;
    --yellow-100:#fef9c3; --yellow-700:#a16207;
    --cyan-100:  #cffafe; --cyan-700:  #0e7490;
    --gray-100:  #f3f4f6;

    /* 라디우스 (카드 10, 버튼·인풋 8, 뱃지 full) */
    --r-card: 10px;
    --r-ctl:  8px;
    --r-sm:   6px;

    --topbar-h:  60px;
    --sidebar-w: 216px;
    --ease: cubic-bezier(.22, .61, .36, 1);

    /* 글꼴 — 국문(과 국영문 병기)은 Pretendard, 영문 전용 요소(코드·URL·단축키·확장자)만 Roboto */
    --font-kr: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Segoe UI',
               'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
    --font-en: Roboto, 'Pretendard Variable', Pretendard, system-ui, sans-serif;

    /* 테마에 따라 바뀌는 보조 토큰 */
    --topbar-bg:       #000;
    --overlay:         rgba(255, 255, 255, .92);   /* 카드 위에 떠 있는 작은 버튼 배경 */
    --backdrop:        rgba(0, 0, 0, .2);
    --primary-hover:   #2a2a72;
    --shadow-floating: 0 4px 16px rgba(17, 17, 17, 0.04);
    --doc-bg:          #fff;                       /* PDF·HTML 미리보기 배경 — 문서는 항상 흰 종이 */
}

/* --------------------------------------------------------------------------
   다크 모드 (기본). html[data-theme="light"] 이면 위 :root 값이 그대로 쓰인다.
   면 대비는 밝기 순서를 그대로 뒤집는다: 페이지(가장 어둡) < 옅은 면 < 카드 면.
   -------------------------------------------------------------------------- */
html[data-theme="dark"] {
    color-scheme: dark;
    --white:      #171a21;
    --gray-50:    #1e2129;
    --gray-100:   #262a33;
    --tint-2:     rgba(255, 255, 255, 0.03);
    --tint-4:     rgba(255, 255, 255, 0.05);
    --tint-6:     rgba(255, 255, 255, 0.08);
    --tint-8:     rgba(255, 255, 255, 0.11);
    --page:       #0f1115;

    --fg:         #ecedf1;
    --fg-title:   #f6f7f9;
    --gray-400:   #6f7683;
    --gray-500:   #9aa1ad;
    --gray-600:   #c2c7d0;
    --fg-th:      rgba(255, 255, 255, 0.5);

    --primary:       #5b7cfa;
    --primary-hover: #4a6cf0;
    --topbar-bg:     #0a0b0f;
    --overlay:       rgba(23, 26, 33, .92);
    --backdrop:      rgba(0, 0, 0, .55);
    --shadow-floating: 0 8px 28px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06);

    --green-50:  rgba(16, 185, 129, .14); --green-100: rgba(16, 185, 129, .22); --green-600: #34d399; --green-700: #6ee7b7;
    --red-50:    rgba(239, 68, 68, .14);  --red-100:   rgba(239, 68, 68, .22);  --red-600:   #f87171;
    --amber-100: rgba(245, 158, 11, .22); --amber-700: #fbbf24;
    --blue-100:  rgba(59, 130, 246, .22); --blue-700:  #93c5fd;
    --purple-100:rgba(168, 85, 247, .22); --purple-700:#d8b4fe;
    --orange-100:rgba(249, 115, 22, .22); --orange-700:#fdba74;
    --yellow-100:rgba(234, 179, 8, .22);  --yellow-700:#fde047;
    --cyan-100:  rgba(6, 182, 212, .22);  --cyan-700:  #67e8f9;
}

/* floating 요소에만 허용되는 최소 드롭섀도우 */
.shadow-floating { box-shadow: var(--shadow-floating); }

* { box-sizing: border-box; }

/* 클래스 선택자가 UA 의 [hidden]{display:none} 을 이기므로 명시적으로 되돌린다. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--page);
    color: var(--fg);
    font: 500 14px/1.55 var(--font-kr);
    font-feature-settings: 'tnum' 0;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

::selection { background: rgba(49, 111, 246, .18); }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ico { flex: none; display: block; }

/* --------------------------------------------------------------------------
   타이포 (.h1~.h6)
   -------------------------------------------------------------------------- */
.h1 { font-size: 26px; font-weight: 700; color: var(--fg-title); letter-spacing: -.02em; }
.h2 { font-size: 18px; font-weight: 700; color: var(--fg); }
.h3 { font-size: 16px; font-weight: 700; color: var(--fg); }
.h4 { font-size: 14px; font-weight: 700; color: var(--fg); }
.h5 { font-size: 12px; font-weight: 700; color: var(--gray-500); }
.h6 { font-size: 12px; font-weight: 600; color: var(--gray-500); }

/* --------------------------------------------------------------------------
   버튼
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 14px;
    border-radius: var(--r-ctl);
    background: var(--tint-4);
    color: var(--fg);
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
    transition: background .14s var(--ease), opacity .14s var(--ease);
}
.btn:hover  { background: var(--tint-8); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

.btn-primary       { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent        { background: var(--accent); color: #fff; }
.btn-accent:hover  { background: #2560e0; }
.btn-ghost         { background: transparent; color: var(--gray-500); }
.btn-ghost:hover   { background: var(--tint-4); color: var(--fg); }
.btn-danger        { background: var(--red-50); color: var(--red-600); }
.btn-danger:hover  { background: var(--pink); color: #fff; }
.btn-sm            { height: 32px; padding: 0 11px; font-size: 12px; border-radius: var(--r-ctl); }
.btn-block         { width: 100%; }

.icon-btn {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: var(--r-ctl);
    background: transparent;
    color: var(--gray-500);
    flex: none;
    transition: background .14s var(--ease), color .14s var(--ease);
}
.icon-btn:hover { background: var(--tint-4); color: var(--fg); }
.icon-btn.on    { background: var(--tint-8); color: var(--fg); }

/* 세그먼트 (뷰 전환) — active 는 #111, 블루 아님 */
.seg { display: flex; gap: 2px; padding: 2px; border-radius: var(--r-ctl); background: var(--tint-4); }
.seg-btn {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: var(--r-sm);
    color: var(--gray-500);
    transition: background .14s var(--ease), color .14s var(--ease);
}
.seg-btn:hover  { color: var(--fg); }
.seg-btn.is-on  { background: var(--white); color: var(--fg); }

kbd {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--tint-6);
    color: var(--gray-600);
    font: 700 12px/1.5 var(--font-en);
}

/* --------------------------------------------------------------------------
   인풋 — 하단선만, rounded-none
   -------------------------------------------------------------------------- */
.field { display: block; }
.field + .field { margin-top: 16px; }
.field-label {
    display: block;
    margin-bottom: 2px;
    color: var(--gray-500);
    font-size: 12px;
    font-weight: 700;
}
.field input[type=text], .field input[type=password], .field input[type=search], .field input[type=number],
.field textarea, .field select, .inp {
    width: 100%;
    padding: 8px 2px;
    border: 0;
    border-bottom: 1px solid var(--tint-8);
    border-radius: 0;
    background: transparent;
    color: var(--fg);
    font-size: 14px;
    transition: border-color .14s var(--ease);
}
.field input:focus, .field textarea:focus, .inp:focus {
    outline: none;
    border-bottom-color: var(--primary);
}
.field input::placeholder, .field textarea::placeholder { color: var(--gray-400); }
.field textarea { resize: vertical; min-height: 62px; line-height: 1.65; }
.field-row { display: flex; gap: 16px; }
.field-row > * { flex: 1; min-width: 0; margin-top: 0; }
.field-hint { margin: 6px 0 0; color: var(--gray-500); font-size: 12px; line-height: 1.6; }
.field-req { color: var(--red-600); }

/* --------------------------------------------------------------------------
   상단 바 — bg-black h-60
   -------------------------------------------------------------------------- */
.topbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--topbar-h);
    padding: 0 16px;
    background: var(--topbar-bg);
    color: #fff;
}

.brand { display: flex; align-items: center; color: #fff; text-decoration: none; flex: none; }
.brand svg { display: block; height: 15px; width: auto; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: var(--r-ctl);
    background: var(--accent);
    color: #fff;
    font: 700 15px/1 Roboto, 'Pretendard Variable', sans-serif;
}
.brand-name { font: 700 16px/1 Roboto, 'Pretendard Variable', sans-serif; letter-spacing: -.01em; }

.search { position: relative; display: flex; align-items: center; flex: 1; max-width: 520px; }
.search > .ico { position: absolute; left: 12px; color: rgba(255,255,255,.5); pointer-events: none; }
.search input {
    width: 100%;
    height: 38px;
    padding: 0 36px 0 36px;
    border: 0;
    border-radius: var(--r-ctl);
    background: rgba(255,255,255,.09);
    color: #fff;
    font-size: 14px;
}
.search input::placeholder { color: rgba(255,255,255,.45); }
.search input:focus { outline: none; background: rgba(255,255,255,.15); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear {
    position: absolute;
    right: 7px;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255,255,255,.14);
    color: #fff;
}
.search-clear:hover { background: rgba(255,255,255,.26); }

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.topbar .seg { background: rgba(255,255,255,.09); }
.topbar .seg-btn { color: rgba(255,255,255,.6); }
.topbar .seg-btn:hover { color: #fff; }
.topbar .seg-btn.is-on { background: rgba(255,255,255,.92); color: #111; }
.topbar .icon-btn { color: rgba(255,255,255,.65); }
.topbar .icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }

/* --------------------------------------------------------------------------
   레이아웃
   -------------------------------------------------------------------------- */
.shell { display: flex; height: 100%; padding-top: var(--topbar-h); }

.sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    flex: none;
    padding: 16px 10px 12px;
    background: var(--white);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.facet { display: flex; flex-direction: column; gap: 1px; }
.facet-scroll { max-height: 224px; overflow-y: auto; overscroll-behavior: contain; }
.facet-head {
    padding: 16px 10px 6px;
    color: var(--gray-500);
    font-size: 12px;
    font-weight: 700;
}
.facet-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--r-sm);
    color: var(--gray-600);
    font-size: 13px;
    text-align: left;
    transition: background .12s var(--ease), color .12s var(--ease);
}
.facet-item:hover  { background: var(--tint-4); color: var(--fg); }
.facet-item.is-on  { background: var(--tint-4); color: var(--fg); font-weight: 700; }
.facet-item > .ico { color: var(--gray-400); }
.facet-item.is-on > .ico { color: var(--fg); }
.facet-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet-count { color: var(--gray-400); font-size: 12px; font-variant-numeric: tabular-nums; }
.facet-item.is-on .facet-count { color: var(--gray-600); }
.facet-empty { padding: 7px 10px; color: var(--gray-400); font-size: 12px; }

.sidebar-foot {
    margin-top: auto;
    padding: 16px 10px 4px;
    color: var(--gray-400);
    font-size: 12px;
    line-height: 1.7;
}

.main {
    flex: 1;
    min-width: 0;
    padding: 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.main > * + * { margin-top: 24px; }

/* --------------------------------------------------------------------------
   드롭존 — 옅은 회색 면, 점선 테두리 없음
   -------------------------------------------------------------------------- */
.dropzone {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-radius: var(--r-card);
    background: var(--white);
    cursor: pointer;
    transition: background .15s var(--ease);
}
.dropzone:hover { background: var(--tint-2); }
.dropzone.is-over { background: var(--tint-4); box-shadow: inset 0 0 0 1px var(--accent); }

.dropzone-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: var(--r-ctl);
    background: var(--tint-4);
    color: var(--gray-500);
}
.dropzone-text { flex: 1; min-width: 0; }
.dropzone-text strong { display: block; font-size: 14px; font-weight: 700; }
.dropzone-text span { display: block; margin-top: 3px; color: var(--gray-500); font-size: 12px; }
.dropzone-mode { display: flex; align-items: center; gap: 8px; flex: none; }

/* 통합/개별 토글 — active #111 */
.modeseg { display: flex; gap: 2px; padding: 2px; border-radius: var(--r-ctl); background: var(--tint-4); }
.modeseg button {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 11px;
    border-radius: var(--r-sm);
    color: var(--gray-500);
    font-size: 12px;
    font-weight: 700;
}
.modeseg button.is-on { background: var(--white); color: var(--fg); }

/* 전역 드래그 인디케이터 — 미니멀: 화면 테두리 링 + 작은 알약 */
.drop-ring {
    position: fixed;
    inset: 0;
    z-index: 90;
    pointer-events: none;
    box-shadow: inset 0 0 0 2px var(--accent);
    background: rgba(49, 111, 246, .04);
}
.drop-pill {
    position: fixed;
    left: 50%;
    bottom: 32px;
    z-index: 91;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--fg);
    color: var(--page);
    font-size: 13px;
    font-weight: 700;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   툴바 (필터 · 정렬 · 날짜)
   -------------------------------------------------------------------------- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.toolbar-spacer { flex: 1; }
.toolbar-count { color: var(--gray-500); font-size: 12px; font-variant-numeric: tabular-nums; }

/* SelectPopover 트리거 — 하단선 */
.sel-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 2px 0 2px;
    min-width: 96px;
    border-bottom: 1px solid var(--tint-8);
    color: var(--fg);
    font-size: 13px;
    font-weight: 600;
    transition: border-color .14s var(--ease);
}
.sel-trigger:hover { border-bottom-color: var(--tint-8); }
.sel-trigger[aria-expanded="true"] { border-bottom-color: var(--primary); }
.sel-trigger .sel-value { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-trigger .ico { color: var(--gray-400); }
.sel-trigger.is-set .sel-value { font-weight: 700; }

/* 팝오버 (floating) */
.pop {
    position: fixed;
    z-index: 120;
    min-width: 168px;
    max-height: 320px;
    overflow-y: auto;
    padding: 6px;
    border-radius: var(--r-card);
    background: var(--white);
    box-shadow: 0 4px 16px rgba(17, 17, 17, 0.04);
}
.pop-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border-radius: var(--r-sm);
    color: var(--fg);
    font-size: 13px;
    text-align: left;
}
.pop-item:hover { background: var(--tint-4); }
.pop-item.is-on { font-weight: 700; }
.pop-item .ico { color: var(--fg); opacity: 0; }
.pop-item.is-on .ico { opacity: 1; }
.pop-item.danger { color: var(--red-600); }
.pop-gap { height: 6px; }

/* CalendarPicker — 달력은 목록보다 키가 커서 .pop 의 max-height 를 따로 푼다 */
.pop-cal { max-height: min(520px, 88vh); }
.cal { width: 268px; padding: 12px; }
.cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; }
.cal-title { flex: 1; text-align: center; font-size: 13px; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow {
    display: grid;
    place-items: center;
    height: 26px;
    color: var(--fg-th);
    font-size: 12px;
    font-weight: 700;
}
.cal-day {
    display: grid;
    place-items: center;
    height: 32px;
    border-radius: 999px;
    color: var(--fg);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.cal-day:hover:not(.is-off) { background: var(--tint-4); }
.cal-day.is-off { color: var(--gray-400); opacity: .5; }
.cal-day.is-today { font-weight: 700; }
.cal-day.in-range { background: var(--tint-4); border-radius: 0; }
.cal-day.is-sel { background: var(--accent); color: #fff; font-weight: 700; }
.cal-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--tint-6);
}
.cal-foot .btn-sm { flex: 1; }
.cal-hint { color: var(--gray-500); font-size: 12px; text-align: center; margin: 0 0 8px; }

/* 활성 필터 칩 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 8px 0 11px;
    border-radius: 999px;
    background: var(--tint-4);
    color: var(--fg);
    font-size: 12px;
    font-weight: 600;
}
.chip:hover { background: var(--tint-8); }
.chip .ico { color: var(--gray-500); }

/* 선택 바 */
.bulkbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px 10px 16px;
    border-radius: var(--r-card);
    background: var(--tint-4);
    font-size: 13px;
    font-weight: 700;
}
.bulkbar-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   파일타입 칩 (8종 고정색)
   -------------------------------------------------------------------------- */
.ftype {
    font-family: var(--font-en);
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .01em;
    text-transform: uppercase;
}
.ftype-pdf   { background: var(--red-100);    color: var(--red-600); }
.ftype-xls   { background: var(--green-100);  color: var(--green-700); }
.ftype-doc   { background: var(--blue-100);   color: var(--blue-700); }
.ftype-png   { background: var(--purple-100); color: var(--purple-700); }
.ftype-jpg   { background: var(--orange-100); color: var(--orange-700); }
.ftype-zip   { background: var(--yellow-100); color: var(--yellow-700); }
.ftype-url   { background: var(--cyan-100);   color: var(--cyan-700); }
.ftype-other { background: var(--gray-100);   color: var(--gray-600); }

/* 시맨틱 뱃지 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-green   { background: var(--green-100);  color: var(--green-700); }
.badge-red     { background: var(--red-100);    color: var(--red-600); }
.badge-amber   { background: var(--amber-100);  color: var(--amber-700); }
.badge-blue    { background: var(--blue-100);   color: var(--blue-700); }
.badge-neutral { background: var(--gray-100);   color: var(--gray-600); }

/* --------------------------------------------------------------------------
   결과 — 날짜 그룹
   -------------------------------------------------------------------------- */
.group + .group { margin-top: 28px; }
.group-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0 0 12px 2px;
    font-size: 13px;
    font-weight: 700;
    color: var(--fg);
}
.group-head .n { color: var(--gray-400); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- 카드 뷰 ---- */
.view-card .group-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.card {
    position: relative;
    border-radius: var(--r-card);
    background: var(--white);
    cursor: pointer;
    overflow: hidden;
    user-select: none; /* 더블클릭이 열기라서 텍스트 선택이 일어나지 않게 */
    -webkit-user-select: none;
    transition: background .14s var(--ease);
}
.card:hover   { background: var(--tint-2); }
/* 선택 = 테두리(2px 링) + 옅은 틴트. 체크박스 대신 카드 자체가 선택돼 보이게.
   링은 ::after 오버레이로 그려 썸네일 이미지 위에도 보인다 */
.card.is-sel  { background: var(--tint-4); }
.card.is-sel::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 2px var(--fg);
    pointer-events: none;
}

/* 썸네일이 없을 때는 회색 상자를 그리지 않고 카드의 흰 면을 그대로 둔다.
   카드(흰) ↔ 페이지(옅은 회색) 대비가 살고, hover·선택 틴트도 카드 전체에 고르게 깔린다. */
.card-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
    background: transparent;
    color: var(--gray-400);
    overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb .ftype { position: absolute; bottom: 8px; right: 8px; }

.card-body { padding: 10px 12px 12px; }
.card-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--fg);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}
.card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    color: var(--gray-500);
    font-size: 12px;
}
.card-code {
    font: 700 12px/1 var(--font-en);
    color: var(--fg);
}
.card-dot { color: var(--gray-400); }

.card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity .12s var(--ease);
}
.card:hover .card-actions, .card:focus-within .card-actions { opacity: 1; }
.card-act {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    background: var(--overlay);
    color: var(--gray-600);
}
.card-act:hover { background: var(--fg); color: var(--page); }

.card-flags { position: absolute; bottom: 8px; left: 8px; display: flex; gap: 4px; }
.flag {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: var(--r-sm);
    background: var(--overlay);
}
.flag-lock { color: var(--amber-700); }
.flag-exp  { color: var(--red-600); }
.flag-time { color: var(--gray-500); }

/* ---- 갤러리 뷰 (썸네일 위주) ---- */
.view-gallery .group-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}
.view-gallery .card-body { display: none; }
.view-gallery .card-thumb { aspect-ratio: 1; }
.view-gallery .card { border-radius: var(--r-ctl); }

/* ---- 리스트 뷰 — 미니멀 테이블 ---- */
.view-list .group-items { display: block; background: var(--white); border-radius: var(--r-card); overflow: hidden; }
.view-list .lhead {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: 38px;
    border-bottom: 1px solid var(--tint-8);
    color: var(--fg-th);
    font-size: 12px;
    font-weight: 700;
}
.view-list .card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 0;
    border-bottom: 1px solid var(--tint-6);
    overflow: visible;
}
.view-list .card:last-child { border-bottom: 0; }
.view-list .card:hover { background: var(--tint-2); }
.view-list .card.is-sel { background: var(--tint-4); }
.view-list .card > * { flex: none; }
.view-list .card-thumb {
    order: 2;
    aspect-ratio: auto;
    width: 34px;
    height: 26px;
    border-radius: var(--r-sm);
}
.view-list .card-thumb .ftype { display: none; }
.view-list .card-body { order: 3; flex: 1 1 auto; min-width: 0; padding: 0; }
.view-list .card-name { -webkit-line-clamp: 1; }
.view-list .card-meta { display: none; }
.view-list .card-flags { order: 4; position: static; }
.view-list .lcol { color: var(--gray-500); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-list .lcol-type { order: 5; width: 56px; text-align: left; }
.view-list .lcol-code { order: 6; width: 92px; text-align: left; font: 700 12px/1 var(--font-en); color: var(--fg); }
.view-list .lcol-size { order: 7; width: 74px; }
.view-list .lcol-hits { order: 8; width: 54px; }
.view-list .lcol-date { order: 9; width: 84px; }
.lhead-act { order: 10; width: 96px; flex: none; }
.view-list .card-actions { order: 10; width: 96px; position: static; opacity: 0; justify-content: flex-end; }
.view-list .card:hover .card-actions, .view-list .card:focus-within .card-actions { opacity: 1; }

@media (max-width: 1020px) {
    .view-list .lcol-size, .view-list .lcol-hits, .view-list .lcol-type { display: none; }
}

/* --------------------------------------------------------------------------
   빈 상태 · 스켈레톤
   -------------------------------------------------------------------------- */
.empty { text-align: center; padding: 48px 20px; }
.empty > .ico { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--gray-400); }
.empty strong { display: block; font-size: 14px; font-weight: 700; color: var(--fg); }
.empty span { display: block; margin-top: 4px; color: var(--gray-500); font-size: 13px; }

.more-wrap { display: grid; place-items: center; padding: 8px 0; }

.skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.skeleton i { display: block; aspect-ratio: 4 / 3.6; border-radius: var(--r-card); background: var(--white); animation: pulse 1.1s var(--ease) infinite; }
@keyframes pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }

/* --------------------------------------------------------------------------
   Drawer — 우측 슬라이드, 오버레이 분리, 무그림자
   -------------------------------------------------------------------------- */
.drawer { position: fixed; inset: 0; z-index: 70; }
.drawer-backdrop { position: absolute; inset: 0; background: var(--backdrop); animation: fade .18s var(--ease); }
@keyframes fade { from { opacity: 0; } }

.drawer-panel {
    position: absolute;
    inset: 0 0 0 auto;
    width: min(600px, 95vw);
    display: flex;
    flex-direction: column;
    background: var(--page);
    animation: slide .22s var(--ease);
}
.drawer-narrow { width: min(480px, 95vw); }
@keyframes slide { from { transform: translateX(20px); opacity: .5; } }

.drawer-head {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 0 12px 0 16px;
    background: var(--white);
    flex: none;
}
.drawer-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; overscroll-behavior: contain; }
.drawer-body > * + * { margin-top: 12px; }

.block { padding: 16px; border-radius: var(--r-card); background: var(--white); }
.block-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--gray-500);
    font-size: 12px;
    font-weight: 700;
}
.block-head .spacer { flex: 1; }

/* 미리보기 */
.preview {
    display: grid;
    place-items: center;
    min-height: 140px;
    max-height: 54vh;
    border-radius: var(--r-card);
    background: var(--gray-50);
    color: var(--gray-400);
    overflow: hidden;
}
.preview img, .preview video { max-width: 100%; max-height: 54vh; display: block; object-fit: contain; }
.preview audio { width: 90%; margin: 24px 0; }
.preview iframe { width: 100%; height: 54vh; border: 0; background: var(--doc-bg); display: block; }
.preview > .ico { width: 48px; height: 48px; margin: 40px 0; }

/* URL 행 */
.urlrow {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 8px 9px 12px;
    border-radius: var(--r-ctl);
    background: var(--gray-50);
}
.urlrow + .urlrow { margin-top: 6px; }
.urlrow .lbl { flex: none; width: 40px; color: var(--gray-500); font-size: 12px; font-weight: 700; }
.urlrow .u {
    flex: 1;
    min-width: 0;
    font: 400 13px/1.45 var(--font-en);
    color: var(--fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.urlrow.primary { background: var(--tint-4); }
.urlrow.primary .u { font-size: 14px; font-weight: 700; }

/* 메타 표 */
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 8px 14px; margin: 0; font-size: 13px; }
.kv dt { color: var(--gray-500); }
.kv dd { margin: 0; color: var(--fg); word-break: break-all; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 12px;
}
.tag:hover { background: var(--tint-8); color: var(--fg); }

/* 폴더/번들 파일 목록 — 미니멀 테이블 */
.filelist { max-height: 320px; overflow-y: auto; }
.filerow {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 4px;
    border-bottom: 1px solid var(--tint-6);
    color: var(--gray-600);
    font-size: 13px;
    text-decoration: none;
}
.filerow:last-child { border-bottom: 0; }
.filerow:hover { background: var(--tint-2); color: var(--fg); }
.filerow > .ico { color: var(--gray-400); }
.filerow .p { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filerow .s { color: var(--gray-400); font-size: 12px; font-variant-numeric: tabular-nums; }
.filerow.is-entry .p { font-weight: 700; color: var(--fg); }

.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* 통계 */
.stat-row { display: flex; gap: 20px; }
.stat { flex: 1; min-width: 0; }
.stat b { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat span { color: var(--gray-500); font-size: 12px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 48px; }
.spark i { flex: 1; min-width: 3px; max-width: 14px; border-radius: 2px 2px 0 0; background: var(--accent); opacity: .85; }

/* --------------------------------------------------------------------------
   업로드 큐
   -------------------------------------------------------------------------- */
.queue {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 80;
    width: 348px;
    max-height: 62vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--r-card);
    background: var(--white);
    box-shadow: var(--shadow-floating);
    overflow: hidden;
}
.queue-head { display: flex; align-items: center; gap: 8px; padding: 12px 8px 12px 16px; flex: none; }
.queue-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; }
.queue-sub { color: var(--gray-500); font-size: 12px; font-weight: 500; }

.queue-progress { height: 2px; background: var(--tint-6); flex: none; }
.queue-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s var(--ease); }

.queue-bundle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 12px 8px;
    padding: 10px 12px;
    border-radius: var(--r-ctl);
    background: var(--tint-4);
}
.queue-bundle .lbl { color: var(--gray-500); font-size: 12px; font-weight: 700; flex: none; }
.queue-bundle code { flex: 1; min-width: 0; font: 700 13px/1.4 var(--font-en); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }

.queue-list { list-style: none; margin: 0; padding: 0 12px 12px; overflow-y: auto; overscroll-behavior: contain; }
.qitem { padding: 9px 4px; border-bottom: 1px solid var(--tint-6); }
.qitem:last-child { border-bottom: 0; }
.qitem-top { display: flex; align-items: center; gap: 8px; }
.qitem-top > .ico { color: var(--gray-400); }
.qitem-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem-state { color: var(--gray-500); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.qitem-bar { height: 3px; margin-top: 7px; border-radius: 2px; background: var(--tint-6); overflow: hidden; }
.qitem-bar i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--accent); transition: width .18s var(--ease); }
.qitem-detail { margin-top: 4px; color: var(--gray-400); font-size: 12px; }

.qitem.is-done .qitem-state { color: var(--green-600); font-weight: 700; }
.qitem.is-fail .qitem-state { color: var(--red-600); font-weight: 700; }
.qitem.is-dup  .qitem-state { color: var(--blue-700); font-weight: 700; }
.qitem.is-fail .qitem-name  { color: var(--red-600); }

.qitem-url { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.qitem-url code {
    flex: 1;
    min-width: 0;
    font: 500 12px/1.4 var(--font-en);
    color: var(--fg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}
.qitem-err { margin-top: 5px; color: var(--red-600); font-size: 12px; line-height: 1.5; }
.qitem-actions { display: flex; gap: 4px; margin-top: 6px; }

/* 진행 스피너 */
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   토스트 — 흰 카드 + 시맨틱 아이콘, 무그림자
   -------------------------------------------------------------------------- */
.toasts {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 130;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    transform: translateX(-50%);
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: 86vw;
    padding: 11px 18px;
    border-radius: var(--r-card);
    background: var(--white);
    color: var(--fg);
    font-size: 13px;
    font-weight: 600;
    animation: pop .2s var(--ease);
}
.toast.ok  > .ico { color: var(--green-600); }
.toast.err > .ico { color: var(--red-600); }
.toast.info > .ico { color: var(--gray-500); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* --------------------------------------------------------------------------
   로그인 화면
   -------------------------------------------------------------------------- */
body.gate { display: grid; place-items: center; overflow: auto; padding: 6vh 20px; }
.gate-card { width: 100%; max-width: 360px; padding: 32px 28px 24px; border-radius: var(--r-card); background: var(--white); }
.gate-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.gate-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: var(--r-card);
    background: var(--accent);
    color: #fff;
    font: 700 20px/1 Roboto, 'Pretendard Variable', sans-serif;
}
.gate-brand svg { display: block; height: 22px; width: auto; color: var(--fg); }
.gate-brand p  { margin: 0; color: var(--gray-500); font: 500 13px/1.4 var(--font-en); }
.gate-notice { margin: 0 0 20px; padding: 12px 14px; border-radius: var(--r-ctl); background: var(--gray-50); color: var(--gray-600); font-size: 13px; line-height: 1.65; }
.gate-error { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; color: var(--red-600); font-size: 13px; }
.gate-card form .btn { margin-top: 24px; }
.gate-foot { margin: 20px 0 0; color: var(--gray-400); font-size: 12px; text-align: center; line-height: 1.7; }

/* --------------------------------------------------------------------------
   문서형 페이지 (setup.php)
   -------------------------------------------------------------------------- */
body.doc { overflow: auto; padding: 48px 24px 96px; }
.doc-wrap { max-width: 720px; margin: 0 auto; }
.doc-wrap h1 { font-size: 26px; font-weight: 700; color: var(--fg-title); margin: 0 0 6px; letter-spacing: -.02em; }
.doc-wrap h2 { font-size: 18px; font-weight: 700; margin: 32px 0 12px; }
.doc-lead { margin: 0 0 28px; color: var(--gray-500); font-size: 14px; }
.doc-lead a { color: var(--accent); }
.check { display: flex; gap: 12px; padding: 12px 16px; border-radius: var(--r-ctl); background: var(--white); }
.check + .check { margin-top: 4px; }
.check > .ico { flex: none; margin-top: 2px; }
.check.pass > .ico { color: var(--green-600); }
.check.warn > .ico { color: var(--amber-700); }
.check.fail > .ico { color: var(--red-600); }
.check .tx { flex: 1; min-width: 0; }
.check .tx b { display: block; font-size: 13px; font-weight: 700; }
.check .tx span { color: var(--gray-500); font-size: 13px; word-break: break-all; line-height: 1.6; }
.doc-wrap code { padding: 2px 6px; border-radius: 4px; background: var(--gray-100); font: 400 13px/1.5 var(--font-en); word-break: break-all; }
.doc-wrap pre { margin: 10px 0 0; padding: 14px 16px; border-radius: var(--r-ctl); background: var(--white); overflow-x: auto; font: 400 13px/1.7 var(--font-en); }
.doc-wrap pre code { background: none; padding: 0; }
.doc-wrap p { font-size: 13px; line-height: 1.75; color: var(--gray-600); }

/* ==========================================================================
   현대적 컴포넌트
   ========================================================================== */

/* --- 커맨드 팔레트 (Ctrl/⌘ + K) --- */
.cmdk { position: fixed; inset: 0; z-index: 140; display: flex; justify-content: center; padding-top: 12vh; }
.cmdk-backdrop { position: absolute; inset: 0; background: var(--backdrop); animation: fade .15s var(--ease); }
.cmdk-panel {
    position: relative;
    width: min(620px, calc(100vw - 32px));
    max-height: 62vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--r-card);
    background: var(--white);
    box-shadow: 0 4px 16px rgba(17, 17, 17, 0.04);
    overflow: hidden;
    animation: cmdk-in .16s var(--ease);
}
@keyframes cmdk-in { from { transform: translateY(-8px) scale(.99); opacity: 0; } }

.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; flex: none; }
.cmdk-input > .ico { color: var(--gray-400); }
.cmdk-input input {
    flex: 1; min-width: 0; border: 0; background: transparent;
    font-size: 15px; color: var(--fg); outline: none;
}
.cmdk-input input::placeholder { color: var(--gray-400); }
.cmdk-hint { display: flex; gap: 4px; flex: none; }

.cmdk-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; overscroll-behavior: contain; }
.cmdk-sec { padding: 10px 8px 4px; color: var(--gray-400); font-size: 12px; font-weight: 700; }
.cmdk-row {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 10px; border-radius: var(--r-ctl); text-align: left; color: var(--fg);
}
.cmdk-row > .ico { color: var(--gray-500); }
.cmdk-row.is-cur { background: var(--tint-4); }
.cmdk-row .t { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-row .s { color: var(--gray-400); font-size: 12px; flex: none; }
.cmdk-row .c {
    font: 700 12px/1 var(--font-en);
    color: var(--gray-500); flex: none;
}
.cmdk-thumb {
    width: 28px; height: 22px; flex: none; border-radius: 4px;
    background: var(--gray-50); object-fit: cover; display: block;
}
.cmdk-empty { padding: 28px 12px; text-align: center; color: var(--gray-400); font-size: 13px; }

/* --- 라이트박스 --- */
.lightbox { position: fixed; inset: 0; z-index: 150; display: flex; flex-direction: column; background: rgba(17, 17, 17, .94); }
.lb-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; color: #fff; flex: none;
}
.lb-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-count { color: rgba(255, 255, 255, .5); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.lb-bar .icon-btn { color: rgba(255, 255, 255, .7); }
.lb-bar .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.lb-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 64px 24px; position: relative; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.lb-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    display: grid; place-items: center; width: 44px; height: 44px;
    border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff;
}
.lb-nav:hover { background: rgba(255, 255, 255, .2); }
.lb-nav.prev { left: 12px; }
.lb-nav.next { right: 12px; }
.lb-foot {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 0 16px 20px; flex: none;
}
.lb-url {
    font: 500 12.5px/1 var(--font-en);
    color: rgba(255, 255, 255, .75); padding: 8px 12px;
    border-radius: var(--r-ctl); background: rgba(255, 255, 255, .08); cursor: pointer;
}
.lb-url:hover { background: rgba(255, 255, 255, .16); color: #fff; }

@media (max-width: 720px) {
    .lb-stage { padding: 0 12px 16px; }
    .lb-nav { width: 36px; height: 36px; }
}

/* --- 컨텍스트 메뉴 --- */
/* ---- 컨텍스트 메뉴 (팝오버형) ---- */
.ctx {
    min-width: 224px;
    max-width: 380px;
    max-height: min(640px, 92vh);
    padding: 6px;
    outline: none;
    animation: ctx-in .12s var(--ease);
}
.ctx-sub { min-width: 204px; }
@keyframes ctx-in { from { opacity: 0; transform: translateY(-3px) scale(.985); } }

.ctx .pop-item { gap: 10px; height: 32px; padding: 0 10px 0 8px; }
.ctx .pop-item .ico { flex: none; opacity: 1; color: var(--gray-500); }
.ctx .pop-item .ctx-check { color: var(--fg); }
.ctx .pop-item.danger .ico { color: var(--red-600); }
.ctx .pop-item:focus { outline: none; background: var(--tint-4); }
.ctx .pop-item[disabled] { opacity: .45; cursor: default; }
.ctx .pop-item[disabled]:hover { background: transparent; }
.ctx-blank { display: inline-block; flex: none; width: 14px; height: 14px; }
.ctx-label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-hint { margin-left: 18px; padding: 0; background: transparent; color: var(--gray-400); font: 600 12px/1.5 var(--font-en); }
.ctx .pop-item .ctx-more { margin-left: auto; color: var(--gray-400); }
.ctx-head {
    padding: 6px 8px 4px;
    color: var(--gray-500);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ctx-sep { height: 1px; margin: 5px 8px; background: var(--tint-6); }

/* 메뉴에서 이어지는 작은 폼 (태그 추가) */
.pop-form { min-width: 272px; padding: 6px; }
.ctx-form-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px 6px; }
.ctx-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 2px;
    border: 0;
    border-bottom: 1px solid var(--tint-8);
    background: transparent;
    color: var(--fg);
    font-size: 13px;
    outline: none;
}
.ctx-input:focus { border-bottom-color: var(--fg); }

/* --------------------------------------------------------------------------
   폴더 — 사이드바 트리 · 경로 표시줄 · 폴더 카드 · 드롭 대상
   -------------------------------------------------------------------------- */
.facet-head-row { display: flex; align-items: center; justify-content: space-between; padding-right: 4px; }
.facet-add {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: var(--r-sm);
    color: var(--gray-400);
}
.facet-add:hover { background: var(--tint-4); color: var(--fg); }
.facet-folders .facet-item { padding-left: calc(10px + var(--depth, 0) * 14px); }

.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; min-height: 28px; }
.crumbs + .toolbar { margin-top: 12px; }
.crumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 8px;
    border-radius: var(--r-sm);
    color: var(--gray-500);
    font-size: 13px;
    font-weight: 600;
}
.crumb:hover { background: var(--tint-4); color: var(--fg); }
.crumb.is-current { color: var(--fg); font-weight: 700; cursor: default; }
.crumb.is-current:hover { background: transparent; }
.crumb-sep { display: inline-flex; color: var(--gray-400); }
.crumb-note { margin-left: 8px; color: var(--gray-400); font-size: 12px; }

.card-folder .card-thumb .ico { color: var(--gray-500); }
.card-folder .card-name { font-weight: 700; }
.view-list .card-folder .lcol-code { color: var(--gray-400); font-weight: 600; }

/* --------------------------------------------------------------------------
   통합 URL 작성 패널 — 큰 인디케이터 · 제목 · 파일 모으기 · 생성된 URL
   -------------------------------------------------------------------------- */
.bundle-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px 20px;
    border-radius: var(--r-card);
    background: var(--white);
}
.bp-head { display: flex; align-items: center; gap: 14px; }
.bp-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    flex: none;
}
.bp-head-text { flex: 1; min-width: 0; }
.bp-head-text strong { display: block; font-size: 15px; font-weight: 700; }
.bp-head-text .sub { display: block; margin-top: 2px; color: var(--gray-500); font-size: 12px; }

/* 묶는 방식 토글 (갤러리/웹페이지) — 세로 flex 안에서 자연 폭을 유지한다 */
.bp-kind { display: flex; }

.bp-title {
    width: 100%;
    padding: 10px 2px;
    border: 0;
    border-bottom: 1px solid var(--tint-8);
    background: transparent;
    color: var(--fg);
    font-size: 15px;
    font-weight: 700;
    outline: none;
    transition: border-color .14s var(--ease);
}
.bp-title:focus { border-bottom-color: var(--fg); }
.bp-title::placeholder { color: var(--gray-400); font-weight: 600; }

.bp-drop {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 140px;
    padding: 12px;
    border-radius: var(--r-card);
    background: var(--gray-50);
    cursor: pointer;
    transition: background .15s var(--ease);
}
.bp-drop:hover { background: var(--tint-6); }
.bp-drop.is-over { background: var(--tint-8); box-shadow: inset 0 0 0 1px var(--accent); }
.bp-drop-hint {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 18px 0;
    color: var(--gray-500);
    font-size: 12px;
    text-align: center;
}
.bp-drop-hint .ico { color: var(--gray-400); margin-bottom: 4px; }
.bp-drop-hint strong { color: var(--fg); font-size: 14px; font-weight: 700; }

.bp-list { display: flex; flex-direction: column; gap: 2px; }
.bp-row {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    padding: 0 8px 0 10px;
    border-radius: var(--r-sm);
    background: var(--white);
    font-size: 13px;
}
.bp-row .ico { color: var(--gray-500); }
.bp-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bp-row .size { color: var(--gray-500); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bp-row .rm { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r-sm); color: var(--gray-400); }
.bp-row .rm:hover { background: var(--tint-6); color: var(--fg); }
.bp-add { display: flex; justify-content: center; gap: 6px; padding-top: 4px; }

.bp-foot { display: flex; align-items: center; gap: 12px; }
.bp-count { color: var(--gray-500); font-size: 12px; font-weight: 600; }

.bp-result {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 14px;
    border-radius: var(--r-ctl);
    background: var(--green-50);
}
.bp-result.is-empty { background: var(--gray-50); }
.bp-result .lbl { color: var(--green-700); font-size: 12px; font-weight: 700; white-space: nowrap; }
.bp-result.is-empty .lbl { color: var(--gray-500); }
.bp-result input {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: var(--green-700);
    font: 700 13px/1 var(--font-en);
    outline: none;
}
.bp-result.is-empty input { color: var(--gray-500); font: 600 13px/1 'Pretendard Variable', Pretendard, sans-serif; }
.bp-result input::placeholder { color: var(--gray-400); }

/* 업로드 진행 표시 — 드롭존과 통합 패널 안에 함께 뜬다 (큐 상자를 안 봐도 진행률·속도·남은 시간을 안다) */
.upprog { display: flex; flex-direction: column; gap: 6px; }
.dropzone-text .upprog { margin-top: 10px; }
.bp-progress { flex: 1; min-width: 0; }
.upprog-bar { height: 6px; border-radius: 999px; background: var(--tint-6); overflow: hidden; }
.upprog-bar i { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width .2s var(--ease); }
.upprog-text { color: var(--gray-600); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* 끌어다 놓기 — 항목을 끄는 동안에만 나타나는 일시적 표시 */
.card.is-dragging, .facet-item.is-dragging { opacity: .5; }
.is-drop { background: var(--tint-8) !important; box-shadow: inset 0 0 0 2px var(--fg); }

/* --- 실행 취소 토스트 --- */
.toast-action {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 10px 9px 16px; pointer-events: auto;
}
.toast-action .btn-sm { flex: none; }

/* --- 복사 완료 피드백 --- */
.copied { color: var(--green-600) !important; }

/* --- 날짜 그룹 헤더 고정 --- */
.group-head {
    position: sticky;
    top: 0;
    z-index: 12;
    padding: 8px 2px;
    margin: 0 0 6px;
    background: var(--page);
}

/* --- 카드 키보드 포커스 --- */
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   좁은 화면
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    :root { --sidebar-w: 0px; }
    .sidebar { display: none; }
    .brand-name { display: none; }
    .topbar { gap: 10px; padding: 0 12px; }
    .main { padding: 16px 12px 40px; }
    .queue { left: 12px; right: 12px; width: auto; }
    .view-card .group-items { grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); }
    .dropzone { flex-wrap: wrap; }
    .dropzone-mode { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* --------------------------------------------------------------------------
   와이드 미리보기 — 속성 드로어를 화면 폭으로 넓히고 미리보기만 남긴다 (모달 아님, 같은 드로어)
   -------------------------------------------------------------------------- */
.drawer.is-wide .drawer-panel { width: min(1440px, 96vw); }
.drawer.is-wide .drawer-body { padding: 12px 16px 16px; }
.drawer.is-wide .drawer-body > :not(.preview) { display: none; }
.drawer.is-wide .preview { max-height: none; height: calc(100vh - 56px - 28px); background: var(--gray-50); }
.drawer.is-wide .preview img, .drawer.is-wide .preview video { max-height: 100%; height: 100%; width: auto; max-width: 100%; }
.drawer.is-wide .preview iframe { height: 100%; }
.drawer-head .icon-btn.is-on { background: var(--tint-8); color: var(--fg); }

/* 상단바 — 모바일 메뉴 버튼은 좁은 화면에서만 */
#btn-menu { display: none; }

/* --------------------------------------------------------------------------
   모바일 — 사이드바는 왼쪽에서 밀어 나오는 서랍, 카드는 두 줄, 드로어는 전체 폭
   -------------------------------------------------------------------------- */
.nav-backdrop { position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 55; background: var(--backdrop); }

@media (max-width: 900px) {
    #btn-menu { display: grid; }
    .sidebar {
        display: flex;
        position: fixed;
        top: var(--topbar-h);
        left: 0;
        bottom: 0;
        z-index: 60;
        width: min(300px, 86vw);
        transform: translateX(-104%);
        transition: transform .22s var(--ease);
        box-shadow: var(--shadow-floating);
    }
    body.is-nav-open .sidebar { transform: none; }
    .search { max-width: none; }
    .topbar-right { gap: 4px; }
    .crumbs { min-height: 0; }
    .drawer-panel, .drawer-narrow { width: 100vw; }
    .drawer.is-wide .drawer-panel { width: 100vw; }
    .bp-head { flex-wrap: wrap; }
    .bp-head .dropzone-mode { width: 100%; }
    .bp-foot { flex-wrap: wrap; }
    .bp-result { flex-wrap: wrap; padding: 8px 10px; }
    .bp-result input { flex-basis: 100%; }
    .toolbar { gap: 6px; }
    .dropzone-text span:not(.upprog):not(.upprog *) { display: none; }
    .pop-form { min-width: min(320px, 92vw); }
}

@media (max-width: 600px) {
    #view-seg { display: none; }
    .brand svg { height: 13px; }
    .topbar { gap: 8px; padding: 0 10px; }
    .main { padding: 12px 10px 48px; }
    .main > * + * { margin-top: 14px; }
    .view-card .group-items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .view-gallery .group-items { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .view-list .lcol-date, .view-list .lcol-code { display: none; }
    .card-body { padding: 8px 10px 10px; }
    .card-meta { font-size: 11px; }
    .bulkbar { padding: 8px 10px; font-size: 12px; }
    .dropzone { padding: 12px 14px; gap: 12px; }
    .bundle-panel { padding: 14px; gap: 10px; }
    .drawer-head { padding: 0 8px 0 12px; }
    .drawer-body { padding: 12px; }
    .kv { grid-template-columns: 72px 1fr; }
    .ctx { min-width: min(260px, 88vw); max-width: 92vw; }
    .queue { max-height: 50vh; }
    .lb-url { max-width: 60vw; }
}

/* 터치 기기 — hover 가 없으니 카드 버튼을 항상 보이게 하고 누르는 면을 키운다 */
@media (hover: none) and (pointer: coarse) {
    .card-actions { opacity: 1; }
    .card-act, .flag { width: 34px; height: 34px; }
    .lhead-act, .view-list .card-actions { width: 114px; }
    .ctx .pop-item { height: 42px; }
    .facet-item { padding: 10px 12px; }
    .sel-trigger { height: 38px; }
    .crumb { height: 34px; }
    .icon-btn { width: 38px; height: 38px; }
}


/* --------------------------------------------------------------------------
   Easy Access — 상단바 드롭다운 (설치 스크립트 · 명령줄 도구 · 앱 설치 · 토큰)
   -------------------------------------------------------------------------- */
.btn-easy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 8px 0 12px;
    border-radius: var(--r-ctl);
    background: rgba(255, 255, 255, .09);
    color: rgba(255, 255, 255, .85);
    font: 700 12px/1 var(--font-en);
    letter-spacing: .01em;
    white-space: nowrap;
}
.btn-easy:hover, .btn-easy[aria-expanded="true"] { background: rgba(255, 255, 255, .16); color: #fff; }
.btn-easy .ico { color: rgba(255, 255, 255, .6); }
@media (max-width: 600px) { .btn-easy span { display: none; } .btn-easy { padding: 0 8px; } }

.guide h3 { margin: 0 0 6px; font-size: 14px; font-weight: 700; }
.guide p, .guide li { color: var(--gray-600); font-size: 13px; line-height: 1.7; }
.guide ol { margin: 6px 0 0; padding-left: 20px; }
.guide code { font-family: var(--font-en); font-weight: 600; color: var(--fg); background: var(--tint-6); padding: 1px 6px; border-radius: 4px; }
.guide .block + .block { margin-top: 12px; }
.guide-cmd { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.guide-cmd code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding: 7px 10px; }

/* ======================================================================
 * 보관 정책 — 만료 표시 · 폴더 규칙 안내 · 새 버전
 * ====================================================================== */
.card-exp { font-weight: 700; }
.card-exp.exp-soon { color: var(--amber-700); }
.card-exp.exp-over { color: var(--red-600); }
.flag-ver { color: var(--blue-700); }
.crumb-policy { display: inline-flex; align-items: center; gap: 5px; color: var(--amber-700); }
.crumb-policy .ico { flex: none; }
.kv-link {
    background: none; border: 0; padding: 0; margin: 0; font: inherit; font-weight: 700;
    color: var(--blue-700); cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.kv-link:hover { opacity: .8; }

/* 업로드 큐 — 새 버전 반영 */
.qitem.is-replaced .qitem-state { color: var(--blue-700); font-weight: 700; }

/* 가운데 대화상자 (같은 이름 확인 등) */
.dlg-backdrop { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, .28); }
html[data-theme="dark"] .dlg-backdrop { background: rgba(0, 0, 0, .55); }
.dlg {
    position: fixed; z-index: 121; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: min(440px, 92vw); padding: 16px 16px 14px;
    /* .pop 의 320px 는 메뉴용 기본값 — 가운데 대화상자는 내용만큼 커진다 */
    max-height: min(86vh, 760px);
}
.dup-box .ctx-head { padding: 0 0 10px; font-size: 14px; }
.dup-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 200px; overflow: auto; border-radius: 10px; background: var(--tint-4); }
.dup-list li { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; font-size: 12.5px; }
.dup-list li + li { border-top: 1px solid var(--tint-8); }
.dup-list code { font-family: var(--font-en), var(--font-kr), monospace; font-weight: 700; word-break: break-all; }
.dup-list span { color: var(--gray-500); font-size: 12px; }
.dup-list .dup-more { color: var(--gray-500); font-size: 12px; }
.dup-actions { display: flex; flex-direction: column; gap: 6px; }
.dup-actions .btn { width: 100%; justify-content: flex-start; height: auto; padding: 10px 12px; flex-wrap: wrap; text-align: left; }
.dup-actions .btn small { flex-basis: 100%; margin-left: 22px; font-size: 11.5px; font-weight: 500; opacity: .75; }
.dup-actions .btn-ghost { justify-content: center; }

/* QR 대화상자 */
.qr-box .ctx-head { padding: 0 0 10px; font-size: 14px; }
.qr-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 9px; background: var(--tint-4); }
.qr-tab {
    flex: 1; height: 28px; border: 0; border-radius: 7px; background: transparent;
    color: var(--gray-500); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.qr-tab:hover { color: var(--fg); }
.qr-tab.is-on { background: var(--white); color: var(--fg); }
.qr-stage { display: grid; place-items: center; padding: 16px 0 10px; }
/* 스캐너가 기대하는 대로 바탕은 늘 흰색 — 다크 테마에서도 반전하지 않는다 */
.qr-img { width: 232px; height: 232px; border-radius: 8px; background: #fff; }
.qr-url { text-align: center; color: var(--gray-500); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-actions { display: flex; gap: 6px; margin-top: 14px; }
.qr-actions .btn { flex: 1; padding: 0 10px; }

/* 이전 버전 목록 */
.ver-list { display: flex; flex-direction: column; gap: 6px; }
.ver-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--tint-4); font-size: 12.5px; }
.ver-row > .ico { color: var(--gray-500); flex: none; }
.ver-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ver-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ver-meta { color: var(--gray-500); font-size: 12px; }
.ver-row .btn { flex: none; }

/* ======================================================================
 * 대량 항목 — 화면 밖 카드는 그리지 않는다 (수천 개를 이어 받아도 스크롤이 무거워지지 않게)
 * ====================================================================== */
.view-card .card, .view-gallery .card { content-visibility: auto; contain-intrinsic-size: auto 250px; }
.view-gallery .card { contain-intrinsic-size: auto 160px; }
.view-list .card { content-visibility: auto; contain-intrinsic-size: auto 46px; }
.more-wrap { min-height: 48px; }
.more-wrap .btn { font-variant-numeric: tabular-nums; }

/* ======================================================================
 * 보호 — 잠금 체크박스 · 임시 링크 줄 · 최근 열람
 * ====================================================================== */
.chk { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13px; }
.chk input[type=checkbox] { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--accent, var(--blue-700)); flex: none; }
.chk strong { font-weight: 700; }
.chk .field-hint { display: block; margin-top: 3px; }
.urlrow .u.muted { color: var(--gray-500); font-weight: 500; }
.block-head .block-sub { margin-left: auto; color: var(--gray-500); font-size: 12px; font-weight: 500; }
.hit-list { display: flex; flex-direction: column; gap: 4px; }
.hit-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; background: var(--tint-4); font-size: 12.5px; }
.hit-time { flex: none; min-width: 64px; color: var(--gray-500); font-variant-numeric: tabular-nums; }
.hit-kind { flex: none; padding: 1px 7px; border-radius: 999px; background: var(--tint-8); font-size: 11.5px; font-weight: 700; }
.hit-kind.is-dl { background: var(--blue-100); color: var(--blue-700); }
.hit-via { flex: none; color: var(--amber-700); font-size: 11.5px; font-weight: 700; }
.hit-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gray-500); }

/* 운영 — 저장소 점검 결과 · 경고 힌트 */
.field-hint.is-warn { color: var(--amber-700); font-weight: 600; }
.scan-host { margin-top: 12px; }
.scan-list { list-style: none; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--tint-4); font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.scan-list li { font-variant-numeric: tabular-nums; }

/* 민감정보 권고 — 카드 배지와 안내 대화상자 */
.flag-risk { color: var(--red-600); cursor: pointer; }
.flag-risk:hover { background: var(--red-50); }
.warn-head { display: flex; align-items: center; gap: 7px; color: var(--amber-700); }
.warn-head .ico { flex: none; }

/* --------------------------------------------------------------------------
   항목 내용 드릴뷰 — 폴더·묶음 항목의 안을 탐색기처럼 본다 (읽기 전용)
   -------------------------------------------------------------------------- */
.browse-bar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.browse-count { margin-left: auto; color: var(--gray-500); font-size: 12px; font-weight: 600; }
.browse-list { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: var(--r-card); background: var(--white); }
.browse-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--r-ctl);
    color: var(--gray-600);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.browse-row:hover { background: var(--tint-4); }
.browse-row.is-sel { background: var(--tint-4); box-shadow: inset 0 0 0 2px var(--fg); }
.browse-row .n { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); font-size: 13px; font-weight: 600; }
.browse-row .s { flex: none; color: var(--gray-500); font-size: 12px; }
.browse-row .tag-entry { flex: none; padding: 2px 7px; border-radius: 999px; background: var(--tint-6); color: var(--gray-600); font-size: 11px; font-weight: 700; }
.browse-open { width: 28px; height: 28px; }

/* --------------------------------------------------------------------------
   연동 페이지 (integrate.php) — doc 레이아웃 위에 block 카드
   -------------------------------------------------------------------------- */
.doc-wrap.integrate { max-width: 880px; }
/* 연동 페이지도 관리 화면의 상단바 · 사이드바 안에 놓는다 (lib/partials/, assets/chrome.js) */
.page-integrate .main { padding: 32px 32px 96px; scrollbar-gutter: stable; }
a.facet-item { text-decoration: none; }
.int-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 8px; }
.int-nav a {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--white);
    color: var(--gray-600);
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
}
.int-nav a:hover { color: var(--fg); background: var(--tint-8); }
.int-block { margin-top: 10px; }
.int-block + .int-block { margin-top: 10px; }
.int-block .block-head { flex-wrap: wrap; gap: 8px 10px; }
.int-title { font-size: 13.5px; font-weight: 700; color: var(--fg-title); }
.integrate pre { margin-top: 10px; }
@media (max-width: 600px) {
    .int-form { flex-direction: column; }
}

/* --------------------------------------------------------------------------
   찾기 쉽게 (1.16.0): NEW 뱃지 · 폴더 접기 · 사이드바 폴더 거르기 · 최근 폴더
   -------------------------------------------------------------------------- */

/* 최근에 올라온 것 */
.flag-new {
    width: auto;
    min-width: 0;
    padding: 0 6px;
    background: var(--accent);
    color: #fff;
    font: 800 9.5px/22px var(--font-en);
    letter-spacing: .06em;
}
.view-list .flag-new { line-height: 20px; }

/* 폴더 묶음 머리말 — 눌러서 접는다 */
.group-toggle {
    width: 100%;
    align-items: center;
    cursor: pointer;
    text-align: left;
}
.group-toggle:hover { color: var(--accent); }
.group-toggle > .ico { color: var(--gray-400); transition: transform .14s var(--ease); }
.group-folders.is-collapsed .group-toggle > .ico { transform: rotate(-90deg); }
.group-folders.is-collapsed .group-items { display: none; }
.group-sub { margin-left: auto; color: var(--gray-400); font-size: 11.5px; font-weight: 600; }

/* 사이드바 — 폴더 거르는 칸 */
.facet-filter { padding: 2px 4px 6px; }
.facet-filter input {
    width: 100%;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--page);
    color: var(--fg);
    font-size: 12.5px;
    box-sizing: border-box;
}
.facet-filter input:focus { outline: none; border-color: var(--accent); }
.facet-filter input::placeholder { color: var(--gray-400); }

/* 사이드바 — 「최근」 · 「전체」 같은 작은 구분 */
.facet-sub {
    padding: 8px 10px 3px;
    color: var(--gray-400);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
}

/* 최근에 바뀐 폴더는 이름 옆에 점 하나 */
.facet-item.is-new .facet-label::after {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--accent);
    vertical-align: middle;
}

/* 검색 결과의 폴더는 한 번 눌러 바로 연다 */
.card-folder.is-jump { cursor: pointer; }
.card-folder.is-jump:hover { outline: 2px solid var(--accent); outline-offset: -2px; }

/* 폴더를 더 보기 · 접어 두기 */
.group-more {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 10px 0 0 2px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--tint-4);
    color: var(--gray-600);
    font-size: 12.5px;
    font-weight: 700;
}
.group-more:hover { background: var(--tint-8); color: var(--fg); }
.group-folders.is-collapsed .group-more { display: none; }

/* --------------------------------------------------------------------------
   1.17.0 · 카드 글자 · 폴더 칩 · 폴더 색 · 끝난 폴더 · 사이드바 접기
   -------------------------------------------------------------------------- */

/* 카드 이름은 늘 두 줄 자리를 잡는다 — 한 줄짜리와 두 줄짜리가 섞여도 아래 줄 위치가 같다 */
.view-card .card-name { min-height: calc(1.4em * 2); }

/* 메타 줄은 한 줄. 넘치면 코드(별칭)부터 줄인다. 전에는 여러 줄로 깨져 카드 높이가 혼자 달라졌다 */
.card-meta { flex-wrap: nowrap; min-width: 0; overflow: hidden; white-space: nowrap; }
.card-meta > * { flex: none; }
.card-meta > .card-code { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-meta > span:only-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* 폴더 칩 — 카드·갤러리 보기 */
.fchips { display: flex; flex-wrap: wrap; gap: 8px; }
.fchip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 280px;
    height: 38px;
    padding: 0 12px 0 11px;
    border-radius: var(--r-ctl);
    background: var(--white);
    color: var(--fg);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    transition: background .12s var(--ease), box-shadow .12s var(--ease);
}
.fchip:hover { background: var(--tint-8); }
.fchip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fchip > .ico { flex: none; color: var(--gray-400); }
.fchip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip-n { flex: none; color: var(--gray-400); font: 600 12px/1 var(--font-en); font-variant-numeric: tabular-nums; }
.fchip-new { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.fchip.is-done { opacity: .55; }
.fchip.is-done .fchip-name { text-decoration: line-through; text-decoration-color: var(--gray-400); }
.fchip.is-drop, .fchip.is-over { box-shadow: 0 0 0 2px var(--accent) inset; }
.fchip-more { background: transparent; color: var(--gray-500); font-weight: 700; box-shadow: inset 0 0 0 1px var(--line); }
.fchip-more:hover { color: var(--fg); background: var(--tint-4); }
.group-folders.as-chips .group-head { margin-bottom: 10px; }
.group-folders.is-collapsed .fchips { display: none; }

/* 끝난 폴더 — 리스트 보기 줄 · 사이드바 */
.card-folder.is-done { opacity: .55; }
.facet-item.is-done { opacity: .5; }
.facet-item.is-done .facet-label { text-decoration: line-through; text-decoration-color: var(--gray-400); }
.facet-more {
    margin: 4px 0 0;
    padding: 6px 10px;
    border-radius: var(--r-sm);
    color: var(--gray-500);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
}
.facet-more:hover { background: var(--tint-4); color: var(--fg); }

/* 폴더 색이 있으면 선택된 줄에서도 색을 지킨다 */
.facet-item.is-on > .ico.has-color { color: inherit; }

/* 메뉴의 색 견본 */
.ctx-swatch { flex: none; width: 14px; height: 14px; border-radius: 50%; }
.ctx-swatch.is-on { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--fg); }

/* 사이드바 구역 접기 */
.facet-toggle { display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.facet-toggle:hover { color: var(--fg); }
.facet-chev { flex: none; color: var(--gray-400); transition: transform .14s var(--ease); }
.facet-toggle.is-off .facet-chev { transform: rotate(-90deg); }
.facet.is-folded { display: none; }
.facet-head-row.facet-toggle > span { flex: 1; }

/* ==========================================================================
   데이터 백업 · 백업 현황 (1.18.0)
   ========================================================================== */
.backup-list { display: flex; flex-direction: column; gap: 4px; }
.backup-row {
    display: grid;
    grid-template-columns: 18px minmax(120px, 1.4fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(90px, 1fr) 56px;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--r-ctl);
    background: var(--white);
    color: var(--fg);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.backup-row:hover { background: var(--tint-4); }
.backup-row .ico { color: var(--gray-500); }
.backup-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backup-last, .backup-size, .backup-rule { color: var(--gray-500); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.backup-state { justify-self: end; font-size: 12px; font-weight: 700; }
.backup-state.is-ok   { color: var(--green-700); }
.backup-state.is-late { color: var(--red-600); }
.backup-row.is-stale { background: var(--red-50); }
@media (max-width: 720px) {
    .backup-row { grid-template-columns: 18px 1fr auto; row-gap: 2px; }
    .backup-last, .backup-size, .backup-rule { grid-column: 2 / 4; }
    .backup-state { grid-column: 3; grid-row: 1; }
}
.crumb-vault { display: inline-flex; align-items: center; gap: 5px; color: var(--green-700); }
.crumb-vault .ico { flex: none; }
.crumb-note.is-stale { color: var(--red-600); }
.facet-item.is-stale .facet-label { color: var(--red-600); }
.flag-vault { color: var(--green-700); }
.vault-hint { display: flex; align-items: flex-start; gap: 6px; margin: 0 0 8px; color: var(--green-700); }
.vault-hint .ico { flex: none; margin-top: 3px; }

.int-pre { margin: 10px 0 0; padding: 10px 12px; border-radius: var(--r-ctl); background: var(--page); overflow-x: auto; }
.int-pre code { font: 600 12px/1.6 var(--font-en), ui-monospace, monospace; white-space: pre; }

/* 데이터 백업 페이지 · 기간별 아카이브 (1.20.0) */
.bk-row { grid-template-columns: 16px minmax(120px, 1.3fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(120px, 1.3fr) 64px auto; }
.bk-row .bk-rule { justify-self: end; }
.bk-items { margin: 2px 0 8px 28px; display: flex; flex-direction: column; gap: 2px; }
.bk-item { display: grid; grid-template-columns: minmax(180px, 1.4fr) 150px 80px auto; align-items: center; gap: 12px; padding: 6px 10px; border-radius: var(--r-sm); font-size: 12.5px; color: var(--gray-600); }
.bk-item:hover { background: var(--tint-4); }
.bk-code { font: 600 12px/1.5 var(--font-en), ui-monospace, monospace; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-actions { display: flex; gap: 6px; justify-self: end; }
.bk-root { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--gray-500); }
.bk-root .btn { margin-left: auto; }
@media (max-width: 720px) {
    .bk-row { grid-template-columns: 16px 1fr auto; }
    .bk-row .backup-last, .bk-row .backup-size, .bk-row .backup-rule { grid-column: 2 / 4; }
    .bk-item { grid-template-columns: 1fr auto; }
    .bk-item .bk-date, .bk-item .bk-size { display: none; }
}
.fchips-period { margin-bottom: 10px; }

/* --------------------------------------------------------------------------
   환경 진단 (setup.php): 연동 페이지와 같은 틀, 묶음마다 카드 하나
   -------------------------------------------------------------------------- */
.page-setup .diag-summary { margin-bottom: 14px; }
.diag-nav { margin: 0 0 4px; }
.diag-block { scroll-margin-top: 72px; }
.diag-block .block-head { margin-bottom: 8px; }
.diag-desc { color: var(--gray-500); font-weight: 500; }
.diag-n.fail { color: var(--red-600); }
.diag-n.warn { color: var(--amber-700); }
.diag-list { display: flex; flex-direction: column; gap: 4px; }
.diag-list .check { background: var(--page); }
.diag-list .check + .check { margin-top: 0; }
.diag-block p { margin: 0 0 8px; }
body.doc .doc-wrap.integrate { max-width: 880px; }
@media (max-width: 600px) {
    .diag-desc { display: none; }
}
.bk-trash-head { margin: 10px 0 4px; }
.bk-item.is-trashed { opacity: .7; }

/* ==========================================================================
   툴팁 (1.21.0): data-tip. 뜨는 요소라 최소 그림자만 허용
   ========================================================================== */
.tooltip {
    position: fixed;
    z-index: 200;
    max-width: 320px;
    padding: 10px 13px;
    border-radius: var(--r-ctl);
    background: var(--fg);
    color: var(--page);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.65;
    white-space: pre-line;
    word-break: keep-all;
    overflow-wrap: anywhere;
    pointer-events: none;
    box-shadow: var(--shadow-floating);
}
.tip-btn {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    color: var(--gray-400);
    vertical-align: middle;
    transition: color .14s var(--ease), background .14s var(--ease);
}
.tip-btn:hover, .tip-btn[aria-describedby] { color: var(--fg); background: var(--tint-4); }
.tip-btn[hidden] { display: none; }

/* ==========================================================================
   연동 페이지 (1.21.0): 탭 여섯 개 · 카드 · 넉넉한 여백 · 아이콘
   ========================================================================== */
.doc-wrap.int-page { max-width: 960px; }
.int-page-head .doc-lead { margin: 0; font-size: 14px; }
.int-page .btn-sm { height: 36px; padding: 0 14px; gap: 7px; font-size: 13px; }
.int-page .int-icon-btn { width: 36px; padding: 0; flex: none; }
.int-page .spacer { flex: 1; }

/* 탭: 아래 밑줄, 선택은 글자색 (sufly 탭 규칙) */
.int-tabs {
    position: sticky;
    top: -32px;   /* .main 의 위 여백만큼 올려 스크롤 영역 맨 위에 붙인다 */
    z-index: 5;
    display: flex;
    gap: 4px;
    margin: 28px 0 36px;
    background: var(--page);
    border-bottom: 1px solid var(--tint-6);
    overflow-x: auto;
    scrollbar-width: none;
}
.int-tabs::-webkit-scrollbar { display: none; }
.int-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: none;
    height: 52px;
    padding: 0 18px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--gray-500);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: color .14s var(--ease), border-color .14s var(--ease);
}
.int-tab:hover { color: var(--fg); }
.int-tab.is-on { color: var(--fg); font-weight: 700; border-bottom-color: var(--fg); }
.int-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: -6px; border-radius: 8px 8px 0 0; }
.int-tab-n {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--tint-8);
    color: var(--fg);
    font: 700 12px/22px var(--font-en);
    text-align: center;
}
.int-tab-n[hidden] { display: none; }

/* 패널 머리 */
.int-panel { display: flex; flex-direction: column; gap: 20px; }
.int-panel[hidden] { display: none; }
.int-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.int-head-ico {
    display: grid;
    place-items: center;
    flex: none;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--white);
    color: var(--fg);
}
.int-head-tx { flex: 1; min-width: 0; }
.int-page .int-head h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--fg-title); }
.int-page .int-head p { margin: 4px 0 0; font-size: 14px; line-height: 1.6; color: var(--gray-500); }

/* 카드 */
.int-card { padding: 26px 28px; border-radius: 14px; background: var(--white); }
.int-card-head { display: flex; align-items: center; gap: 14px; }
.int-card > .int-card-head + * { margin-top: 22px; }
.int-card-ico {
    display: grid;
    place-items: center;
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--tint-4);
    color: var(--gray-600);
}
.int-card-tx { flex: 1; min-width: 0; }
.int-page .int-card-tx h3 { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 15px; font-weight: 700; color: var(--fg-title); }
.int-card-tx > span { display: block; margin-top: 3px; color: var(--gray-500); font-size: 13px; line-height: 1.5; }
.int-card-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* 긴 글 · 코드 */
.int-page pre.int-doc {
    margin: 22px 0 0;
    max-height: 280px;
    padding: 20px 22px;
    border-radius: 10px;
    background: var(--page);
    color: var(--gray-600);
    font: 500 13px/1.85 var(--font-kr);
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
}
.int-page pre.int-doc-tall { max-height: 520px; }
.int-page pre.int-code {
    margin: 22px 0 0;
    padding: 18px 22px;
    border-radius: 10px;
    background: var(--page);
    color: var(--fg);
    font: 500 13px/1.8 var(--font-en), ui-monospace, monospace;
    white-space: pre;
    overflow-x: auto;
}

/* 새 키 발급 */
.int-keyform { display: flex; align-items: flex-end; gap: 24px; }
.int-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.int-keyform .int-field:first-child { flex: 1; }
.int-field-label { color: var(--gray-500); font-size: 12px; font-weight: 700; }
.int-keyform .inp { height: 46px; padding: 0 4px; font-size: 15px; }
.int-scope-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 46px;
    min-width: 176px;
    padding: 0 4px;
    border-bottom: 1px solid var(--tint-8);
    color: var(--fg);
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    transition: border-color .14s var(--ease);
}
.int-scope-trigger:hover { border-bottom-color: var(--gray-400); }
.int-scope-trigger[aria-expanded="true"] { border-bottom-color: var(--primary); }
.int-scope-trigger:focus-visible { outline: none; border-bottom-color: var(--primary); }
.int-scope-value { flex: 1; text-align: left; }
.int-scope-chev { color: var(--gray-400); }
.int-page .int-keyform-go { height: 46px; padding: 0 24px; font-size: 14px; }

/* 권한 팝오버 */
.pop.int-scope-pop { min-width: 360px; max-width: calc(100vw - 16px); max-height: none; padding: 8px; }
.int-scope-list { display: flex; flex-direction: column; gap: 2px; }
.int-scope-opt {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px;
    border-radius: var(--r-ctl);
    color: var(--fg);
    text-align: left;
}
.int-scope-opt:hover, .int-scope-opt:focus-visible { background: var(--tint-4); outline: none; }
.int-scope-opt.is-on { background: var(--tint-4); }
.int-scope-opt-ico {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--tint-6);
    color: var(--fg);
}
.int-scope-opt-tx b { display: block; font-size: 14px; font-weight: 700; }
.int-scope-opt-tx span { display: block; margin-top: 3px; color: var(--gray-500); font-size: 12.5px; line-height: 1.55; word-break: keep-all; }
.int-scope-opt-check { color: var(--fg); opacity: 0; }
.int-scope-opt.is-on .int-scope-opt-check { opacity: 1; }

/* 새 키 값 */
.int-new { margin-top: 24px; padding: 22px 24px; border-radius: 12px; background: var(--page); }
.int-new[hidden] { display: none; }
.int-new-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.int-new-ico { display: inline-flex; color: var(--amber-700); }
.int-token-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.int-page code.int-token {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    border-radius: var(--r-ctl);
    background: var(--white);
    font: 600 14px/1.5 var(--font-en), ui-monospace, monospace;
    word-break: break-all;
    user-select: all;
}
.int-new-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }

/* 발급한 키 */
.int-keys { display: flex; flex-direction: column; gap: 8px; }
.int-key {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 12px;
    background: var(--page);
}
.int-key.is-off { opacity: .6; }
.int-key-ico {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--tint-4);
    color: var(--gray-600);
}
.int-key-name { font-size: 14.5px; font-weight: 700; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.int-key-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 5px; color: var(--gray-500); font-size: 12.5px; }
.int-page .int-key-meta code { padding: 1px 8px; border-radius: 6px; background: var(--tint-6); color: var(--gray-600); font: 600 12px/1.7 var(--font-en), ui-monospace, monospace; }
.int-key-ip { font-family: var(--font-en); }
.int-key-tags { display: flex; align-items: center; gap: 10px; }
.int-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 11px;
    border-radius: 999px;
    background: var(--tint-6);
    color: var(--gray-600);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.int-pill.scope-upload { background: var(--green-50); color: var(--green-700); }
.int-pill.scope-read { background: var(--blue-100); color: var(--blue-700); }
.int-pill.is-ok, .int-pill.is-off { padding: 0 2px; background: transparent; }
.int-pill.is-ok::before, .int-pill.is-off::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green-600); }
.int-pill.is-off::before { background: var(--gray-400); }
.int-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 0; color: var(--gray-400); text-align: center; }
.int-page .int-empty p { margin: 0; font-size: 13px; color: var(--gray-500); }

/* 단계 */
.int-steps { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.int-step { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: 12px; background: var(--page); }
.int-step-n {
    display: grid;
    place-items: center;
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: var(--fg);
    color: var(--page);
    font: 700 13px/1 var(--font-en);
}
.int-step-tx { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.int-step-tx b { color: var(--fg); font-size: 14px; font-weight: 700; line-height: 1.55; }
.int-step-tx > span { color: var(--gray-500); font-size: 13px; line-height: 1.55; }
.int-page code.int-step-cmd {
    display: block;
    margin-top: 8px;
    padding: 10px 14px;
    border-radius: var(--r-ctl);
    background: var(--white);
    color: var(--fg);
    font: 500 13px/1.6 var(--font-en), ui-monospace, monospace;
    white-space: nowrap;
    overflow-x: auto;
}
.int-step > .btn, .int-step > .tip-btn { flex: none; }

/* CLI 설치 */
.int-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.int-option { display: flex; flex-direction: column; gap: 6px; padding: 22px; border-radius: 12px; background: var(--page); }
.int-option-ico {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: var(--tint-4);
    color: var(--fg);
}
.int-option b { font-size: 14.5px; font-weight: 700; color: var(--fg); }
.int-page .int-option p { flex: 1; margin: 0; color: var(--gray-500); font-size: 13px; line-height: 1.6; }
.int-option-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.int-page code.int-inline-cmd { padding: 7px 11px; border-radius: 6px; background: var(--white); font: 600 13px/1.5 var(--font-en), ui-monospace, monospace; }

/* 자주 쓰는 명령 */
.int-cmds { display: flex; flex-direction: column; }
.int-cmd { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--tint-6); }
.int-cmd:first-child { padding-top: 0; }
.int-cmd:last-child { padding-bottom: 0; border-bottom: 0; }
.int-cmd-tx { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.int-page .int-cmd-tx code {
    align-self: flex-start;
    max-width: 100%;
    padding: 7px 11px;
    border-radius: 6px;
    background: var(--page);
    color: var(--fg);
    font: 500 13px/1.55 var(--font-en), ui-monospace, monospace;
    white-space: pre-wrap;
    word-break: break-all;
}
.int-cmd-tx > span { padding-left: 2px; color: var(--gray-500); font-size: 13px; line-height: 1.5; }

/* MCP 도구 */
.int-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.int-tool { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: 10px; background: var(--page); }
.int-page .int-tool code { align-self: flex-start; padding: 0; background: none; color: var(--fg); font: 600 13px/1.5 var(--font-en), ui-monospace, monospace; }
.int-tool span { color: var(--gray-500); font-size: 13px; line-height: 1.55; }

/* API 요점 */
.int-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.int-fact {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    column-gap: 12px;
    align-items: center;
    padding: 18px 20px;
    border-radius: 12px;
    background: var(--white);
}
.int-fact-ico {
    display: grid;
    place-items: center;
    grid-row: 1 / 3;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--tint-4);
    color: var(--gray-600);
}
.int-fact > span:nth-child(2) { color: var(--gray-500); font-size: 12px; font-weight: 700; }
.int-page .int-fact code { padding: 0; background: none; color: var(--fg); font: 600 13.5px/1.5 var(--font-en), ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 760px) {
    .page-integrate .main { padding: 20px 16px 64px; }
    .int-tabs { top: -20px; margin: 20px 0 24px; }
    .int-tab { height: 48px; padding: 0 14px; }
    .int-card { padding: 20px 18px; }
    .int-card-head { flex-wrap: wrap; }
    .int-card-actions { width: 100%; padding-left: 52px; }
    .int-keyform { flex-direction: column; align-items: stretch; gap: 16px; }
    .int-scope-trigger { width: 100%; }
    .int-options, .int-tools, .int-facts { grid-template-columns: 1fr; }
    .int-key { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px 16px; }
    .int-key-ico { display: none; }
    .int-key-tags { grid-column: 1 / 3; grid-row: 2; }
    .int-step { flex-wrap: wrap; }
    .int-step > .btn { margin-left: 46px; }
    .pop.int-scope-pop { min-width: 0; width: calc(100vw - 16px); }
}

/* sufly 계정 로그인 · 비상 로그인 · 승인 대기 (1.23.0) */
.gate-sso { margin-top: 4px; }
.gate-emergency { margin-top: 22px; border-top: 1px solid var(--gray-100); padding-top: 14px; }
.gate-emergency summary { cursor: pointer; color: var(--gray-500); font-size: 13px; list-style: none; }
.gate-emergency summary::-webkit-details-marker { display: none; }
.gate-emergency[open] summary { margin-bottom: 8px; }
.gate-hint { margin: 0 0 12px; color: var(--gray-500); font-size: 12px; line-height: 1.6; }
.gate-card .gate-title { margin: 0 0 8px; font-size: 17px; font-weight: 700; }
.gate-card .gate-text { margin: 0 0 20px; color: var(--gray-600); font-size: 14px; line-height: 1.7; }

/* 사용자 · 기록 페이지 (1.23.0) */
.user-row  { grid-template-columns: 18px minmax(90px, 1fr) minmax(120px, 1.4fr) minmax(110px, 1fr) 76px auto; cursor: default; }
.audit-row { grid-template-columns: 18px minmax(120px, 1fr) minmax(90px, .8fr) minmax(160px, 2fr) 84px; cursor: default; }
.user-row:hover, .audit-row:hover { background: var(--white); }
.user-actions { display: flex; gap: 6px; justify-content: flex-end; }
.audit-row .backup-size { color: var(--gray-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-row .backup-state { font-weight: 500; color: var(--gray-500); }
@media (max-width: 720px) {
    .user-row, .audit-row { grid-template-columns: 18px 1fr auto; }
    .user-actions { grid-column: 2 / 4; justify-content: flex-start; }
}

/* 폴더 권한 패널 (1.23.0) */
.access-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.access-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--tint-4); font-size: 13px; }
.access-kind { color: var(--gray-500); font-size: 12px; }
.access-chip .chip-x { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: var(--gray-500); cursor: pointer; }
.access-chip .chip-x:hover { background: var(--tint-8, var(--tint-4)); color: var(--fg); }
.access-add { display: flex; gap: 8px; align-items: center; margin: 4px 0 8px; }
.access-add .sel-trigger { flex: 1; min-width: 0; }
.access-save { margin-top: 12px; }
#au-filter .seg-btn { white-space: nowrap; }
