/* RESET & BASE STYLES */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  background-color: #f4f1ea;
  color: #1a1a1a;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.app-viewport {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* MASTHEAD */
.app-masthead {
  width: 100%;
  background: #1a365d;
  color: #ffffff;
  padding: 14px 18px;
  border-radius: 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(26, 54, 93, 0.2);
}

.flag-banner {
  display: flex;
  height: 4px;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.flag-stripe { flex: 1; }
.flag-stripe.green { background: #006a4e; }
.flag-stripe.yellow { background: #ffce00; }
.flag-stripe.red { background: #d21034; }

.masthead-content h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

.masthead-content p {
  font-size: 0.72rem;
  color: #cbd5e1;
  margin-top: 2px;
}

.export-badge {
  margin-top: 8px;
  background: #d4af37;
  color: #1a365d;
  border: none;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  letter-spacing: 0.5px;
}

/* SMARTPHONE SHELL FRAME */
.smartphone-frame {
  width: 100%;
  background: #ffffff;
  border: 10px solid #1a1a1a;
  border-radius: 40px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 720px;
}

.smartphone-notch {
  width: 140px;
  height: 18px;
  background: #1a1a1a;
  margin: 0 auto;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.speaker { width: 40px; height: 4px; background: #333; border-radius: 2px; }
.camera { width: 8px; height: 8px; background: #222; border-radius: 50%; }

/* STATUS BAR */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1a365d;
  background: #f8fafc;
}

/* MOBILE HEADER */
.mobile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.user-info { display: flex; align-items: center; gap: 10px; }
.avatar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid #1a365d; }
.user-info h2 { font-size: 0.85rem; font-weight: 700; color: #1a365d; }
.badge-amu { font-size: 0.68rem; color: #059669; font-weight: 600; }

.qr-btn {
  background: #1a365d;
  color: #ffffff;
  border: none;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

/* SCREEN TABS */
.screen-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: #ffffff;
  color: #1a365d;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* MAIN CANVAS & SCREENS */
.mobile-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
}

.app-screen { display: none; }
.app-screen.active { display: block; animation: fadeIn 0.25s ease-out; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* CARDS & UI COMPONENTS */
.amu-card {
  background: linear-gradient(135deg, #1a365d 0%, #0d9488 100%);
  color: #ffffff;
  padding: 16px;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(26, 54, 93, 0.2);
  margin-bottom: 16px;
}

.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.amu-logo { font-weight: 800; font-size: 0.85rem; letter-spacing: 1px; color: #fde047; }
.status-pill.green { background: rgba(16, 185, 129, 0.2); color: #34d399; font-size: 0.65rem; font-weight: 700; padding: 2px 8px; border-radius: 12px; }

.card-number { font-family: monospace; font-size: 0.95rem; font-weight: 700; margin-bottom: 12px; letter-spacing: 1px; }

.card-details { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 0.68rem; }
.card-details label { color: #cbd5e1; font-weight: 600; display: block; }
.card-details p { font-weight: 700; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.grid-card {
  background: #ffffff;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.grid-card:hover { transform: translateY(-2px); border-color: #1a365d; }
.card-icon { font-size: 1.2rem; margin-bottom: 4px; }
.grid-card h3 { font-size: 0.78rem; font-weight: 700; color: #1a365d; }
.grid-card p { font-size: 0.65rem; color: #64748b; margin-top: 2px; }

.recent-activity h3, .section-title h2 { font-size: 0.9rem; font-weight: 800; color: #1a365d; margin-bottom: 8px; }
.section-title p { font-size: 0.72rem; color: #64748b; margin-bottom: 12px; }

.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 8px;
}
.act-icon { font-size: 1.1rem; }
.activity-item h4 { font-size: 0.75rem; font-weight: 700; color: #1e293b; }
.activity-item p { font-size: 0.65rem; color: #64748b; }
.act-amount { font-size: 0.72rem; font-weight: 800; color: #059669; margin-left: auto; }

/* VITAL BANNER */
.vitals-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.vital-item {
  background: #ffffff;
  padding: 8px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid #e2e8f0;
}
.vital-item span { font-size: 0.62rem; color: #64748b; display: block; }
.vital-item strong { font-size: 0.75rem; color: #1a365d; font-weight: 800; }

.record-card {
  background: #ffffff;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-bottom: 10px;
}
.record-head { display: flex; justify-content: space-between; font-size: 0.68rem; margin-bottom: 6px; }
.date { font-weight: 700; color: #64748b; }
.tag.green { color: #059669; background: #ecfdf5; padding: 2px 6px; border-radius: 4px; font-weight: 700; }
.tag.blue { color: #2563eb; background: #eff6ff; padding: 2px 6px; border-radius: 4px; font-weight: 700; }
.record-card h3 { font-size: 0.82rem; font-weight: 800; color: #1a365d; margin-bottom: 4px; }
.record-card p { font-size: 0.72rem; color: #334155; }
.record-card .notes { margin-top: 6px; font-style: italic; color: #475569; background: #f1f5f9; padding: 6px; border-radius: 6px; }

/* PRESTA & CALCULATOR */
.presta-hero { background: #1a365d; color: #ffffff; padding: 14px; border-radius: 12px; margin-bottom: 12px; }
.presta-hero h2 { font-size: 0.95rem; font-weight: 800; }
.presta-hero p { font-size: 0.7rem; color: #cbd5e1; }

.calculator-box { background: #ffffff; padding: 14px; border-radius: 12px; border: 1px solid #e2e8f0; }
.calculator-box label { font-size: 0.72rem; font-weight: 700; color: #1a365d; display: block; margin-bottom: 6px; }
.calculator-box input, .doctor-form input, .doctor-form textarea {
  width: 100%;
  padding: 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.calc-results { background: #f8fafc; padding: 10px; border-radius: 8px; margin-bottom: 12px; }
.res-row { display: flex; justify-content: space-between; font-size: 0.75rem; margin-bottom: 6px; }
.text-green { color: #059669; }
.text-amber { color: #d97706; }

.primary-btn {
  width: 100%;
  padding: 12px;
  background: #059669;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}
.primary-btn.dark { background: #1a365d; }

/* MODAL */
.modal-backdrop {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 100;
}
.modal-backdrop.open { display: flex; }
.modal-card {
  background: #ffffff;
  padding: 20px;
  border-radius: 20px;
  text-align: center;
  width: 100%;
  max-width: 300px;
}
.modal-card h3 { font-size: 0.95rem; font-weight: 800; color: #1a365d; }
.modal-card p { font-size: 0.72rem; color: #64748b; margin-top: 2px; }

.qr-placeholder {
  width: 160px;
  height: 160px;
  margin: 16px auto;
  background: #1a1a1a;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-pattern {
  width: 100%;
  height: 100%;
  background: repeating-conic-gradient(#fff 0% 25%, #000 0% 50%) 50% / 20px 20px;
  border-radius: 6px;
}

.qr-code-text { font-family: monospace; font-weight: 800; font-size: 0.8rem; color: #1a365d; }

.close-btn {
  margin-top: 12px;
  background: #f1f5f9;
  color: #334155;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
}

.app-footer {
  text-align: center;
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 8px;
}