/* webapp3 — Organic/natural: earth tones, soft shapes, botanical feel */

:root {
  --font-display: 'Outfit', sans-serif;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --bg: #f7f5f0;
  --surface: #fffefb;
  --border: #e8e4dc;
  --text: #2d2a26;
  --text-muted: #6b6560;
  --accent: #4a7c59;
  --accent-hover: #3d6b4a;
  --danger: #b85450;
  --danger-hover: #9e4844;
  --focus-ring: #4a7c59;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(45, 42, 38, 0.06);
}

html.dark {
  --bg: #1c1b18;
  --surface: #252320;
  --border: #3a3732;
  --text: #ebe8e3;
  --text-muted: #9c9890;
  --accent: #6b9b76;
  --accent-hover: #7fad8a;
  --danger: #d4726e;
  --danger-hover: #e88a86;
  --focus-ring: #6b9b76;
  --shadow: 0 2px 12px rgba(0,0,0,.25);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}
.logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--accent);
  text-decoration: none;
}
.logo:hover { color: var(--accent-hover); }
.main-nav { display: flex; align-items: center; gap: 0; flex: 1; }
.nav-dropdown { position: relative; }
.nav-trigger {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color .2s, background .2s;
}
.nav-trigger:hover { color: var(--accent); background: rgba(74, 124, 89, 0.08); }
.nav-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 12rem;
  margin: 0.5rem 0 0;
  padding: 0.5rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .2s, transform .2s, visibility .2s;
}
.nav-dropdown.open .nav-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav-menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.nav-menu a:hover { background: rgba(74, 124, 89, 0.1); }
.header-actions { margin-left: auto; }

.theme-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
}
.theme-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.theme-slider {
  width: 100%;
  height: 100%;
  background: var(--border);
  border-radius: 999px;
  transition: background .2s;
}
.theme-slider::before {
  content: '';
  position: absolute;
  width: 1.125rem;
  height: 1.125rem;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  transition: transform .25s ease;
  box-shadow: var(--shadow);
}
.theme-switch input:checked + .theme-slider { background: var(--accent); }
.theme-switch input:checked + .theme-slider::before { transform: translateY(-50%) translateX(1.25rem); }

.page { max-width: 72rem; margin: 0 auto; padding: 2rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
.btn {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background .2s, border-color .2s;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { color: var(--danger-hover); }
.btn-icon { background: none; border: none; padding: 0.25rem 0.5rem; font-size: 0.8125rem; cursor: pointer; color: var(--text-muted); border-radius: 6px; }
.btn-icon:hover { color: var(--accent); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th,
.data-table td { padding: 0.875rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(74, 124, 89, 0.04); }
.data-table .actions { white-space: nowrap; }

.dialog {
  border: 1px solid var(--border);
  padding: 0;
  max-width: 28rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}
.dialog::backdrop { background: rgba(45, 42, 38, 0.35); }
.dialog-inner { padding: 1.5rem; }
.dialog-title { font-family: var(--font-display); font-size: 1.125rem; margin: 0 0 1rem; }
.dialog-desc { font-size: 0.875rem; color: var(--text-muted); margin: 0 0 1rem; }
.dialog-form label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.dialog-form input,
.dialog-form textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}
.dialog-form input:focus,
.dialog-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.2);
}
.dialog-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.dialog-actions .btn { flex: 0 0 auto; }
.dialog-danger .dialog-title { color: var(--danger); }
