:root {
  --bg: #bfe6ff;
  --surface: #ffffff;
  --surface-soft: #f8fbfe;
  --surface-tint: #eef8ff;
  --ink: #162033;
  --ink-soft: #475569;
  --muted: #657084;
  --line: #e5edf5;
  --line-strong: #b8d7eb;
  --brand: #38b6ff;
  --brand-strong: #1286c9;
  --brand-soft: #eef8ff;
  --accent: #8bcdf5;
  --accent-soft: #edf7ff;
  --warn: #7a5200;
  --warn-soft: #fff2d2;
  --danger: #b42318;
  --danger-soft: #fdecec;
  --shadow-sm: 0 1px 2px rgba(20, 43, 76, 0.06);
  --shadow-md: 0 12px 30px rgba(20, 43, 76, 0.08);
  --shadow-lg: 0 24px 70px rgba(20, 43, 76, 0.18);
  --radius: 22px;
  --radius-sm: 16px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.50), rgba(191, 230, 255, 0) 340px),
    linear-gradient(180deg, rgba(56, 182, 255, 0.16), rgba(191, 230, 255, 0) 320px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: inherit;
}

/* topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 12px 22px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(229, 237, 245, 0.9);
  box-shadow: 0 10px 28px rgba(20, 43, 76, 0.08);
  backdrop-filter: blur(14px);
}

.topbar strong {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  font-size: 15px;
  font-weight: 760;
  letter-spacing: 0;
}

.topbar strong::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-right: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #79d4ff);
  box-shadow: 0 0 0 4px rgba(56, 182, 255, 0.14);
}

.topbar a {
  color: inherit;
  text-decoration: none;
}

.topbar-left {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 18px;
}

.topbar-right a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  color: var(--brand-strong);
  background: var(--surface-tint);
}

.topbar-right a:hover {
  color: #ffffff;
  background: var(--brand-strong);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.topnav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.topnav a:hover {
  color: var(--brand-strong);
  background: #ffffff;
}

.topnav a.active {
  color: #ffffff;
  background: var(--ink);
  box-shadow: var(--shadow-sm);
}

.page {
  width: 100%;
  padding: 22px;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: min(100%, 1320px);
  margin: 0 auto;
  min-width: 0;
}

/* layout */
.grid,
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid > .card:nth-child(n + 3) {
  min-width: 0;
}

.patient-detail-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

/* cards */
.card {
  position: relative;
  min-width: 0;
  padding: 20px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(229, 237, 245, 0.96);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.card::before {
  display: none;
}

/* headings */
h1,
h2 {
  color: var(--ink);
  letter-spacing: 0;
}

h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.18;
}

h2 {
  margin: 0 0 14px;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 760;
}

.muted {
  color: var(--muted);
}

/* forms */
label {
  display: block;
  margin-top: 13px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 720;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  box-shadow: 0 1px 0 rgba(23, 32, 27, 0.02);
}

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

input::placeholder,
textarea::placeholder {
  color: #9aa6a0;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.18);
}

input[readonly],
input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-soft);
  color: var(--muted);
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0 4px;
}

/* buttons */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  min-height: 40px;
  margin-top: 0;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.15;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(56, 182, 255, 0.24);
}

button:hover,
.btn:hover {
  opacity: 1;
  background: var(--brand-strong);
}

button:active,
.btn:active {
  transform: translateY(1px);
}

button:disabled,
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.btn-sm {
  min-height: 34px;
  padding: 8px 11px;
  font-size: 12px;
}

.btn-soft {
  border-color: var(--line);
  background: var(--surface-tint);
  color: var(--brand-strong);
  box-shadow: none;
}

.btn-soft:hover {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--brand-strong);
}

.btn.danger,
button.danger {
  background: var(--danger);
  box-shadow: 0 8px 18px rgba(180, 35, 24, 0.16);
}

.btn.danger:hover,
button.danger:hover {
  background: #842929;
}

form > button,
form > .btn {
  margin-top: 16px;
}

/* helpers */
.row {
  display: flex;
  min-width: 0;
}

