:root {
  --bg: #f7f5f2;
  --text: #1f2328;
  --muted: #6b7280;
  --primary: #dd6b20;
  --primary-dark: #b45309;
  --secondary: #0f766e;
  --border: #e5e7eb;
  --card: #ffffff;
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Poppins", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 20%, #fff6ec, var(--bg) 60%);
}

main {
  flex: 1 0 auto;
}

a { color: inherit; text-decoration: none; }

.container {
  width: min(1200px, 92%);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
}

.nav-cta {
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.nav-link { color: var(--muted); }

.hero {
  padding: 120px 0 80px;
}

.hero-grid {
  display: grid;
  gap: 40px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: center;
}

.hero h1 {
  font-family: "DM Sans", sans-serif;
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  margin: 0 0 16px;
}

.hero p { color: var(--muted); font-size: 1.05rem; }

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.btn {
  padding: 10px 16px;
  border-radius: 14px;
  border: 2px solid transparent;
  font-weight: 600;
  display: inline-block;
  min-width: 112px;
  text-align: center;
}

.btn-sm {
  min-width: 90px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.btn-xs {
  min-width: 78px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-outline {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff;
}

.section {
  padding: 80px 0;
}

.section-title {
  text-align: center;
  margin-bottom: 40px;
}

.section-title h2 {
  font-family: "DM Sans", sans-serif;
  font-size: clamp(2rem, 3vw, 2.8rem);
  margin: 0 0 10px;
}

.card-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(31, 35, 40, 0.08);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff2e6;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
}

.plan-table {
  width: 100%;
  border-collapse: collapse;
}

.plan-table th, .plan-table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.plan-table th:first-child, .plan-table td:first-child { text-align: left; }

.form-card {
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 32px;
}

.form-group { margin-bottom: 16px; }

.form-group label { display: block; font-size: 14px; margin-bottom: 6px; }

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-family: inherit;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar .btn {
  min-width: 112px;
}

.toolbar .search-input {
  flex: 1;
  min-width: 220px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  font-family: inherit;
}

.inline-select, .inline-date {
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  font-family: inherit;
  background: #fff;
  appearance: none;
}

input[type="date"] {
  border-radius: 18px;
}

.table input[type="text"],
.table input[type="number"],
.table-input {
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  font-family: inherit;
  background: #fff;
}

.dashboard {
  padding: 68px 0 60px;
}

.stats {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 24px;
}

.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: auto;
  min-width: 920px;
}

.diet-table {
  table-layout: fixed;
  min-width: 720px;
}

.table th, .table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.table th {
  background: #fff8f2;
  font-weight: 600;
}

.table td form {
  display: inline-block;
  margin-left: 6px;
}

.table td .btn {
  margin-right: 6px;
}

.item-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.item-actions form {
  margin: 0;
}

.item-actions .btn {
  white-space: nowrap;
}

.table td {
  overflow: hidden;
}

.table .col-student { width: 18%; }
.table .col-email { width: 18%; }
.table .col-template { width: 16%; }
.table .col-date { width: 10%; }
.table .col-actions { width: 38%; min-width: 360px; }
.table .col-action-small { width: 220px; }

.assign-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

.assign-form .inline-select,
.assign-form .inline-date {
  min-width: 130px;
  height: 40px;
  width: 140px;
}

.assign-form .btn {
  min-width: 90px;
  height: 40px;
  line-height: 16px;
  width: 90px;
}

@media (max-width: 980px) {
  .table { min-width: 860px; }
}

@media (max-width: 820px) {
  .assign-form { flex-wrap: wrap; }
  .assign-form .inline-select,
  .assign-form .inline-date,
  .assign-form .btn { width: 100%; }
}

.table tbody tr:hover {
  background: #fffdfa;
}

.table tbody tr.total-row:hover {
  background: inherit;
}

.total-row td {
  font-weight: 600;
  border-top: 1px solid var(--border);
}

.total-row-meal td {
  background: #fff7ed;
  color: #9a3412;
}

.total-row-day td {
  background: #ecfeff;
  color: #155e75;
}

.total-row-week td {
  background: #eef2ff;
  color: #3730a3;
  border-top: 2px solid #c7d2fe;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2ff;
  color: #3730a3;
}

.footer {
  background: #1f1b16;
  color: #f7f5f2;
  padding: 50px 0 30px;
}

.footer-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.footer a { color: #f7f5f2; opacity: 0.8; display: block; margin-bottom: 6px; }

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 20px;
  padding-top: 16px;
  font-size: 13px;
  opacity: 0.8;
}

.notice {
  padding: 10px 12px;
  border-radius: 12px;
  background: #ecfeff;
  color: #155e75;
  font-size: 14px;
  margin-bottom: 12px;
}

.error { background: #fee2e2; color: #991b1b; }

@media (max-width: 1024px) {
  .nav { display: none; }
  .hero { padding-top: 100px; }
  .footer { display: none; }
}
