:root {
  --bg: #fff7f8;
  --bg-soft: #f8e9ef;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --text: #3d2430;
  --muted: #8e6c78;
  --primary: #b94f73;
  --primary-2: #d98ca9;
  --accent: #b99ce8;
  --accent-soft: #f3ebff;
  --success: #4f9f78;
  --warning: #c58a28;
  --danger: #c95764;
  --line: rgba(185, 79, 115, 0.16);
  --shadow: 0 22px 60px rgba(120, 56, 78, 0.14);
  --shadow-soft: 0 12px 32px rgba(120, 56, 78, 0.1);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", "Inter", Arial, sans-serif;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 7% 12%, rgba(217, 140, 169, 0.24), transparent 34%),
    radial-gradient(circle at 92% 4%, rgba(185, 156, 232, 0.2), transparent 30%),
    linear-gradient(135deg, #fffafb 0%, #fff6f7 38%, #f8eef4 100%),
    var(--bg);
  min-height: 100vh;
}

.container {
  max-width: 1120px;
  margin: 28px auto;
  padding: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.narrow {
  max-width: 650px;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 10px;
}

h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.03em;
}

h3 {
  margin: 8px 0 2px;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.muted {
  color: var(--muted);
  margin: 6px 0 0;
}

.btn {
  display: inline-block;
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), #9f3f61);
  box-shadow: 0 12px 24px rgba(185, 79, 115, 0.24);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(185, 79, 115, 0.28);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ghost {
  background: #ffffff;
  color: var(--primary);
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(120, 56, 78, 0.08);
}

.btn-ghost:hover {
  box-shadow: 0 12px 24px rgba(120, 56, 78, 0.12);
}

.btn-danger {
  background: linear-gradient(135deg, #c95764, #e78d96);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(201, 87, 100, 0.24);
}

.btn-danger:hover {
  box-shadow: 0 16px 30px rgba(201, 87, 100, 0.28);
}

.tech-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(120, 56, 78, 0.06);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tech-table th,
.tech-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
}

.tech-table th {
  background: linear-gradient(135deg, #fff0f4, #f7efff);
  color: #6c3349;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status.ok {
  background: rgba(79, 159, 120, 0.14);
  color: #2f7353;
}

.status.pending {
  background: rgba(197, 138, 40, 0.14);
  color: #90621a;
}

.status.locked {
  background: rgba(201, 87, 100, 0.14);
  color: #a1424c;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.stack {
  display: grid;
  gap: 14px;
}

.form-grid h3,
.full-row {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: #5b3847;
  font-weight: 600;
}

input {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  background: #fffafc;
  color: var(--text);
  outline: none;
}

select,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  background: #fffafc;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(185, 79, 115, 0.12);
}

select:focus,
textarea:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(185, 79, 115, 0.12);
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

.card a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.break-all {
  overflow-wrap: anywhere;
  word-break: break-all;
  font-family: "Consolas", "Menlo", "Courier New", monospace;
  font-size: 0.92em;
}

.pdf-frame {
  width: 100%;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
}

.video-shell {
  position: relative;
}

.video-locked-player {
  pointer-events: none;
}

.video-controls {
  margin-top: 10px;
}

.video-placeholder {
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(135deg, #fff5f8, #f7efff);
}

.ok-bg {
  border-color: rgba(79, 159, 120, 0.3);
  background: #effaf5;
  color: #2f7353;
}

.danger-bg {
  border-color: rgba(201, 87, 100, 0.3);
  background: #fff0f2;
  color: #8f3540;
}

.check {
  margin: 2px 0 2px;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.check input {
  width: 16px;
  height: 16px;
}

.helper-text {
  font-size: 12px;
  margin-top: -2px;
}

.gestation-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
  padding-right: 10px;
}

.gestation-card-info p {
  margin: 0 0 10px;
}

.gestation-week-media {
  width: 320px;
  min-width: 320px;
  max-width: 320px;
  margin-right: 6px;
}

.gestation-week-image {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-top: 8px;
  background: #fffafc;
}

.readonly-field input,
.readonly-field textarea,
.readonly-field select {
  background: #f6eef2;
  color: #7d5b68;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.actions form {
  margin: 0;
}

.page-back-link {
  display: flex;
  justify-content: flex-start;
  margin-top: 16px;
}

.action-card,
.footer-actions-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 95% 10%, rgba(185, 156, 232, 0.16), transparent 30%),
    #ffffff;
  box-shadow: var(--shadow-soft);
}

.action-card h3,
.footer-actions-card h3 {
  margin: 0 0 4px;
}

.action-card .muted,
.footer-actions-card .muted {
  margin-top: 0;
}

.footer-actions-card {
  margin-top: 28px;
}

.footer-actions {
  justify-content: flex-end;
  row-gap: 10px;
}

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0 12px;
}