.between {
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.link {
  color: var(--brand-strong);
  font-weight: 700;
  text-decoration: none;
}

.link:hover {
  color: var(--brand-strong);
  text-decoration: underline;
}

/* tags */
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-tint);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
}

.tag.ok {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.tag.ok::before {
  content: "";
  width: 13px;
  height: 13px;
  margin-right: 5px;
  border-radius: 999px;
  background: var(--brand-strong);
  flex: 0 0 auto;
  -webkit-mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='4' stroke-linecap='round' stroke-linejoin='round' d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
    center / 10px 10px no-repeat;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='4' stroke-linecap='round' stroke-linejoin='round' d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
    center / 10px 10px no-repeat;
}

.tag.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.tag a {
  color: inherit;
  text-decoration: none;
}

.tag a:hover {
  text-decoration: underline;
}

/* patient detail */
.topbar-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-tint);
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.topbar-back:hover {
  background: #ffffff;
}

.patient-profile-card {
  padding: 18px 20px;
  background: linear-gradient(135deg, #ffffff 0%, #f0fbff 100%);
}

.patient-profile-row {
  align-items: center;
}

.patient-profile-card h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.12;
}

.patient-profile-card .muted {
  margin-top: 8px !important;
  line-height: 1.5;
}

.patient-profile-card .row[style*="gap"] {
  width: auto;
}

.patient-profile-card .row[style*="gap"] .btn:first-child {
  display: none;
}

.patient-profile-card .row[style*="gap"] .btn {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--brand-strong);
  box-shadow: none;
  font-size: 12px;
}

.patient-profile-card .row[style*="gap"] .btn::before {
  content: "Edit";
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-tint);
  color: var(--brand-strong);
  font-size: 9px;
  font-weight: 900;
}

.icon-badge-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 780;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.icon-badge-link:hover {
  border-color: var(--line-strong);
  background: var(--surface-tint);
  text-decoration: none;
}

.icon-badge-link svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* billing cards */
.legacy-billing-table,
.card table.legacy-billing-table {
  display: none !important;
}

.billing-card-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.billing-card-list.compact {
  gap: 10px;
}

.patient-detail-stack .is-extra {
  display: none;
}

.patient-detail-stack .card.is-expanded .is-extra {
  display: revert;
}

.patient-detail-stack .card.is-expanded .billing-record-card.is-extra {
  display: grid;
}

.expand-card-button {
  display: flex;
  width: fit-content;
  min-height: 40px;
  margin: 14px auto 0;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--brand-strong);
  box-shadow: 0 10px 22px rgba(20, 43, 76, 0.10);
  font-size: 12px;
  font-weight: 840;
}

.expand-card-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-tint);
}

.billing-record-card {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 254, 0.98));
  box-shadow: var(--shadow-sm);
}

.billing-record-card.is-paid {
  border-color: #cfe9d7;
  background:
    linear-gradient(135deg, rgba(247, 253, 249, 0.98), rgba(235, 248, 240, 0.98));
}

.billing-record-card.is-paid .billing-card-amount {
  border-color: #cfe9d7;
  background: #f4fbf6;
  color: #277447;
}

.billing-record-card.is-paid .billing-card-date {
  color: #4f8062;
}

.billing-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.billing-card-date {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.billing-card-patient {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 760;
  line-height: 1.25;
}

.billing-card-subtitle {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.billing-card-subtitle span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-tint);
  color: var(--brand-strong);
  font-size: 11px;
  font-weight: 800;
}

.billing-card-amount {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--brand-strong);
  font-size: 16px;
  font-weight: 820;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.billing-card-value-line {
  margin-top: 9px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 760;
}

.payment-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 860;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.payment-status-badge.is-paid {
  border: 1px solid #cfe9d7;
  background: #f4fbf6;
  color: #277447;
}

.payment-status-badge.is-unpaid {
  border: 1px solid #f4dfaa;
  background: var(--warn-soft);
  color: var(--warn);
}

.portal-document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.billing-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.billing-card-actions {
  display: flex;
  justify-content: flex-end;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
}

.patient-portal-card {
  background: rgba(255, 255, 255, 0.92);
}

