/* ══════════════ Modal Overlay & Sheet ══════════════ */
.modal-ov {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,.35);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  transition: opacity .25s var(--ease);
}
.modal-ov.open { display: flex; opacity: 1; }

.modal-sh {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 16px 28px calc(32px + env(safe-area-inset-bottom,0));
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform .35s var(--ease);
}
.modal-ov.open .modal-sh { transform: translateY(0); }

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 24px;
}
.modal-title {
  font-size: 20px;
  font-weight: 750;
  margin-bottom: 28px;
  letter-spacing: -0.02em;
}

/* ══════════════ Form Fields ══════════════ */
.field { margin-bottom: 22px; }
.field-lbl {
  display: block;
  font-size: 13px;
  font-weight: 650;
  color: var(--text2);
  margin-bottom: 8px;
}
.field-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  background: var(--bg);
}
.field-input:focus {
  border-color: var(--pri);
  background: #fff;
  box-shadow: 0 0 0 3px var(--pri-subtle);
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.time-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  text-align: center;
  font-weight: 600;
}
.time-input::placeholder { color: var(--text4); font-weight: 400; }

/* Tag picker inside modals */
.tag-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-chip {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s var(--ease);
  background: var(--bg);
  color: var(--text3);
}
.tag-chip:hover { background: var(--bg-warm); }
.tag-chip.sel   { border-color: var(--pri); color: var(--pri); background: var(--pri-light); }

/* ══════════════ Modal Buttons ══════════════ */
.modal-btns {
  display: flex;
  gap: 10px;
  margin-top: 32px;
}
.m-btn {
  flex: 1;
  padding: 16px;
  border: none;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s var(--ease);
}
.m-btn:active { transform: scale(.98); }
.m-btn-cancel { background: var(--bg); color: var(--text2); }
.m-btn-cancel:hover { background: var(--bg-warm); }
.m-btn-save { background: var(--pri); color: #fff; }
.m-btn-save:hover { background: var(--pri-dark); box-shadow: 0 4px 12px rgba(38,85,212,.25); }
.m-btn-del { background: var(--err-light); color: var(--err); flex: 0; padding: 16px 20px; }

/* Confirm modal */
.confirm-icon { font-size: 40px; margin-bottom: 12px; }
.confirm-msg  { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.confirm-sub  { font-size: 14px; color: var(--text3); }
.m-btn-del-confirm { background: var(--err); color: #fff; flex: 1; }
.m-btn-del-confirm:hover { background: #e02020; }

/* Sub-routine parent info banner */
.rm-parent-info {
  background: var(--pri-light);
  color: var(--pri);
  padding: 10px 14px;
  border-radius: var(--r-xs);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rm-parent-info svg { flex-shrink: 0; }

/* Day picker (weekly modal) */
.day-picker { display: flex; gap: 6px; }
.day-chip {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text3);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}
.day-chip:hover { border-color: var(--text4); color: var(--text2); }
.day-chip.sel   { border-color: #10b981; color: #065f46; background: #d1fae5; }

/* Repeat type toggle */
.repeat-type { display: flex; gap: 8px; margin-bottom: 4px; }
.repeat-chip {
  flex: 1;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  font-family: inherit;
  background: var(--bg);
  color: var(--text3);
  text-align: center;
  transition: all .15s var(--ease);
}
.repeat-chip:hover { border-color: var(--text4); color: var(--text2); }
.repeat-chip.sel   { border-color: var(--pri); color: var(--pri); background: var(--pri-light); }

/* Week number picker (monthly modal) */
.week-num-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.week-num-chip {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s var(--ease);
}
.week-num-chip:hover { border-color: var(--text4); color: var(--text2); }
.week-num-chip.sel   { border-color: var(--pri); color: var(--pri); background: var(--pri-light); }

/* Day-of-month picker */
.dom-picker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.dom-chip {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text3);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dom-chip:hover { border-color: var(--text4); color: var(--text2); }
.dom-chip.sel   { border-color: var(--pri); color: var(--pri); background: var(--pri-light); }
