.jr-routine-screen { color: var(--jr-ink); }
.jr-routine-panel { margin-block: 14px 0; }
.jr-routine-panel-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 7px 12px; }
.jr-routine-panel-head > span { color: var(--jr-muted); font-size: .82rem; }
.jr-routine-screen .jr-routine-notice { margin-block: 10px; color: var(--jr-muted); font-size: .84rem; line-height: 1.5; }
.jr-routine-screen a { color: var(--jr-ink); }
.jr-routine-screen a:focus-visible { outline: 3px solid #648b32; outline-offset: 3px; }
.jr-routine-screen :is(button, input)[hidden], .jr-routine-screen [data-routine-offset][hidden] { display: none; }

.jr-routine-fold > summary,
.jr-routine-archive > summary,
.jr-routine-weeklog > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  cursor: pointer;
  list-style: none;
}
.jr-routine-fold > summary::-webkit-details-marker,
.jr-routine-archive > summary::-webkit-details-marker,
.jr-routine-weeklog > summary::-webkit-details-marker { display: none; }
.jr-routine-fold > summary::after,
.jr-routine-archive > summary::after,
.jr-routine-weeklog > summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin: -4px 4px 0 auto;
  border: solid var(--jr-muted);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.jr-routine-screen details[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
.jr-routine-archive, .jr-routine-weeklog { margin-top: 16px; padding: 8px 11px; background: var(--jr-wash); border-radius: 9px; }
.jr-routine-archive > summary, .jr-routine-weeklog > summary { font-size: .86rem; font-weight: 650; }

.jr-routine-screen .jr-routine-list { margin-top: 12px; }
.jr-routine-occurrence {
  display: grid;
  grid-template-columns: minmax(46px, max-content) minmax(0, 1fr) minmax(95px, max-content) auto;
  align-items: start;
  gap: 8px 14px;
  padding: 13px 0;
  border-top: 1px solid var(--jr-line);
}
.jr-routine-occurrence:focus, .jr-routine-plan:focus { outline: 2px solid #648b32; outline-offset: 3px; border-radius: 5px; }
.jr-routine-occurrence-main, .jr-routine-clock { display: grid; gap: 4px; align-content: start; min-width: 0; }
.jr-routine-occurrence-main > a.jr-text-btn { justify-self: start; padding: 3px 0; }
.jr-routine-clock { font-variant-numeric: tabular-nums; font-size: .83rem; }
.jr-routine-clock time { color: var(--jr-muted); font-size: .77rem; }
.jr-routine-name { color: var(--jr-ink); font-size: .95rem; font-weight: 700; overflow-wrap: anywhere; }
.jr-routine-note { display: block; color: var(--jr-muted); font-size: .8rem; line-height: 1.35; overflow-wrap: anywhere; }
.jr-routine-description { white-space: pre-line; }
.jr-routine-occurrence-status { display: grid; justify-items: start; gap: 4px; }
.jr-routine-badge {
  display: inline-block;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--jr-wash);
  color: var(--jr-muted);
  font-size: .74rem;
  line-height: 1.25;
  font-weight: 650;
}
.jr-routine-badge[data-status="completed"] { background: #e2ebd0; color: #284637; }
.jr-routine-badge[data-status="skipped"] { background: var(--jr-lavender); color: #4a455e; }
.jr-routine-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.jr-routine-actions .jr-btn { min-height: 37px; padding: 5px 8px; font-size: .78rem; }
.jr-routine-reminder-row { grid-template-columns: 66px minmax(0, 1fr); }
.jr-routine-push-link { margin-top: 12px; }

.jr-routine-metrics, .jr-routine-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 136px), 1fr));
  gap: 8px;
  margin-block: 13px 0;
}
.jr-routine-metrics > div, .jr-routine-counts > div {
  display: grid;
  gap: 5px;
  align-content: center;
  min-width: 0;
  padding: 11px 12px;
  background: var(--jr-wash);
  border-radius: 8px;
}
.jr-routine-metrics span, .jr-routine-counts dt { color: var(--jr-muted); font-size: .77rem; }
.jr-routine-metrics strong, .jr-routine-counts dd { color: var(--jr-ink); font-size: 1rem; font-weight: 750; margin: 0; }

