:root {
  --bg-main: #f4f8ff;
  --bg-deep: #e8f1ff;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --ink: #14213d;
  --ink-soft: #4f6385;
  --line: rgba(143, 175, 218, 0.28);
  --blue: #2563eb;
  --sky: #06b6d4;
  --teal: #0f9d89;
  --lime: #84cc16;
  --amber: #f59e0b;
  --orange: #f97316;
  --rose: #ef4444;
  --violet: #7c3aed;
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow-lg: 0 30px 80px rgba(28, 56, 110, 0.14);
  --shadow-md: 0 18px 40px rgba(28, 56, 110, 0.12);
  --shadow-sm: 0 10px 24px rgba(28, 56, 110, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.18), transparent 28%),
    radial-gradient(circle at 10% 90%, rgba(249, 115, 22, 0.15), transparent 22%),
    linear-gradient(135deg, var(--bg-main), var(--bg-deep));
  min-height: 100vh;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  z-index: -1;
  width: 360px;
  height: 360px;
  border-radius: 999px;
  filter: blur(10px);
  opacity: 0.35;
}

body::before {
  top: -130px;
  right: -90px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.42), transparent 68%);
  animation: floatBlob 16s ease-in-out infinite;
}

body::after {
  bottom: -130px;
  left: -80px;
  background: radial-gradient(circle, rgba(15, 157, 137, 0.38), transparent 68%);
  animation: floatBlob 18s ease-in-out infinite reverse;
}

.wrap {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 38px;
}

.hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 28px;
  margin-bottom: 20px;
  border-radius: var(--radius-xl);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(14, 30, 73, 0.95), rgba(25, 91, 205, 0.92) 48%, rgba(6, 182, 212, 0.88)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
  box-shadow: 0 30px 70px rgba(24, 53, 112, 0.28);
  overflow: hidden;
  animation: panelRise 0.6s ease both;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -20% auto auto 58%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 68%);
  animation: spinHalo 20s linear infinite;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto auto -80px -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.32), transparent 70%);
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero-kicker {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.74);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 800;
}

.title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.sub {
  margin: 12px 0 0;
  max-width: 760px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 15px;
  line-height: 1.6;
}

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.hero-pill,
.pill-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-pill {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  animation: pulseBadge 3s ease-in-out infinite;
}

.pill-link {
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f9fbff;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.pill-link:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.18);
}

.pill-link.alert {
  background: linear-gradient(135deg, rgba(255, 140, 102, 0.95), rgba(239, 68, 68, 0.95));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 28px rgba(239, 68, 68, 0.25);
}

.pill-link.danger {
  background: rgba(255, 255, 255, 0.94);
  color: #a02746;
  border-color: rgba(255, 255, 255, 0.95);
}

.flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(15, 157, 137, 0.14));
  color: #0e6258;
  border: 1px solid rgba(15, 157, 137, 0.2);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
  animation: panelRise 0.45s ease both;
}

.grid {
  display: grid;
  gap: 16px;
}

.metrics {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 18px;
}

.card,
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.card::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), transparent);
}

.card:hover,
.panel:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 56px rgba(25, 54, 112, 0.16);
}

.stat {
  min-height: 156px;
  padding: 18px 18px 20px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stat::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -28px;
  bottom: -34px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), transparent 66%);
}

.metrics .stat:nth-child(1) {
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.92), rgba(96, 165, 250, 0.86));
  color: #fff;
}

.metrics .stat:nth-child(2) {
  background: linear-gradient(145deg, rgba(15, 157, 137, 0.92), rgba(45, 212, 191, 0.84));
  color: #fff;
}

.metrics .stat:nth-child(3) {
  background: linear-gradient(145deg, rgba(124, 58, 237, 0.92), rgba(168, 85, 247, 0.84));
  color: #fff;
}

.metrics .stat:nth-child(4) {
  background: linear-gradient(145deg, rgba(249, 115, 22, 0.92), rgba(251, 191, 36, 0.84));
  color: #fff;
}

.metrics .stat:nth-child(5) {
  background: linear-gradient(145deg, rgba(239, 68, 68, 0.92), rgba(251, 113, 133, 0.82));
  color: #fff;
}

.metrics .k,
.metrics .v {
  position: relative;
  z-index: 1;
  color: inherit;
}

.k {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.v {
  margin-top: 14px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 700;
}

.charts {
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  margin-bottom: 18px;
}

.panel {
  padding: 18px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

h3 {
  margin: 0 0 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.panel-sub {
  margin: -4px 0 14px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
}

.donut {
  --pct: 0;
  width: 134px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.42), transparent 30%),
    conic-gradient(from -90deg, var(--blue) calc(var(--pct) * 1%), rgba(217, 228, 243, 0.9) 0);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 14px 30px rgba(37, 99, 235, 0.16);
  animation: chartPop 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.donut::before {
  content: "";
  width: 86px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(241, 246, 255, 0.95));
  box-shadow: inset 0 0 0 1px rgba(197, 214, 238, 0.5);
  position: absolute;
}

.donut span {
  position: relative;
  z-index: 1;
  font-family: "Space Grotesk", sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
}

.donut.alt {
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.42), transparent 30%),
    conic-gradient(from -90deg, var(--orange) calc(var(--pct) * 1%), rgba(227, 233, 243, 0.95) 0);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 14px 30px rgba(249, 115, 22, 0.18);
}

