/* crushdb – simple, clean dark UI */

:root {
  --bg: #101418;
  --panel: #1a2028;
  --panel-2: #202830;
  --border: #2c3642;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #4da3ff;
  --danger: #ff5d5d;
  --ok: #47d68a;
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  max-width: 960px;
  padding: 2rem 1rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1 { margin: 0 0 0.25rem; font-size: 1.6rem; }
.tagline { margin: 0 0 1.5rem; color: var(--muted); }

#flash {
  min-height: 1.4rem;
  margin-bottom: 1rem;
  color: var(--ok);
}
#flash.error { color: var(--danger); }

#unlock, #setup {
  max-width: 420px;
  margin: 3rem auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}

#unlock h2, #setup h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.intro { color: var(--muted); font-size: 0.9rem; margin: 0 0 1rem; }

#unlock label, #setup label { display: block; margin-bottom: 0.75rem; }
#unlock input, #setup input {
  width: 100%;
  margin-top: 0.25rem;
}
.hint { color: var(--muted); font-size: 0.85rem; margin-top: 1rem; }

input, button {
  font: inherit;
  color: var(--text);
}

input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
}
input:focus { outline: 1px solid var(--accent); }

button {
  background: var(--accent);
  color: #0b1016;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 600;
}
button:hover { filter: brightness(1.1); }

#app .toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
#lock-btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
thead th { background: var(--panel-2); color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }

.row-error td { color: var(--danger); font-size: 0.9rem; }

td:last-child, td button { white-space: nowrap; }
td button + button { margin-left: 0.4rem; }

/* modal */
/* NOTE: keep `hidden` winning over the flex display below, otherwise the
   backdrop is permanently visible and blocks everything underneath. */
#editor-backdrop[hidden] { display: none; }

#editor-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

#editor {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  width: min(440px, 92vw);
}

#editor h2 { margin-top: 0; font-size: 1.15rem; }
#editor label { display: block; margin-bottom: 0.75rem; color: var(--muted); }
#editor input { width: 100%; margin-top: 0.25rem; }
#editor .actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
#editor-cancel { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