.jr-routine-screen .jr-routine-plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  align-items: start;
  gap: 10px;
  margin-top: 12px;
}
.jr-routine-plan {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--jr-line);
  border-radius: 10px;
  background: #fafbf5;
  scroll-margin: 32px;
}
.jr-routine-plan-head { display: flex; align-items: start; gap: 8px; overflow-wrap: anywhere; }
.jr-routine-plan-head > div { display: grid; min-width: 0; gap: 3px; justify-items: start; }
.jr-routine-plan-head h3 { font-size: 1rem; }
.jr-routine-glyph { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; background: #e5edcc; color: var(--jr-ink); }
.jr-routine-dose-times { display: grid; gap: 5px; font-size: .8rem; line-height: 1.4; }
.jr-routine-dose-times li { display: flex; flex-wrap: wrap; gap: 3px 6px; }
.jr-routine-dose-times span { color: var(--jr-muted); }
.jr-routine-next { color: var(--jr-ink); font-size: .84rem; font-weight: 700; }
.jr-routine-plan > .jr-text-btn { justify-self: start; }
.jr-routine-plan > .jr-routine-actions { padding-top: 8px; border-top: 1px solid var(--jr-line); }
.jr-routine-manage { align-items: start; }
.jr-routine-manage > .jr-btn { align-self: start; }
.jr-routine-more > summary { list-style: none; cursor: pointer; }
.jr-routine-more > summary::-webkit-details-marker { display: none; }
.jr-routine-more[open] > summary .sd-icon { transform: rotate(180deg); }
.jr-routine-more-actions {
  display: grid; gap: 2px; margin-top: 5px; padding: 3px; border: 1px solid var(--jr-line);
  border-radius: 8px; background: var(--jr-paper);
}
.jr-routine-more-actions button {
  display: flex; align-items: center; gap: 6px; min-height: 37px; padding: 6px 8px;
  border: 0; border-radius: 5px; background: transparent; color: var(--jr-ink); text-align: left; font-size: .82rem;
}
.jr-routine-more-actions button:hover { background: var(--jr-wash); }
.jr-routine-more-actions .jr-danger-icon { color: #893b32; }

.jr-routine-history { margin-top: 12px; }
.jr-routine-history-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; margin-bottom: 12px; }
.jr-routine-history-controls > .jr-field { flex: 1 1 148px; max-width: 224px; }
.jr-routine-screen .jr-routine-period-label { margin-top: 12px; font-size: .92rem; }
.jr-routine-show-more { margin-top: 8px; }
.jr-routine-weeklog li { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding: 7px 0; border-top: 1px solid var(--jr-line); font-size: .82rem; }
.jr-routine-comparison { margin-top: 18px; }
.jr-routine-comparison h3 { font-size: .94rem; }
.jr-routine-comparison table { width: 100%; margin-top: 8px; border-collapse: collapse; text-align: left; font-size: .79rem; }
.jr-routine-comparison :is(th, td) { padding: 6px; border-bottom: 1px solid var(--jr-line); overflow-wrap: anywhere; }

.jr-routine-calendar {
  width: min(100%, 400px);
  padding: 8px;
  background: var(--jr-wash);
  border: 1px solid var(--jr-line);
  border-radius: 8px;
}
.jr-routine-calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-bottom: 4px; }
.jr-routine-calendar-head strong { font-size: .89rem; text-transform: capitalize; }
.jr-routine-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; text-align: center; }
.jr-routine-cal-day { padding-block: 5px; font-size: .73rem; color: var(--jr-muted); }
.jr-routine-date {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  min-height: 39px;
  padding: 2px;
  border: 1px solid var(--jr-line);
  border-radius: 5px;
  background: var(--jr-paper);
  color: var(--jr-ink);
  font-size: .79rem;
}
.jr-routine-date[aria-pressed="true"] { background: var(--jr-ink); color: white; }
.jr-routine-dot { width: 5px; height: 5px; border: 1px solid #61726a; border-radius: 50%; background: #f7f8f3; }
.jr-routine-dot[data-status="completed"] { border-color: #527030; background: #8fba64; }
.jr-routine-dot[data-status="partial"] { border-color: #897289; background: #d5c4d7; }

.jr-routine-dialog .jr-routine-slots { display: grid; gap: 10px; }
.jr-slot { min-width: 0; margin: 0; padding: 11px 12px; border: 1px solid var(--jr-line); border-radius: 8px; }
.jr-slot legend { padding: 0 4px; color: var(--jr-ink); font-size: .83rem; font-weight: 700; }
.jr-slot-head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 6px; }
.jr-slot-head > label { flex: 1 1 120px; max-width: 200px; }
.jr-slot-days, .jr-icon-options-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.jr-slot-days { margin-block: 10px; }
.jr-slot-days label, .jr-icon-options-grid label { position: relative; cursor: pointer; }
.jr-slot-days label > span, .jr-icon-options-grid label > span {
  display: grid;
  place-items: center;
  min-width: 40px;
  min-height: 36px;
  padding: 4px;
  color: var(--jr-ink);
  border: 1px solid var(--jr-line);
  border-radius: 6px;
  background: white;
  font-size: .75rem;
}
.jr-routine-screen :is(.jr-slot-days, .jr-icon-options-grid) input:checked + span { border-color: var(--jr-ink); background: var(--jr-ink); color: #fff; }
.jr-routine-screen :is(.jr-slot-days, .jr-icon-options-grid) input:focus-visible + span { outline: 3px solid #648b32; outline-offset: 2px; }
.jr-routine-check { display: flex; align-items: center; gap: 8px; margin-block: 8px 4px; color: var(--jr-ink); font-size: .84rem; font-weight: 650; }
.jr-routine-check > input { width: 17px; height: 17px; margin: 0; accent-color: var(--jr-ink); }
.jr-slot [data-routine-offset] { margin-top: 8px; }
.jr-slot [data-routine-offset] input { max-width: 180px; }
.jr-slot [data-routine-preview] { margin-top: 3px; }
.jr-routine-dialog .jr-add-slot { justify-self: start; }
.jr-routine-dialog .jr-slot label { min-width: 0; }

@container (max-width: 640px) {
  .jr-routine-occurrence { grid-template-columns: minmax(40px, max-content) minmax(0, 1fr) minmax(70px, max-content); gap: 7px 8px; }
  .jr-routine-occurrence > .jr-routine-actions { grid-column: 2 / -1; }
  .jr-routine-reminder-row { grid-template-columns: 55px minmax(0, 1fr); }
}
@container (max-width: 330px) {
  .jr-routine-occurrence { grid-template-columns: minmax(40px, max-content) minmax(0, 1fr); }
  .jr-routine-occurrence > .jr-routine-occurrence-status, .jr-routine-occurrence > .jr-routine-actions { grid-column: 2; }
}
@media (max-width: 600px) {
  .jr-routine-screen button.jr-routine-mark, .jr-routine-manage .jr-btn, .jr-routine-more-actions button,
  .jr-routine-dialog :is(.jr-slot-days, .jr-icon-options-grid) label > span { min-height: 44px; }
  .jr-routine-dialog .jr-field :is(input, textarea, select) { font-size: 1rem; }
}