.legend {
  display: grid;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-soft);
}

.legend div {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(244, 248, 255, 0.9);
  border: 1px solid rgba(195, 214, 239, 0.6);
}

.legend b {
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  margin-right: 6px;
}

.layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.2fr 1fr;
}

.facility-list {
  display: grid;
  gap: 12px;
}

.facility-item {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(190, 212, 238, 0.75);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(243, 248, 255, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.facility-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--ink);
}

.facility-top span {
  font-weight: 700;
}

.facility-top b {
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
}

.track {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(218, 229, 243, 0.85), rgba(238, 243, 250, 0.8));
  overflow: hidden;
}

.bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--sky), var(--blue));
  background-size: 200% 100%;
  transform-origin: left center;
  animation: growBar 1s cubic-bezier(0.2, 0.8, 0.2, 1) both, shimmerBar 5s linear infinite;
}

.empty {
  margin: 0;
  color: var(--ink-soft);
}

.send-form {
  display: grid;
  gap: 10px;
}

.two-col-form {
  grid-template-columns: 1fr;
}

.hospital-meta {
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

.hospital-meta strong {
  color: var(--ink);
}

.hospital-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.hospital-actions form {
  margin: 0;
  flex: 1 1 150px;
}

.hospital-actions .download-link,
.hospital-actions button {
  min-height: 42px;
}

.hospital-actions .btn-stop {
  background: linear-gradient(135deg, var(--rose), #b91c1c);
}

.login-wrap {
  min-height: 88vh;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(520px, 100%);
  padding: 26px;
}

.login-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 8px 0 18px;
}

.login-logo {
  display: block;
  width: min(100%, 360px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 30px rgba(37, 99, 235, 0.16));
  animation: panelRise 0.7s ease both;
}

.login-powered {
  margin: 16px 0 0;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
}

.filter-panel {
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.table-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(6, 182, 212, 0.1));
  border: 1px solid rgba(136, 175, 236, 0.35);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(6, 182, 212, 0.12));
  color: var(--blue);
  border: 1px solid rgba(150, 186, 240, 0.44);
  text-decoration: none;
  font-weight: 800;
  transition: transform 0.2s ease, background 0.2s ease;
}

.download-link:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(6, 182, 212, 0.18));
}

.appeals-table {
  width: 100%;
  min-width: 880px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.appeals-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 14px 12px;
  background: linear-gradient(180deg, rgba(242, 247, 255, 0.98), rgba(235, 243, 255, 0.98));
  color: #49607f;
  border-bottom: 1px solid rgba(189, 208, 233, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  text-align: left;
}

.appeals-table tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(225, 234, 245, 0.95);
  vertical-align: top;
}

.appeals-table tbody tr:nth-child(odd) {
  background: rgba(251, 253, 255, 0.9);
}

.appeals-table tbody tr:nth-child(even) {
  background: rgba(245, 249, 255, 0.72);
}

.appeals-table tbody tr:hover {
  background: rgba(227, 239, 255, 0.76);
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status.ok {
  color: #0d6b58;
  background: rgba(15, 157, 137, 0.13);
  border: 1px solid rgba(15, 157, 137, 0.22);
}

.status.wait {
  color: #9a5a0c;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.24);
}

label {
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 800;
}

input,
textarea,
select,
button {
  width: 100%;
  font: inherit;
  border-radius: 14px;
}

input,
textarea,
select {
  border: 1px solid rgba(187, 207, 234, 0.72);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  padding: 12px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

textarea {
  min-height: 118px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

button {
  border: 0;
  padding: 12px 16px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--blue), var(--sky));
  box-shadow: 0 16px 28px rgba(37, 99, 235, 0.22);
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
  box-shadow: 0 18px 32px rgba(37, 99, 235, 0.26);
}

.metrics .card,
.charts .panel,
.layout .panel,
.filter-panel,
.panel {
  animation: panelRise 0.55s ease both;
}

.metrics .card:nth-child(1) { animation-delay: 0.03s; }
.metrics .card:nth-child(2) { animation-delay: 0.08s; }
.metrics .card:nth-child(3) { animation-delay: 0.13s; }
.metrics .card:nth-child(4) { animation-delay: 0.18s; }
.metrics .card:nth-child(5) { animation-delay: 0.23s; }
.charts .panel:nth-child(1) { animation-delay: 0.26s; }
.charts .panel:nth-child(2) { animation-delay: 0.32s; }
.layout .panel:nth-child(1) { animation-delay: 0.36s; }
.layout .panel:nth-child(2) { animation-delay: 0.42s; }

@keyframes panelRise {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes floatBlob {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(28px, -18px) scale(1.06);
  }
}

@keyframes pulseBadge {
  0%, 100% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 10px 20px rgba(255, 255, 255, 0.08);
  }
  50% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 18px 30px rgba(255, 255, 255, 0.14);
  }
}

@keyframes chartPop {
  from {
    transform: scale(0.82) rotate(-10deg);
    opacity: 0.35;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

@keyframes growBar {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes shimmerBar {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 200% 0;
  }
}

@keyframes spinHalo {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1040px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .wrap {
    width: min(100% - 18px, 100%);
    padding: 18px 0 28px;
  }

  .hero {
    padding: 22px 18px;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .donut-wrap,
  .panel-head,
  .search-row {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .search-row {
    display: grid;
  }

  .appeals-table {
    min-width: 720px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
