/* Components of the work screen. Sizes: touch targets ≥ 44px (tools 48,
   phone 52, keypad 48); radii panel 12 · tool 10 · input 8. */

/* ---- top bar ---- */
.fname { display: flex; flex-direction: column; min-width: 0; }
.fbtn {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 2px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.fbtn:hover { background: var(--hover); }
.fbtn > span { overflow: hidden; text-overflow: ellipsis; }
.fbtn .ic { width: 16px; height: 16px; color: var(--muted); }
.fname-sub { display: flex; align-items: center; gap: 6px; padding: 0 4px; font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 0; }
.fname-sub > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--muted); }
.dot.saved { background: var(--ok); }
.dot.dirty { background: var(--warn); }

.zoom {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0 6px 0 10px;
  border: 0;
  border-radius: var(--r-input);
  background: transparent;
  font-family: var(--mono);
  font-size: 12.5px;
}
.zoom:hover { background: var(--hover); }
.zoom .ic { width: 16px; height: 16px; color: var(--muted); }

.share-btn {
  height: 36px;
  margin-left: 6px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-input);
  background: var(--fill);
  color: var(--on-fill);
  font-weight: 600;
}
.share-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--fill) 85%, #fff); }

/* Shown only at some widths (see responsive.css). */
.nav-close,
.tablet-up,
.phone-only { display: none; }

/* ---- panel parts ---- */
.tabs { display: flex; align-items: center; gap: 2px; padding: 8px 8px 6px; border-bottom: 1px solid var(--line); flex: none; }
.tab {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-input);
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--panel2); color: var(--text); font-weight: 600; }

.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.pfoot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.empty { padding: 16px 14px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }

.search {
  flex: none;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 10px 4px;
  padding: 0 8px;
  border-radius: var(--r-input);
  background: var(--panel2);
  color: var(--muted);
}
.search .ic { width: 16px; height: 16px; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--text); font-size: 13px; }
.search:focus-within,
.cmd:focus-within { box-shadow: inset 0 0 0 1px var(--accent); }

/* Layer rows. */
.layers { padding: 4px 6px; }
.lrow { display: flex; align-items: center; gap: 2px; padding-right: 4px; border-radius: var(--r-input); }
.lrow:hover { background: var(--hover); }
.lrow.cur { background: var(--tint); }
.lrow.off .lname { opacity: 0.45; }
.lpick {
  flex: 1;
  min-width: 0;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  text-align: left;
}
.sw { width: 12px; height: 12px; flex: none; border-radius: 3px; box-shadow: inset 0 0 0 1px rgb(127 127 127 / 35%); }
.lname { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.curtag { flex: none; font-size: 10.5px; font-weight: 600; color: var(--ink); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; line-height: 16px; }
.lrow .eye { color: var(--muted); }
.lrow.off .eye { color: var(--text); }
.layer-form { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); }
.layer-form .field { height: 32px; }

