/* Reset and base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #fdfaf3;
  --color-surface: #ffffff;
  --color-text: #2c2416;
  --color-text-muted: #5e5544;
  --color-primary: #8b6914;
  --color-primary-light: #f4d03f;
  --color-accent: #27ae60;
  --color-danger: #c0392b;
  --color-border: #d9cdb3;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --max-width: 960px;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  font-size: 1rem;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 1000;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.1rem;
}
.logo-text {
  white-space: nowrap;
}
.nav-list {
  list-style: none;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.nav-list a {
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-list a:hover {
  color: var(--color-primary);
}

/* Sections */
section {
  padding: 2rem 0;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--color-primary);
}
.subtitle {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-text);
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Cards */
.form-card, .settings-card, .stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* Form */
.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.form-group {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
}
input[type="text"],
input[type="number"],
select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: #fff;
}
.checkbox-group {
  justify-content: flex-end;
  flex-direction: row;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
  cursor: pointer;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover {
  background: #6b5210;
}
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
}
.btn-danger {
  background: var(--color-surface);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
}
.btn-danger:hover {
  background: #fdecea;
}
.status-message {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  min-height: 1.2em;
}

/* Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
}
progress {
  width: 100%;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
}
progress::-webkit-progress-bar {
  background: #f0e6d2;
  border-radius: 6px;
}
progress::-webkit-progress-value {
  background: var(--color-accent);
  border-radius: 6px;
}
.chart-card {
  display: flex;
  flex-direction: column;
}
.chart-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.chart-legend {
  font-size: 0.8rem;
  max-height: 120px;
  overflow-y: auto;
}
.dashboard-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}
th {
  background: #faf6ed;
  font-weight: 600;
}
.empty-row td {
  text-align: center;
  color: var(--color-text-muted);
  padding: 2rem;
}

/* Settings */
.goal-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* Support */
.support-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.support-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.support-block ul {
  padding-left: 1.25rem;
  margin-top: 0.5rem;
}
.support-block li {
  margin-bottom: 0.4rem;
}

/* Footer */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.site-footer a {
  color: var(--color-primary);
  text-decoration: none;
}
.footer-note {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 600px) {
  h1 {
    font-size: 1.5rem;
  }
  .form-row {
    flex-direction: column;
    gap: 0.75rem;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav-list {
    gap: 0.75rem;
  }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
