:root {
  --fg: #1a1a1a;
  --bg: #fafafa;
  --muted: #777;
  --card-bg: #fff;
  --border: #e0e0e0;
  --primary: #2b6cb0;
  --danger: #c53030;
  --good: #2f855a;
  --warn: #b7791f;
  --fail: #c53030;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--fg); background: var(--bg); }
header { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1.25rem; background: var(--card-bg); border-bottom: 1px solid var(--border); }
header .brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--fg); }
header nav a, header nav button.link { margin-left: 1rem; color: var(--fg); text-decoration: none; background: none; border: none; cursor: pointer; font-size: inherit; padding: 0; }
header nav a:hover, header nav button.link:hover { text-decoration: underline; }
main { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
h1, h2, h3 { margin-top: 0; }
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.25rem; margin: 0 0 1.25rem 0; }
.card.center { max-width: 360px; margin: 4rem auto; text-align: center; }
.muted { color: var(--muted); font-size: 0.9em; }
.note { color: var(--good); }
.error { color: var(--danger); }
button, .btn { background: var(--primary); color: #fff; border: 0; padding: 0.45rem 0.85rem; border-radius: 4px; cursor: pointer; font-size: 0.95rem; text-decoration: none; display: inline-block; }
button.danger, .btn.danger { background: var(--danger); }
button.primary { background: var(--primary); }
button:hover { opacity: 0.9; }
input, select, textarea { font: inherit; padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 4px; min-width: 240px; }
label { display: block; margin: 0.5rem 0; }
form { margin: 0.5rem 0; }
table { width: 100%; border-collapse: collapse; }
table th, table td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table th { background: #f0f0f0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.host h3 { margin: 0 0 0.3rem 0; }
.crumbs { margin: 0.5rem 0; font-size: 0.95rem; }
.crumbs a { text-decoration: none; color: var(--primary); }
pre { background: #f4f4f4; padding: 0.6rem; border-radius: 4px; overflow-x: auto; }
pre.inline { background: transparent; padding: 0; margin: 0; }
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; }
.status-pending { color: var(--warn); }
.status-running { color: var(--primary); }
.status-done   { color: var(--good); }
.status-ready  { color: var(--good); }
.status-failed { color: var(--fail); }
.status-created, .status-blob_exists, .status-already_exists, .status-path_exists { color: var(--good); }
.restore-tree { list-style: none; padding-left: 0; }
.restore-tree li { padding: 0.2rem 0; }
code { background: #f0f0f0; padding: 0 0.2rem; border-radius: 3px; font-size: 0.9em; }
progress { width: 160px; height: 1rem; }
.hash-cell { max-width: 280px; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85em; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0.2rem 0 0; }
.back-link { color: var(--muted); font-size: 0.9rem; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.pill { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 0.28rem 0.65rem; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.upload-panel { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 0.8rem; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.upload-panel input[type="text"] { min-width: 320px; flex: 1; }
.upload-help { display: inline-flex; gap: 0.25rem; }
.upload-help span, .upload-info { display: inline-grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: 999px; background: #eef4fb; color: var(--primary); font-weight: 700; font-size: 0.8rem; cursor: help; }
.file-picker { margin: 0; display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.file-picker input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; min-width: 0; }
.file-picker span { border: 1px dashed var(--primary); color: var(--primary); border-radius: 8px; padding: 0.43rem 0.75rem; background: #f7fbff; }
.drop-trigger { background: #eef4fb; color: var(--primary); border: 1px solid #cfe2fa; }
.drop-area { width: 100%; border: 1px dashed #b8d3f7; border-radius: 10px; background: #f8fbff; color: var(--muted); min-height: 66px; display: grid; place-items: center; gap: 0.3rem; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; padding: 0.65rem; text-align: center; }
.drop-area:hover, .drop-area:focus-visible { border-color: var(--primary); background: #f2f8ff; outline: none; }
.drop-area.is-dragover { border-color: var(--primary); background: #eaf4ff; transform: scale(1.01); }
.drop-icon { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 999px; background: #e4efff; color: var(--primary); font-weight: 700; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.6rem; }
.section-title h2 { margin: 0; }
.upload-list { display: grid; gap: 0.45rem; }
.upload-item { display: flex; align-items: center; gap: 0.65rem; min-height: 3.2rem; padding: 0.55rem 0.7rem; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.upload-main { min-width: 0; flex: 1; }
.upload-top { display: grid; grid-template-columns: minmax(150px, 1.8fr) auto minmax(140px, 0.9fr) auto; align-items: center; gap: 0.6rem; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-size { color: var(--muted); font-size: 0.86rem; white-space: nowrap; }
.upload-hash, .upload-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: transparent; color: var(--muted); font-size: 0.78rem; padding: 0; }
.upload-progress { display: grid; grid-template-columns: 1fr 2.8rem; align-items: center; gap: 0.5rem; margin-top: 0.35rem; color: var(--muted); font-size: 0.8rem; }
.upload-progress progress { width: 100%; height: 0.45rem; accent-color: var(--primary); }
.upload-status { flex: 0 0 auto; display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 999px; border: 0; background: #edf2f7; color: var(--muted); font-weight: 800; padding: 0; cursor: help; }
.upload-item[data-state="created"] .upload-status,
.upload-item[data-state="blob_exists"] .upload-status,
.upload-item[data-state="already_exists"] .upload-status,
.upload-item[data-state="path_exists"] .upload-status,
.upload-item[data-state="done"] .upload-status { background: #e8f5ee; color: var(--good); }
.upload-item[data-state="hashing"] .upload-status,
.upload-item[data-state="checking"] .upload-status,
.upload-item[data-state="uploading"] .upload-status,
.upload-item[data-state="registering"] .upload-status { background: #edf4ff; color: var(--primary); }
.upload-item[data-state="failed"] .upload-status { background: #fff0f0; color: var(--danger); }
@media (max-width: 760px) {
  .page-head { align-items: start; flex-direction: column; }
  .upload-panel input[type="text"] { min-width: 100%; }
  .upload-top { grid-template-columns: 1fr auto; }
  .upload-hash, .upload-path { grid-column: 1 / -1; }
}
