
:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --soft: #f8fafc;
  --line: #d8e2ee;
  --text: #182230;
  --muted: #667085;
  --nav: #0b1f33;
  --nav2: #123047;
  --primary: #0f766e;
  --primary2: #115e59;
  --secondary: #2563eb;
  --good: #16a34a;
  --warn: #f59e0b;
  --danger: #dc2626;
  --info: #0284c7;
  --desc-bg: #fff7ed;
  --desc-border: #fdba74;
  --shadow: 0 18px 40px rgba(15, 23, 42, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--nav), var(--nav2));
  color: #fff;
  padding: 22px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2dd4bf, #38bdf8);
  display: grid;
  place-items: center;
  color: #062b3d;
  font-weight: 900;
}
.brand h1 { margin: 0; font-size: 20px; }
.brand p { margin: 3px 0 0; color: #bdd0e3; font-size: 13px; }

.hospital-card {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
}
.hospital-card span {
  display: block;
  color: #93f0e4;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
}
.hospital-card strong { display: block; margin: 5px 0; }
.hospital-card small { color: #c8d8e7; }

.search {
  width: 100%;
  padding: 12px 14px;
  border-radius: 13px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: #fff;
  outline: none;
  margin-bottom: 14px;
}
.search::placeholder { color: #bed1e4; }

details {
  border-top: 1px solid rgba(255,255,255,.12);
  padding: 10px 0;
}
summary {
  list-style: none;
  cursor: pointer;
  font-weight: 800;
  margin-bottom: 8px;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "▾"; float: right; color: #7dd3fc; }

.nav-group { display: grid; gap: 6px; }
.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #dcecfb;
  text-align: left;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  display: grid;
  gap: 2px;
}
.nav-item span { font-size: 14px; font-weight: 750; }
.nav-item small { font-size: 11px; color: #aec3d7; }
.nav-item:hover, .nav-item.active {
  background: rgba(20, 184, 166, .22);
  color: #fff;
}

.main { padding: 24px; min-width: 0; }
.topbar {
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}
.breadcrumb { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.topbar h2 { margin: 0; font-size: 24px; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.icon-btn, .top-btn, .avatar {
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
}
.icon-btn span {
  display: inline-grid;
  place-items: center;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 99px;
  min-width: 22px;
  height: 22px;
  margin-left: 5px;
}
.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #0b1f33;
  color: white;
}

.page-hero {
  background: linear-gradient(135deg, #ffffff, #e8fbf8);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.eyebrow.dark { color: #9a3412; }
.page-hero h1 { margin: 0; font-size: 36px; }
.page-hero p { color: #43546a; line-height: 1.6; max-width: 900px; }
.hero-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; }

.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  font-weight: 850;
  cursor: pointer;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary2); }
.btn.secondary { background: var(--secondary); color: #fff; }
.btn.neutral { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.small { padding: 8px 10px; font-size: 13px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 17px;
  overflow: hidden;
  position: relative;
}
.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--info);
}
.stat.good::before { background: var(--good); }
.stat.warn::before { background: var(--warn); }
.stat.danger::before { background: var(--danger); }
.stat.info::before { background: var(--info); }
.stat span { display: block; color: var(--muted); font-weight: 800; font-size: 13px; }
.stat strong { display: block; font-size: 30px; margin: 7px 0; }
.stat small { color: var(--muted); }

.work-area {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, .8fr);
  gap: 18px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.register-panel, .detail-panel, .description-section { grid-column: 1 / -1; }

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.panel-title h3 { margin: 0; font-size: 20px; }
.panel-title p { color: var(--muted); margin: 5px 0 0; }
.button-row { display: flex; flex-wrap: wrap; gap: 7px; }

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(4, 165px) auto;
  gap: 9px;
  margin-bottom: 14px;
}
.filters input, .filters select, .field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
.table-card { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; min-width: 980px; border-collapse: collapse; background: #fff; }
th {
  background: #f1f5f9;
  text-align: left;
  color: #344054;
  font-size: 13px;
  padding: 13px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 13px; border-bottom: 1px solid #edf2f7; color: #344054; font-size: 14px; }
tr:hover td { background: #f8fafc; }
.badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.badge.good { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.badge.info { background: #dbeafe; color: #1d4ed8; }
.row-actions { white-space: nowrap; }
.row-actions button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 6px 8px;
  margin-right: 4px;
  cursor: pointer;
  font-size: 12px;
}

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.field { display: grid; gap: 6px; }
.field.full, .form-actions.full { grid-column: 1 / -1; }
.field span { font-weight: 850; font-size: 13px; color: #344054; }
.field textarea { min-height: 82px; resize: vertical; }
.dropzone {
  border: 2px dashed #b6c6d8;
  background: #f8fafc;
  border-radius: 14px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}
.form-actions {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.detail-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}
.detail-tabs button.active { background: #ecfeff; border-color: #67e8f9; color: #155e75; font-weight: 800; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.detail-grid > div {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.detail-grid span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.detail-grid strong { display: block; margin-top: 6px; }

.timeline { display: grid; gap: 10px; }
.timeline h4 { margin: 0 0 4px; }
.timeline-row {
  display: grid;
  grid-template-columns: 36px minmax(0,1fr);
  gap: 10px;
  align-items: center;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px;
}
.timeline-row > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e2e8f0;
  font-weight: 900;
}
.timeline-row.done > span { background: #dcfce7; color: #166534; }
.timeline-row.current > span { background: #fef3c7; color: #92400e; }
.timeline-row small { display: block; color: var(--muted); margin-top: 3px; }

.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.report-grid button {
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  font-weight: 800;
}
.mini-chart {
  height: 180px;
  margin-top: 18px;
  background: linear-gradient(180deg, #f8fafc, #eef6ff);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.mini-chart div {
  flex: 1;
  background: linear-gradient(180deg, #14b8a6, #2563eb);
  border-radius: 10px 10px 0 0;
  min-height: 20px;
}

.description-section {
  background: var(--desc-bg);
  border: 2px solid var(--desc-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.description-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.description-header h3 { margin: 0; font-size: 22px; color: #7c2d12; }
.description-btn { background: #9a3412; color: #fff; }
.description-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
}
.description-grid section {
  background: #fff;
  border: 1px solid #fed7aa;
  border-radius: 16px;
  padding: 16px;
}
.description-grid h4 { margin: 0 0 8px; color: #9a3412; }
.description-grid p, .description-grid li { color: #4b5563; line-height: 1.65; }
.description-grid ul { margin: 0; padding-left: 20px; }
.workflow-text { font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span {
  background: #ffedd5;
  border: 1px solid #fdba74;
  color: #9a3412;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

@media (max-width: 1280px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-area { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .description-grid, .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .main { padding: 14px; }
  .topbar, .page-hero, .panel-title, .description-header { flex-direction: column; }
  .page-hero h1 { font-size: 28px; }
  .stats, .form-grid, .filters, .report-grid { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar, .hero-buttons, .button-row, .filters, .row-actions { display: none !important; }
  .app-shell { display: block; }
  .main { padding: 0; }
  .panel, .page-hero, .stat, .description-section { box-shadow: none; break-inside: avoid; }
}
