:root {
  --bg: #f8f7f4;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --primary: #0d7377;
  --primary-hover: #095c5f;
  --accent: #e07a5f;
  --border: #e5e2dc;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg: #121416;
  --bg-card: #1e2124;
  --text: #f0f0f0;
  --text-muted: #a0a0a0;
  --primary: #2dd4bf;
  --primary-hover: #14b8a6;
  --accent: #f4a261;
  --border: #2d3236;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--primary);
  text-decoration: none;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 0.5rem;
  flex-wrap: wrap;
}

nav a {
  text-decoration: none;
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  transition: background 0.2s;
}

nav a:hover, nav a.active {
  background: var(--primary);
  color: white;
}

.theme-toggle, .auth-btn {
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}

.theme-toggle:hover, .auth-btn:hover {
  border-color: var(--primary);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.section { display: none; }
.section.active { display: block; }

h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-card h3 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.stat-card .count { font-size: 2.2rem; font-weight: 700; color: var(--primary); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
}

.card h3 { margin-bottom: 0.5rem; font-size: 1.2rem; }
.card .meta { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.75rem; }
.card .notes { margin-top: 0.75rem; font-size: 0.95rem; }

.badge {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.4rem;
}

.form-card {
  background: var(--bg-card);
  padding: 1.75rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

label { display: block; font-weight: 500; margin-bottom: 0.35rem; font-size: 0.9rem; }

input, select, textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
}

textarea { min-height: 80px; resize: vertical; }

button.primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
}

button.primary:hover { background: var(--primary-hover); }

.danger {
  background: #ef4444;
  color: white;
  border: none;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.auth-box {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius);
  width: 90%;
  max-width: 400px;
  text-align: center;
}

.auth-box input { margin: 1rem 0; }

.hidden { display: none !important; }

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .nav { flex-direction: column; align-items: flex-start; }
  nav ul { width: 100%; }
  h1 { font-size: 1.8rem; }
}
