.routines-page-container {
  --routine-glass-border: var(--app-glass-border, rgba(255, 255, 255, 0.09));
  --routine-glass-border-strong: var(--app-glass-border-strong, rgba(255, 255, 255, 0.16));
  --routine-glass-bg: var(
    --app-glass-bg,
    linear-gradient(135deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.012)),
    rgba(8, 8, 8, 0.84)
  );
  --routine-glass-bg-soft: var(
    --app-glass-bg-soft,
    linear-gradient(180deg, rgba(255, 255, 255, 0.042), rgba(255, 255, 255, 0.014)),
    rgba(10, 10, 10, 0.78)
  );
  --routine-glass-bg-muted: var(
    --app-glass-bg-muted,
    linear-gradient(180deg, rgba(255, 255, 255, 0.026), rgba(255, 255, 255, 0.008)),
    rgba(4, 4, 4, 0.76)
  );
  --routine-glass-shadow: var(
    --app-glass-shadow,
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 14px 30px rgba(0, 0, 0, 0.28)
  );
  --routine-glass-shadow-soft: var(
    --app-glass-shadow-soft,
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 18px rgba(0, 0, 0, 0.2)
  );
  min-height: 100dvh;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.container.routines-page-container {
  width: 100%;
  max-width: none;
  margin: 0;
}

.routines-page,
.routines-builder-page {
  width: 100%;
}

.routines-builder-page {
  position: relative;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background: #101010;
}

.routines-builder-page::before {
  content: "";
  position: fixed;
  z-index: 118;
  top: 0;
  left: 0;
  right: 0;
  height: 102px;
  background: #101010;
}

.routines-builder-page::after {
  content: "";
  position: fixed;
  z-index: 119;
  top: 90px;
  left: 21px;
  right: 21px;
  height: 1px;
  background: rgba(255, 255, 255, 0.7);
}

.routines-builder-page .page-header {
  position: fixed;
  z-index: 121;
  top: 40px;
  left: 20px;
  right: 20px;
  min-height: 40px;
}

.routines-shell {
  width: min(100%, 980px);
  margin: 0 auto;
}

.routines-shell--builder {
  width: min(100%, 1120px);
}

.routines-builder-page .routines-shell--builder {
  position: fixed;
  top: 102px;
  right: 0;
  bottom: 0;
  left: 0;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 12px clamp(12px, 3vw, 40px)
    calc(82px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.routines-builder-page .routines-builder-panel {
  width: 100%;
  max-width: none;
  margin: 0 auto;
}

.routines-hero,
.routines-builder-panel,
.routines-list-panel {
  width: 100%;
  border: 1px solid var(--routine-glass-border);
  background: var(--routine-glass-bg);
  backdrop-filter: blur(18px);
  box-shadow: var(--routine-glass-shadow);
  box-sizing: border-box;
}

.routines-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 138px;
  padding: 24px;
  border-radius: 8px;
}

.routines-list-panel,
.routines-builder-panel {
  margin-top: 16px;
  padding: 20px 20px 8px;
  border-radius: 8px;
}

.scenes-create-section .scene-control-card--routine {
  width: 100%;
  min-height: 76px;
  height: 76px;
  margin-top: 0;
}

.scene-control-card--routine .control-label {
  font-size: 20px;
  font-weight: 400;
}

.routines-list-panel--embedded {
  margin-top: 0;
  padding: 14px;
  border: 1px solid var(--scene-glass-border, rgba(255, 255, 255, 0.09));
  border-radius: 8px;
  background: var(
    --scene-glass-bg,
    linear-gradient(135deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.012)),
    rgba(8, 8, 8, 0.84)
  );
  backdrop-filter: blur(18px);
  box-shadow: var(
    --scene-glass-shadow,
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 14px 30px rgba(0, 0, 0, 0.28)
  );
}

.routines-list-panel--embedded .routines-list {
  grid-template-columns: 1fr;
  gap: 10px;
}

.routines-list-panel--embedded .routines-feedback:empty {
  display: none;
  min-height: 0;
  margin: 0;
}

.routines-list-panel--embedded .routines-empty {
  min-height: 64px;
  display: grid;
  place-items: center;
  padding: 18px 14px;
  border: 1px solid var(--scene-glass-border, rgba(255, 255, 255, 0.09));
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.68);
  background: var(
    --scene-glass-bg-muted,
    linear-gradient(180deg, rgba(255, 255, 255, 0.026), rgba(255, 255, 255, 0.008)),
    rgba(4, 4, 4, 0.76)
  );
  font-size: 0.9rem;
  font-weight: 600;
}

