:root {
  --brand: #2F6F4F;
  --brand-dark: #244f39;
  --bg: #f5f7f6;
  --card-bg: #ffffff;
  --border: #dfe5e2;
  --text: #1f2a24;
  --muted: #6b7a72;
  --danger: #b3261e;
}

* { box-sizing: border-box; }

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

.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* Navbar */
.navbar { background: var(--brand); color: white; }
.navbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.brand { color: white; font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.nav-links { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav-links a { color: white; text-decoration: none; opacity: 0.9; }
.nav-links a:hover { opacity: 1; text-decoration: underline; }
.user-chip { font-size: 0.85rem; opacity: 0.85; }

/* Auth */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.auth-card h1 { font-size: 1.3rem; margin: 0 0 4px; }
.forgot-link { text-align: center; margin-top: 16px; }
.forgot-link a { color: var(--brand); text-decoration: none; font-size: 0.9rem; }
.forgot-link a:hover { text-decoration: underline; }

/* Forms */
label { display: block; font-weight: 600; margin: 14px 0 4px; font-size: 0.9rem; }
input[type="text"], input[type="password"], input[type="date"], input[type="url"], input[type="file"], select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem;
}
.form-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 24px; max-width: 640px; }
.form-row { display: flex; gap: 16px; }
.form-row > div { flex: 1; }
.form-row.three > div { flex: 1; }

.btn {
  display: inline-block; padding: 9px 18px; border-radius: 8px; border: none;
  font-weight: 600; cursor: pointer; text-decoration: none; font-size: 0.9rem;
}
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #eef2f0; color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-link { background: none; color: var(--brand); text-decoration: underline; padding: 9px 6px; }
.btn-block { width: 100%; margin-top: 18px; }
.link-button { background: none; border: none; color: white; text-decoration: underline; cursor: pointer; font-size: 0.9rem; padding: 0; }

.alert { padding: 12px 16px; border-radius: 8px; margin: 12px 0; }
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f4c7c3; }

/* Dashboard */
.page-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.filter-bar input[type="text"] { flex: 1; min-width: 200px; }
.filter-bar select { width: auto; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  text-decoration: none; color: var(--text); display: block;
}
.card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
.card-thumb { aspect-ratio: 1 / 1; background: #eef2f0; display: flex; align-items: center; justify-content: center; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder { color: var(--muted); font-size: 0.85rem; text-align: center; padding: 10px; }
.thumb-placeholder.large { aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; background: #eef2f0; border-radius: 10px; }
.card-body { padding: 10px 12px; }

.pagination { display: flex; gap: 6px; margin-top: 24px; flex-wrap: wrap; }
.page-link { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; color: var(--text); }
.page-link.active { background: var(--brand); color: white; border-color: var(--brand); }

/* Detail */
.back-link { display: inline-block; margin-bottom: 16px; color: var(--brand); text-decoration: none; }
.detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.detail-image img { width: 100%; border-radius: 10px; border: 1px solid var(--border); }
.meta-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.meta-table th, .meta-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.meta-table th { width: 140px; color: var(--muted); font-weight: 600; }
.action-row { display: flex; gap: 10px; margin-top: 12px; }

@media (max-width: 720px) {
  .detail-layout { grid-template-columns: 1fr; }
  .form-row, .form-row.three { flex-direction: column; }
}

/* Tables */
.data-table { width: 100%; border-collapse: collapse; margin-bottom: 32px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.data-table th { background: #eef2f0; }
.row-actions { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
