/* UThere PWA — mobile-first styles */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --blue: #007AFF;
  --blue-dark: #0056b3;
  --indigo: #5856D6;
  --green: #34C759;
  --red: #FF3B30;
  --orange: #FF9500;
  --gray: #8E8E93;
  --gray-light: #F2F2F7;
  --text: #1C1C1E;
  --text-secondary: #6C6C70;
  --border: #C6C6C8;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
  --gradient: linear-gradient(135deg, var(--blue) 0%, var(--indigo) 100%);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--gray-light);
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Layout ── */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }

.btn-success { background: var(--green); color: #fff; }
.btn-danger  { background: var(--red);   color: #fff; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--blue);
  color: var(--blue);
}

.btn-ghost {
  background: var(--gray-light);
  color: var(--text);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 14px;
  width: auto;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="time"],
select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus {
  border-color: var(--blue);
}

.error-msg {
  color: var(--red);
  font-size: 14px;
  margin-top: 8px;
}

.success-msg {
  color: var(--green);
  font-size: 14px;
  margin-top: 8px;
}

/* ── Nav ── */
.nav {
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  color: var(--gray);
  font-size: 11px;
  cursor: pointer;
  border: none;
  background: none;
  text-decoration: none;
}

.nav-item.active { color: var(--blue); }

.nav-icon { font-size: 22px; }

/* ── Ward list ── */
.ward-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-light);
  cursor: pointer;
}
.ward-item:last-child { border-bottom: none; }

.ward-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ward-info { flex: 1; }
.ward-name  { font-weight: 600; font-size: 16px; }
.ward-status { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-ok       { background: var(--green); }
.status-pending  { background: #FF9500; }
.status-alert    { background: var(--red); }
.status-inactive { background: var(--gray); }

/* ── Check-in history ── */
.checkin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-light);
  font-size: 14px;
}
.checkin-item:last-child { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-ok        { background: #d1fae5; color: #065f46; }
.badge-sent      { background: #fef3c7; color: #92400e; }
.badge-no_response { background: #fee2e2; color: #991b1b; }
.badge-alerted   { background: #fee2e2; color: #991b1b; }
.badge-pending   { background: var(--gray-light); color: var(--gray); }

/* ── Ward home (подопечный) ── */
.checkin-big {
  text-align: center;
  padding: 40px 20px;
}
.checkin-big .icon { font-size: 80px; margin-bottom: 20px; }
.checkin-big h2  { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.checkin-big p   { color: var(--text-secondary); margin-bottom: 32px; }

/* ── Logo / branding ── */
.logo {
  text-align: center;
  margin-bottom: 32px;
}
.logo-icon { font-size: 56px; }
.logo-name {
  font-size: 32px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: -1px;
}
.logo-tagline { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* ── Divider link ── */
.link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}
.link:hover { text-decoration: underline; }

.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }

/* ── Days picker ── */
.days-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.day-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
}
.day-btn.selected {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* ── Loading ── */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-light);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

/* ── Share link ── */
.share-code {
  font-family: monospace;
  font-size: 16px;
  background: var(--gray-light);
  padding: 14px;
  border-radius: var(--radius);
  word-break: break-all;
  margin: 12px 0;
}

/* ── Landing page ── */

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: var(--text);
}

/* Header */
.lp-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0,0,0,0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}

.lp-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
  text-decoration: none;
}

.lp-logo-icon {
  font-size: 26px;
  -webkit-text-fill-color: initial;
}

.lp-nav { display: flex; gap: 10px; align-items: center; }
.lp-nav .btn { padding: 9px 18px; font-size: 15px; width: auto; }

/* Hero */
.lp-hero {
  padding: 72px 20px 64px;
  text-align: center;
  background: linear-gradient(160deg, #eef3ff 0%, #f5efff 40%, #fafbff 80%, #fff 100%);
  position: relative;
  overflow: hidden;
}

.lp-hero::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,122,255,0.1) 0%, transparent 65%);
  top: -200px; right: -100px;
  pointer-events: none;
}

.lp-hero::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(88,86,214,0.08) 0%, transparent 65%);
  bottom: 0; left: -80px;
  pointer-events: none;
}

.lp-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,122,255,0.08);
  border: 1px solid rgba(0,122,255,0.15);
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 24px;
  letter-spacing: 0.2px;
}

