/* ============================================================
   FROTTIS CERVICO-UTERIN — design system (plain CSS, no framework)
   Variables have static fallbacks where it matters for old browsers.
   ============================================================ */

:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --text: #1f2a37;
  --muted: #6b7280;
  --border: #d6dde5;
  --accent: #0d7d8c;        /* clinical teal */
  --accent-dark: #0a626e;
  --accent-soft: #e3f1f3;
  --primary: #1763a6;       /* blue */
  --primary-dark: #124e84;
  --danger: #b3261e;
  --danger-dark: #8e1d17;
  --success-bg: #e7f5ec;
  --success-fg: #1e6b3a;
  --error-bg: #fdecea;
  --error-fg: #9b2620;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: #eef2f6;
  background: var(--bg);
  color: #1f2a37;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: #1763a6; color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; margin: 0; }
h2 { font-size: 18px; }

/* ---------- App bar ---------- */
.appbar {
  background: #ffffff;
  background: var(--surface);
  border-bottom: 1px solid #d6dde5;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.appbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-block;
  background: #0d7d8c;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  padding: 6px 8px;
  border-radius: 6px;
  margin-right: 10px;
}
.brand-text { font-weight: 700; font-size: 16px; }
.nav { margin-left: 24px; flex: 1 1 auto; }
.nav a {
  display: inline-block;
  margin-right: 16px;
  color: #1f2a37;
  color: var(--text);
  font-weight: 600;
}
.user-area { display: flex; align-items: center; }
.user-email { color: #6b7280; color: var(--muted); font-size: 13px; margin-right: 8px; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 10px;
}
.badge-admin { background: #e3f1f3; background: var(--accent-soft); color: #0a626e; color: var(--accent-dark); }
.badge-assistant { background: #eef2f6; color: #6b7280; color: var(--muted); }

/* ---------- Layout ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 22px 20px 60px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-head .head-actions { display: flex; flex-wrap: wrap; }
.page-head .head-actions > * { margin-left: 8px; }

.card {
  background: #ffffff;
  background: var(--surface);
  border: 1px solid #d6dde5;
  border: 1px solid var(--border);
  border-radius: 8px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card.narrow { max-width: 540px; }
.card-title { font-weight: 700; font-size: 15px; margin-bottom: 12px; color: #0a626e; color: var(--accent-dark); }

.muted { color: #6b7280; color: var(--muted); }
.empty { text-align: center; padding: 24px 0; }
.back-link { margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  line-height: 1;
  padding: 9px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  background: #e5e9ef;
  color: #1f2a37;
  color: var(--text);
}
.btn:hover { text-decoration: none; filter: brightness(0.97); }
.btn-sm { padding: 5px 9px; font-size: 12.5px; }
.btn-block { display: block; width: 100%; }

.btn-primary { background: #1763a6; background: var(--primary); color: #fff; }
.btn-primary:hover { background: #124e84; background: var(--primary-dark); filter: none; }
.btn-secondary {
  background: #fff;
  color: #1f2a37;
  color: var(--text);
  border: 1px solid #c2ccd6;
}
.btn-ghost { background: transparent; color: #1763a6; color: var(--primary); border: 1px solid transparent; }
.btn-ghost:hover { background: #e9eef3; }
.btn-danger { background: #b3261e; background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8e1d17; background: var(--danger-dark); filter: none; }
.btn.disabled { opacity: 0.45; pointer-events: none; }

.inline { display: inline; margin: 0; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.field input,
.field select,
.field textarea,
.inline-text {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  color: #1f2a37;
  color: var(--text);
  background: #fff;
  border: 1px solid #c2ccd6;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.inline-text:focus {
  outline: none;
  border-color: #1763a6;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 99, 166, 0.15);
}
textarea { resize: vertical; }

.form-stack .field:last-of-type { margin-bottom: 18px; }

.grid {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
  margin: 0 -8px;
}
.grid .field {
  width: 50%;
  padding: 0 8px;
}

.form-actions { margin-top: 4px; }
.form-actions .btn { margin-right: 8px; }

/* Sections (edit form) */
.section {
  border: 1px solid #e1e7ee;
  border-radius: 6px;
  padding: 10px 14px 14px;
  margin: 0 0 14px;
}
.section legend {
  font-weight: 700;
  color: #0a626e;
  color: var(--accent-dark);
  padding: 0 6px;
}
.rows { margin-top: 4px; }
.row { display: flex; align-items: center; flex-wrap: wrap; padding: 2px 0; }
.subheader { font-weight: 700; margin: 8px 0 2px; }
.check { display: inline-flex; align-items: center; cursor: pointer; }
.check input { margin-right: 7px; }
.check-head input { margin-right: 8px; }
.inline-text { width: auto; flex: 1 1 160px; margin-left: 10px; min-width: 120px; }
.indent-1 { padding-left: 22px; }
.indent-2 { padding-left: 44px; }

/* Two-column layout (anomalies, users page) */
.two-col {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
  margin: 0 -9px;
}
.two-col > .col { width: 50%; padding: 0 9px; }

/* ---------- Search bar ---------- */
.searchbar { display: flex; flex-wrap: wrap; margin-bottom: 16px; }
.searchbar input {
  flex: 1 1 260px;
  padding: 8px 10px;
  font: inherit;
  border: 1px solid #c2ccd6;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-right: 8px;
}
.searchbar .btn { margin-right: 8px; }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid #e6ebf0;
  vertical-align: middle;
}
.table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #6b7280;
  color: var(--muted);
}
.table tbody tr:nth-child(even) { background: #f7f9fb; }
.table tbody tr:hover { background: #eef4f7; }
.actions-col { white-space: nowrap; }
.actions-col .btn, .actions-col form { margin-right: 4px; }

/* ---------- Pager ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.pager-info { color: #6b7280; color: var(--muted); font-size: 13px; }
.pager-links .btn { margin-left: 4px; }

/* ---------- Alerts ---------- */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-weight: 600; }
.alert-error { background: #fdecea; background: var(--error-bg); color: #9b2620; color: var(--error-fg); }
.alert-success { background: #e7f5ec; background: var(--success-bg); color: #1e6b3a; color: var(--success-fg); }

/* ---------- Auth ---------- */
.auth-wrap { max-width: 420px; margin: 6vh auto 0; }
.auth-card { padding: 28px 26px; }
.auth-title { margin: 0 0 4px; }
.auth-sub { margin: 0 0 18px; color: #6b7280; color: var(--muted); font-size: 13px; }

/* ---------- Report sheet (view + print) ---------- */
.report-sheet { color: #1f2a37; }
.letterhead { text-align: left; border-bottom: 1px solid #c2ccd6; padding-bottom: 10px; margin-bottom: 12px; }
.lab-title { margin: 0 0 6px; font-size: 19px; letter-spacing: 0.5px; text-align: center; }
.lab-name { font-weight: 700; }
.lab-doctor { font-weight: 700; }
.lab-line { font-size: 13px; color: #374151; }

.ident-grid {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
  margin: 0 -10px 14px;
}
.ident-item { width: 50%; padding: 3px 10px; font-size: 14px; }
.ident-label { font-weight: 700; margin-right: 6px; }

.dsection { margin-bottom: 12px; }
.dsection-title {
  font-weight: 700;
  color: #0a626e;
  color: var(--accent-dark);
  border-bottom: 1px solid #e1e7ee;
  padding-bottom: 3px;
  margin-bottom: 6px;
}
.drows { padding-left: 2px; }
.dsubheader { font-weight: 700; margin: 6px 0 2px; }
.drow { display: flex; align-items: baseline; padding: 1px 0; font-size: 14px; }
.dlbl { }
.dtxt { margin-left: 4px; color: #374151; }

.box {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 1.5px solid #5b6873;
  border-radius: 2px;
  margin-right: 8px;
  position: relative;
  top: 1px;
  flex: 0 0 auto;
}
.box-on { background: #0d7d8c; background: var(--accent); border-color: #0a626e; }
.box-on:after {
  content: "\2713";
  color: #fff;
  font-size: 11px;
  line-height: 13px;
  position: absolute;
  top: -1px;
  left: 1px;
}

.conclusion-text { font-size: 14px; }

.dsection-title + .drows { }

/* ---------- Print toolbar ---------- */
.print-body { background: #fff; padding: 18px; }
.print-toolbar { margin-bottom: 16px; }
.print-toolbar .btn { margin-right: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .grid .field { width: 100%; }
  .two-col > .col { width: 100%; }
  .ident-item { width: 100%; }
  .nav { margin-left: 0; width: 100%; order: 3; margin-top: 8px; }
  .appbar-inner { align-items: flex-start; }
}
