/* Inputs, chips, dialogs and toasts. */

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--hairline-strong);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-tile);
  padding: 0 14px;
  height: 46px;
  font-size: 16px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.textarea {
  height: auto;
  min-height: 110px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.5;
}
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--turf);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--turf) 18%, transparent);
}
.input::placeholder,
.textarea::placeholder { color: var(--loam-soft); }

.field { display: grid; gap: 6px; }
.field + .field { margin-top: 14px; }
.field-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.field-hint {
  font-size: 13px;
  color: var(--loam);
}
.field-error {
  font-size: 14px;
  color: var(--danger-ink);
  min-height: 1em;
}

.input-with-icon { position: relative; }
.input-with-icon > i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--loam-soft);
  pointer-events: none;
}
.input-with-icon > .input { padding-left: 42px; }

/* Chips: status and filters */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--sprout);
  color: var(--turf-ink);
}
.chip--water { background: var(--water-soft); color: #1F77BD; }
.chip--weed { background: var(--weed-soft); color: var(--weed-ink); }
.chip--danger { background: var(--danger-soft); color: var(--danger-ink); }
.chip--muted { background: var(--card-sunk); color: var(--loam); border: 1px solid var(--hairline); }
.chip--dark { background: rgba(21, 32, 26, 0.55); color: #FFFFFF; backdrop-filter: blur(8px); }
@media (prefers-color-scheme: dark) {
  .chip--water { color: #7CC0F4; }
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline-strong);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.filter-chip:hover { border-color: var(--loam-soft); color: var(--ink); }
.filter-chip.is-active {
  background: var(--hedge);
  border-color: var(--hedge);
  color: var(--on-dark);
}

/* Segmented control (units, tabs on small cards) */
.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: var(--radius-pill);
  background: var(--card-sunk);
  border: 1px solid var(--hairline);
}
.segmented button,
.segmented a {
  height: 34px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 14px;
  color: var(--loam);
}
.segmented .is-active {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(21, 32, 26, 0.12);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  padding: 12px 16px 14px;
  font-weight: 600;
  color: var(--loam);
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--turf-ink); }
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--turf);
}
.tab-panel[hidden] { display: none; }

/* Dialogs */
.dialog {
  border: 0;
  padding: 0;
  border-radius: var(--radius-card);
  background: var(--card);
  color: var(--ink);
  width: min(460px, calc(100vw - 32px));
  box-shadow: var(--shadow-hero);
}
.dialog::backdrop {
  background: rgba(12, 29, 22, 0.45);
  backdrop-filter: blur(3px);
}
.dialog-body { padding: 24px; }
.dialog-title {
  font-size: 22px;
  margin-bottom: 8px;
}
.dialog-text {
  color: var(--loam);
  margin-bottom: 18px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* Toasts */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 100;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-tile);
  background: var(--hedge);
  color: var(--on-dark);
  font-weight: 600;
  box-shadow: var(--shadow-pop);
  animation: toast-in 0.25s var(--ease) both;
}
.toast--error { background: var(--danger-ink); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-tile);
  background: var(--sprout);
  color: var(--ink);
}
.notice > i { color: var(--turf-ink); margin-top: 3px; }
.notice--warn { background: var(--weed-soft); }
.notice--warn > i { color: var(--weed); }
.notice--error { background: var(--danger-soft); }
.notice--error > i { color: var(--danger); }