.routines-section-head {
  margin-bottom: 8px;
}

.routines-section-title {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.2;
}

.routines-builder-panel {
  margin-top: 18px;
}

.routines-title {
  margin: 0;
  color: #fff;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.routines-subtitle {
  max-width: 620px;
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.92rem;
  line-height: 1.45;
}

.routines-btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.routines-btn__icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  object-fit: contain;
}

.routines-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.routines-btn--primary {
  color: #101010;
  background: #fff;
}

.routines-btn--secondary,
.routines-btn--ghost {
  color: #fff;
  border: 1px solid var(--routine-glass-border);
  background: var(--routine-glass-bg-soft);
  box-shadow: var(--routine-glass-shadow-soft);
}

.routines-btn--danger {
  color: #ffcece;
  border: 1px solid rgba(255, 179, 179, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 179, 179, 0.12), rgba(255, 82, 82, 0.06)),
    rgba(22, 8, 8, 0.58);
  box-shadow: var(--routine-glass-shadow-soft);
}

.routines-feedback {
  min-height: 20px;
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
}

.routines-feedback[data-state="error"] {
  color: #ffb3b3;
}

.routines-feedback[data-state="success"] {
  color: #c7ffd7;
}

.routines-builder-panel .routines-feedback {
  min-height: 0;
  margin: 10px 0 0;
}

.routines-builder-panel .routines-feedback:empty {
  display: none;
}

.routines-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.routine-card {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--routine-glass-border);
  border-radius: 8px;
  background: var(--routine-glass-bg-soft);
  backdrop-filter: blur(16px);
  box-shadow: var(--routine-glass-shadow-soft);
  box-sizing: border-box;
}

.routine-card__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 12px;
}

.routine-card__name {
  margin: 0;
  color: #fff;
  font-size: 1rem;
  line-height: 1.25;
}

.routine-card__meta,
.routine-card__schedule {
  margin: 7px 0 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.84rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.routine-status {
  flex: 0 0 auto;
  align-self: start;
  padding: 5px 8px;
  border-radius: 999px;
  color: #111;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.routine-status[data-enabled="false"] {
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.12);
}

.routine-card__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.routine-card__action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.routine-card__action-group--run .routines-btn {
  flex: 1 1 130px;
}

.routine-card__action-group--manage .routines-btn {
  flex: 1 1 82px;
}

.routine-card__actions .routines-btn {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012)),
    rgba(6, 6, 6, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 8px 18px rgba(0, 0, 0, 0.18);
  font-size: 0.8rem;
}

.routine-card__actions .routines-btn:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)),
    rgba(8, 8, 8, 0.8);
}

.routine-card__actions .routines-btn--danger {
  border-color: rgba(255, 160, 160, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 90, 90, 0.13), rgba(255, 40, 40, 0.045)),
    rgba(24, 8, 8, 0.82);
}

.routine-card__actions .routines-btn--danger:hover {
  border-color: rgba(255, 180, 180, 0.42);
}

.routine-card__actions .routines-btn__icon {
  width: 15px;
  height: 15px;
}

.routines-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 22px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--routine-glass-bg-muted);
  text-align: center;
}

.routines-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.routines-field {
  display: grid;
  gap: 8px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.82rem;
  font-weight: 700;
}

.routines-field--wide {
  grid-column: 1 / -1;
}

.routines-input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--routine-glass-border);
  border-radius: 8px;
  color: #fff;
  background: var(--routine-glass-bg-muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  box-sizing: border-box;
  font: inherit;
  letter-spacing: 0;
}

.routines-input:focus {
  outline: 2px solid rgba(255, 255, 255, 0.32);
  outline-offset: 2px;
}

.routines-input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.routines-action-field {
  position: relative;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--routine-glass-border);
  border-left: 3px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: var(--routine-glass-bg-soft);
  backdrop-filter: blur(16px);
  box-shadow: var(--routine-glass-shadow-soft);
}

.routines-action-field[data-routine-action-field="on"] {
  border-left-color: rgba(199, 255, 215, 0.75);
}

