/* =============================================
   ReconMed – Shared Stylesheet
   ============================================= */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #1a5f9e;
  --brand-dark:  #0f3f6b;
  --brand-light: #e8f2fc;
  --accent:      #e85d2e;
  --warn:        #d4940a;
  --ok:          #1e7e4b;
  --surface:     #ffffff;
  --bg:          #f4f7fb;
  --border:      #dce3ed;
  --text:        #1a1e27;
  --muted:       #6b7280;
  --radius:      6px;
  --nav-h:       60px;
  --shadow:      0 1px 4px rgba(0,0,0,.10);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* --- Utility --- */
.sr-only { position: absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-s { gap: 8px; }
.gap-m { gap: 16px; }
.gap-l { gap: 24px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; font-weight: 600; }
.text-2xl { font-size: 28px; font-weight: 700; }
.bold { font-weight: 600; }
.mt-s { margin-top: 8px; }
.mt-m { margin-top: 16px; }
.mt-l { margin-top: 24px; }
.mb-s { margin-bottom: 8px; }
.mb-m { margin-bottom: 16px; }
.w-full { width: 100%; }

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
}
.badge-red   { background:#fde8e2; color:#c0392b; }
.badge-amber { background:#fef3cd; color:#8a6200; }
.badge-green { background:#e2f5eb; color:#1e7e4b; }
.badge-blue  { background:#e8f2fc; color:#1a5f9e; }
.badge-grey  { background:#eaecf0; color:#4b5563; }

/* --- Pill status --- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.status-pill::before { content:''; display:inline-block; width:7px; height:7px; border-radius:50%; }
.pill-pending  { background:#fef3cd; color:#8a6200; }
.pill-pending::before  { background:#d4940a; }
.pill-approved { background:#e2f5eb; color:#1e7e4b; }
.pill-approved::before { background:#1e7e4b; }
.pill-review   { background:#fde8e2; color:#c0392b; }
.pill-review::before   { background:#e85d2e; }

/* --- Navbar --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--brand-dark);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.navbar .logo {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .5px;
  margin-right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar .logo span { color: #89c4f9; }
.navbar nav { display: flex; gap: 4px; flex: 1; }
.navbar nav a {
  color: rgba(255,255,255,.8);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.navbar nav a:hover,
.navbar nav a.active {
  background: rgba(255,255,255,.15);
  color: #fff;
  text-decoration: none;
}
.navbar .role-badge {
  margin-left: auto;
  background: rgba(255,255,255,.15);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.navbar .role-badge .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4ade80;
}

/* --- Page wrapper --- */
.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* --- Page header --- */
.page-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p  { color: var(--muted); font-size: 14px; margin-top: 4px; }
.page-header .header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

/* --- Card --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-body { padding: 20px; }
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* --- Table --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { background: var(--bg); }
th { padding: 10px 12px; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--brand-light); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary   { background: var(--brand);      color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }
.btn-outline   { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: var(--brand-light); text-decoration: none; }
.btn-danger    { background: #c0392b; color: #fff; border-color: #c0392b; }
.btn-danger:hover  { background: #a93226; text-decoration: none; }
.btn-success   { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-success:hover { background: #155d37; text-decoration: none; }
.btn-warn      { background: var(--warn); color: #fff; border-color: var(--warn); }
.btn-warn:hover    { background: #a87200; text-decoration: none; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--muted); }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--brand); }
select.form-control { appearance: none; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* --- Alert boxes --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  border-left: 4px solid;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-danger { background: #fde8e2; border-color: #c0392b; color: #7b1d1d; }
.alert-warn   { background: #fef3cd; border-color: #d4940a; color: #713f12; }
.alert-info   { background: #e8f2fc; border-color: #1a5f9e; color: #0c345a; }
.alert-ok     { background: #e2f5eb; border-color: #1e7e4b; color: #14532d; }

/* --- Discrepancy row --- */
.disc-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.disc-row .disc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.disc-row .disc-header h3 { font-size: 14px; font-weight: 600; }
.disc-body { padding: 14px 16px; }
.disc-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 12px; }
.source-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.source-cell .source-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.source-cell .source-val { font-size: 14px; font-weight: 600; }
.source-cell.conflict { border-color: var(--accent); background: #fdf1ee; }
.source-cell.missing  { border-color: var(--warn);  background: #fef9ec; }
.source-cell.match    { border-color: var(--ok);    background: #f0faf4; }

/* --- Score ring --- */
.score-ring {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid;
  font-size: 20px;
  font-weight: 800;
}
.score-high   { border-color: #c0392b; color: #c0392b; background: #fde8e2; }
.score-medium { border-color: var(--warn); color: var(--warn); background: #fef3cd; }
.score-low    { border-color: var(--ok); color: var(--ok); background: #e2f5eb; }
.score-label  { font-size: 10px; font-weight: 600; }

/* --- Two-col layout --- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.sidebar-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
@media(max-width:720px) {
  .two-col, .three-col, .sidebar-layout { grid-template-columns: 1fr; }
}

/* --- Stat card --- */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.stat-card .stat-val { font-size: 30px; font-weight: 800; color: var(--brand); line-height: 1; }
.stat-card .stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* --- Hero (landing page) --- */
.hero {
  background: linear-gradient(135deg, var(--brand-dark) 0%, #1a5f9e 100%);
  color: #fff;
  padding: 72px 24px;
  text-align: center;
}
.hero h1 { font-size: 36px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 16px; }
.hero h1 span { color: #89c4f9; }
.hero p { font-size: 17px; max-width: 600px; margin: 0 auto 28px; opacity: .88; }
.hero .hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .btn-white { background: #fff; color: var(--brand-dark); border-color: #fff; font-size: 15px; }
.hero .btn-white:hover { background: #e8f2fc; text-decoration: none; }
.hero .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); font-size: 15px; }
.hero .btn-ghost:hover { background: rgba(255,255,255,.12); text-decoration: none; }

/* --- Landing sections --- */
.section { padding: 52px 0; }
.section-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.section-sub { color: var(--muted); font-size: 15px; margin-bottom: 32px; }

/* Feature card */
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.feature-card .icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}
.feature-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.feature-card p  { font-size: 13px; color: var(--muted); line-height: 1.55; }

/* Step */
.step-list { counter-reset: step; list-style: none; display: flex; flex-direction: column; gap: 16px; }
.step-item { counter-increment: step; display: flex; gap: 14px; align-items: flex-start; }
.step-item::before {
  content: counter(step);
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}
.step-item p { font-size: 14px; }
.step-item strong { display: block; font-size: 14px; font-weight: 600; margin-bottom: 2px; }

/* --- Footer --- */
.footer {
  background: var(--brand-dark);
  color: rgba(255,255,255,.65);
  text-align: center;
  padding: 18px;
  font-size: 13px;
  margin-top: 48px;
}
.footer a { color: rgba(255,255,255,.7); }

/* --- Divider --- */
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* --- Breadcrumb --- */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.breadcrumb a { color: var(--brand); }
.breadcrumb .sep { color: var(--border); }

/* --- Patient info bar --- */
.patient-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.patient-bar .avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 18px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.patient-bar .pname { font-weight: 700; font-size: 16px; }
.patient-bar .pmeta { font-size: 13px; color: var(--muted); }
.patient-bar .pdivider { width: 1px; height: 36px; background: var(--border); }
.patient-bar .pfield { font-size: 13px; }
.patient-bar .pfield strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }

/* --- Tabs --- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--brand); }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* --- Arabic / RTL --- */
.rtl { direction: rtl; text-align: right; font-family: 'Segoe UI', Tahoma, Arial, sans-serif; }

/* --- Checklist --- */
.checklist { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; }
.checklist li::before { content:'checkmark'; font-style:normal; color: var(--ok); font-weight: 700; flex-shrink: 0; margin-top: 1px; }

/* --- Timeline --- */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 14px; }
.tl-col { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }
.tl-dot-ok   { background: var(--ok); }
.tl-dot-warn { background: var(--warn); }
.tl-line { flex: 1; width: 2px; background: var(--border); margin: 2px 0; min-height: 20px; }
.tl-body { padding: 0 0 20px 0; flex: 1; }
.tl-time { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.tl-text { font-size: 14px; }

/* --- Separator label --- */
.sep-label {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  margin: 20px 0 14px;
}
.sep-label::before, .sep-label::after { content:''; flex:1; height:1px; background: var(--border); }
