/* Site Builder Builder — the editor's Files sheet
   Under the topbar's Files button, over the canvas: three glass panes side
   by side — the site's folder as a tree, the picked folder or file with where
   it is kept and whether it goes out, and Claude reading the files. The
   daylight-glass system from app.css — the same tokens, hairlines and press
   contract; "published" is the ok green so it reads at a glance as "goes
   out", and maroon stays the selection. The Claude pane wears the chat
   panel's warm paper and clay (app.css .chat). */

/* the topbar button — To-dos' twin: a word on a wide screen, an icon on a laptop */
.files-btn svg { width: 14px; height: 14px; }
.files-btn.on { background: var(--accent-soft); border-color: rgba(123, 30, 46, .45); color: var(--accent-deep); }
@media (max-width: 1600px) {
  .files-btn { padding: 0; width: 33px; height: 33px; justify-content: center; }
  .files-btn svg { width: 15px; height: 15px; }
  .files-btn .files-lab { display: none; }
}

.files-sheet {
  position: fixed; z-index: 88; top: 64px; left: 12px; right: 12px; bottom: 12px;
  padding: 14px; gap: 12px;
  background: rgba(245, 245, 245, .9); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 24px 70px rgba(26, 26, 26, .24), 0 4px 14px rgba(26, 26, 26, .1);
  backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  display: none; flex-direction: column; min-height: 0;
}
.files-sheet.open { display: flex; animation: dd-in .24s var(--ease-out); }
.files-sheet.closing { display: flex; animation: dd-out .16s var(--ease-out) forwards; pointer-events: none; }
.fl-sheet-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 0 2px 0 6px; }
.fl-sheet-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; min-width: 0; flex: 1; }
.fl-sheet-title > b { font: 800 19px/1.2 var(--display); letter-spacing: -.015em; color: #111111; }
.fl-sheet-title > span { font-size: 12.5px; color: var(--muted); }

.fl-shell {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) minmax(300px, 370px); gap: 12px;
}
.fl-pane {
  min-width: 0; min-height: 0; display: flex; flex-direction: column;
  background: var(--glass); border: 1px solid var(--line); border-radius: 18px;
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--shadow-rest), inset 0 1px 0 rgba(255, 255, 255, .7);
}

/* the published mark — one green dot, everywhere it appears */
.fl-pub-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px rgba(14, 138, 95, .16); flex-shrink: 0; vertical-align: 1px; }

/* ---- the tree ---- */
.fl-nav { padding: 12px 8px 8px; gap: 10px; }
.fl-find {
  display: flex; align-items: center; gap: 7px; margin: 0 4px; padding: 7px 11px;
  background: rgba(255, 255, 255, .75); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .16s var(--ease-out), box-shadow .16s var(--ease-out);
}
.fl-find:focus-within { border-color: rgba(123, 30, 46, .45); box-shadow: 0 0 0 3px var(--accent-soft); }
.fl-find svg { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
.fl-find input { border: 0; background: transparent; font: 400 13px var(--sans); color: var(--ink); width: 100%; outline: none; }
.fl-scope { margin: 0 4px; }
.fl-scope .btn { flex: 1 1 auto; justify-content: center; font-size: 12px; padding: 5px 8px; }
.fl-tree, .fl-tree ul { list-style: none; margin: 0; padding: 0; }
.fl-tree { overflow: auto; flex: 1; min-height: 0; padding: 0 2px 6px; }
.fl-row {
  --d: 0;
  display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0;
  padding: 5px 9px 5px calc(6px + var(--d) * 15px); margin: 1px 0;
  font: 500 13px/1.3 var(--sans); color: var(--ink); text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 9px; cursor: pointer;
  transition: background .16s var(--ease-out), border-color .16s var(--ease-out);
}
.fl-row:hover { background: rgba(255, 255, 255, .7); }
.fl-row:active { background: rgba(255, 255, 255, .9); }
.fl-row.sel { background: var(--accent-soft); border-color: rgba(123, 30, 46, .3); color: var(--accent-deep); }
.fl-site > .fl-row { font-weight: 700; }
.fl-chev, .fl-chev-gap { width: 12px; height: 12px; flex-shrink: 0; color: var(--muted); transition: transform .22s var(--ease-out); }
[aria-expanded="true"] > .fl-row .fl-chev { transform: rotate(90deg); }
.fl-ic { display: inline-flex; flex-shrink: 0; color: var(--muted); }
.fl-ic svg { width: 15px; height: 15px; }
.fl-row.pub .fl-ic { color: var(--ok); }
.fl-row.sel .fl-ic { color: var(--accent); }
.fl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-meta { font: 400 11px var(--mono); color: var(--muted); opacity: .8; white-space: nowrap; flex-shrink: 0; }
.fl-loading { padding: 6px 10px 6px calc(10px + var(--d, 0) * 15px); font-size: 12.5px; color: var(--muted); }
.fl-none { margin: 4px 12px; font-size: 13px; color: var(--muted); }

/* ---- the middle ---- */
.fl-detail { padding: 16px 20px 20px; overflow: auto; }
.fl-blank { margin: auto; max-width: 340px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; }
.fl-blank svg { width: 30px; height: 30px; opacity: .5; margin-bottom: 4px; }
.fl-blank b { color: var(--ink); font-size: 15px; }
.fl-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-bottom: 10px; font-size: 12.5px; }
.fl-crumb { background: none; border: 0; padding: 2px 5px; border-radius: 6px; font: 500 12.5px var(--sans); color: var(--muted); cursor: pointer; transition: background .16s var(--ease-out), color .16s var(--ease-out); }
.fl-crumb:hover { background: rgba(255, 255, 255, .8); color: var(--accent-deep); }
.fl-crumb:last-child { color: var(--ink); font-weight: 700; }
.fl-crumb-sep { color: var(--muted); opacity: .5; }
.fl-detail-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.fl-detail-head h2 { margin: 0; font: 800 22px/1.2 var(--display); letter-spacing: -.015em; color: #111111; overflow-wrap: anywhere; }
.fl-detail-acts { display: flex; gap: 6px; margin-left: auto; }
.fl-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font: 700 11px var(--sans); letter-spacing: .04em; text-transform: uppercase;
  background: rgba(255, 255, 255, .55); border: 1px solid var(--line); color: var(--muted);
}
.fl-badge.pub { color: var(--ok); border-color: rgba(14, 138, 95, .35); background: rgba(14, 138, 95, .08); }

