/* Form controls and the chore dialog. */

.label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  color: var(--color-ink-muted);
}

.hint {
  margin-top: 0.375rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--color-ink-muted);
}

.input {
  display: block;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-line);
  border-radius: 0.5rem;
  background: #fff;
  color: var(--color-ink);
  font: inherit;
}

.input:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: -1px;
}

.input[readonly] {
  background: var(--color-surface);
  color: var(--color-ink-muted);
}

/* Room for the Show/Hide button inside a password field. */
.password-field .input {
  padding-right: 3.5rem;
}

/* Time picker: hour and minute selects drawn as the two segments of one input. */
.time-picker {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 0.375rem;
  border: 1px solid var(--color-line);
  border-radius: 0.5rem;
  background: #fff;
  color: var(--color-ink);
}

.time-picker:focus-within {
  outline: 2px solid var(--color-accent);
  outline-offset: -1px;
}

.time-picker:has(select:disabled) {
  background: var(--color-surface);
  color: var(--color-ink-muted);
}

.time-part {
  appearance: none;
  padding: 0.25rem 0.375rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: inherit;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
  cursor: pointer;
}

.time-part:hover:not(:disabled) {
  background: var(--color-surface);
}

.time-part:focus {
  outline: none;
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
}

.time-part:disabled {
  cursor: default;
}

.time-colon {
  font-weight: 500;
}

.button-primary {
  display: flex;
  width: 100%;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0.5rem;
  background: var(--color-accent);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

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

.button-primary:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Validation messages above a form. */
.field-errors {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: #FCE8E6;
  color: var(--color-danger);
  font-size: 0.875rem;
  line-height: 1.25rem;
  list-style: none;
}

/* Sign-in, sign-up and password pages (layouts/auth): one white card on the grey surface. */
.auth-card {
  padding: 1.5rem;
  border: 1px solid var(--color-line);
  border-radius: 0.75rem;
  background: #fff;
}

.auth-title {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: var(--color-ink);
}

.auth-title + form,
.auth-lead + form {
  margin-top: 1.25rem;
}

.auth-lead {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--color-ink-muted);
}

.auth-links {
  margin: 1.25rem 0 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--color-ink-muted);
}

.auth-links a {
  color: var(--color-accent);
}

.auth-links a:hover {
  text-decoration: underline;
}

.auth-flash {
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: #E6F4EA;
  color: #137333;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.auth-flash.is-alert {
  background: #FCE8E6;
  color: var(--color-danger);
}

/* Color swatches: a radio hidden behind a dot; the chosen one gets a ring in its own color. */
.swatch {
  cursor: pointer;
}

.swatch-dot {
  box-shadow: 0 0 0 1px rgb(32 33 36 / 0.08);
}

.swatch input:checked + .swatch-dot {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--chore-strip);
}

.swatch input:focus-visible + .swatch-dot {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Segmented control for the frequency. */
.segmented label + label .segment {
  border-left: 1px solid var(--color-line);
}

.segmented input:checked + .segment {
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
}

.segmented input:focus-visible + .segment {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

/* Weekday pills. */
.weekday input:checked + span {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.weekday input:focus-visible + span {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Show only the fields that belong to the chosen frequency (no JavaScript needed). */
.chore-form .only-daily,
.chore-form .only-weekly,
.chore-form .only-monthly {
  display: none;
}

.chore-form:has(input[name="chore[frequency]"][value="daily"]:checked) .only-daily,
.chore-form:has(input[name="chore[frequency]"][value="weekly"]:checked) .only-weekly,
.chore-form:has(input[name="chore[frequency]"][value="monthly"]:checked) .only-monthly {
  display: block;
}

/* The dialog itself is just a transparent box around the form panel. */
.dialog {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: none;
  max-height: none;
}

.dialog::backdrop {
  background: rgb(32 33 36 / 0.45);
}

/* Phones: the chore form fills the screen. */
@media (max-width: 639px) {
  .dialog,
  .dialog .chore-form {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }
}
