:root {
  --blue: #007AFF;
  --blue-soft: rgba(0, 122, 255, .12);
  --red: #FF3B30;
  --canvas: #F2F2F7;
  --dot: rgba(60, 60, 67, .16);
  --panel: #FBFBFD;   /* 패널·메뉴·창의 면 (불투명) */
  --solid: #FFFFFF;
  --line: rgba(60, 60, 67, .13);
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .2);
  --text: #1C1C1E;
  --text-2: rgba(60, 60, 67, .78);
  --text-3: rgba(60, 60, 67, .5);
  --shadow: 0 0 0 .5px rgba(28, 32, 48, .08), 0 1px 2px rgba(28, 32, 48, .04), 0 10px 30px rgba(28, 32, 48, .10);
  --shadow-pop: 0 0 0 .5px rgba(28, 32, 48, .10), 0 18px 50px rgba(28, 32, 48, .20);
  --r: 16px;       /* 패널 */
  --r-ctl: 10px;   /* 버튼·입력 */
  --r-sm: 8px;     /* 패널 안의 작은 컨트롤·목록 줄 */
  --ring: 0 0 0 2px var(--solid), 0 0 0 4px var(--blue);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #0A84FF;
    --blue-soft: rgba(10, 132, 255, .22);
    --red: #FF453A;
    --canvas: #1C1C1E;
    --dot: rgba(235, 235, 245, .13);
    --panel: #2A2A2C;
    --solid: #2C2C2E;
    --line: rgba(235, 235, 245, .12);
    --fill: rgba(118, 118, 128, .24);
    --fill-2: rgba(118, 118, 128, .36);
    --text: #F2F2F7;
    --text-2: rgba(235, 235, 245, .72);
    --text-3: rgba(235, 235, 245, .46);
    --shadow: 0 0 0 .5px rgba(255, 255, 255, .08), 0 8px 28px rgba(0, 0, 0, .4);
    --shadow-pop: 0 0 0 .5px rgba(255, 255, 255, .1), 0 16px 48px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { font: 13px/1.4 var(--font); color: var(--text); background: var(--canvas); -webkit-font-smoothing: antialiased; user-select: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
.grow { flex: 1; }

.glass {
  background: var(--panel);
  border-radius: var(--r); box-shadow: var(--shadow);
}

/* ---------- 로고 ---------- */
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--blue); display: grid; grid-template: 5fr 3fr / 1fr 1fr; gap: 2.5px; padding: 6px; flex: none; }
.logo i { background: #fff; border-radius: 2px; }
.logo i:nth-child(2), .logo i:nth-child(3) { opacity: .65; }
.logo.big { width: 64px; height: 64px; border-radius: 18px; padding: 14px; gap: 5px; margin: 0 auto 18px; box-shadow: 0 10px 30px rgba(0, 122, 255, .35); }
.logo.big i { border-radius: 4px; }

/* ---------- 로그인 ---------- */
#login { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; z-index: 50;
  background: radial-gradient(900px 520px at 50% 0%, var(--blue-soft), transparent 70%), radial-gradient(var(--dot) 1.2px, transparent 1.3px) 0 0 / 24px 24px, var(--canvas); }