.portal-link-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}

.portal-link-box input {
  margin-top: 0;
  font-size: 13px;
}

.patient-portal-body {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), rgba(191, 230, 255, 0) 340px),
    var(--bg);
}

.patient-portal-shell {
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 108px;
}

.patient-portal-topbar {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.patient-portal-logo-card {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  background: #f4f2ed;
  box-shadow: var(--shadow-md);
}

.patient-portal-logo-card img {
  width: min(260px, 80%);
  height: auto;
  display: block;
}

.patient-portal-header {
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.80);
  border-radius: 28px;
  background: linear-gradient(135deg, #ffffff 0%, #f0fbff 100%);
  box-shadow: var(--shadow-md);
}

.patient-portal-header h1 {
  margin: 12px 0 6px;
  font-size: 24px;
  line-height: 1.08;
}

.patient-portal-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.patient-portal-identity {
  display: inline-flex;
  margin-top: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--surface-tint);
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 820;
}

.patient-portal-mini-header {
  margin-bottom: 12px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.80);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-sm);
}

.patient-portal-mini-header span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.portal-tabs {
  position: sticky;
  top: 8px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin: 14px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.portal-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
}

.portal-tabs a.active {
  background: var(--ink);
  color: #ffffff;
}

.portal-bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  width: min(430px, 100%);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 6px 10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 -12px 30px rgba(20, 43, 76, 0.10);
  backdrop-filter: blur(14px);
}

.portal-bottom-nav a {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 820;
  text-decoration: none;
}

.portal-bottom-nav a.active {
  background: var(--surface-tint);
  color: var(--brand-strong);
}

.portal-bottom-nav svg,
.portal-bottom-nav i,
.portal-bottom-nav i svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.portal-bottom-nav a.active svg,
.portal-bottom-nav a.active i svg {
  stroke-width: 2.8;
}

.patient-portal-section {
  scroll-margin-top: 76px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(229, 237, 245, 0.96);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-md);
}

.patient-portal-home {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.portal-home-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 104px;
  padding: 16px;
  border: 1px solid rgba(229, 237, 245, 0.96);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-md);
}

.portal-home-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.patient-portal-section .patient-portal-billing-list .is-extra {
  display: none;
}

.patient-portal-section.is-expanded .patient-portal-billing-list .is-extra {
  display: grid;
}

.patient-portal-section .expand-card-button {
  display: flex;
  width: fit-content;
  min-height: 40px;
  margin: 14px auto 0;
  padding: 9px 16px;
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--brand-strong);
  font-weight: 840;
  box-shadow: 0 10px 22px rgba(20, 43, 76, 0.10);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title-row h2 {
  margin: 0;
}

/* tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  background: var(--surface-soft);
}

th:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

th:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: rgba(238, 248, 255, 0.75);
}

td .tag + .tag {
  margin-left: 5px;
}

/* list */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  display: block;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.list-item:hover {
  border-color: var(--line-strong);
  box-shadow: 0 12px 24px rgba(20, 43, 76, 0.08);
  transform: translateY(-1px);
}

.item-title {
  margin-bottom: 3px;
  font-weight: 790;
}

/* form grid */
.form-grid {
  display: grid;
  gap: 12px;
}

details {
  padding-top: 2px;
}

summary {
  width: fit-content;
  font-weight: 750;
}

/* modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow: auto;
  background: rgba(22, 32, 51, 0.42);
  backdrop-filter: blur(10px);
}

.modal-backdrop .modal {
  width: min(900px, 100%);
  max-height: calc(100vh - 48px);
  margin-top: 0;
  overflow-y: auto;
  padding: 22px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.modal-backdrop .modal > .row:first-child {
  position: sticky;
  top: -22px;
  z-index: 2;
  margin: -22px -22px 18px;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.modal form + form {
  margin-top: 12px;
}

/* home */
.home-shell {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.home-hero {
  min-height: auto;
  display: block;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.80);
  border-radius: 28px;
  overflow: hidden;
  background:
    linear-gradient(135deg, #ffffff 0%, #f0fbff 100%);
  box-shadow: var(--shadow-md);
  color: var(--ink);
}

.home-kicker {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-tint);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 780;
}

