:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f7f3;
  color: #1d2a2e;
  --admob-banner-height: 0px;
  --primary-gradient: linear-gradient(135deg, #0d3b35 0%, #126259 55%, #0f756b 100%);
  --primary-gradient-pressed: linear-gradient(135deg, #0a312c 0%, #104f48 58%, #0c625a 100%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(210, 232, 222, 0.6), rgba(247, 247, 243, 0) 320px),
    #f7f7f3;
}

body.has-admob-banner {
  padding-bottom: calc(var(--admob-banner-height) + env(safe-area-inset-bottom));
}

button,
input,
select,
textarea {
  font: inherit;
}

button:disabled {
  cursor: progress;
  opacity: 0.64;
}

#app {
  display: flex;
  flex-direction: column;
}

.shell {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0 48px;
}

.top-bar {
  position: sticky;
  top: env(safe-area-inset-top);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  margin: env(safe-area-inset-top) 0 10px;
  border-radius: 0 0 8px 8px;
  padding: 10px 12px;
  background: var(--primary-gradient);
  box-shadow: 0 8px 22px rgba(18, 59, 58, 0.18);
}

.top-bar strong {
  color: #ffffff;
  font-size: 17px;
}

.top-menu {
  position: relative;
}

.top-bar button,
.menu-panel button,
.menu-panel a {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: min(280px, calc(100vw - 32px));
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 8px;
  background:
    linear-gradient(145deg, #0d3b35 0%, #115b53 58%, #0f756b 100%);
  box-shadow: 0 18px 34px rgba(18, 35, 37, 0.26);
}

.menu-panel button,
.menu-panel a {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 0;
  background: transparent;
  text-decoration: none;
  text-align: left;
}

.menu-panel > :is(button, a) + :is(button, a) {
  margin-top: 4px;
}

.menu-separator {
  height: 1px;
  margin: 8px 6px;
  background: rgba(255, 255, 255, 0.22);
}

.menu-panel span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.language-submenu {
  margin-top: 4px;
  padding-left: 12px;
}

.language-submenu .language-option {
  width: 100%;
  display: grid;
  grid-template-columns: 24px minmax(0,1fr);
  gap: 10px;
  align-items: center;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 14px;
}

.language-submenu .language-option span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #fff;
}

.language-submenu .language-option[aria-selected="true"] span {
  font-weight: 900;
}

.status {
  min-height: 70vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 16px;
}

.status h1 {
  margin: 0;
  font-size: 28px;
}

.status button,
.dialog-actions button,
.apply-button {
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  background: var(--primary-gradient);
  color: #fff;
  cursor: pointer;
}

.status button:active,
.dialog-actions button:active,
.apply-button:active,
#device-plan-action:active,
.multi-active-plan-actions button:active,
.notification-actions button:last-child:active {
  background: var(--primary-gradient-pressed);
}

.header {
  padding: 18px 0 24px;
}

.screen-heading,
.account-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.legal-content {
  margin-top: 18px;
  border: 1px solid #d6ded8;
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.76);
  color: #354943;
  line-height: 1.65;
}

.legal-content p {
  margin: 0 0 16px;
}

.legal-content h2 {
  margin: 28px 0 8px;
  color: #1d2a2e;
  font-size: 20px;
  line-height: 1.3;
}

.legal-content h3 {
  margin: 20px 0 6px;
  color: #1d2a2e;
  font-size: 16px;
}

.legal-effective-date {
  color: #647772;
  font-weight: 800;
}

.legal-content ul {
  margin: 0 0 16px;
  padding-left: 24px;
}

.legal-content li + li {
  margin-top: 6px;
}

.legal-content a {
  color: #0f665d;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.legal-links {
  margin-bottom: 20px;
}

.screen-heading button,
.account-heading button,
.account-actions button,
.account-device button {
  min-height: 42px;
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  padding: 10px 14px;
  background: #ffffff;
  color: #1d2a2e;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.header .screen-heading button {
  display: none;
  flex: 0 0 auto;
}

#app.configuring-plan .screen-heading button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.price-subtitle {
  margin: 4px 0 0;
  color: #647772;
  font-size: 14px;
  font-weight: 700;
}