/* Reference files. */
.notice {
  margin: 10px 10px 4px;
  padding: 10px 12px;
  border-radius: var(--r-input);
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  font-size: 12.5px;
  line-height: 1.5;
}
.xref {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-tool);
}
.xref.missing { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.xref .t { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.xref .t > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xref .s { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xref .ok { color: var(--ok); }
.xref .miss { color: var(--warn); }
.xref .row { display: flex; gap: 6px; margin-top: 4px; }
.xref .btn { height: 30px; font-size: 12.5px; padding: 0 10px; }
.refs-head { display: flex; flex-direction: column; gap: 8px; padding: 10px 10px 4px; }
.refs-head p { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.refs-list { padding-bottom: 10px; }
.rail-sep { width: 28px; }

/* Inspector. */
.ph { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px 14px; border-bottom: 1px solid var(--line); }
.kind { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: var(--r-input); background: var(--tint); color: var(--ink); }
.kind .ic { width: 18px; height: 18px; }
.ph-title { font-weight: 600; font-size: 14px; }
.ph-sub { font-size: 12px; color: var(--muted); }
.sec { padding: 12px 14px 14px; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sh { margin: 0 0 10px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); }
.kv { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 8px; }
.k { font-size: 12.5px; color: var(--muted); }
.xy { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.fx {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--r-input);
  background: var(--panel2);
  min-width: 0;
}
.fx span { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.fx output { flex: 1; min-width: 0; text-align: right; font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx.act { border-color: var(--accent); }
select.field.dd { height: 32px; font-size: 12.5px; }
.swrow { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.swb { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; box-shadow: inset 0 0 0 1px rgb(127 127 127 / 35%); }
.swb[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.bylayer {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  font-size: 11.5px;
  font-weight: 600;
}
.bylayer[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: transparent;
  font-size: 12.5px;
}
.chip[aria-pressed="true"] { border-color: transparent; background: var(--tint); color: var(--ink); font-weight: 500; }
.text-value { font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sh.gap-top { margin-top: 16px; }
.help { font-size: 12.5px; line-height: 1.6; color: var(--muted); }

/* "더보기": every tool in a grid. */
.more-tools { width: 300px; gap: 4px; }
.more-tools .sh { margin: 6px 6px 2px; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; }
.tool-grid .tb { min-width: 0; width: 100%; height: 60px; }
.tool-grid .tb .lbl { display: block; }

/* ---- dock ---- */
.toolbar { position: relative; display: flex; align-items: center; gap: 2px; padding: 6px; }
.tb {
  min-width: var(--tool);
  height: var(--tool);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: none;
  padding: 0 6px;
  border: 0;
  border-radius: var(--r-tool);
  background: transparent;
  color: var(--text);
}
.tb:hover:not(:disabled, [aria-pressed="true"]) { background: var(--hover); }
.tb[aria-pressed="true"] { background: var(--fill); color: var(--on-fill); }
.tb .lbl { font-size: 10.5px; line-height: 1; white-space: nowrap; }
.tb.danger { color: var(--danger); }
.tb.more { display: none; }

.cmd {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 2px;
  padding: 0 8px 0 10px;
  border-radius: var(--r-tool);
  background: var(--panel2);
  color: var(--muted);
  cursor: text;
}
.cmd input { width: 184px; min-width: 0; border: 0; background: transparent; outline: none; color: var(--text); font-size: 13px; }
.cmd input::placeholder { color: var(--muted); }
.cmd kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; line-height: 18px; }

.aid {
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-input);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.aid:hover:not([aria-pressed="true"]) { background: var(--hover); }
.aid[aria-pressed="true"] { background: var(--tint); color: var(--ink); }
.aid .ic { width: 18px; height: 18px; }

/* Prompt and messages. */
.prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 8px 8px 14px;
  white-space: nowrap;
}
.prompt .ptxt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.prompt b { font-weight: 600; }
.prompt .log { color: var(--muted); }
.prompt.idle { opacity: 0; pointer-events: none; transition: opacity 0.4s; }
.esc {
  height: 28px;
  flex: none;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

/* Number pad for drawing on phones. */
.keypad { display: none; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; }
.keypad .fx { height: 44px; }
.keypad .fx output { font-size: 16px; }
.keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.key { height: 48px; border: 0; border-radius: var(--r-tool); background: var(--panel2); font: 18px var(--mono); }
.key.fn { font-size: 16px; color: var(--ink); }
.key.ok { background: var(--fill); color: var(--on-fill); font: 600 15px var(--font); }

/* Selection edit bar. */
.ctx { display: flex; align-items: center; gap: 0; padding: 4px; }
.ctx .chip-count { padding: 0 10px 0 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ctx .tb { min-width: 36px; height: 36px; border-radius: var(--r-input); padding: 0; }
.ctx .tb .lbl { display: none; }

/* ---- menus ---- */
.menu { width: max-content; min-width: 240px; max-width: min(340px, calc(100vw - 24px)); padding: 6px; display: flex; flex-direction: column; }
.menu-item {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-input);
  background: transparent;
  text-align: left;
  white-space: nowrap;
}
.menu-item:hover:not(:disabled) { background: var(--hover); }
.menu-item .hint { margin-left: auto; color: var(--muted); font: 11.5px var(--mono); }
.menu-info { padding: 8px 10px; font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.menu-links { display: flex; gap: 12px; padding: 6px 10px 4px; font-size: 12px; }

/* ---- empty state ---- */
.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
  pointer-events: none;
}
.empty-card { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 360px; padding: 24px; text-align: center; pointer-events: auto; }
.empty-card h2 { margin: 0; font-size: 16px; }
.empty-card p { color: var(--muted); line-height: 1.6; }
.empty-card .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#app.dragging .empty-state { background: var(--tint); }
