:root {
  --fg: #1f2328;
  --muted: #656d76;
  --line: #d8dee4;
  --bg: #ffffff;
  --accent: #0969da;
  --danger: #cf222e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 24px 48px;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--fg);
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 600; font-size: 16px; }
.spacer { flex: 1; }
.who { color: var(--muted); }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 12px 0;
  color: var(--muted);
  min-height: 20px;
}

.breadcrumb a { color: var(--accent); text-decoration: none; cursor: pointer; }
.breadcrumb .sep { color: var(--line); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
}

button {
  font: inherit;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f6f8fa;
  cursor: pointer;
}

button:hover { background: #eef1f4; }
button.danger { color: var(--danger); }

.hint { color: var(--muted); }

.banner {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid #f3c7c7;
  border-radius: 6px;
  background: #fff5f5;
  color: var(--danger);
}

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

.entries th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
}

.entries td {
  padding: 8px 6px;
  border-bottom: 1px solid #eef1f4;
}

.col-size, .col-time { width: 160px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-actions { width: 200px; }

.name-dir { color: var(--accent); cursor: pointer; font-weight: 500; }
.name-dir:hover { text-decoration: underline; }
.name-file { cursor: default; }

.actions { display: flex; gap: 8px; }
.actions button { padding: 2px 8px; font-size: 13px; }

.empty { color: var(--muted); }

.col-check { width: 32px; }
.col-check input { cursor: pointer; }

.selection-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fa;
  box-shadow: 0 -2px 12px rgb(0 0 0 / 6%);
}

.selection-bar[hidden] { display: none; }

#selection-summary { color: var(--muted); }


.uploads {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.upload-batch {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(120px, 240px) 1fr auto;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}

.upload-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-row progress {
  width: 100%;
  height: 8px;
}

.upload-status {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 160px;
}

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

.upload-failed summary {
  cursor: pointer;
  color: var(--danger);
}

.upload-failed ul {
  margin: 4px 0 0 16px;
  padding: 0;
  color: var(--danger);
}

.upload-failed li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.upload-failed button.retry {
  padding: 1px 8px;
  font-size: 12px;
  color: var(--fg);
}

.upload-batch.done .upload-status { color: #1a7f37; }
.upload-batch.has-failure .upload-status { color: var(--danger); }

main.dragging {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
  border-radius: 6px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 35%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
}

.dialog {
  background: var(--bg);
  border-radius: 8px;
  padding: 20px;
  width: min(640px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 20%);
}

.dialog h2 {
  margin: 0;
  font-size: 16px;
}

.dialog-bulk {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.conflict-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conflict-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.conflict-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conflict-existing { color: var(--muted); }

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

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

button.primary:hover { background: #0550ae; }

.picker-crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.picker-crumb a { color: var(--accent); text-decoration: none; cursor: pointer; }
.picker-crumb .sep { color: var(--line); }

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 45vh;
  overflow: auto;
}

.picker-row {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
}

.picker-row:hover { background: #eef1f4; border-color: var(--line); }

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.login-card h1 { margin: 0; font-size: 22px; }
.login-hint { margin: 0 0 4px; color: var(--muted); font-size: 13px; }

.entry {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--fg);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.entry:hover { background: #f6f8fa; }
.entry span { color: var(--muted); font-size: 12px; }

/* Long press in progress: the only visible hint that another user pool can be chosen. */
.entry.pressing {
  background: #eef1f4;
  border-color: var(--accent);
}

.text-input {
  font: inherit;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.text-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.device-card { align-items: center; text-align: center; }

.device-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 40px;
  letter-spacing: 8px;
  padding: 8px 0 8px 8px;
  font-weight: 600;
}

.device-status { margin: 0; color: var(--muted); font-size: 13px; }

.dialog-hint { margin: 0; color: var(--muted); font-size: 13px; }
.dialog-text { margin: 0; font-size: 14px; line-height: 1.6; }
.dialog-error { margin: 0; color: var(--danger); font-size: 13px; }

.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px;
  letter-spacing: 6px;
  text-align: center;
  text-transform: uppercase;
  padding: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview-dialog { width: min(900px, 92vw); }

.preview-body {
  overflow: auto;
  max-height: 64vh;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}

.preview-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.55;
}

.preview-image {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  margin: 0 auto;
}

.dialog-actions .link { margin-right: auto; align-self: center; }

/* ── Security settings ───────────────────────────────── */

.settings {
  max-width: 900px;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings h1 { margin: 0; font-size: 22px; }
.settings .hint { margin: 0; }

.panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel[hidden] { display: none; }
.panel h2 { margin: 0; font-size: 15px; }

.stack { display: flex; flex-direction: column; gap: 8px; }
.stack[hidden] { display: none; }

.field-label { font-size: 13px; color: var(--muted); }

.entry-button {
  font: inherit;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fa;
  cursor: pointer;
  text-align: left;
}

.entry-button:hover { background: #eef1f4; }
.entry-button[hidden] { display: none; }

.muted { color: var(--muted); }
.factors td { font-size: 13px; }

.qr {
  width: 180px;
  height: 180px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.secret {
  display: block;
  padding: 6px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 1px;
  word-break: break-all;
  background: #f6f8fa;
  border-radius: 6px;
}