.price-picker {
  display: grid;
  grid-template-columns: 72px 82px minmax(0, 1fr) 82px 72px;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

.picker-value {
  min-height: 112px;
  border: 1px solid #d6ded8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  place-items: center;
  padding: 12px;
}

.picker-value strong {
  font-size: clamp(48px, 13vw, 82px);
  line-height: 0.95;
  color: #123b3a;
}

.picker-value span {
  margin-top: -6px;
  color: #647772;
  font-weight: 700;
}

.step-button {
  min-height: 84px;
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  background: #ffffff;
  color: #123b3a;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.step-button:active {
  transform: translateY(1px);
  background: #e7f1ed;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.summary div,
.known,
.active-plan,
.device-field select {
  border: 1px solid #d6ded8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.summary div {
  padding: 14px;
}

.empty-plan-hint {
  border: 1px solid #d6ded8;
  border-radius: 8px;
  padding: 16px;
  margin: 4px 0 12px;
  background: rgba(255, 255, 255, 0.72);
  color: #123b3a;
}

.empty-plan-hint strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
}

#app.no-active-plan:not(.configuring-plan) .header,
#app.no-active-plan:not(.configuring-plan) .summary {
  display: none;
}

.summary span,
.known span {
  display: block;
  color: #647772;
  font-size: 14px;
}

.summary strong,
.known strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid #cbd8d1;
  border-radius: 999px;
  background: #ffffff;
  color: #145c55;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.icon-button:disabled {
  cursor: progress;
}

.known {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "label refresh"
    "date refresh";
  column-gap: 12px;
  row-gap: 6px;
  align-items: center;
  padding: 16px;
  margin: 12px 0 18px;
}

.known > div,
.known-value-row {
  display: contents;
}

.known span {
  grid-area: label;
}

.known-value-row strong {
  grid-area: date;
  margin-top: 0;
}

.known-value-row .icon-button {
  grid-area: refresh;
  justify-self: end;
}

.known p {
  grid-area: status;
  margin: 2px 0 0;
  color: #145c55;
  font-weight: 700;
  text-align: left;
}

.active-plan {
  padding: 16px;
  margin: 12px 0 18px;
  cursor: pointer;
}

.active-plans-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 18px;
}

.active-plans-list .active-plan {
  margin: 0;
  cursor: pointer;
}

.active-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.active-heading button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: #e7ece8;
  color: #1d2a2e;
  cursor: pointer;
  touch-action: manipulation;
}

.active-plan-name {
  margin: 4px 0 0;
  color: #647772;
  font-size: 14px;
  font-weight: 800;
}

.active-plan-target {
  color: #647772;
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.active-summary-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #d6ded8;
}

.active-summary-line strong {
  min-width: 0;
  font-size: 22px;
  line-height: 1.15;
}

.active-summary-line > strong:last-child {
  justify-self: end;
  align-self: end;
  text-align: right;
}

.active-summary-state-block {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.active-summary-state-block span {
  color: #647772;
  font-size: 13px;
  font-weight: 700;
}

.active-summary-state-block strong {
  justify-self: start;
  text-align: left;
}

.active-plan-details {
  display: none;
}

.active-plan.expanded .active-plan-details {
  display: block;
}

.active-plan dl {
  margin: 14px 0 0;
  display: grid;
  gap: 10px;
}

.active-plan dl div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid #d6ded8;
  padding-top: 10px;
}

.active-plan dt {
  color: #647772;
}

