:root {
  --color-primary: #2f6f4f;
  --color-primary-dark: #234f38;
  --color-bg: #f5f6f5;
  --color-card: #ffffff;
  --color-border: #dfe3e0;
  --color-text: #222;
  --color-muted: #6b7370;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
}

.app-header {
  background: var(--color-primary);
  color: #fff;
  padding: 1rem 1.5rem;
}

.app-header h1 {
  margin: 0 0 0.75rem 0;
  font-size: 1.4rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
}

.tab-button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 0.95rem;
}

.tab-button.active {
  background: var(--color-bg);
  color: var(--color-primary-dark);
  font-weight: 600;
  border-color: var(--color-bg);
}

.app-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card h3 {
  margin-top: 0;
}

.wip-note {
  background: #fff8e1;
  border: 1px solid #f0dca0;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  color: #6b5a10;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

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

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem 1rem;
  align-items: flex-end;
  /* reserves room for the last row's absolutely positioned field-help so it doesn't spill past the card */
  padding-bottom: 2.5rem;
}

.form-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.form-field label {
  font-weight: 600;
  font-size: 0.9rem;
}

.form-field input,
.form-field select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.9rem;
  min-width: 220px;
}

.field-help {
  margin: 0.2rem 0 0 0;
  color: var(--color-muted);
  font-size: 0.8rem;
}

/* Absolutely positioned only within the ration/pen row so help text doesn't affect the field's height used for row alignment */
.inline-form .field-help {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

button {
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: #fff;
  cursor: pointer;
}

button.primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary-dark);
}

button.primary:hover {
  background: var(--color-primary-dark);
}

button.danger {
  color: #b23b3b;
  border-color: #e2b4b4;
  background: #fff;
}

.settings-save-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.saved-message {
  color: var(--color-primary-dark);
  font-weight: 600;
}

.row-actions {
  display: flex;
  gap: 0.4rem;
}

.form-message {
  margin: 0;
  color: var(--color-primary-dark);
  font-weight: 600;
  font-size: 0.9rem;
}

.form-message.error {
  color: #b23b3b;
  background: #fbeaea;
  border: 1px solid #e2b4b4;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-weight: normal;
}

.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.checkbox-field input[type="checkbox"] {
  min-width: 0;
  width: auto;
}

.decisions-warnings .wip-note {
  margin-bottom: 0.75rem;
}

.data-table td.over-capacity {
  color: #b23b3b;
  font-weight: 600;
}

.ration-detail-card {
  margin-bottom: 1rem;
}

.ration-detail-card h5 {
  margin: 0 0 0.5rem 0;
}

.animal-list {
  margin: 0.25rem 0 0.75rem 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
}

.animal-list li {
  margin-bottom: 0.2rem;
}

.animal-list-details {
  margin-bottom: 0.5rem;
}

.animal-list-details summary {
  cursor: pointer;
  font-weight: 600;
}

.animal-list-details summary::marker {
  color: var(--color-muted);
}


.sign-out-button {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
}

.login-main {
  max-width: 420px;
}

.login-card .form-field input {
  min-width: 0;
}

.login-card button[type="submit"] {
  width: 100%;
}

.login-error {
  color: #b23b3b;
  background: #fbeaea;
  border: 1px solid #e2b4b4;
  border-radius: 6px;
  padding: 0.75rem 1rem;
}
