:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1c2024;
  --muted: #667085;
  --line: #e3e6ea;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --ok: #0a7c42;
  --radius: 8px;
}

* { box-sizing: border-box; }

/* Several elements below set display:flex/grid, which would otherwise beat the user
   agent's [hidden] rule and leave hidden panels on screen. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- chrome */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 600; }

.session { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }

.banner {
  margin: 16px 24px 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #fef3f2;
  color: var(--danger);
  border: 1px solid #fecdca;
  font-size: 14px;
}

.banner.ok {
  background: #ecfdf3;
  color: var(--ok);
  border-color: #abefc6;
}

/* ---------------------------------------------------------------- buttons */

button {
  font: inherit;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

button:hover:not(:disabled) { border-color: #c8ced6; }
button:disabled { opacity: 0.5; cursor: default; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

button.linkish {
  border: none;
  background: none;
  color: var(--accent);
  padding: 4px;
}

button.danger { color: var(--danger); }

/* ---------------------------------------------------------------- gate */

.gate {
  max-width: 460px;
  margin: 80px auto;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}

.gate h1 { margin: 0 0 8px; font-size: 21px; }
.gate p { margin: 0 0 24px; color: var(--muted); }

/* ---------------------------------------------------------------- browser */

.browser { max-width: 1000px; margin: 24px auto; padding: 0 24px; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 14px; }
.crumbs button { border: none; background: none; padding: 2px 4px; color: var(--accent); }
.crumbs .sep { color: var(--muted); }
.crumbs .here { color: var(--muted); padding: 2px 4px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.uploads { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }

.uploads li {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
}

.uploads .row { display: flex; justify-content: space-between; gap: 12px; }
.uploads .bar { height: 4px; margin-top: 8px; background: var(--line); border-radius: 2px; overflow: hidden; }
.uploads .bar > div { height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }
.uploads .failed { color: var(--danger); }

.listing-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.listing { width: 100%; border-collapse: collapse; }

.listing th,
.listing td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.listing th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.listing tbody tr:last-child td { border-bottom: none; }
.listing tbody tr:hover { background: #fafbfc; }
.listing .num { text-align: right; white-space: nowrap; }
.listing td.actions { text-align: right; white-space: nowrap; }
.listing td.actions button { padding: 4px 10px; font-size: 13px; }

.name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.name .icon { flex: none; width: 18px; text-align: center; color: var(--muted); }
.name .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name button.label { border: none; background: none; padding: 0; color: var(--accent); text-align: left; }

.empty,
.loading { padding: 32px 16px; text-align: center; color: var(--muted); margin: 0; }

/* ---------------------------------------------------------------- dialog */

dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: 520px;
  width: calc(100% - 32px);
}

dialog::backdrop { background: rgba(16, 24, 40, 0.45); }
dialog form { padding: 24px; }
dialog h2 { margin: 0 0 4px; font-size: 18px; }

.share-file { margin: 0 0 20px; color: var(--muted); font-size: 14px; word-break: break-all; }

dialog label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }

select,
textarea {
  font: inherit;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}

textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

.note { font-size: 13px; color: var(--muted); margin: 14px 0 0; }
.share-result { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.share-result button { justify-self: start; }

.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

@media (max-width: 640px) {
  .browser { padding: 0 16px; }
  .listing th:nth-child(3),
  .listing td:nth-child(3) { display: none; }
}