.login-card { width: min(400px, 100%); padding: 40px 32px 28px; text-align: center; background: var(--panel); border-radius: 28px; box-shadow: var(--shadow-pop); }
.login-card h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.login-card .sub { margin: 8px 0 26px; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.btn-google { width: 100%; height: 48px; border-radius: 14px; background: var(--solid); box-shadow: 0 0 0 1px var(--line), 0 2px 8px rgba(0, 0, 0, .06); font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 10px; transition: transform .12s; }
.btn-google:active { transform: scale(.98); }
.btn-google:disabled { opacity: .45; cursor: default; }
.btn-google span { display: flex; }
.btn-plain { margin-top: 12px; height: 40px; width: 100%; border-radius: 12px; color: var(--blue); font-size: 14px; font-weight: 500; }
.btn-plain:hover { background: var(--blue-soft); }
.login-msg { min-height: 18px; margin: 14px 0 0; color: var(--red); font-size: 13px; white-space: pre-line; }
.fine { margin: 16px 0 0; color: var(--text-2); font-size: 12px; line-height: 1.55; }

/* ---------- 캔버스 ---------- */
#canvas-wrap { position: fixed; inset: 0; background-color: var(--canvas); background-image: radial-gradient(var(--dot) 1.2px, transparent 1.3px); touch-action: none; overflow: hidden; }
#stage { width: 100%; height: 100%; display: block; cursor: default; }
#canvas-wrap[data-tool="hand"] #stage, #canvas-wrap.space #stage { cursor: grab; }
#canvas-wrap.panning #stage { cursor: grabbing !important; }
#canvas-wrap:not([data-tool="select"]):not([data-tool="hand"]) #stage { cursor: crosshair; }
#canvas-wrap[data-tool="text"] #stage { cursor: text; }
#canvas-wrap[data-tool="select"]:not(.space) #content > g { cursor: move; }
#canvas-wrap:not([data-tool="select"]) #overlay { pointer-events: none; }
#content image { image-rendering: auto; }

#canvas-wrap.layer-drop #stage, #canvas-wrap.layer-drop #content > g { cursor: copy !important; }
.sel-outline { fill: none; stroke: var(--blue); stroke-width: 1.25; pointer-events: none; }
.sel-box { fill: none; stroke: var(--blue); stroke-width: 1; stroke-dasharray: 4 3; pointer-events: none; }
.bind-outline { fill: rgba(0, 122, 255, .08); stroke: var(--blue); stroke-width: 2.5; pointer-events: none; }
.handle { fill: #fff; stroke: var(--blue); stroke-width: 1.5; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .2)); }
.handle.corner, .handle.mid { fill: var(--blue); stroke: #fff; }
/* 구간 가운데의 "여기를 끌어 꺾기" 점: 작고 옅게 */
.handle.ghost { r: 3.5px; fill: #fff; stroke: var(--blue); stroke-width: 1.25; opacity: .75; }
.handle.ghost:hover { r: 5px; opacity: 1; }
.marquee { fill: rgba(0, 122, 255, .1); stroke: var(--blue); stroke-width: 1; pointer-events: none; }
.guide { stroke: #FF2D55; stroke-width: 1; pointer-events: none; }

#text-editor { display: none; position: absolute; margin: 0; padding: 0; border: 0; outline: 1.5px solid var(--blue); outline-offset: 3px; border-radius: 1px; background: transparent; resize: none; overflow: hidden; line-height: 1.3; user-select: text; }

/* ---------- 상단 바 ---------- */
#topbar { position: fixed; top: 12px; left: 12px; right: 12px; height: 52px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; z-index: 10; }
.tb-group { display: flex; align-items: center; gap: 2px; min-width: 0; }
/* 왼쪽(파일)과 오른쪽(공유·계정)은 내용만큼, 가운데 편집 도구가 남는 폭의 중앙에 온다 */
.tb-group:first-child { flex: 0 1 auto; }
.tb-group.tb-edit { flex: 1 1 auto; justify-content: center; }
.tb-group:last-child { flex: 0 0 auto; }
.tb-group:last-child { justify-content: flex-end; gap: 6px; }
.tb-group:first-child .logo { margin: 0 6px 0 2px; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; flex: none; }

.btn { height: 34px; min-width: 34px; padding: 0 7px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--text); flex: none; transition: background .12s, transform .1s, opacity .12s; }
.btn:hover { background: var(--fill); }
.btn:active { transform: scale(.94); background: var(--fill-2); }
.btn:disabled { opacity: .28; pointer-events: none; }
.btn.label { padding: 0 11px 0 9px; font-weight: 500; }
.btn.primary { background: var(--blue); color: #fff; font-weight: 600; padding: 0 14px 0 11px; }
.btn.primary:hover { filter: brightness(1.07); }
/* 저장이 진행 중인 버튼: 돌아가는 표시 + "저장 중 42%". 끝나면 잠깐 초록색 "저장됨" */
.btn.busy { background: var(--blue-soft); color: var(--blue); cursor: progress; font-variant-numeric: tabular-nums; }
.btn.busy:hover { background: var(--blue-soft); }
.btn.busy .ic { display: none; }
.btn.busy::before { content: ''; width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--blue-soft); border-top-color: var(--blue); animation: spin .7s linear infinite; flex: none; }
.btn.done { color: #1F8A3B; }
/* 상단 바 아래쪽의 저장 진행 막대 */
#save-bar { position: absolute; left: 16px; right: 16px; bottom: 0; height: 3px; border-radius: 2px; overflow: hidden; background: var(--fill); pointer-events: none; }
#save-bar i { display: block; height: 100%; background: var(--blue); transform: scaleX(0); transform-origin: left; transition: transform .25s ease-out; }
.btn.sm { height: 26px; min-width: 26px; padding: 0 5px; border-radius: 8px; color: var(--text-2); }
.btn.on { background: var(--blue); color: #fff; }
.btn.danger { color: var(--red); }
.btn.tinted { background: var(--fill); font-weight: 500; padding: 0 14px; }

.doc-name { height: 32px; min-width: 110px; width: 200px; flex: 0 1 200px; padding: 0 8px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; font-weight: 600; text-overflow: ellipsis; user-select: text; }
.doc-name:hover { background: var(--fill); }
.doc-name:focus { outline: 0; background: var(--solid); box-shadow: 0 0 0 3px var(--blue-soft), 0 0 0 1px var(--blue); }
.status { color: var(--text-2); font-size: 12px; white-space: nowrap; margin-left: 4px; overflow: hidden; text-overflow: ellipsis; }

.avatar { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #5AC8FA, #007AFF); color: #fff; font-weight: 600; font-size: 13px; flex: none; display: grid; place-items: center; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 왼쪽 도구 ---------- */
#toolbar { position: fixed; left: 12px; top: 76px; width: 50px; padding: 7px; display: flex; flex-direction: column; gap: 3px; z-index: 9; }
#toolbar .btn { width: 36px; height: 36px; position: relative; }
#toolbar .btn .corner { position: absolute; right: 3px; bottom: 3px; width: 0; height: 0; border: 3px solid transparent; border-right-color: currentColor; border-bottom-color: currentColor; opacity: .5; }
#toolbar hr { width: 22px; height: 1px; border: 0; background: var(--line); margin: 3px auto; }

/* ---------- 오른쪽 패널 ---------- */
#side { position: fixed; top: 76px; right: 12px; bottom: 12px; width: 272px; display: flex; flex-direction: column; overflow: hidden; z-index: 9; transition: transform .28s cubic-bezier(.3, .8, .3, 1), opacity .2s; }
body.side-hidden #side { transform: translateX(calc(100% + 20px)); opacity: 0; pointer-events: none; }
#side section { border-bottom: 1px solid var(--line); }
#side section:last-child { border-bottom: 0; }
#side h3 { margin: 0; padding: 11px 14px 7px; font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: .01em; display: flex; align-items: center; justify-content: space-between; height: 40px; }
.h-actions { display: flex; gap: 2px; margin-right: -6px; }

/* 높이를 고정한다: 선택에 따라 속성 줄 수가 달라져도 아래 레이어 목록이 밀리지 않게 (더블클릭·드래그 중 줄이 움직이면 안 됨) */
#props { flex: none; height: min(50%, 404px); overflow-y: auto; }
#props-body { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 9px; }
.hint { color: var(--text-2); font-size: 12px; margin: 0; }
.row { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.row > label { width: 48px; flex: none; color: var(--text-2); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.field { display: flex; align-items: center; height: 28px; border-radius: 8px; background: var(--fill); padding: 0 8px; gap: 5px; min-width: 0; flex: 1; }
.field span { color: var(--text-2); font-size: 12px; flex: none; }
.field input { width: 100%; min-width: 0; border: 0; background: none; outline: 0; font-size: 12.5px; font-variant-numeric: tabular-nums; padding: 0; user-select: text; -moz-appearance: textfield; }
.field input::-webkit-inner-spin-button { display: none; }
.field:focus-within { box-shadow: 0 0 0 1.5px var(--blue); background: var(--solid); }
select.field { border: 0; appearance: none; outline: 0; font-size: 12.5px; padding-right: 22px; cursor: pointer;
  background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238E8E93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center; }
select.field option { background: var(--solid); color: var(--text); }
.swatch { width: 28px; height: 28px; border-radius: 8px; flex: none; box-shadow: inset 0 0 0 1px var(--line); background: var(--c); position: relative; overflow: hidden; }
.swatch.none { background: var(--solid); }
.swatch.none::after { content: ''; position: absolute; left: -4px; right: -4px; top: 50%; height: 1.5px; background: var(--red); transform: rotate(-45deg); }
.seg { display: flex; background: var(--fill); border-radius: 8px; padding: 2px; flex: 1; }
.seg button { flex: 1; height: 24px; border-radius: 6px; font-size: 12px; color: var(--text-2); display: grid; place-items: center; }
.seg button svg { display: block; }
.seg button.on { background: var(--solid); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); font-weight: 500; }
input[type="range"] { flex: 1; min-width: 0; height: 4px; appearance: none; background: var(--fill-2); border-radius: 2px; outline: 0; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .1), 0 2px 6px rgba(0, 0, 0, .22); cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .1), 0 2px 6px rgba(0, 0, 0, .22); }
.val { width: 36px; text-align: right; color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }

#layers { flex: 1; min-height: 120px; display: flex; flex-direction: column; overflow: hidden; }
#layer-list { flex: 1; overflow-y: auto; padding: 0 6px 8px; }
.lrow { display: flex; align-items: center; height: 30px; border-radius: 8px; padding: 0 4px; gap: 1px; position: relative; }
.lrow:hover { background: var(--fill); }
.lrow.layer { font-weight: 600; margin-top: 2px; }
.lrow.layer.active .name { color: var(--blue); }
.lrow.layer.active { box-shadow: inset 3px 0 0 var(--blue); }
.lrow.obj { padding-left: 22px; }
.lrow.obj.sel { background: var(--blue-soft); }
.lrow.off .name, .lrow.off .tico { opacity: .35; }
.lrow .ib { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: var(--text-2); flex: none; }
.lrow .ib:hover { background: var(--fill-2); color: var(--text); }
.lrow .ib.dim { color: var(--text-3); opacity: 0; }
.lrow:hover .ib.dim, .lrow .ib.dim.keep { opacity: 1; }
.lrow .chev svg { transition: transform .15s; }
.lrow .chev.open svg { transform: rotate(90deg); }
.lrow .tico { color: var(--text-2); display: grid; place-items: center; width: 22px; flex: none; }
.lrow .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; font-size: 12.5px; }
.lrow .name[contenteditable="true"] { background: var(--solid); box-shadow: 0 0 0 1.5px var(--blue); border-radius: 5px; outline: 0; text-overflow: clip; user-select: text; cursor: text; }
.lrow .gtag { flex: none; font-size: 10.5px; color: var(--text-2); background: var(--fill-2); border-radius: 5px; padding: 1px 5px; margin-right: 2px; }
.row.grow { align-items: center; gap: 8px; }
.row.grow .hint { flex: 1; }
.row.grow .btn { flex: none; white-space: nowrap; }
.lrow .count { color: var(--text-2); font-size: 12px; font-weight: 400; padding-right: 4px; }
.lrow.drop-before::before, .lrow.drop-after::after { content: ''; position: absolute; left: 6px; right: 6px; height: 2px; border-radius: 1px; background: var(--blue); }
.lrow.drop-before::before { top: -1px; }
.lrow.drop-after::after { bottom: -1px; }
.lrow.drop-into { box-shadow: inset 0 0 0 1.5px var(--blue); }
.empty { color: var(--text-2); font-size: 12px; padding: 2px 0 6px 30px; }

/* 히스토리 패널 */
#side h3 .tabs { flex: none; margin-left: -6px; }
#side h3 .tabs button { padding: 0 11px; font-weight: 500; white-space: nowrap; flex: none; }
#history-list { flex: 1; overflow-y: auto; padding: 0 6px 8px; }
.hsec { padding: 10px 8px 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.hrow { display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 4px 8px; border-radius: 8px; cursor: pointer; }
.hrow:hover { background: var(--fill); }
.hrow.cur { background: var(--blue-soft); }
.hrow.future { opacity: .4; }
.hrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; margin: 0 8px 0 7px; }
.hrow.cur .dot { background: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.hrow .avatar { width: 22px; height: 22px; font-size: 11px; }
.hrow .who { min-width: 0; flex: 1; }
.hrow .who b { display: block; font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrow .who small { display: block; color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrow.busy { opacity: .5; pointer-events: none; }

#nav { flex: none; padding: 10px; }
#nav-box { position: relative; height: 132px; border-radius: 10px; overflow: hidden; background: var(--canvas); box-shadow: inset 0 0 0 1px var(--line); }
#nav-canvas { position: absolute; pointer-events: none; }
#nav-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; touch-action: none; }
/* 글자가 읽을 수 없을 만큼 작게 보일 때: 글 대신 글자색의 옅은 띠 */
#content g.lod text { display: none; }
#content g.lod .hit { fill: var(--tc); fill-opacity: .28; }
#nav-view { fill: rgba(0, 122, 255, .1); stroke: var(--blue); stroke-width: 1.5; pointer-events: none; }
.zoom-row { display: flex; align-items: center; gap: 2px; margin-top: 8px; }
.zoom-label { min-width: 52px; height: 26px; border-radius: 8px; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text-2); }
.zoom-label:hover { background: var(--fill); }

/* ---------- 표 ---------- */
#content g[data-type="table"] text { pointer-events: none; }
.tline { stroke: transparent; stroke-width: 9; }
.tline:hover { stroke: rgba(0, 122, 255, .35); }
.cell-sel { fill: rgba(0, 122, 255, .10); stroke: var(--blue); stroke-width: 2; pointer-events: none; }
.tbtns { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.tbtns .btn { flex: 1 1 auto; padding: 0 8px; font-size: 12px; background: var(--fill); color: var(--text); }
.tpick-menu { min-width: 0; padding: 10px; }
.tpick { display: grid; grid-template-columns: repeat(8, 18px); gap: 3px; }
.tpick i { width: 18px; height: 18px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--line); background: var(--solid); cursor: pointer; }
.tpick i.on { background: var(--blue-soft); box-shadow: inset 0 0 0 1.5px var(--blue); }
.tpick-label { margin-top: 8px; text-align: center; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- 스티커 메모와 알림 ---------- */
#badges { pointer-events: none; }
.note-new .dot { fill: #FF3B30; stroke: #fff; stroke-width: 2; }
.note-new .ring { fill: none; stroke: #FF3B30; stroke-width: 2.5; transform-box: fill-box; transform-origin: center; animation: notePing 1.4s ease-out infinite; }
@keyframes notePing { from { transform: scale(1); opacity: .95; } to { transform: scale(3.4); opacity: 0; } }
#content g[data-type="note"] text, #content g[data-type="note"] .string { pointer-events: none; }
#canvas-wrap[data-tool="select"]:not(.space) #content g[data-type="note"] .pin { cursor: grab; }

#btn-bell { position: relative; }
#btn-bell .badge { position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #FF3B30; color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--panel); font-variant-numeric: tabular-nums; }
#btn-bell.has-new .badge::after { content: ''; position: absolute; inset: 0; border-radius: 9px; border: 2px solid #FF3B30; animation: notePing 1.4s ease-out infinite; }
#btn-bell.has-new { color: #FF3B30; }

.menu.notif { width: 300px; padding: 6px; max-height: min(70vh, 520px); overflow-y: auto; }
.notif .nhead { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 2px; font-size: 14px; }
.notif .link, .notif .link:hover { width: auto; height: auto; padding: 2px 4px; background: none; color: var(--blue); font-size: 12.5px; font-weight: 500; }
.notif .nempty { margin: 0; padding: 10px 8px 12px; color: var(--text-2); font-size: 13px; }
.menu.notif .nrow { height: auto; min-height: 44px; padding: 6px 8px; gap: 10px; align-items: center; }
.menu.notif .nrow:hover { background: var(--fill); color: var(--text); }
.notif .chip { width: 22px; height: 22px; border-radius: 4px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(28, 32, 48, .12), 1px 2px 0 rgba(28, 32, 48, .1); flex: none; position: relative; }
.notif .nrow.new .chip::after { content: ''; position: absolute; top: -4px; right: -4px; width: 9px; height: 9px; border-radius: 50%; background: #FF3B30; box-shadow: 0 0 0 2px var(--panel); }
.notif .who { min-width: 0; flex: 1; }
.notif .who b { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif .nrow.new .who b { font-weight: 700; }
.notif .who small { display: block; color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif .nupdate { display: flex; align-items: center; gap: 10px; margin: 4px 2px 6px; padding: 10px; border-radius: 10px; background: var(--blue-soft); }
.notif .nupdate .btn, .notif .nupdate .btn:hover { width: auto; height: 30px; padding: 0 12px; border-radius: 9px; background: var(--blue); color: #fff; font-size: 12.5px; font-weight: 600; flex: none; }
.notif .nupdate.app { background: rgba(52, 199, 89, .16); }
.notif .nupdate.app .btn, .notif .nupdate.app .btn:hover { background: #1F8A3B; }
.stickies { gap: 6px; }
.stickies .swatch { width: 26px; height: 26px; border-radius: 5px; }

/* ---------- 메뉴 / 팝오버 ---------- */
.menu { position: fixed; z-index: 100; min-width: 210px; padding: 5px; background: var(--panel); border-radius: 13px; box-shadow: var(--shadow-pop); animation: pop .14s cubic-bezier(.2, .9, .3, 1.2); transform-origin: top left; }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 10px; border-radius: 8px; text-align: left; font-size: 13px; }
.menu button:hover { background: var(--blue); color: #fff; }
.menu button:hover .key { color: rgba(255, 255, 255, .75); }
.menu button:disabled { opacity: .35; pointer-events: none; }
.menu button.danger { color: var(--red); }
.menu button.danger:hover { background: var(--red); color: #fff; }
.menu .key { margin-left: auto; padding-left: 18px; color: var(--text-2); font-size: 12px; }
.menu .check { width: 14px; margin-right: -4px; }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 5px 8px; }
.menu .info { padding: 8px 10px 6px; }
.menu .info b { display: block; font-size: 13px; }
.menu .info small { color: var(--text-2); font-size: 12px; }
.menu.flyout { min-width: 0; display: flex; gap: 2px; padding: 6px; }
.menu.flyout .btn { width: 36px; height: 36px; padding: 0; justify-content: center; }
.menu.flyout .btn:hover { background: var(--fill); color: var(--text); }
.menu.flyout .btn.on, .menu.flyout .btn.on:hover { background: var(--blue); color: #fff; }

.palette { width: 216px; min-width: 0; padding: 10px; }
.palette .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.palette .grid button { width: 100%; height: auto; aspect-ratio: 1; padding: 0; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px var(--line); transition: transform .1s; }
.palette .grid button:hover { background: var(--c); transform: scale(1.15); }
.palette .grid button.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--blue); }
.palette .foot { display: flex; gap: 6px; margin-top: 10px; align-items: center; }
.palette .foot .btn { height: 28px; width: auto; font-size: 12px; background: var(--fill); padding: 0 10px; color: var(--text); justify-content: center; }
.palette .foot .btn:hover { background: var(--fill-2); color: var(--text); }
.palette input[type="color"] { width: 28px; height: 28px; padding: 0; border: 0; background: none; border-radius: 8px; cursor: pointer; flex: none; }
.palette .field { height: 28px; }

/* ---------- 다이얼로그 ---------- */
.backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .28); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .18s; }
@keyframes fade { from { opacity: 0; } }
.dialog { width: min(440px, 100%); max-height: min(720px, calc(100dvh - 40px)); flex: none; display: flex; flex-direction: column; background: var(--panel); border-radius: 22px; box-shadow: var(--shadow-pop); animation: rise .26s cubic-bezier(.2, .9, .3, 1.1); user-select: text; }
.dialog.wide { width: min(780px, 100%); }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.dialog header { display: flex; align-items: center; padding: 18px 16px 8px 22px; gap: 8px; }
.dialog header h2 { margin: 0; font-size: 18px; font-weight: 700; flex: 1; letter-spacing: -.01em; }
.dialog .body { padding: 6px 22px 8px; overflow-y: auto; min-height: 0; }
.dialog .body p { margin: 0 0 12px; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 20px; }
.dialog footer .btn { height: 36px; padding: 0 18px; border-radius: 11px; font-weight: 600; background: var(--fill); }
.dialog footer .btn.primary { background: var(--blue); }
.dialog footer .btn.primary.danger { background: var(--red); color: #fff; }
.input { width: 100%; height: 38px; border-radius: 11px; border: 0; background: var(--fill); padding: 0 12px; font-size: 14px; outline: 0; user-select: text; }
.input:focus { background: var(--solid); box-shadow: 0 0 0 3px var(--blue-soft), 0 0 0 1px var(--blue); }
textarea.code { width: 100%; height: min(46vh, 380px); padding: 12px 14px; border: 0; border-radius: 12px; background: var(--fill); outline: 0; resize: vertical; white-space: pre; overflow: auto; user-select: text;
  font: 12px/1.55 ui-monospace, "SF Mono", Menlo, Consolas, "D2Coding", monospace; tab-size: 4; }
textarea.code:focus { box-shadow: 0 0 0 1.5px var(--blue); }
.dialog code { font: 12px ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--fill); padding: 1px 5px; border-radius: 5px; }
.dialog a { color: var(--blue); }
.inline { display: flex; gap: 8px; align-items: center; }
.inline select.field { flex: none; width: 96px; height: 38px; border-radius: 11px; font-size: 13.5px; }
.inline .btn { height: 38px; border-radius: 11px; }
.sec-title { margin: 18px 0 8px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.people { display: flex; flex-direction: column; background: var(--fill); border-radius: 13px; overflow: hidden; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; min-height: 48px; }
.person + .person { border-top: 1px solid var(--line); }
.person .avatar { width: 30px; height: 30px; font-size: 12px; }
.person .who { flex: 1; min-width: 0; }
.person .who b { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .who small { color: var(--text-2); font-size: 12px; }
.person select.field { flex: none; width: 92px; background-color: transparent; }
.person .role { color: var(--text-2); font-size: 12.5px; padding-right: 8px; }
.note { margin-top: 14px !important; font-size: 12px !important; color: var(--text-2) !important; }

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; padding-bottom: 8px; }
.fcard { text-align: left; border-radius: 14px; padding: 6px; position: relative; transition: background .12s; cursor: pointer; }
.fcard:hover { background: var(--fill); }
.fcard.current .thumb { box-shadow: 0 0 0 2.5px var(--blue); }
.fcard .thumb { aspect-ratio: 4 / 3; border-radius: 10px; background: var(--solid); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; overflow: hidden; color: var(--text-3); }
.fcard .thumb img { width: 100%; height: 100%; object-fit: contain; }
.fcard b { display: block; margin: 8px 26px 0 4px; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcard small { display: block; margin: 1px 4px 2px; color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcard .btn { position: absolute; right: 6px; bottom: 8px; }
.files-empty { text-align: center; color: var(--text-2); padding: 44px 0 36px; font-size: 14px; }
.dialog footer.split { justify-content: space-between; }
.dialog footer.split div { display: flex; gap: 8px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--fill-2); border-top-color: var(--blue); animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 토스트 ---------- */
#toasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; max-width: min(520px, 90vw); padding: 10px 16px; border-radius: 14px; background: rgba(40, 40, 42, .92); color: #fff; font-size: 13.5px; box-shadow: var(--shadow-pop); display: flex; align-items: center; gap: 14px; animation: rise .25s cubic-bezier(.2, .9, .3, 1.1); }
.toast button { color: #64B5FF; font-weight: 600; white-space: nowrap; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .25s; }

/* ---------- 키보드 포커스 ---------- */
:focus-visible { outline: 0; }
.btn:focus-visible, .btn-google:focus-visible, .btn-plain:focus-visible, .avatar:focus-visible, .seg button:focus-visible, .swatch:focus-visible,
.zoom-label:focus-visible, .lrow .ib:focus-visible, .hrow:focus-visible, .fcard:focus-visible, .menu button:focus-visible, .palette .grid button:focus-visible { box-shadow: var(--ring); }
input[type="range"]:focus-visible { box-shadow: 0 0 0 3px var(--blue-soft); }

/* ---------- 툴팁: 아이콘 버튼의 이름과 단축키 ---------- */
.tip { position: fixed; z-index: 300; pointer-events: none; display: flex; align-items: center; gap: 8px; max-width: 280px; padding: 6px 9px; border-radius: var(--r-sm);
  background: rgba(40, 40, 44, .94); color: #fff; font-size: 12px; font-weight: 500; line-height: 1.35; box-shadow: 0 6px 20px rgba(28, 32, 48, .22); opacity: 0; transform: translateY(2px); transition: opacity .12s, transform .12s; }
.tip.show { opacity: 1; transform: none; }
.tip kbd { font: inherit; font-weight: 500; color: rgba(255, 255, 255, .72); padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, .16); white-space: nowrap; }

/* ---------- 빈 보드 안내 ---------- */
#empty-hint { position: fixed; left: 74px; right: 296px; top: 76px; bottom: 12px; display: grid; place-items: center; pointer-events: none; z-index: 1; }
body.side-hidden #empty-hint { right: 12px; }
#empty-hint .box { max-width: 460px; text-align: center; padding: 0 16px; }
#empty-hint .art { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); }
#empty-hint h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
#empty-hint p { margin: 0 auto 18px; max-width: 340px; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
#empty-hint .acts { display: flex; flex-wrap: nowrap; justify-content: center; gap: 8px; pointer-events: auto; }
#empty-hint .btn { height: 36px; padding: 0 14px 0 11px; border-radius: 11px; font-weight: 500; background: var(--solid); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(28, 32, 48, .05); }
#empty-hint .btn:hover { background: var(--solid); box-shadow: 0 0 0 1px var(--blue), 0 1px 2px rgba(28, 32, 48, .05); }
#empty-hint .btn.primary { background: var(--blue); box-shadow: none; }
#empty-hint kbd, #tool-hint kbd { font: inherit; font-size: 12px; font-weight: 500; color: var(--text-2); min-width: 20px; padding: 1px 6px; border-radius: 6px; background: var(--fill); text-align: center; }

/* ---------- 도구 사용법 한 줄 ---------- */
#tool-hint { position: fixed; left: 74px; bottom: 14px; z-index: 8; display: flex; align-items: center; gap: 14px; height: 34px; padding: 0 14px; border-radius: 17px; font-size: 12.5px; color: var(--text); pointer-events: none;
  background: var(--panel); box-shadow: var(--shadow); animation: rise .2s cubic-bezier(.2, .9, .3, 1.1); }
#tool-hint b { font-weight: 600; }
#tool-hint span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); white-space: nowrap; }

/* ---------- 속성 묶음 ---------- */
.pgroup { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.pgroup:last-child { border-bottom: 0; padding-bottom: 0; }
.ptitle { font-size: 12px; font-weight: 600; color: var(--text); }
#props-body { gap: 12px; }

/* 저장 상태: 글자만이 아니라 모양으로도 구분 */
.status { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.status[data-state="saved"]::before { background: #34C759; }
.status[data-state="dirty"]::before { background: #FF9500; }
.status[data-state="busy"]::before { background: var(--blue); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

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

@media (max-width: 1240px) { .wide-only { display: none !important; } }
@media (max-width: 860px) {
  .tb-edit, .status, #tool-hint { display: none; }
  #empty-hint { left: 12px; right: 12px; }
  /* 좁은 화면에서는 상단 버튼을 아이콘만 남긴다 */
  #topbar .btn.label { font-size: 0; gap: 0; padding: 0 7px; }
  #topbar .tb-group:first-child { flex: 1 1 auto; overflow: hidden; }
  #topbar .tb-group:last-child { flex: none; }
  .doc-name { flex-basis: 110px; }
  #side { width: 250px; }
}