.routines-action-field[data-routine-action-field="off"] {
  border-left-color: rgba(255, 206, 206, 0.75);
}

.routines-action-field.is-disabled {
  color: rgba(255, 255, 255, 0.44);
  background: var(--routine-glass-bg-muted);
  border-left-color: rgba(255, 255, 255, 0.16);
}

.routines-action-field.needs-action {
  border-color: rgba(255, 179, 179, 0.42);
  border-left-color: rgba(255, 179, 179, 0.78);
  box-shadow: 0 0 0 1px rgba(255, 179, 179, 0.08);
}

.routines-action-field__head {
  display: flex;
  min-height: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.routines-action-field__head > label:first-child {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.84rem;
}

.routines-action-field .routines-input {
  min-height: 50px;
  margin-top: 6px;
  font-size: 1.02rem;
  font-weight: 800;
}

.routines-time-input {
  font-variant-numeric: tabular-nums;
}

.routines-check-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.74);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.routines-check-toggle input {
  position: relative;
  width: 34px;
  height: 20px;
  margin: 0;
  border: 1px solid var(--routine-glass-border-strong);
  border-radius: 999px;
  appearance: none;
  background: var(--routine-glass-bg-muted);
  cursor: pointer;
}

.routines-check-toggle input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.68);
  transition: transform 160ms ease, background 160ms ease;
}

.routines-check-toggle input:checked {
  border-color: rgba(255, 255, 255, 0.46);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.1)),
    rgba(255, 255, 255, 0.08);
}

.routines-check-toggle input:checked::before {
  background: #fff;
  transform: translateX(14px);
}

.routines-days-card,
.routines-devices-card,
.routines-preview {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--routine-glass-border);
  border-radius: 8px;
  background: var(--routine-glass-bg-soft);
  backdrop-filter: blur(16px);
  box-shadow: var(--routine-glass-shadow-soft);
}

.routines-days-card {
  position: relative;
  overflow: hidden;
  border-color: var(--routine-glass-border-strong);
  background: var(--routine-glass-bg);
  backdrop-filter: blur(18px);
  box-shadow: var(--routine-glass-shadow);
}

.routines-days-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent 42%);
}

.routines-days-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.84rem;
  font-weight: 700;
}

.routines-days-card .routines-days-head {
  margin: -2px 0 14px;
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.routines-days-card .routines-days-head > span {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.92rem;
  font-weight: 900;
}

.routines-days-card .routines-days-head .routines-btn {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--routine-glass-border-strong);
  background: var(--routine-glass-bg-soft);
}

.routines-days-head--stacked > div:first-child {
  display: grid;
  gap: 3px;
}

.routines-devices-card {
  padding: 12px;
}

.routines-devices-card .routines-days-head {
  align-items: center;
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
}

.routines-devices-card .routines-days-head > span {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.94rem;
  font-weight: 900;
  line-height: 1.1;
}

.routines-devices-card .routines-inline-actions {
  gap: 8px;
}

.routines-devices-card .routines-btn {
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.84rem;
}

.routines-selection-count {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.76rem;
  font-weight: 700;
}

.routines-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.routines-devices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.routines-selected-devices {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.routines-selected-devices[hidden] {
  display: none;
}

.routines-selected-devices__label {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.routines-selected-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--routine-glass-border);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.86);
  background: var(--routine-glass-bg-soft);
  box-shadow: var(--routine-glass-shadow-soft);
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
}

.routines-selected-chip--more {
  cursor: default;
}

.routine-room-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.routine-room-tab {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--routine-glass-border);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.76);
  background: var(--routine-glass-bg-muted);
  box-shadow: var(--routine-glass-shadow-soft);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
}

.routine-room-tab.is-active {
  border-color: rgba(255, 255, 255, 0.42);
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 -2px 0 #fff;
}

.routine-room-tab.has-selection:not(.is-active) {
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  background: var(--routine-glass-bg-soft);
}

.routine-room-tab__count {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: inherit;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.72rem;
}

.routine-room-tab.is-active .routine-room-tab__count {
  background: rgba(255, 255, 255, 0.18);
}

.routine-room-panel {
  display: none;
}

.routine-room-panel.is-active {
  display: block;
}

.routine-room-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.78rem;
  font-weight: 700;
}

.routine-room-panel__head .routines-btn {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.76rem;
}

