:root {
  color-scheme: light dark;
  --bg: #f7f7f8;
  --surface: #ffffff;
  --border: #e0e0e3;
  --text: #1c1c1f;
  --text-muted: #6b6b73;
  --accent: #3462ea;
  --accent-hover: #274ec2;
  --danger: #c8372f;
  --radius: 8px;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }

/* --- login page --- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 320px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.login-card h1 {
  font-size: 1.1rem;
  margin: 0 0 1.25rem;
}

.login-card input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.login-card button {
  width: 100%;
}

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  margin: -0.4rem 0 0.75rem;
}

/* --- app shell --- */
header.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

header.app-bar h1 {
  font-size: 1rem;
  margin: 0;
  font-weight: 600;
}

main {
  max-width: 960px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.breadcrumbs {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.breadcrumbs button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0 0.15rem;
  font-size: 0.9rem;
}

button, .btn {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
}

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

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

#dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  transition: border-color 0.15s, color 0.15s;
}
#dropzone.drag-over {
  border-color: var(--accent);
  color: var(--accent);
}

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

th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tr:last-child td { border-bottom: none; }

td.name-cell button.name-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  font-size: 0.9rem;
}
td.name-cell button.name-link:hover { color: var(--accent); }

.row-actions { display: flex; gap: 0.4rem; justify-content: flex-end; }
.row-actions button { padding: 0.25rem 0.55rem; font-size: 0.78rem; }

.empty-state {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.status-msg {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
}
.status-msg.error { background: #fdecea; color: var(--danger); }
.status-msg.ok { background: #e9f7ef; color: #1a7f4c; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181c;
    --surface: #1f2025;
    --border: #303138;
    --text: #ececee;
    --text-muted: #9a9aa2;
  }
  .status-msg.error { background: #3a1f1e; }
  .status-msg.ok { background: #1c3327; }
}