.active-plan dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.multi-active-plan-details {
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.multi-active-plan-details dl {
  margin-top: 0;
}

.multi-active-plan .active-heading h1 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.multi-active-plan .active-heading button {
  flex: 0 0 auto;
}

.multi-active-plan .active-summary-line {
  margin-top: 10px;
  padding-top: 10px;
}

.multi-active-plan .active-periods-block {
  margin-top: 12px;
}

.multi-active-plan-actions {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.multi-active-plan-actions button {
  min-height: 50px;
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  background: var(--primary-gradient);
  color: #ffffff;
  font-weight: 800;
  touch-action: manipulation;
}

.multi-active-plan-actions .secondary-action {
  background: #ffffff;
  color: #1d2a2e;
}

.active-plan.expanded .active-closed-actions {
  display: none;
}

.active-plan p {
  margin: 14px 0 0;
  color: #647772;
  font-size: 14px;
}

.active-periods-block {
  margin-top: 16px;
  border-top: 1px solid #d6ded8;
  padding-top: 12px;
}

.active-periods-block h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.active-periods-block .periods {
  gap: 8px;
  margin-top: 0;
}

.active-periods-block .day-group {
  padding: 8px 0;
}

.active-periods-block .day-group:first-child {
  border-top: 0;
}

.active-periods-block .day-group li {
  font-size: 16px;
}

.completed-periods-block {
  margin-top: 16px;
  border-top: 1px solid #d6ded8;
  padding: 12px;
  border-radius: 8px;
  background: #f1f3f2;
}

.completed-periods-block details {
  color: #7a8783;
  font-size: 14px;
  font-style: italic;
}

.completed-periods-block summary {
  cursor: pointer;
}

.completed-periods-block .periods {
  gap: 8px;
  margin-top: 8px;
}

.completed-periods-block .day-group {
  padding: 8px 0;
}

.completed-periods-block .day-group h2,
.completed-periods-block .day-group li {
  color: inherit;
  font-size: inherit;
  font-style: inherit;
}

.completed-periods-block .interval-failed {
  color: #a14848;
}

.device-field {
  display: grid;
  gap: 8px;
  margin: 18px 0 8px;
  color: #647772;
  font-size: 14px;
  font-weight: 700;
}

.device-field h2 {
  margin: 0;
  color: #1d2a2e;
  font-size: 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.notification-prompt,
.notification-toggle-row {
  border: 1px solid #d6ded8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.notification-prompt {
  display: grid;
  gap: 12px;
  padding: 12px;
  color: #1d2a2e;
}

.notification-prompt p {
  margin: 4px 0 0;
  color: #647772;
  font-weight: 500;
  line-height: 1.35;
}

.notification-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.notification-actions button {
  min-height: 44px;
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  background: #ffffff;
  color: #1d2a2e;
  cursor: pointer;
}

.notification-actions button:last-child {
  border: 0;
  background: var(--primary-gradient);
  color: #ffffff;
}

.notification-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  color: #1d2a2e;
}

.push-message {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  border: 1px solid #b7d2cf;
  border-radius: 8px;
  padding: 12px;
  background: #e7f4f1;
  color: #123b3a;
}

.push-message strong {
  display: block;
  font-size: 16px;
}

.push-message p {
  margin: 4px 0 0;
  color: #315250;
  line-height: 1.35;
}

.push-message .push-message-context {
  font-weight: 600;
}

.push-message .push-message-time {
  display: block;
  margin-top: 2px;
  color: #526f6d;
  font-size: 14px;
}

.push-message button {
  width: 34px;
  height: 34px;
  border: 1px solid #b7d2cf;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  color: #123b3a;
  font-size: 22px;
  line-height: 1;
}

.device-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.device-row select {
  display: none;
}

.device-options {
  display: grid;
  gap: 8px;
}

.device-option {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 48px;
  border: 1px solid #d6ded8;
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: #1d2a2e;
  font-weight: 800;
}

.device-option input {
  width: 20px;
  height: 20px;
  accent-color: #00776f;
}

.device-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.connection-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  color: #1d2a2e;
}

.connection-row span {
  min-width: 0;
}

.connection-row button {
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: #1d2a2e;
  cursor: pointer;
}

.device-field select {
  width: 100%;
  padding: 13px 14px;
  color: #1d2a2e;
  outline: none;
}

.device-row button {
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  padding: 0 14px;
  background: #ffffff;
  color: #1d2a2e;
  cursor: pointer;
}

#device-plan-action {
  min-height: 48px;
  background: var(--primary-gradient);
  color: #ffffff;
  border: 0;
  font-weight: 800;
}

.account-screen,
.notifications-screen,
.setup-screen,
.privacy-screen,
.legal-screen {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  padding-top: 4px;
  /* Keep section headings below the iOS sticky header after scrollIntoView(). */
  scroll-margin-top: calc(96px + env(safe-area-inset-top));
}

