/* ===========================================================
   Westly DevVault — design tokens
   Dark-first, graphite/slate, one violet accent, flat cards.
   =========================================================== */

:root {
  /* color */
  --bg-base: #0f1115;
  --bg-elevated: #161a20;
  --bg-elevated-hover: #1c212a;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #e6e8eb;
  --text-secondary: #8b93a1;
  --text-tertiary: #565d6a;
  --accent: #7c5cff;
  --accent-hover: #9075ff;
  --accent-dim: rgba(124, 92, 255, 0.15);
  --danger: #f5576c;
  --warning: #f5a623;
  --success: #4fd1a5;

  /* type */
  --font-ui: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, monospace;

  /* layout */
  --sidebar-width: 240px;
  --radius: 8px;
  --header-height: 56px;
}

:root[data-theme="light"] {
  --bg-base: #f7f7f8;
  --bg-elevated: #ffffff;
  --bg-elevated-hover: #f0f0f2;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --text-primary: #14161a;
  --text-secondary: #565d6a;
  --text-tertiary: #8b93a1;
  --accent-dim: rgba(124, 92, 255, 0.1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
}

#app { min-height: 100vh; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font-family: inherit; font-size: inherit; }

button {
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: var(--radius);
  padding: 8px 14px;
  transition: background 0.12s ease, border-color 0.12s ease;
}
button:hover { background: var(--bg-elevated-hover); border-color: var(--border-strong); }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

button.danger { color: var(--danger); }
button.danger:hover { background: rgba(245, 87, 108, 0.1); border-color: var(--danger); }

input, textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius);
  padding: 9px 12px;
}
input:focus, textarea:focus { border-color: var(--accent); outline: none; }

label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field { margin-bottom: 16px; }

code, .mono { font-family: var(--font-mono); }

/* ---------- auth screens ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 32px;
}
.auth-logo {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 4px;
}
.auth-card h1 { font-size: 20px; margin: 0 0 24px; }
.auth-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: -8px;
  margin-bottom: 16px;
}
.auth-switch {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}
.auth-switch a { color: var(--accent); }

/* ---------- app shell (sidebar + content) ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}

.project-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
  cursor: pointer;
  font-size: 13px;
}
.project-switcher:hover { background: var(--bg-elevated-hover); }

.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
}
.nav-item:hover { background: var(--bg-elevated-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }

.sidebar-footer { margin-top: auto; font-size: 12px; color: var(--text-tertiary); padding: 8px 10px; }

.content { flex: 1; padding: 28px 32px; max-width: 1200px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; margin: 0; }

/* ---------- cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 18px;
}
.card:hover { border-color: var(--border-strong); }

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-card .stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  margin-top: 8px;
  color: var(--text-primary);
}
.stat-card .stat-value::before { content: "> "; color: var(--accent); }

.project-card { cursor: pointer; }
.project-card .project-color-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px;
}
.project-card h3 { margin: 10px 0 4px; font-size: 15px; }
.project-card p { margin: 0; color: var(--text-secondary); font-size: 13px; }

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-secondary);
}
.empty-state h2 { color: var(--text-primary); font-size: 17px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  width: 100%; max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 24px;
}
.modal h2 { margin: 0 0 20px; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------- mobile ---------- */
.bottom-tabs {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  padding: 6px 0;
  z-index: 50;
}
.bottom-tabs .nav-list { flex-direction: row; justify-content: space-around; }
.bottom-tabs .nav-item { flex-direction: column; font-size: 11px; gap: 4px; }

@media (max-width: 640px) {
  .sidebar { display: none; }
  .bottom-tabs { display: block; }
  .content { padding: 16px 16px 80px; }
  .card-grid { grid-template-columns: 1fr 1fr; }
}
