:root {
  --bg: #f5efe6;
  --bg-accent: #efe3d2;
  --panel: rgba(255, 250, 244, 0.86);
  --stroke: rgba(88, 72, 53, 0.16);
  --text: #2b241d;
  --muted: #6f6253;
  --brand: #1f8f87;
  --brand-deep: #0f5f5c;
  --alert: #a65a38;
  --shadow: 0 18px 50px rgba(52, 38, 19, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(31, 143, 135, 0.18), transparent 28%),
    radial-gradient(circle at right center, rgba(166, 90, 56, 0.14), transparent 22%),
    linear-gradient(180deg, var(--bg), #f9f5ef 40%, #f2e9de 100%);
  font-family: Aptos, "Trebuchet MS", sans-serif;
}

.shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 24px auto;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 248, 240, 0.92), rgba(248, 238, 226, 0.78));
  box-shadow: var(--shadow);
}

.eyebrow,
.panel-kicker,
.hero-label {
  margin: 0 0 8px;
  color: var(--brand-deep);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1,
.panel-head h2,
.empty-state h2,
.detail-head h2,
.table-head h3,
.meta-block h3 {
  margin: 0;
  font-family: "Iowan Old Style", Georgia, serif;
  font-weight: 700;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.95;
  max-width: 10ch;
}

.lede {
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.5;
}

.hero-card {
  min-width: 240px;
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
  color: #f7fffe;
  align-self: flex-start;
}

.hero-card strong {
  display: block;
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 8px;
}

.hero-card span {
  color: rgba(247, 255, 254, 0.9);
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 20px;
  margin-top: 20px;
}

.panel {
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel-list,
.panel-detail {
  padding: 24px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

input[type="search"] {
  width: min(240px, 100%);
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.stat-card,
.detail-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(88, 72, 53, 0.12);
}

.stat-card span,
.detail-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.stat-card strong,
.detail-card strong {
  font-size: 1.35rem;
}

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

.invoice-item {
  width: 100%;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.64);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
  text-align: left;
  color: inherit;
}

.invoice-item:hover,
.invoice-item.active {
  transform: translateY(-1px);
  border-color: rgba(31, 143, 135, 0.32);
  background: rgba(255, 255, 255, 0.95);
}

.invoice-item-top,
.invoice-item-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.invoice-item-top strong {
  font-size: 1.02rem;
}

.invoice-item p {
  margin: 8px 0;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 143, 135, 0.12);
  color: var(--brand-deep);
  font-size: 0.84rem;
  font-weight: 700;
}

.badge.pending {
  background: rgba(166, 90, 56, 0.14);
  color: var(--alert);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: end;
}

.detail-patient {
  margin-top: 8px;
  color: var(--muted);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--brand-deep);
  color: #f5fffe;
  text-decoration: none;
  font-weight: 700;
  border: 0;
  cursor: pointer;
}

.button-link-alt {
  background: #dfeeea;
  color: var(--brand-deep);
}

.detail-grid,
.meta-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.meta-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-block {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(88, 72, 53, 0.12);
}

.meta-block p {
  color: var(--muted);
  line-height: 1.5;
}

.table-wrap {
  margin-top: 18px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(88, 72, 53, 0.1);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.58);
}

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

  .detail-grid,
  .meta-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 18px, 100%);
    margin: 10px auto;
  }

  .hero,
  .panel-list,
  .panel-detail {
    padding: 18px;
  }

  .hero {
    flex-direction: column;
  }

  .detail-grid,
  .meta-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .detail-head {
    flex-direction: column;
    align-items: stretch;
  }

  input[type="search"] {
    width: 100%;
  }
}