.account-screen.login-only {
  min-height: calc(100vh - 96px);
  align-content: start;
}

.account-screen.login-only .account-heading {
  margin-top: 12px;
}

.account-card {
  border: 1px solid #d6ded8;
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.setup-card {
  display: grid;
  gap: 12px;
  border: 1px solid #d6ded8;
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.setup-card h1 {
  margin: 0;
  color: #1d2a2e;
  font-size: 24px;
}

.setup-card p {
  margin: 0;
  color: #647772;
  line-height: 1.4;
}

.screen-note {
  margin: 0;
  color: #647772;
  line-height: 1.4;
}

.setup-actions {
  display: grid;
  gap: 10px;
}

.setup-actions button {
  min-height: 48px;
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  padding: 12px 14px;
  background: #ffffff;
  color: #1d2a2e;
  font-weight: 800;
  cursor: pointer;
}

.setup-actions button:not(.secondary-action) {
  border: 0;
  background: var(--primary-gradient);
  color: #ffffff;
}

.setup-actions button:active {
  transform: translateY(1px);
}

.notification-types {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.notification-type-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 48px;
  padding: 10px;
  border: 1px solid #d6ded8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  color: #1d2a2e;
}

.notification-type-row input {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: #145c55;
}

.notification-type-row span {
  display: grid;
  gap: 2px;
}

.notification-type-row strong {
  font-size: 16px;
}

.notification-type-row small {
  color: #647772;
  font-size: 13px;
  line-height: 1.3;
}

.notification-select-all {
  align-items: center;
  font-weight: 800;
}

.notification-onboarding-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.notification-onboarding-actions button {
  min-height: 48px;
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  padding: 12px 14px;
  background: #ffffff;
  color: #1d2a2e;
  font-weight: 800;
  cursor: pointer;
}

.notification-onboarding-actions button:last-child {
  border: 0;
  background: var(--primary-gradient);
  color: #ffffff;
}

.account-card span,
.account-card p {
  color: #647772;
}

.account-card > span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

.account-card strong {
  overflow-wrap: anywhere;
}

.account-card h2 {
  margin: 0;
  font-size: 20px;
}

.account-card p {
  margin: 0 0 12px;
  line-height: 1.35;
}

.auth-panel {
  display: grid;
  gap: 10px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-panel label {
  display: grid;
  gap: 6px;
  color: #647772;
  font-size: 13px;
  font-weight: 700;
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid #cbd8d1;
  border-radius: 10px;
  background: #f2f6f3;
}

.auth-mode-tab {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  padding: 8px;
  background: transparent;
  color: #647772;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.auth-mode-tab[aria-selected="true"] {
  background: #ffffff;
  color: #145c55;
  box-shadow: 0 1px 3px rgba(29, 42, 46, 0.14);
}

.auth-panel input,
.token-field input {
  width: 100%;
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  color: #1d2a2e;
  font: inherit;
}

/* iOS enlarges the whole WebView when a form field is smaller than 16px. */
@supports (-webkit-touch-callout: none) {
  .auth-panel input,
  .token-field input {
    font-size: 16px;
  }
}

.password-input {
  position: relative;
  display: block;
}

.password-input input {
  padding-right: 48px;
}

.password-visibility {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: transparent;
  color: #145c55;
  cursor: pointer;
}

.password-visibility svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.password-visibility .password-eye-off,
.password-visibility[aria-pressed="true"] .password-eye {
  display: none;
}

.password-visibility[aria-pressed="true"] .password-eye-off {
  display: block;
}

.auth-panel .account-note {
  margin: 0;
}

.link-action {
  justify-self: start;
  border: 0;
  padding: 0;
  background: transparent;
  color: #145c55;
  font-weight: 800;
}

.auth-mode-switch {
  justify-self: start;
  border: 0;
  padding: 2px 0;
  background: transparent;
  color: #647772;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.danger-action {
  color: #8f1d1d;
}

.account-connection {
  display: grid;
  gap: 8px;
}

.account-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 4px;
}

.account-actions button:first-child {
  border: 0;
  background: var(--primary-gradient);
  color: #ffffff;
}

.account-management {
  display: grid;
  gap: 10px;
  margin-top: 28px;
  border-top: 1px solid #d6ded8;
  padding: 24px 2px 0;
}

.account-management h2 {
  margin: 0;
  color: #647772;
  font-size: 16px;
}

.account-management-actions {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.account-management-actions button {
  min-height: 44px;
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  padding: 10px 14px;
  background: #ffffff;
  color: #354943;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.account-management-actions .danger-action {
  width: 100%;
  border-color: #c97b7b;
  background: #fff7f7;
  color: #8f1d1d;
}

.country-setting-row {
  display: grid;
  gap: 8px;
}

.inline-selection-trigger {
  position: relative;
  width: 100%;
  border: 1px solid #d7ddd8;
  border-radius: 8px;
  background: #ffffff;
  color: #162021;
  font: inherit;
  padding: 12px 42px 12px 12px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.inline-selection-trigger::after {
  content: "▾";
  position: absolute;
  right: 14px;
  top: 50%;
  color: #145c55;
  font-size: 18px;
  transform: translateY(-50%);
}

.inline-selection-trigger[aria-expanded="true"]::after {
  content: "▴";
}

.inline-selection-options {
  display: grid;
  width: 100%;
  border: 1px solid #d7ddd8;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  background: #ffffff;
}

.inline-selection-options button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-top: 1px solid #e4e9e5;
  padding: 12px 14px 12px 40px;
  background: #ffffff;
  color: #162021;
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.inline-selection-options button:first-child {
  border-top: 0;
}

.inline-selection-options button[aria-selected="true"] {
  position: relative;
  font-weight: 800;
}

.inline-selection-options button[aria-selected="true"]::before {
  content: "✓";
  position: absolute;
  left: 14px;
  color: #0f756b;
  font-weight: 900;
}

.inline-selection-options button:focus-visible,
.inline-selection-trigger:focus-visible {
  outline: 3px solid rgba(15, 117, 107, 0.28);
  outline-offset: -2px;
}

.country-options {
  display: grid;
  gap: 10px;
}

.country-options button {
  width: 100%;
  min-height: 56px;
  padding: 16px;
  font-size: 18px;
  font-weight: 800;
}

.account-card-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
}

.account-card-heading button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--primary-gradient);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.account-devices {
  display: grid;
  gap: 8px;
}

.account-device {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #d6ded8;
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
}

.account-device div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.account-device span {
  font-size: 13px;
  font-weight: 700;
}

.account-device-disabled {
  opacity: 0.68;
}

.add-device-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.plan-name-field {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  color: #647772;
  font-size: 14px;
  font-weight: 700;
}

.plan-name-field input {
  width: 100%;
  border: 1px solid #d6ded8;
  border-radius: 8px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.72);
  color: #1d2a2e;
  outline: none;
}

.saved-plans {
  margin: 16px 0 8px;
}

.saved-plans h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

#saved-plans-list {
  display: grid;
  gap: 8px;
}

