:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --green: #16803c;
  --green-bg: #eafaf0;
  --amber: #92400e;
  --amber-bg: #fef3e2;
  --accent: #2f7a4f;
  --accent-dark: #1f5c3a;
  --radius: 12px;
}

* { box-sizing: border-box; }

.ar, .name-ar {
  display: block;
  direction: rtl;
  unicode-bidi: isolate;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--muted);
  font-weight: 400;
}

h1 .ar { font-size: 0.75em; margin-top: 2px; color: var(--muted); }
h2 .ar { font-size: 0.85em; margin-top: 2px; font-weight: 500; letter-spacing: 0; }
.name-ar { font-size: 0.88em; margin-top: 1px; }
button .ar, a.primary .ar { font-size: 0.82em; color: rgba(255,255,255,0.85); margin-top: 2px; }
a.secondary .ar { font-size: 0.85em; color: var(--muted); }
.badge .ar { font-size: 0.85em; margin-top: 2px; }
.warning-box strong .ar { display: inline; margin: 0 0 0 4px; color: var(--amber); font-size: 1em; }
.empty-slot .ar { font-size: 0.95em; margin-top: 2px; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

header.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 8px;
}

header.top h1 {
  font-size: 1.5rem;
  margin: 0;
}

header.top .date {
  color: var(--muted);
  font-size: 0.95rem;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}
.messages li {
  background: var(--amber-bg);
  color: var(--amber);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 0.9rem;
  white-space: pre-line;
}

.category-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.category-card h2 {
  font-size: 1rem;
  margin: 0 0 12px;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px 16px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.92rem;
}

.checkbox-row input {
  margin-top: 3px;
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.checkbox-row .meta {
  color: var(--muted);
  font-size: 0.82rem;
  display: block;
}

.submit-bar {
  position: sticky;
  bottom: 16px;
  margin-top: 24px;
  text-align: center;
}

button.primary, a.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 13px 32px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(31, 92, 58, 0.35);
  text-decoration: none;
  display: inline-block;
}
button.primary:hover, a.primary:hover { background: var(--accent-dark); }

a.secondary {
  color: var(--accent-dark);
  font-weight: 500;
  text-decoration: none;
}
a.secondary:hover { text-decoration: underline; }

.summary-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  text-align: center;
}

.summary-card .total {
  font-size: 2.4rem;
  font-weight: 700;
}

.summary-card .badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.badge.ontarget { background: var(--green-bg); color: var(--green); }
.badge.offtarget { background: var(--amber-bg); color: var(--amber); }

.warning-box {
  background: var(--amber-bg);
  color: var(--amber);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 0.88rem;
}
.warning-box ul { margin: 6px 0 0; padding-left: 18px; }

.slot-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 14px;
}

.slot-card .slot-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.slot-card .slot-head h2 {
  font-size: 1.05rem;
  margin: 0;
}

.slot-card .slot-head .kcal {
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 0.95rem;
}

.slot-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.slot-card li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 0.94rem;
}
.slot-card li:first-child { border-top: none; }

.slot-card li .amount { color: var(--muted); margin-left: 8px; }
.slot-card li .kcal { color: var(--muted); }

.empty-slot { color: var(--muted); font-style: italic; font-size: 0.9rem; }

footer.actions {
  margin-top: 28px;
  display: flex;
  justify-content: center;
  gap: 20px;
}
