/* ==========================================================================
   forms.css — standard boxed inputs, switch, segmented control, modals
   ========================================================================== */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.field label,
.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

/* -------------------------------------------------------- text input -- */
.input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.input::placeholder { color: var(--text-3); }
.input:hover:not(:disabled) { border-color: var(--text-3); }

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.input:disabled { background: var(--surface-alt); color: var(--text-3); cursor: not-allowed; }

.input.invalid {
  border-color: var(--critical);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--critical) 15%, transparent);
}

input[type="number"].input,
input[type="url"].input { font-variant-numeric: tabular-nums; }

/* Variants must follow the .input base so they win on source order. */

/* The consumed-time fields are typed on every run — give them presence. */
.input-lg {
  height: 48px;
  padding: 0 14px;
  font-size: 19px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.textarea {
  height: auto;
  min-height: 96px;
  padding: 11px 12px;
  line-height: 1.6;
  font-size: 13.5px;
  resize: vertical;
}

.field-error {
  font-size: 12px;
  color: var(--critical);
  min-height: 0;
}

.field-hint { font-size: 11.5px; color: var(--text-3); }

/* ------------------------------------------------------------ switch -- */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  user-select: none;
}

.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch .track {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background-color var(--dur) var(--ease);
}

.switch .track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: transform 180ms var(--ease);
}

.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:checked ~ span { color: var(--text); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------- segmented control -- */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--radius);
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-3);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.segmented button svg { width: 14px; height: 14px; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* ------------------------------------------------------------- modal -- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 17, 21, .45);
  backdrop-filter: blur(2px);
  animation: backdrop-in 160ms var(--ease);
}
.modal-backdrop.closing { animation: backdrop-out 140ms var(--ease) forwards; }

@keyframes backdrop-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-out { to { opacity: 0; } }

.modal {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  animation: modal-in 180ms var(--ease);
}
.modal-backdrop.closing .modal { animation: modal-out 140ms var(--ease) forwards; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to   { opacity: 1; transform: none; }
}
@keyframes modal-out { to { opacity: 0; transform: translateY(6px); } }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 22px 0;
}

.modal-head h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.005em;
}
.modal-head p { font-size: 12.5px; color: var(--text-2); margin-top: 6px; max-width: 40ch; }

.modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 22px 22px;
}

.modal-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-alt);
}
.modal-meta div span {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 3px;
}
.modal-meta div strong { font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------- confirm -- */
.confirm {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.confirm-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--critical-wash);
  color: var(--critical);
}
.confirm-icon.info { background: var(--accent-wash); color: var(--accent); }
.confirm-icon svg { width: 18px; height: 18px; }
.confirm p { font-size: 13.5px; line-height: 1.6; color: var(--text-2); }

/* ----------------------------------------------------- settings rows -- */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.setting-row:first-child { border-top: none; padding-top: 0; }

.setting-info { flex: 1; min-width: 220px; max-width: 46ch; }
.setting-info strong { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); }
.setting-info span { font-size: 12.5px; color: var(--text-2); }

.setting-control { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.setting-control .input { width: 300px; max-width: 100%; }

.shortcut-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}
.shortcut-row:first-child { border-top: none; }
.shortcut-row kbd { flex: none; }
.shortcut-row span { font-size: 13px; color: var(--text-2); }

@media (max-width: 760px) {
  .setting-control { width: 100%; }
  .setting-control .input { width: 100%; }
}