.saved-plan-card {
  border: 1px solid #d6ded8;
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.saved-plan-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.saved-plan-title strong,
.saved-plan-title span {
  min-width: 0;
}

.saved-plan-title span {
  color: #647772;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.saved-plan-card p {
  margin: 6px 0 10px;
  color: #647772;
  font-size: 14px;
}

.saved-plan-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.saved-plan-actions button {
  min-height: 44px;
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  background: #ffffff;
  color: #1d2a2e;
  font-weight: 800;
}

.periods-block {
  margin-top: 24px;
}

.select-all-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 10px;
  color: #1d2a2e;
  font-weight: 800;
}

.select-all-row input {
  width: 22px;
  height: 22px;
  accent-color: #145c55;
}

.periods {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.day-group {
  padding: 14px 0;
  border-top: 1px solid #d6ded8;
}

.day-group h2 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin: 0 0 8px;
  font-size: 17px;
}

.day-group h2 small {
  color: #647772;
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.day-group ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.day-group li {
  font-size: 18px;
}

.selectable-day-group ul {
  gap: 8px;
}

.selectable-interval {
  font-size: 16px;
}

.selectable-interval label {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid #d6ded8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
}

.selectable-interval input {
  width: 22px;
  height: 22px;
  accent-color: #145c55;
}

.selectable-interval span {
  min-width: 0;
  font-weight: 700;
}

.selectable-interval strong {
  color: #145c55;
  font-size: 15px;
  text-align: right;
  white-space: nowrap;
}

.empty {
  color: #647772;
}

.plan-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 28px;
}