.tab-link {
  display: inline-block;
  padding: 9px 14px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(120, 56, 78, 0.06);
}

.tab-link.active {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 24px rgba(185, 79, 115, 0.2);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(61, 36, 48, 0.24);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay.active {
  display: flex;
}

.loading-card {
  min-width: 280px;
  max-width: 90vw;
  text-align: center;
  padding: 18px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(185, 79, 115, 0.16);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 10px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.link,
a {
  color: var(--primary);
}

.topbar {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.topbar p,
.panel p,
.card p {
  line-height: 1.55;
}

.dashboard-hero,
.portal-hero,
.auth-hero {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 88% 10%, rgba(185, 156, 232, 0.24), transparent 32%),
    linear-gradient(135deg, #ffffff 0%, #fff1f5 58%, #f5edff 100%);
  box-shadow: var(--shadow-soft);
}

.dashboard-hero::after,
.portal-hero::after,
.auth-hero::after {
  content: "";
  position: absolute;
  right: -58px;
  top: -58px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(217, 140, 169, 0.18);
}

.dashboard-hero > *,
.portal-hero > *,
.auth-hero > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-intro {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 10px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
}

.form-grid h3 {
  margin: 12px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #fff5f8, #f7efff);
}

.client-shell {
  max-width: 980px;
}

.client-shell .tabs {
  position: sticky;
  top: 10px;
  z-index: 5;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px rgba(120, 56, 78, 0.08);
}

.client-name-pill {
  display: inline-flex;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(185, 79, 115, 0.1);
  color: var(--primary);
  font-weight: 700;
}

@media (max-width: 820px) {
  .container {
    margin: 10px;
    padding: 14px;
    border-radius: 12px;
  }

  h1 {
    font-size: 22px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .actions .link {
    width: 100%;
    text-align: center;
    padding: 8px 0;
  }

  .action-card,
  .footer-actions-card {
    align-items: stretch;
    flex-direction: column;
  }

  .footer-actions {
    justify-content: stretch;
  }

  .footer-actions form,
  .footer-actions .btn,
  .page-back-link .btn,
  .action-card .btn {
    width: 100%;
  }

  .pdf-frame {
    min-height: 420px;
  }

  input {
    font-size: 16px;
  }

  .gestation-card-grid {
    grid-template-columns: 1fr;
  }

  .gestation-week-media {
    width: 100%;
    min-width: 0;
    max-width: 340px;
    margin-right: 0;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .container {
    margin: 8px;
    padding: 12px;
  }

  .table-wrap {
    overflow-x: visible;
  }

  .tech-table,
  .tech-table thead,
  .tech-table tbody,
  .tech-table tr,
  .tech-table th,
  .tech-table td {
    display: block;
    width: 100%;
  }

  .tech-table {
    min-width: 0;
    border: none;
    border-radius: 0;
    overflow: visible;
  }

  .tech-table thead {
    position: absolute;
    left: -9999px;
    top: -9999px;
  }

  .tech-table tr {
    margin: 0 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    overflow: hidden;
  }

  .tech-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: right;
    word-break: break-word;
  }

  .tech-table td:last-child {
    border-bottom: none;
  }

  .tech-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    text-align: left;
    flex: 0 0 40%;
    max-width: 40%;
  }

  .tech-table td.actions,
  .tech-table td .actions {
    justify-content: flex-start;
  }

  .tech-table td form.actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .tech-table td form.actions input[type="number"] {
    width: 100%;
  }

  .tech-table td form.actions .btn,
  .tech-table td form .btn {
    width: 100%;
  }
}