.fl-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.fl-stat { display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; border-radius: 14px; background: rgba(255, 255, 255, .55); border: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }
.fl-stat .lab { font: 700 11px var(--sans); letter-spacing: .11em; text-transform: uppercase; }
.fl-stat b { font: 800 22px/1.15 var(--display); color: #111111; font-variant-numeric: tabular-nums; }
.fl-stat.pub b { color: var(--ok); }

.fl-facts { margin: 0 0 16px; display: grid; gap: 1px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-soft); background: var(--line-soft); }
.fl-fact { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 14px; background: rgba(255, 255, 255, .62); }
.fl-fact dt { font: 700 11px/1.9 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fl-fact dd { margin: 0; font-size: 13px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; overflow-wrap: anywhere; }
.fl-fact code, .fl-detail code { font: 400 12px var(--mono); background: rgba(26, 26, 26, .06); padding: 1px 6px; border-radius: 6px; }
.fl-fact a { color: var(--accent); font-weight: 600; text-decoration: none; }
.fl-fact a:hover { text-decoration: underline; }
.fl-dim { color: var(--muted); font-size: 12px; opacity: .85; }
.fl-fact .fl-dim { flex-basis: 100%; }
.fl-copy { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font: 600 11px var(--sans); color: var(--muted); cursor: pointer; transition: border-color .16s var(--ease-out), color .16s var(--ease-out), background .16s var(--ease-out); }
.fl-copy:hover { color: var(--accent-deep); border-color: rgba(123, 30, 46, .45); background: #FFFFFF; }

.fl-sec-lab { font: 700 11px var(--sans); letter-spacing: .11em; text-transform: uppercase; color: var(--muted); margin: 4px 2px 8px; }
.fl-items { display: flex; flex-direction: column; gap: 2px; }
.fl-item {
  display: grid; grid-template-columns: 18px minmax(120px, auto) minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 10px; border: 1px solid transparent; background: transparent;
  font: 500 13px var(--sans); color: var(--ink); text-align: left; cursor: pointer;
  transition: background .16s var(--ease-out), border-color .16s var(--ease-out);
}
.fl-item:hover { background: rgba(255, 255, 255, .75); border-color: var(--line-soft); }
.fl-item.pub .fl-ic { color: var(--ok); }
.fl-item-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-item-what { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fl-preview { border-radius: 14px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .7); overflow: hidden; }
.fl-preview > .fl-dim { padding: 14px; }
.fl-preview > p.fl-dim { margin: 0; padding: 8px 14px; border-top: 1px solid var(--line-soft); }
.fl-code { margin: 0; padding: 14px 16px; max-height: 60vh; overflow: auto; font: 400 12px/1.6 var(--mono); color: var(--ink); white-space: pre; tab-size: 2; }
.fl-img { padding: 16px; display: flex; justify-content: center; background:
  repeating-conic-gradient(rgba(26, 26, 26, .05) 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.fl-img img { max-width: 100%; max-height: 52vh; object-fit: contain; border-radius: 6px; }
.fl-img + .fl-code { border-top: 1px solid var(--line-soft); max-height: 30vh; }
.fl-img video { max-width: 100%; max-height: 52vh; border-radius: 6px; background: #111111; }
.fl-audio { padding: 18px 16px; }
.fl-audio audio { width: 100%; }
.fl-page-chip {
  background: rgba(255, 255, 255, .8); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px;
  font: 500 12px var(--mono); color: var(--ink); cursor: pointer;
  transition: border-color .16s var(--ease-out), color .16s var(--ease-out);
}
.fl-page-chip:hover { color: var(--accent-deep); border-color: rgba(123, 30, 46, .45); }

/* ---- Media: the gallery ---- */
.fl-media-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin: 0 0 16px; }
.fl-media-bar .fl-sec-lab { margin: 0 0 0 2px; }
.fl-media-bar .mode-group + .fl-sec-lab { margin-left: 8px; }
.fl-media-bar .btn { font-size: 12px; padding: 5px 11px; }
.fl-media-group { margin-bottom: 18px; }
.fl-media-group-head { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 8px; min-width: 0; }
.fl-media-group-head b { font: 700 13.5px var(--sans); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-media-group-head span { font: 400 11.5px var(--mono); color: var(--muted); white-space: nowrap; }
.fl-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fl-tile {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 6px 6px 8px; text-align: left; cursor: pointer;
  background: rgba(255, 255, 255, .55); border: 1px solid var(--line-soft); border-radius: 14px;
  font: 500 12.5px var(--sans); color: var(--ink);
  transition: background .16s var(--ease-out), border-color .16s var(--ease-out), transform .32s var(--ease-spring), box-shadow .32s var(--ease-out);
}
.fl-tile:hover { background: #FFFFFF; border-color: var(--line); transform: translateY(-1px); box-shadow: var(--shadow-rest); }
.fl-tile:active { transform: translateY(1px) scale(.98); transition-duration: .06s; }
.fl-tile-pic {
  position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 9px; overflow: hidden; color: var(--muted);
  background: repeating-conic-gradient(rgba(26, 26, 26, .05) 0 25%, transparent 0 50%) 0 0 / 14px 14px;
}
.fl-tile-pic img, .fl-tile-pic video { width: 100%; height: 100%; object-fit: contain; }
.fl-tile-pic.k-video video { object-fit: cover; }
.fl-tile-pic > svg { width: 28px; height: 28px; opacity: .55; }
.fl-tile-kind {
  position: absolute; left: 6px; bottom: 6px; padding: 1px 6px; border-radius: 6px; font: 700 10px var(--mono); font-style: normal;
  background: rgba(17, 17, 17, .72); color: #FFFFFF;
}
.fl-tile-name { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 2px 2px 0; font-weight: 600; }
.fl-tile-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-tile-meta { display: flex; justify-content: space-between; gap: 6px; padding: 0 2px; font: 400 11px var(--mono); color: var(--muted); white-space: nowrap; }
.fl-tile-meta > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.fl-tile-meta .none { color: var(--danger-ink); }

/* ---- Claude ---- */
.fl-claude {
  --clay: #D97757; --clay-soft: #FBE9E2; --cl-ink: #141413; --cl-muted: #7C7A72; --cl-paper: #FAF9F5; --cl-line: rgba(20, 20, 19, .11);
  background: rgba(250, 249, 245, .9); color: var(--cl-ink); padding: 14px; gap: 10px;
}
.fl-claude-head { display: flex; align-items: center; gap: 10px; }
.fl-claude-mark { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--clay-soft); color: var(--clay); flex-shrink: 0; }
.fl-claude-mark svg { width: 16px; height: 16px; }
.fl-claude-title { display: flex; flex-direction: column; min-width: 0; }
.fl-claude-title b { font-size: 14px; }
.fl-claude-title span { font-size: 12px; color: var(--cl-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-check { justify-content: center; }
/* a primary button that is waiting keeps its colour under the pointer —
   the shared disabled hover would turn it white on white */
.fl-claude .btn.primary:disabled:hover { background: var(--cta-grad); border-color: transparent; }
.fl-check.loading:disabled { opacity: .92; }
.fl-feed { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px; }
.fl-feed-empty { color: var(--cl-muted); font-size: 13px; line-height: 1.5; padding: 6px 2px; }
.fl-sugg { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.fl-sugg-q {
  text-align: left; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--cl-line); background: #FFFFFF;
  font: 500 12.5px var(--sans); color: var(--cl-ink); cursor: pointer;
  transition: border-color .16s var(--ease-out), transform .32s var(--ease-spring), box-shadow .32s var(--ease-out);
}
.fl-sugg-q:hover { border-color: var(--clay); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(217, 119, 87, .14); }
.fl-sugg-q:active { transform: translateY(1px) scale(.98); transition-duration: .06s; }
.fl-msg { font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.fl-msg.you { align-self: flex-end; max-width: 88%; padding: 8px 12px; border-radius: 14px 14px 4px 14px; background: var(--cl-ink); color: #FFFFFF; }
.fl-msg.claude { padding: 10px 12px; border-radius: 14px; background: #FFFFFF; border: 1px solid var(--cl-line); }
.fl-msg.claude.err { color: var(--danger-ink); border-color: var(--danger-line); background: var(--danger-bg); }
.fl-msg.working { display: flex; align-items: center; gap: 10px; color: var(--cl-muted); }
.fl-msg.md > :first-child { margin-top: 0; }
.fl-msg.md > :last-child { margin-bottom: 0; }
.fl-msg.md p, .fl-msg.md ul, .fl-msg.md ol { margin: 0 0 8px; }
.fl-msg.md ul, .fl-msg.md ol { padding-left: 18px; }
.fl-msg.md li { margin: 3px 0; }
.fl-msg.md h3, .fl-msg.md h4, .fl-msg.md h5, .fl-msg.md h6 { margin: 10px 0 6px; font-size: 13.5px; }
.fl-msg.md code { font: 400 11.5px var(--mono); background: var(--cl-paper); border: 1px solid var(--cl-line); padding: 0 4px; border-radius: 5px; }
.fl-msg.md pre { margin: 0 0 8px; padding: 8px 10px; background: var(--cl-paper); border-radius: 8px; overflow: auto; }
.fl-msg.md pre code { border: 0; padding: 0; background: none; }
.fl-msg.md a { color: var(--clay); }
.fl-msg.md blockquote { margin: 0 0 8px; padding-left: 10px; border-left: 3px solid var(--clay-soft); color: var(--cl-muted); }
.fl-think { display: inline-flex; gap: 3px; }
.fl-think i { width: 5px; height: 5px; border-radius: 50%; background: var(--clay); animation: fl-think 1.2s var(--ease-out) infinite; }
.fl-think i:nth-child(2) { animation-delay: .15s; }
.fl-think i:nth-child(3) { animation-delay: .3s; }
@keyframes fl-think { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .fl-think i { animation-duration: 3s; } }
.fl-ask { display: flex; align-items: flex-end; gap: 8px; padding: 6px; border-radius: 16px; background: #FFFFFF; border: 1px solid var(--cl-line); transition: border-color .16s var(--ease-out), box-shadow .16s var(--ease-out); }
.fl-ask:focus-within { border-color: var(--clay); box-shadow: 0 0 0 3px rgba(217, 119, 87, .14); }
.fl-ask textarea { flex: 1; border: 0; resize: none; background: transparent; font: 400 13px/1.45 var(--sans); color: var(--cl-ink); padding: 5px 6px; outline: none; max-height: 140px; }
.fl-ask textarea:disabled { cursor: not-allowed; }
.fl-claude-note { margin: 0; font-size: 11.5px; color: var(--cl-muted); text-align: center; }

/* ---- narrower windows ---- */
@media (max-width: 1180px) {
  .files-sheet { overflow: auto; }
  .fl-shell { flex: none; grid-template-columns: minmax(220px, 270px) minmax(0, 1fr); grid-template-rows: minmax(420px, calc(100vh - 170px)) 440px; }
  .fl-claude { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .files-sheet { left: 6px; right: 6px; bottom: 6px; padding: 10px; }
  .fl-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .fl-nav { height: 360px; min-height: 0; }
  .fl-detail { height: auto; min-height: 0; }
  .fl-claude { height: 460px; }
  .fl-stats { grid-template-columns: minmax(0, 1fr); }
  .fl-fact { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .fl-item { grid-template-columns: 18px minmax(0, 1fr) auto; }
  .fl-item-what { display: none; }
}