.plan-name-field,
.periods-block,
.plan-actions {
  display: none;
}

#app.configuring-plan .plan-name-field,
#app.configuring-plan .periods-block,
#app.configuring-plan .plan-actions {
  display: grid;
}

#app.configuring-plan .plan-actions {
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#app.configuring-plan {
  padding-top: 6px;
  scroll-margin-top: calc(96px + env(safe-area-inset-top));
}

#app.configuring-plan .header {
  padding: 0 0 12px;
}

#app.configuring-plan .price-subtitle {
  display: none;
}

#app.configuring-plan .price-picker {
  margin-top: 0;
}

.apply-button,
.secondary-action {
  width: 100%;
  font-weight: 800;
}

.plan-actions .apply-button,
.plan-actions .secondary-action {
  margin: 0;
  touch-action: manipulation;
}

.secondary-action {
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: #1d2a2e;
  cursor: pointer;
}

.plan-actions .apply-button,
.plan-actions .secondary-action {
  box-sizing: border-box;
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1.15;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
}

.plan-actions .apply-button {
  word-break: keep-all;
}

#app.has-active-plan:not(.editing-plan) .header,
#app.has-active-plan:not(.editing-plan) .summary {
  display: none;
}

#app.active-plan-expanded.has-active-plan:not(.editing-plan) .known,
#app.active-plan-expanded.has-active-plan:not(.editing-plan) .notification-prompt,
#app.active-plan-expanded.has-active-plan:not(.editing-plan) .notification-toggle-row,
#app.active-plan-expanded.has-active-plan:not(.editing-plan) .device-field {
  display: none;
}

#app.has-active-plan:not(.editing-plan) .active-plan {
  order: -10;
  margin: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

#app.has-active-plan:not(.editing-plan) .active-plans-list {
  order: -10;
}

#app.has-active-plan:not(.editing-plan) .plan-actions {
  order: -6;
  position: relative;
  z-index: 2;
  margin-top: -1px;
  padding: 0 16px 16px;
  border: 1px solid #d6ded8;
  border-top: 0;
  border-bottom-right-radius: 8px;
  border-bottom-left-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

#app.has-active-plan:not(.editing-plan) .apply-button {
  min-height: 58px;
  font-size: 18px;
}

#app.has-active-plan.editing-plan .active-plan {
  display: none;
}

#app.configuring-plan .known,
#app.configuring-plan .notification-prompt,
#app.configuring-plan .notification-toggle-row,
#app.configuring-plan .device-field,
#app.configuring-plan .saved-plans,
#app.configuring-plan .active-plans-list {
  display: none;
}

#app.configuring-plan .plan-name-field {
  margin-top: 4px;
}

.dialog {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: min(520px, calc(100% - 32px));
  max-height: min(calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), 680px);
  overflow: hidden;
  margin: auto;
  border: 0;
  border-radius: 8px;
  padding: 24px;
  color: #1d2a2e;
}

.dialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog::backdrop {
  background: rgba(18, 35, 37, 0.42);
}

.dialog h1 {
  margin-bottom: 16px;
}

.dialog p {
  margin: 8px 0;
}

.dialog-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dialog-warning {
  margin: 0 0 12px;
  border: 1px solid #d7c66b;
  border-radius: 8px;
  padding: 12px;
  background: #fff8cf;
  color: #3b3420;
  font-weight: 750;
  line-height: 1.35;
}

.token-field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: #647772;
  font-size: 14px;
  font-weight: 700;
}

.token-field textarea {
  width: 100%;
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  padding: 12px;
  color: #1d2a2e;
  resize: vertical;
}

.dialog-periods {
  max-height: 260px;
  overflow: auto;
  margin-top: 16px;
}