.lp-hero h1 {
  font-size: clamp(32px, 7vw, 56px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
  color: #0a0a0a;
}

.lp-hero h1 span {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lp-hero p {
  font-size: clamp(16px, 2.5vw, 19px);
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 36px;
  line-height: 1.65;
}

.lp-hero-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 40px;
}

.lp-hero-btns .btn { width: auto; padding: 15px 30px; font-size: 16px; }
.lp-hero-btns .btn-primary { background: var(--gradient); box-shadow: 0 4px 20px rgba(0,122,255,0.3); }

/* Stats strip */
.lp-stats {
  display: flex;
  justify-content: center;
  max-width: 580px;
  margin: 0 auto 52px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.06);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.lp-stat {
  flex: 1;
  padding: 16px 10px;
  text-align: center;
  border-right: 1px solid #f0f0f0;
}
.lp-stat:last-child { border-right: none; }

.lp-stat-value {
  font-size: 17px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.lp-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.3;
}

/* Phone mockup */
.lp-illustration {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.lp-phone {
  width: 220px;
  background: linear-gradient(160deg, #1e1e2e, #12121e);
  border-radius: 36px;
  padding: 20px 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.08);
  position: relative;
}

.lp-phone-notch {
  width: 60px; height: 8px;
  background: #2a2a3e;
  border-radius: 4px;
  margin: 0 auto 16px;
}

.lp-phone-screen {
  background: #f8f9fa;
  border-radius: 22px;
  padding: 16px 14px;
  min-height: 220px;
}

.lp-notification {
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  animation: lp-slide-in 0.5s ease;
}

.lp-notification-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.lp-notification-text { font-size: 12px; color: #333; line-height: 1.4; }
.lp-notification-title { font-weight: 700; font-size: 12px; margin-bottom: 2px; }

.lp-ok-btn {
  display: block;
  background: linear-gradient(135deg, #34C759, #30b350);
  color: #fff;
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  margin-top: 10px;
  box-shadow: 0 3px 10px rgba(52,199,89,0.35);
}

.lp-phone-label {
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin-top: 10px;
  font-weight: 500;
}

.lp-arrow {
  font-size: 28px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0.7;
}

@keyframes lp-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Sections */
.lp-section {
  padding: 64px 20px;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
}

.lp-section-label {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.lp-section h2 {
  text-align: center;
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 900;
  letter-spacing: -0.8px;
  margin-bottom: 44px;
  color: #0a0a0a;
}

/* Role cards */
.lp-roles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 600px) {
  .lp-roles { grid-template-columns: 1fr; }
  .lp-arrow { display: none; }
  .lp-stats { flex-wrap: wrap; }
  .lp-stat { min-width: 50%; }
}

.lp-role-card {
  border-radius: 24px;
  padding: 32px 26px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.lp-role-card.caregiver {
  background: linear-gradient(145deg, #eef3ff 0%, #e0e8ff 100%);
  border: 1.5px solid rgba(0,122,255,0.15);
}

.lp-role-card.ward {
  background: linear-gradient(145deg, #edfff4 0%, #d1fae5 100%);
  border: 1.5px solid rgba(52,199,89,0.2);
}

.lp-role-icon { font-size: 44px; margin-bottom: 14px; }

.lp-role-title {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.lp-role-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 22px;
  line-height: 1.6;
}

.lp-steps { list-style: none; display: flex; flex-direction: column; gap: 12px; }

.lp-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.lp-step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background: var(--gradient);
  color: #fff;
}

.lp-role-card.ward .lp-step-num {
  background: linear-gradient(135deg, #34C759, #059669);
}

.lp-role-cta { margin-top: 24px; }
.lp-role-cta .btn { width: 100%; }
.lp-role-card.caregiver .lp-role-cta .btn-primary { background: var(--gradient); }

/* Features */
.lp-features-bg {
  background: #f7f8fc;
  width: 100%;
}

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

.lp-feature {
  background: #fff;
  border-radius: 20px;
  padding: 26px 22px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.04);
  transition: transform 0.2s, box-shadow 0.2s;
}

.lp-feature:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.lp-feature-icon-wrap {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 14px;
}

.lp-feature-title { font-weight: 700; font-size: 15px; margin-bottom: 7px; color: #0a0a0a; }
.lp-feature-desc  { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }

/* CTA */
.lp-cta {
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  padding: 80px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.lp-cta::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 65%);
  top: -150px; right: -80px;
  pointer-events: none;
}

.lp-cta::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 65%);
  bottom: -80px; left: -60px;
  pointer-events: none;
}

/* Footer */
.lp-footer {
  background: #09090b;
  color: #71717a;
  text-align: center;
  padding: 32px 20px;
  font-size: 13px;
  margin-top: auto;
}

.lp-footer a { color: #a1a1aa; text-decoration: none; }
.lp-footer a:hover { color: #fff; }
.lp-footer-logo { color: #fff; font-weight: 800; font-size: 18px; margin-bottom: 8px; letter-spacing: -0.3px; }

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1C1C1E;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
  z-index: 1000;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
