@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  --deep: #0B3B4A;
  --teal: #1F7A73;
  --ivory: #FBF8F2;
  --ink: #0E2933;
  --alert: #C22A2A;
  --alert-bg: #FDEDED;
  --gold: #B9925A;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  background: linear-gradient(180deg, #EEF3F2 0%, #F7F5EF 100%);
  color: var(--ink);
  direction: rtl;
  min-height: 100vh;
}

.topbar {
  background: linear-gradient(135deg, var(--deep), #0a2e3a);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .badge {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.topbar .title { color: #fff; font-weight: 800; font-size: 15px; line-height: 1.2; }
.topbar .subtitle { color: rgba(255,255,255,0.75); font-size: 10.5px; letter-spacing: 1px; }

button, a.patient-row, .icon-btn { transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease; }
button.primary:active, button.secondary:active { transform: scale(0.98); }
a.patient-row:hover { box-shadow: 0 4px 14px rgba(11,59,74,0.10); transform: translateY(-1px); }
button.primary:hover { box-shadow: 0 4px 14px rgba(31,122,115,0.35); }

.icon-btn {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1.5px solid #DCE4E2; background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; color: var(--teal);
}
.icon-btn:hover { background: #EFF6F5; border-color: var(--teal); }

.empty-state {
  text-align: center; padding: 40px 20px; color: #8A9AA0;
}
.empty-state .icon { font-size: 34px; margin-bottom: 10px; opacity: 0.6; }
.empty-state .msg { font-size: 13.5px; }

.wrap { max-width: 480px; margin: 0 auto; padding: 28px 16px 60px; }

.card-box {
  background: #fff;
  border: 1px solid #E3E8E7;
  border-radius: 14px;
  padding: 22px;
}

label { display: block; margin-bottom: 14px; }
.field-label { font-size: 12.5px; color: var(--teal); font-weight: 700; margin-bottom: 5px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid #DCE4E2;
  font-size: 14px;
  font-family: 'Tajawal', sans-serif;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 70px; resize: vertical; }

button.primary {
  width: 100%;
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 11px 0;
  border-radius: 8px;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
}
button.secondary {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid #DCE4E2;
  padding: 10px 22px;
  border-radius: 8px;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
button.link {
  background: none; border: none; color: var(--teal);
  font-family: 'Tajawal', sans-serif; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; margin: 0 auto;
}

.error { color: var(--alert); font-size: 12.5px; margin-bottom: 10px; }

.emergency-card { border-radius: 16px; overflow: hidden; box-shadow: 0 8px 30px rgba(11,59,74,0.18); }
.ec-header { background: linear-gradient(135deg, var(--teal), var(--deep)); padding: 18px 20px; }
.ec-alerts { background: var(--alert-bg); padding: 16px 20px; border-bottom: 1px solid #F3D3D3; }
.ec-alert-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--alert); font-weight: 800; font-size: 14.5px; }
.ec-alert-line { font-size: 14px; color: #7A1E1E; font-weight: 700; margin-bottom: 4px; padding-right: 8px; border-right: 3px solid var(--alert); }
.ec-body { background: var(--ivory); padding: 18px 20px; }
.ec-name { font-size: 19px; font-weight: 800; color: var(--deep); }
.ec-meta { font-size: 12.5px; color: #5B7078; }
.ec-section { margin-bottom: 14px; }
.ec-section-title { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 12.5px; font-weight: 800; color: var(--teal); }

.patient-row {
  background: #fff; border: 1px solid #E3E8E7; border-radius: 12px;
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; text-decoration: none; color: inherit; margin-bottom: 10px;
}
.patient-name { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.patient-sub { font-size: 12px; color: #8A9AA0; }
.alert-flag { color: var(--alert); font-size: 11.5px; font-weight: 700; }

.field-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.showcase-card {
  max-width: 380px; margin: 8px auto 0; border-radius: 16px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(11,59,74,0.22); border: 1px solid rgba(255,255,255,0.4);
}
.sc-header {
  background: linear-gradient(135deg, var(--teal), var(--deep));
  padding: 16px 18px; display: flex; justify-content: space-between; align-items: flex-start;
}
.sc-title { color: #fff; font-weight: 800; font-size: 14.5px; }
.sc-sub { color: rgba(255,255,255,0.75); font-size: 10px; letter-spacing: 0.5px; margin-top: 2px; }
.sc-qr { color: rgba(255,255,255,0.85); }
.sc-body { background: var(--ivory); padding: 16px 18px 14px; }
.sc-line { height: 9px; border-radius: 5px; background: #DDE7E5; }
.sc-line-name { width: 55%; margin-bottom: 8px; }
.sc-line-sub { width: 75%; margin-bottom: 12px; background: #E7E2D4; }
.sc-alert {
  background: var(--alert-bg); color: var(--alert); font-size: 11.5px; font-weight: 700;
  padding: 8px 10px; border-radius: 8px; border-right: 3px solid var(--alert);
}
.login-box { max-width: 380px; margin: 0 auto; }
