:root {
  --bg: #1e1e1e;
  --panel: #2a2a2a;
  --panel2: #333;
  --border: #3d3d3d;
  --text: #e8e8e8;
  --muted: #9a9a9a;
  --accent: #2d7ff9;
  --ok: #3fb950;
  --warn: #d4a017;
  --err: #e5534b;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
#app-view { display: flex; flex-direction: column; height: 100vh; }
#app-view.hidden { display: none !important; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--err); margin-top: 8px; min-height: 18px; }
.ok { color: var(--ok); }

/* Login */
#login-view { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card input, .modal-card input, .modal-card select, select, input {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 14px;
}

button {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 14px;
}
button:hover { background: #3d3d3d; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #1f6fe0; }
button.secondary { background: transparent; }

/* App chrome */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; font-size: 16px; }
.session { display: flex; align-items: center; gap: 12px; }
.tabs { display: flex; gap: 2px; padding: 8px 16px 0; background: var(--panel); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.tab { border-radius: 6px 6px 0 0; border-bottom: none; background: transparent; }
.tab.active { background: var(--bg); border-color: var(--border); }
.tab-panel { padding: 16px; flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.tab-panel.hidden { display: none; }

/* Explorer */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-shrink: 0; }
.toolbar select { min-width: 240px; }
.toolbar .checkbox { display: flex; align-items: center; gap: 6px; }
.columns { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; flex: 1 1 auto; min-height: 0; }
.col { display: flex; flex-direction: column; min-height: 0; }
.col h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; flex-shrink: 0; }
.list {
  list-style: none; margin: 0 0 10px; padding: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  flex: 1 1 auto; min-height: 60px; overflow-y: auto;
}
.list.short { flex: 0 0 auto; max-height: 120px; }
.list li {
  padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.list li:last-child { border-bottom: none; }
.list li:hover { background: var(--panel2); }
.list li.selected { background: var(--accent); color: #fff; }
.list .meta { color: var(--muted); font-size: 12px; }
.list li.selected .meta { color: #dbe9ff; }
.version-row { cursor: default; }
.version-row:hover { background: var(--panel) !important; }

.status { margin-top: 12px; color: var(--muted); user-select: text; }

/* Tables */
table.data { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.data th, table.data td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); }
table.data th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.st-ok { color: var(--ok); }
.st-warn { color: var(--warn); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; }
.modal-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 24px; width: 520px; display: flex; flex-direction: column; gap: 10px;
}
.modal-card h2 { margin: 0; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.path-row { display: flex; gap: 8px; }
.path-row input { flex: 1; font-family: Consolas, monospace; font-size: 13px; }
#create-result { display: flex; flex-direction: column; gap: 10px; }
