/* Design tokens — light default, dark override. No feature/business-logic
   related class names or content live in this file — pure presentation. */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #16181d;
  --text-muted: #5b616e;
  --border: #e3e5e8;
  --accent: #2563eb;
  --accent-contrast: #ffffff;
  --radius: 8px;
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a21;
  --text: #f0f1f3;
  --text-muted: #9aa0ab;
  --border: #2a2e37;
  --accent: #3b82f6;
  --accent-contrast: #0f1115;
}

* { box-sizing: border-box; }

/* Guarantees the `hidden` attribute always wins, even on elements whose
   own class sets `display: flex/grid/block` (author-origin CSS otherwise
   beats the browser's default `[hidden] { display: none }` UA-stylesheet
   rule regardless of selector specificity — this is the standard fix). */
[hidden] { display: none !important; }

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

#app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#header-placeholder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.header-brand {
  font-weight: 700;
  color: var(--text);
}

.header-profile {
  position: relative;
}

.header-profile-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.header-profile-menu {
  position: absolute;
  right: 0;
  top: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 160px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.header-profile-menu.open {
  display: flex;
}

.header-profile-menu a,
.header-profile-menu button {
  display: block;
  width: 100%;
  padding: 0.6rem 0.9rem;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
}

.header-profile-menu a:hover,
.header-profile-menu button:hover {
  background: var(--bg);
}

.shell-body {
  display: flex;
  flex: 1;
}

#nav-placeholder {
  width: 240px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem;
}

#nav-placeholder a {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  margin-bottom: 0.2rem;
}

#nav-placeholder a:hover {
  background: var(--bg);
}

#content-placeholder {
  flex: 1;
  padding: 1.5rem;
}

.shell-loading {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-card {
  max-width: 380px;
  margin: 10vh auto;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.auth-card input {
  width: 100%;
  padding: 0.6rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

.auth-card button {
  width: 100%;
  padding: 0.6rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.auth-card select {
  width: 100%;
  padding: 0.6rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

.auth-secondary {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.6rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.auth-error {
  color: #dc2626;
  font-size: 0.85rem;
  min-height: 1.1em;
  margin: 0 0 0.5rem;
}

.auth-note {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.profile-page,
.projects-page,
.project-view-page {
  max-width: 560px;
}

.projects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.projects-header button,
#new-project-btn {
  padding: 0.5rem 0.9rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.projects-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.projects-list li {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 0.6rem;
}

.projects-list a {
  display: flex;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  color: var(--text);
  text-decoration: none;
}

.projects-list .project-status {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: capitalize;
}

.project-view-page button {
  padding: 0.6rem 1.1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.project-view-page button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.profile-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.profile-section h2 {
  margin-top: 0;
  font-size: 1rem;
}

.profile-section label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.profile-section input,
.profile-section select {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

.profile-section button {
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.profile-section button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
