/* ============================
   ЖИРЭМСЭН ХЯНАЛТЫН СИСТЕМ
   CSS
   ============================ */

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

:root {
  --pink:     #e91e8c;
  --pink-lt:  #fce4f3;
  --pink-dk:  #b5006e;
  --teal:     #00897b;
  --teal-lt:  #e0f2f1;
  --blue:     #1565c0;
  --blue-lt:  #e3f2fd;
  --gray:     #f5f5f5;
  --gray-dk:  #757575;
  --text:     #212121;
  --white:    #ffffff;
  --shadow:   0 2px 8px rgba(0,0,0,0.10);
  --radius:   10px;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  background: #f0f4f8;
  color: var(--text);
  min-height: 100vh;
}

/* ── NAVBAR ── */
.navbar {
  background: #005186;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 58px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.nav-brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.nav-icon { font-size: 22px; }
.nav-user { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.nav-name { font-weight: 600; }
.nav-role { background: rgba(255,255,255,0.2); padding: 3px 10px; border-radius: 20px; font-size: 13px; }
.btn-logout {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 5px 14px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 13px;
  transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.3); }

/* ── MAIN CONTENT ── */
.main-content { padding: 24px; max-width: 1200px; margin: 0 auto; }

/* ── LOGIN ── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fce4f3 0%, #e0f2f1 100%);
}
.login-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(233,30,140,0.12);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 8px; font-size: 48px; }
.login-title { text-align: center; font-size: 20px; font-weight: 700; color: #005186; margin-bottom: 4px; }
.login-sub { text-align: center; font-size: 13px; color: var(--gray-dk); margin-bottom: 28px; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-dk); margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.2s;
  background: #fafafa;
}
.form-control:focus { outline: none; border-color: #1dbecf; background: #fff; }
.form-select { width: 100%; padding: 10px 14px; border: 1.5px solid #ddd; border-radius: 8px; font-size: 15px; background: #fafafa; }

/* ── BUTTONS ── */
.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-primary { background: #005186; color: #fff; }
.btn-primary:hover { background: #003d66; }
.btn-teal { background: var(--teal); color: #fff; }
.btn-teal:hover { background: #00695c; }
.btn-outline { background: transparent; border: 1.5px solid #005186; color: #005186; }
.btn-outline:hover { background: #e6eef5; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; text-align: center; }
.btn-danger { background: #c62828; color: #fff; }

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--pink-lt);
}
.card-title { font-size: 17px; font-weight: 700; color: #005186; }

/* ── DASHBOARD STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon { font-size: 36px; }
.stat-label { font-size: 13px; color: var(--gray-dk); }
.stat-value { font-size: 28px; font-weight: 700; color: #005186; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead { background: var(--pink-lt); }
th { padding: 10px 14px; text-align: left; font-weight: 600; color: #005186; font-size: 13px; }
td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tr:hover td { background: #fdf5fb; }

/* ── ALERTS ── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-danger { background: #fdecea; color: #b71c1c; border-left: 4px solid #e53935; }
.alert-success { background: #e8f5e9; color: #1b5e20; border-left: 4px solid #43a047; }
.alert-warning { background: #fff8e1; color: #e65100; border-left: 4px solid #ffa000; }

/* ── VISIT FORM ── */
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-lt);
  padding: 8px 14px;
  border-radius: 6px;
  margin: 20px 0 12px;
  border-left: 4px solid var(--teal);
}
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.checkbox-item { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.checkbox-item input[type=checkbox] { width: 16px; height: 16px; accent-color: #1dbecf; }

/* ── VISIT TABS ── */
.visit-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.visit-tab {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--pink);
  color: #1dbecf;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: #fff;
  transition: all 0.2s;
}
.visit-tab.active, .visit-tab:hover { background: #005186; color: #fff; }
.visit-tab.done { background: var(--teal-lt); border-color: var(--teal); color: var(--teal); }

/* ── SEARCH ── */
.search-bar { display: flex; gap: 10px; margin-bottom: 18px; }
.search-bar input { flex: 1; }

/* ── RISK BADGE ── */
.risk-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.risk-low  { background: #e8f5e9; color: #2e7d32; }
.risk-mid  { background: #fff3e0; color: #e65100; }
.risk-high { background: #fdecea; color: #b71c1c; }

/* ── FOOTER ── */
.footer { text-align: center; padding: 20px; color: var(--gray-dk); font-size: 13px; margin-top: 40px; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .navbar { padding: 0 12px; }
  .nav-brand span:last-child { display: none; }
  .main-content { padding: 12px; }
  .login-card { padding: 24px 16px; }
}

/* ── MOBILE FIRST — Гар утасны тусгай стиль ── */
.mobile-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.mobile-card .section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 2px solid var(--pink-lt);
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 700;
  color: #005186;
}
.radio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.radio-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f9f9f9;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.radio-btn input { accent-color: #1dbecf; width:16px; height:16px; }
.radio-btn:has(input:checked) {
  background: #e6f9fb;
  border-color: #1dbecf;
  color: #005186;
  font-weight: 600;
}
.check-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f9f9f9;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  margin-bottom: 8px;
}
.check-btn input { accent-color: #1dbecf; width:18px; height:18px; flex-shrink:0; }
.check-btn:has(input:checked) {
  background: #e6f9fb;
  border-color: #1dbecf;
  color: #005186;
  font-weight: 600;
}
.form-control-lg {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  background: #fafafa;
}
.form-control-lg:focus { outline: none; border-color: #1dbecf; background: #fff; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.prev-preg-table { width:100%; border-collapse:collapse; font-size:13px; }
.prev-preg-table th { background:var(--pink-lt); color:var(--pink-dk); padding:8px 6px; font-size:12px; text-align:center; }
.prev-preg-table td { padding:8px 6px; border-bottom:1px solid #f0f0f0; text-align:center; }
.prev-preg-table input { width:100%; padding:6px; border:1px solid #ddd; border-radius:6px; font-size:13px; text-align:center; }
.btn-save-mobile {
  position: sticky;
  bottom: 16px;
  width: 100%;
  padding: 16px;
  font-size: 17px;
  font-weight: 700;
  border-radius: 12px;
  background: #1dbecf;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(233,30,140,0.3);
  margin-top: 16px;
}
@media (max-width: 600px) {
  .radio-grid { grid-template-columns: 1fr; }
  .input-row { grid-template-columns: 1fr; }
  .input-row-3 { grid-template-columns: 1fr 1fr; }
  .main-content { padding: 10px; }
  .navbar { height: 52px; }
  .nav-brand span:last-child { font-size: 14px; }
}