.home-hero h1 {
  max-width: 100%;
  margin: 14px 0 10px;
  color: var(--ink);
  font-size: 30px;
  line-height: 1.08;
  font-weight: 830;
}

.home-hero p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.action-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 24px;
  align-items: center;
  min-height: 108px;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.action-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 18px 34px rgba(20, 43, 76, 0.12);
}

.action-card-primary {
  background:
    linear-gradient(135deg, #ffffff 0%, #f0fbff 100%);
}

.action-card-disabled {
  opacity: 0.66;
  cursor: not-allowed;
}

.action-card-disabled:hover {
  transform: none;
  border-color: var(--line);
  box-shadow: var(--shadow-md);
}

.action-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--brand), #79d4ff);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(56, 182, 255, 0.25);
}

.action-icon svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-icon i,
.action-icon i svg {
  width: 27px;
  height: 27px;
  stroke-width: 2.2;
}

.action-label {
  display: block;
  margin-bottom: 7px;
  font-size: 18px;
  line-height: 1.15;
  font-weight: 820;
}

.action-text {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.action-arrow {
  color: var(--brand-strong);
  font-size: 32px;
  font-weight: 300;
}

.action-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--brand-strong);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

/* responsive */
@media (max-width: 900px) {
  .page {
    padding: 16px;
  }

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

  .card {
    padding: 18px;
  }
}

@media (max-width: 700px) {
  body {
    font-size: 14px;
  }

  .topbar {
    position: sticky;
    min-height: auto;
    padding: 10px 12px;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .topbar-left {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topbar strong {
    min-height: 28px;
  }

  .topbar-right {
    position: absolute;
    top: 10px;
    right: 12px;
  }

  .topbar-right a {
    min-height: 30px;
    padding: 5px 9px;
    font-size: 12px;
  }

  .topnav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topnav a {
    width: 100%;
  }

  .page {
    padding: 12px;
  }

  .content {
    gap: 12px;
  }

  .card {
    padding: 15px;
    box-shadow: 0 6px 18px rgba(19, 33, 27, 0.07);
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 17px;
  }

  .row {
    flex-wrap: wrap;
  }

  .row.between {
    align-items: flex-start;
  }

  .card .row.between > .row {
    width: 100%;
    align-items: stretch;
  }

  .card .row.between > .row .btn,
  .card .row.between > .btn {
    width: 100%;
  }

  .card .row.between > .btn.btn-soft,
  .card .row.between > .row .btn.btn-soft {
    width: auto;
  }

  .btn,
  button {
    width: 100%;
    min-height: 42px;
    white-space: normal;
  }

  .btn.btn-sm,
  .icon-badge-link {
    width: auto;
  }

  form .row {
    width: 100%;
    flex-direction: column;
    align-items: stretch !important;
  }

  form .row > div {
    width: 100%;
  }

  .card table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .card table th,
  .card table td {
    padding: 10px 9px;
  }

  .list-item {
    padding: 12px;
  }

  .list-item .row.between {
    flex-wrap: nowrap;
    align-items: center;
  }

  .list-item .tag {
    flex: 0 0 auto;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal-backdrop .modal {
    max-height: calc(100vh - 20px);
    padding: 16px;
  }

  .modal-backdrop .modal > .row:first-child {
    top: -16px;
    margin: -16px -16px 16px;
    padding: 14px 16px;
  }

  .home-shell {
    padding: 12px;
  }

  .home-hero {
    min-height: auto;
    padding: 22px;
  }

  .home-actions {
    grid-template-columns: 1fr;
  }

  .action-card {
    min-height: 118px;
  }
}

@media (max-width: 430px) {
  .page {
    padding: 10px;
  }

  .card {
    padding: 13px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .tag {
    font-size: 11px;
    padding-inline: 7px;
  }

  .home-hero h1 {
    font-size: 28px;
  }

  .action-card {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .action-arrow,
  .action-pill {
    grid-column: 2;
    justify-self: start;
  }
}
