/* The Home page (index.html): the programs, templates, recent files and what this browser keeps. Tokens from kit.css. */
#home { display: flex; flex-direction: column; height: 100%; }

/* ---------- top ---------- */
.h-top { display: flex; align-items: center; gap: 16px; flex: none; height: 56px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.h-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-size: 17px; font-weight: 600; letter-spacing: -.01em; flex: none; }
.h-brand svg { display: block; }
.h-tag { margin: 0; color: var(--muted); font-size: 13px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-links { display: flex; gap: 4px; flex: none; margin-left: auto; }
.h-links a { color: var(--text-2); text-decoration: none; padding: 6px 10px; border-radius: var(--radius); font-size: 13px; }
.h-links a:hover { background: var(--hover); color: var(--text); }

/* ---------- body: the programs, and the files panel on the right ---------- */
.h-body { display: flex; flex: 1; min-height: 0; }
.h-main { flex: 1; min-width: 0; overflow-y: auto; padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 26px; }
.h-main > section { max-width: 1120px; width: 100%; }
.h-main h2 { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }

/* drop any file here */
.h-drop { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-l); background: var(--surface); }
.h-drop > .material-symbols-outlined { font-size: 26px; color: var(--muted); flex: none; }
.h-drop > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.h-drop b { font-weight: 600; font-size: 14px; }
.h-drop span { color: var(--muted); font-size: 12.5px; }
body.dragging .h-drop { border-color: var(--accent); background: var(--accent-soft); }

/* buttons */
.h-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; flex: none; }
.h-btn:hover { background: var(--hover); }
.h-btn:disabled { opacity: .5; cursor: progress; }
.h-btn .material-symbols-outlined { font-size: 18px; }
.h-btn.quiet { border-color: transparent; background: none; color: var(--text-2); }
.h-btn.quiet:hover { background: var(--hover); color: var(--text); }
.h-btn:focus-visible, .h-prog-main:focus-visible, .h-tpl:focus-visible, .h-file:focus-visible, .h-kind:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* program cards */
.h-progs { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 10px; }
.h-prog { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.h-prog:hover { border-color: var(--line-strong); }
.h-prog-main { display: flex; align-items: center; gap: 12px; padding: 12px 12px 8px; color: var(--text); text-decoration: none; border-radius: var(--radius-l) var(--radius-l) 0 0; }
.h-tile { width: 40px; height: 40px; border-radius: 10px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--tint-soft); color: var(--tint-strong); }
.h-tile .material-symbols-outlined { font-size: 22px; font-variation-settings: 'opsz' 24; }
.h-prog-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.h-prog-name { font-size: 14px; font-weight: 600; }
.h-prog-main:hover .h-prog-name { color: var(--tint-strong); }
.h-prog-hint { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-prog-acts { display: flex; gap: 4px; padding: 0 12px 12px 64px; }

/* templates */
.h-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 10px; }
.h-tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 14px 14px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--tint); border-radius: var(--radius-l); cursor: pointer; color: var(--text); font: inherit; }
.h-tpl:hover { border-color: var(--line-strong); border-top-color: var(--tint-strong); background: var(--surface); }
.h-tpl-top { display: flex; align-items: center; gap: 6px; color: var(--tint-strong); font-size: 12px; margin-bottom: 2px; }
.h-tpl-top .material-symbols-outlined { font-size: 17px; }
.h-tpl-name { font-size: 14px; font-weight: 600; }
.h-tpl-desc { font-size: 12.5px; color: var(--muted); line-height: 1.4; }

/* ---------- the files panel (styled like the programs' side panels) ---------- */
.h-side { width: 340px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
.h-pane { display: flex; flex-direction: column; border-bottom: 1px solid var(--line); min-height: 0; }
.h-pane-grow { flex: 1; }
.h-pane .pane-head { display: flex; align-items: center; gap: 6px; flex: none; height: 36px; padding: 0 12px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; font-weight: 600; }
.h-pane .pane-head > .material-symbols-outlined { font-size: 17px; color: var(--accent-strong); }
.h-pane .pane-sub { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: auto; font-variant-numeric: tabular-nums; }
.h-kinds { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px 0; flex: none; }
.h-kind { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; }
.h-kind .material-symbols-outlined { font-size: 15px; }
.h-kind:hover { background: var(--hover); }
.h-kind.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }
.h-find { margin: 8px 10px 0; height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; flex: none; }
.h-find:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.h-recent { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 6px 10px; }
.h-recent .empty-state { margin: 0; padding: 10px 8px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.h-file { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius); color: var(--text); text-decoration: none; }
.h-file:hover { background: var(--hover); }
.h-file-ic { width: 30px; height: 30px; flex: none; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--tint-strong); background: var(--tint-soft); }
.h-file-ic .material-symbols-outlined { font-size: 18px; }
.h-file-main { display: flex; flex-direction: column; min-width: 0; }
.h-file-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-file-when { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

.h-store { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.h-meter { height: 6px; border-radius: 3px; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.h-meter > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.h-note { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.h-store > .h-note { margin: 0; }
.h-note b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.h-row { display: flex; flex-wrap: wrap; gap: 6px; }
.h-check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; cursor: pointer; }
.h-check input { margin: 2px 0 0; accent-color: var(--accent); flex: none; }

/* ---------- a file dragged over the page, and messages ---------- */
.h-dropzone { position: fixed; inset: 10px; z-index: 50; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border: 2px dashed var(--accent); border-radius: 16px; background: color-mix(in srgb, var(--accent-soft) 88%, transparent); color: var(--accent-strong); font-size: 16px; font-weight: 600; pointer-events: none; }
.h-dropzone .material-symbols-outlined { font-size: 40px; }
body.dragging .h-dropzone { display: flex; }
.h-toast { position: fixed; left: 50%; bottom: 22px; z-index: 60; transform: translate(-50%, 12px); max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; border-radius: var(--radius-l); background: var(--text); color: var(--surface); font-size: 13px; box-shadow: var(--pop-shadow); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
.h-toast.show { opacity: 1; transform: translate(-50%, 0); }
.h-toast.bad { background: var(--danger); color: #fff; }

/* ---------- narrow screens: one column, the whole page scrolls ---------- */
@media (max-width: 860px) {
  #home { height: auto; min-height: 100%; }
  html, body { overflow: auto; height: auto; }
  .h-body { flex-direction: column; }
  .h-main { overflow: visible; padding: 16px 16px 24px; }
  .h-side { width: auto; border-left: 0; border-top: 1px solid var(--line); }
  .h-recent { max-height: 420px; }
  .h-tag { display: none; }
  .h-top { padding: 0 16px; }
}
@media (max-width: 520px) {
  .h-drop { flex-wrap: wrap; }
  .h-drop > div { flex-basis: calc(100% - 50px); }
  .h-prog-acts { padding-left: 12px; }
}
