:root {
  --bg: #0f1115;
  --card: #171a21;
  --border: #2a2e38;
  --text: #e6e8eb;
  --muted: #8b909c;
  --accent: #4f8cff;
  --error: #ff6b6b;
  --success: #4fd18b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}

.topbar nav { display: flex; gap: 16px; align-items: center; }
.topbar a { color: var(--muted); text-decoration: none; }
.topbar a:hover { color: var(--text); }
.who { color: var(--muted); font-size: 0.9rem; }

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 24px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 16px;
}

.card.narrow { max-width: 420px; margin: 40px auto; }

h1 { font-size: 1.4rem; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }

label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: var(--muted);
}

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  background: #0f1115;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

textarea { resize: vertical; }

.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  margin-bottom: 4px;
}

.edit-grid .span-2 { grid-column: 1 / -1; }

.password-field {
  position: relative;
  display: block;
  margin-top: 6px;
}

.password-field input {
  margin-top: 0;
  padding-right: 40px;
}

.icon-button {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 36px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.icon-button:hover, .icon-button.active { color: var(--text); }

.file-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.file-list li + li { border-top: 1px solid var(--border); }

.file-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

.file-list-item input[type="checkbox"] {
  display: inline-block;
  width: auto;
  margin: 0;
}

.file-list-item .hint { margin: 0 0 0 auto; }

.file-tree {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.file-tree .file-tree {
  margin: 2px 0 4px 18px;
  padding-left: 12px;
  border-left: 1px dashed var(--border);
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
}

.tree-icon { flex: none; }
.tree-name { font-size: 0.9rem; color: var(--text); }

.tree-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex: none;
}

.tree-btn {
  padding: 3px 10px;
  font-size: 0.78rem;
  border-radius: 999px;
}

.tree-btn-danger { border-color: rgba(255,107,107,0.4); color: var(--error); }
.tree-btn-danger:hover { border-color: var(--error); }

.tree-root-actions {
  display: flex;
  gap: 6px;
  padding: 6px 4px 2px;
}

.tree-empty { padding: 4px 4px 6px; }

.tree-file .file-list-item { padding: 6px 4px; }

.card.danger { border-color: rgba(255,107,107,0.35); }

button.danger, .button.danger {
  background: var(--error);
  color: #1a0f0f;
}

button, .button {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
}

button.secondary, .button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

.inline-form { display: flex; gap: 8px;}
.inline-form input { margin: 0; }

.flashes { list-style: none; padding: 0; margin: 0 0 20px; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; font-size: 0.9rem; }
.flash-error { background: rgba(255,107,107,0.12); color: var(--error); border: 1px solid rgba(255,107,107,0.3); }
.flash-success { background: rgba(79,209,139,0.12); color: var(--success); border: 1px solid rgba(79,209,139,0.3); }

.badge { padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; }
.badge-pending { background: #333; color: #ccc; }
.badge-building { background: rgba(79,140,255,0.15); color: var(--accent); }
.badge-ready { background: rgba(79,209,139,0.15); color: var(--success); }
.badge-failed { background: rgba(255,107,107,0.15); color: var(--error); }

.empty { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: 16px; line-height: 1.5; }

.presets { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.presets .hint { margin: 0; }
.chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.log {
  background: #0b0d11;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 400px;
  overflow-y: auto;
}
