:root {
  --pwa-olive: #6f7757;
  --pwa-olive-dark: #4f583f;
  --pwa-ivory: #f7f4ec;
  --pwa-text: #1d1d1f;
  --pwa-muted: #6e6e73;
}

html, body {
  overscroll-behavior-y: none;
}

body {
  padding-top: env(safe-area-inset-top, 0px);
}

.app-shell {
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px));
}

.title {
  position: relative;
  padding-right: 82px;
}

.pwa-status-pill {
  position: absolute;
  z-index: 20;
  top: 2px;
  right: 0;
  bottom: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 6px 9px;
  border: 1px solid rgba(45,62,36,.13);
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  color: #2d3e24;
  box-shadow: 0 3px 12px rgba(0,0,0,.055);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  font: 650 11.5px/1 var(--font-en, system-ui, sans-serif);
  white-space: nowrap;
}

.pwa-status-pill.offline {
  color: #a02c2c;
  border-color: rgba(160,44,44,.16);
}

.pwa-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4f7a3c;
  box-shadow: 0 0 0 4px rgba(79,122,60,.08);
}

.pwa-status-pill.offline .pwa-status-dot {
  background: #d04444;
  box-shadow: 0 0 0 4px rgba(208,68,68,.08);
}

.pwa-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(20,20,20,.32);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.pwa-modal-backdrop.show { display: flex; }

.pwa-modal {
  width: min(100%, 560px);
  max-height: min(82vh, 720px);
  overflow: auto;
  border: 1px solid rgba(0,0,0,.065);
  border-radius: 24px;
  background: rgba(255,255,255,.985);
  box-shadow: 0 30px 90px rgba(0,0,0,.20);
  padding: 22px;
}

.pwa-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.pwa-modal-head h3 {
  margin: 3px 0 0;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: -.025em;
}

.pwa-kicker {
  color: var(--pwa-olive);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
}

.pwa-close {
  border: 1px solid #dedee2;
  border-radius: 12px;
  background: #fff;
  color: var(--pwa-text);
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 600;
}

.pwa-copy {
  color: #434348;
  font-size: 16px;
  line-height: 1.55;
  margin-bottom: 16px;
}

.pwa-field {
  display: block;
  margin-top: 14px;
}

.pwa-field > span {
  display: block;
  margin-bottom: 7px;
  color: #36363b;
  font-size: 14px;
  font-weight: 650;
}

.pwa-field input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid #d8d8dd;
  border-radius: 14px;
  background: #fff;
  color: #1d1d1f;
  outline: none;
}

.pwa-field input:focus {
  border-color: rgba(45,62,36,.55);
  box-shadow: 0 0 0 4px rgba(45,62,36,.08);
}

.pwa-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 18px;
}

.pwa-result {
  min-height: 20px;
  margin-top: 12px;
  color: var(--pwa-muted);
  font-size: 14px;
  line-height: 1.45;
}

.pwa-result.ok { color: #48623c; }
.pwa-result.error { color: #a02c2c; }

.pwa-note,
.pwa-draft-meta {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--pwa-ivory);
  color: #6a675f;
  font-size: 13px;
  line-height: 1.5;
}

.pwa-install-steps {
  display: grid;
  gap: 12px;
}

.pwa-install-steps > div {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border-radius: 14px;
  background: #f7f7f8;
}

.pwa-install-steps strong {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #2d3e24;
  color: #fff;
  font-size: 13px;
}

.pwa-install-steps span {
  padding-top: 4px;
  font-size: 15px;
  line-height: 1.45;
}

.pwa-mini-toast {
  position: fixed;
  z-index: 13000;
  left: 50%;
  bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 12px);
  width: min(calc(100% - 30px), 560px);
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(27,27,29,.94);
  color: #fff;
  box-shadow: 0 16px 50px rgba(0,0,0,.20);
  opacity: 0;
  pointer-events: none;
  transition: .22s ease;
  text-align: center;
  font-size: 14px;
}

.pwa-mini-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 720px) {
  .top-actions .pwa-only-control {
    flex: 1 1 auto;
  }
  .pwa-modal {
    padding: 18px;
    border-radius: 21px;
  }
  .pwa-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .pwa-actions .btn { width: 100%; }
}

@media (display-mode: standalone) {
  .pwa-status-pill {
    top: 2px;
    bottom: auto;
  }
}
