/* Gingerly Farms — Service Portal
   Simple, mobile-first styles. Built for a tech standing next to a tower
   with one hand free, not for a desktop marketing audience. */

:root {
  --navy: #1b2a33;
  --navy-light: #2c414d;
  --sage: #7a9482;
  --sage-dark: #5d7566;
  --cream: #f7f5f0;
  --white: #ffffff;
  --error: #b3452c;
  --border: #d8d3c8;
  --text: #23282b;
  --text-muted: #6b6f70;

  --radius: 10px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top bar, present on every logged-in page */
.topbar {
  background: var(--navy);
  color: var(--white);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar__brand {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.topbar__signout {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--white);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: 0.85rem;
  cursor: pointer;
}

.topbar__signout:active {
  background: rgba(255, 255, 255, 0.1);
}

main {
  flex: 1;
  padding: var(--space-4);
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}

/* Login-specific centering */
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  width: 100%;
  max-width: 380px;
}

.card--wide {
  max-width: 520px;
}

.brand-mark {
  text-align: center;
  margin-bottom: var(--space-4);
}

.brand-mark h1 {
  font-size: 1.3rem;
  margin: 0;
  color: var(--navy);
}

.brand-mark p {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

h2 {
  font-size: 1.1rem;
  color: var(--navy);
  margin: 0 0 var(--space-3);
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy-light);
  margin-bottom: var(--space-1);
}

input, select {
  width: 100%;
  font-size: 1rem;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  margin-bottom: var(--space-3);
}

input:focus, select:focus {
  outline: 2px solid var(--sage);
  outline-offset: 1px;
  border-color: var(--sage);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

button.primary {
  width: 100%;
  background: var(--navy);
  color: var(--white);
  border: none;
  padding: 14px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

button.primary:active {
  background: var(--navy-light);
}

button.primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.message {
  font-size: 0.85rem;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  margin-bottom: var(--space-3);
}

.message--error {
  background: #f7e6e1;
  color: var(--error);
  border: 1px solid #e6bdb0;
}

.message--success {
  background: #e9f0e9;
  color: var(--sage-dark);
  border: 1px solid #c7d8c9;
  font-weight: 600;
  font-size: 0.95rem;
  padding: var(--space-3) var(--space-3);
}

.section {
  margin-bottom: var(--space-5);
}

.section__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.dose-result {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  text-align: center;
}

.dose-result__amount {
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
}

.dose-result__unit {
  font-size: 1rem;
  color: var(--text-muted);
}

.dose-result__note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-2);
}

.hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: -8px 0 var(--space-3);
}

.loading-state, .empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-5) 0;
}

.combobox {
  position: relative;
}

.combobox__field {
  position: relative;
}

#tower-search {
  padding-right: 40px;
  margin-bottom: 0;
}

.combobox {
  margin-bottom: var(--space-3);
}

.combobox__clear {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
}

.combobox__clear:hover {
  color: var(--text);
  background: var(--cream);
}

.combobox__results {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(27, 42, 51, 0.12);
}

.combobox__option {
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.combobox__option:last-child {
  border-bottom: none;
}

.combobox__option-name {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.combobox__option-context {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.combobox__option--active,
.combobox__option:hover {
  background: var(--cream);
}

.combobox__empty {
  padding: 12px 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