.dialog-status {
  border: 1px solid #d6ded8;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f7f7f3;
  color: #1d2a2e;
  font-weight: 750;
  line-height: 1.35;
}

.dialog-status.error {
  border-color: #d9a0a0;
  background: #fff1f1;
  color: #8f1d1d;
}

.dialog-actions {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.device-state-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.device-state-actions .cancel-action {
  grid-column: 1 / -1;
  width: 100%;
}

.dialog-actions button.primary-action {
  border: 0;
  background: var(--primary-gradient);
  color: #ffffff;
}

.dialog-actions button.secondary-action {
  border: 1px solid #cbd8d1;
  background: #e7ece8;
  color: #1d2a2e;
}

.dialog-actions button.secondary-action:active {
  background: #dbe3dd;
}

.dialog-actions button.cancel-action {
  border: 1px solid #cbd8d1;
  background: #ffffff;
  color: #1d2a2e;
}

.dialog-actions button.cancel-action:active {
  background: #f1f4f2;
}

.dialog-actions button.destructive-action {
  border: 0;
  background: #8f1d1d;
  color: #ffffff;
}

.dialog-actions button.destructive-action:active {
  background: #741717;
}

.dialog-actions button:only-child {
  min-width: 132px;
  margin-inline: auto;
  justify-self: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--admob-banner-height) + 132px + env(safe-area-inset-bottom));
  z-index: 50;
  transform: translateX(-50%);
  border-radius: 8px;
  padding: 12px 16px;
  background: #123b3a;
  color: white;
  box-shadow: 0 12px 32px rgba(18, 35, 37, 0.24);
}

.toast.near-known {
  top: var(--toast-top, 160px);
  bottom: auto;
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 16px, 720px);
    padding: 10px 0 28px;
  }

  .header {
    padding: 8px 0 12px;
  }

  .price-subtitle {
    font-size: 13px;
  }

  h1 {
    font-size: 22px;
  }

  #app.has-active-plan:not(.editing-plan) .header {
    padding-top: 4px;
  }

  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0;
  }

  .summary div {
    min-height: 82px;
    padding: 10px 12px;
  }

  .summary div:first-child {
    grid-column: 1 / -1;
  }

  .summary span,
  .known span {
    font-size: 13px;
  }

  .summary strong,
  .known strong {
    margin-top: 6px;
    font-size: 20px;
  }

  .price-picker {
    grid-template-columns: 46px 58px minmax(86px, 1fr) 58px 46px;
    gap: 6px;
    margin-top: 12px;
  }

  #app.configuring-plan .price-picker {
    margin-top: 0;
  }

  .picker-value {
    grid-column: auto;
    grid-row: auto;
    min-height: 54px;
    padding: 6px 4px;
  }

  .picker-value strong {
    font-size: 34px;
  }

  .picker-value span {
    margin-top: -2px;
    font-size: 11px;
  }

  .step-button {
    min-height: 54px;
    padding: 0 4px;
  }

  .known {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    margin: 10px 0 16px;
  }

  .known p {
    text-align: left;
  }

  .active-plan dl div {
    display: grid;
    gap: 4px;
  }

  .active-plan dd {
    text-align: left;
  }

  .active-summary-line strong {
    font-size: 20px;
  }

  .active-periods-block h2 {
    font-size: 16px;
  }

  .active-periods-block .day-group li {
    font-size: 15px;
  }

  .device-row {
    grid-template-columns: 1fr;
  }

  .connection-row {
    grid-template-columns: 1fr;
  }

  .device-row button,
  .connection-row button {
    min-height: 44px;
  }

  .periods-block {
    margin-top: 18px;
  }

  .apply-button {
    margin-top: 20px;
  }

  .dialog {
    width: min(100% - 16px, 520px);
    padding: 20px 14px 14px;
  }

  .dialog h1 {
    font-size: 24px;
    margin-bottom: 12px;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 16px;
  }

  .device-state-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dialog-actions button {
    min-width: 0;
    min-height: 54px;
    padding: 10px 8px;
    line-height: 1.15;
  }

  .dialog-actions button:only-child {
    grid-column: 1 / -1;
    justify-self: center;
    width: min(160px, 70%);
  }

}