.routine-room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.routines-days {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.routine-day,
.routine-device {
  min-height: 38px;
  border: 1px solid var(--routine-glass-border);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.76);
  background: var(--routine-glass-bg-muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
}

.routine-day {
  position: relative;
  min-height: 36px;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.56);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.012)),
    rgba(3, 3, 3, 0.72);
  backdrop-filter: blur(12px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 18px rgba(0, 0, 0, 0.18);
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.routine-day::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 12px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0;
  transform: translateY(-50%) scale(0.8);
  transition: opacity 160ms ease, transform 160ms ease;
}

.routine-day:hover {
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.78);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.024)),
    rgba(8, 8, 8, 0.72);
}

.routine-device {
  min-height: 44px;
  padding: 0 12px;
  text-align: left;
}

.routine-day.is-selected {
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.055)),
    rgba(8, 8, 8, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.055),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.26);
  transform: translateY(-1px);
}

.routine-day.is-selected::after {
  opacity: 0.9;
  transform: translateY(-50%) scale(1);
}

.routine-device.is-selected {
  color: #101010;
  border-color: rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.36);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 10px 24px rgba(0, 0, 0, 0.18);
}

.routines-empty--inline {
  grid-column: 1 / -1;
  padding: 14px;
  text-align: left;
}

.routines-preview {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.9rem;
  line-height: 1.45;
}

.routines-save-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.routines-save-summary:empty {
  display: none;
}

.routines-save-summary__item {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--routine-glass-border);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  background: var(--routine-glass-bg-soft);
  box-shadow: var(--routine-glass-shadow-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.routines-save-summary[data-state="warning"] .routines-save-summary__item {
  border-color: rgba(255, 179, 179, 0.28);
  color: #ffcece;
}

.routines-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.routines-actions .routines-btn {
  flex: 1 1 0;
}

@media (max-width: 720px) {
  .container.routines-page-container {
    padding: 0;
  }

  .routines-builder-page .routines-shell--builder {
    padding: 12px 8px calc(78px + env(safe-area-inset-bottom, 0px));
  }

  .routines-shell,
  .routines-shell--builder {
    width: 100%;
    max-width: none;
  }

  .routines-hero {
    align-items: stretch;
    flex-direction: column;
    min-height: 0;
    padding: 18px;
  }

  .routines-list-panel,
  .routines-builder-panel {
    padding: 14px 14px 8px;
  }

  .routines-form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 14px;
  }

  .routines-title {
    font-size: 1.24rem;
  }

  .routines-subtitle {
    font-size: 0.86rem;
  }

  .routines-input {
    min-height: 44px;
  }

  .routines-days-card,
  .routines-devices-card,
  .routines-preview {
    margin-top: 12px;
    padding: 12px;
  }

  .routines-days-head--stacked {
    align-items: stretch;
    flex-direction: column;
  }

  .routine-room-panel__head {
    align-items: stretch;
    flex-direction: column;
  }

  .routine-room-panel__head .routines-inline-actions {
    justify-content: stretch;
  }

  .routine-room-panel__head .routines-btn {
    flex: 1 1 0;
  }

  .routine-room-grid {
    grid-template-columns: 1fr;
  }

  .routines-days {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .routines-actions .routines-btn,
  .routines-hero .routines-btn {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .routine-card__actions {
    grid-template-columns: 1fr;
  }

  .routine-card__action-group {
    justify-content: stretch;
  }

  .routine-card__actions .routines-btn {
    min-width: 42px;
    padding: 0 10px;
  }

  .routine-card__action-group--manage .routines-btn {
    flex: 1 1 42px;
  }

  .routine-card__actions .routines-btn__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (max-width: 420px) {
  .container.routines-page-container {
    padding-right: 6px;
    padding-left: 6px;
  }

  .routines-builder-page .routines-shell--builder {
    padding-right: 8px;
    padding-left: 8px;
  }

  .routines-builder-panel {
    padding: 12px;
  }

  .routines-days {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .routines-inline-actions {
    width: 100%;
    justify-content: stretch;
  }

  .routines-inline-actions .routines-btn {
    flex: 1 1 0;
  }

  .routine-room-tab {
    flex: 1 1 calc(50% - 8px);
    justify-content: space-between;
  }

  .routine-card__action-group .routines-btn {
    flex: 1 1 42px;
  }
}
