.portal-body {
  --bg: #f7f6fb;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --line: #e5e1f0;
  --text: #1c1330;
  --muted: #6c6480;
  --soft: #f1edfa;

  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
}

[hidden] {
  display: none !important;
}

.portal-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 28px;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 18px;
}

.portal-brand img {
  height: 32px;
  width: auto;
}

.portal-brand em {
  font-style: normal;
  color: var(--purple-bright);
}

.portal-logout {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.portal-logout:hover {
  border-color: var(--purple-bright);
}

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

/* Login */
.portal-login {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.portal-login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 8px 30px rgba(50, 30, 90, 0.08);
}

.portal-login-card h1 {
  font-size: 22px;
  margin: 0 0 6px;
}

.portal-login-card form {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.portal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.portal-field input,
.portal-field textarea {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
}

.portal-field input:focus,
.portal-field textarea:focus {
  outline: none;
  border-color: var(--purple-bright);
}

.portal-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.portal-checkbox input {
  width: 17px;
  height: 17px;
  accent-color: var(--purple);
  cursor: pointer;
}

.portal-tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.portal-tag {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.portal-tag:hover {
  border-color: var(--purple-bright);
  color: var(--purple);
}

.portal-tag.is-selected {
  background: var(--soft);
  border-color: var(--purple);
  color: var(--purple);
  font-weight: 700;
}

.portal-tag.is-selected::before {
  content: "✓ ";
  font-weight: 800;
}

.portal-tag:active {
  transform: scale(0.97);
}

.portal-tag-add {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.portal-tag-add input {
  flex: 1;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}

.portal-tag-add button {
  background: none;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--purple);
  font-weight: 700;
  font-size: 13px;
  padding: 0 14px;
  cursor: pointer;
}

.portal-schedule-day-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  flex-wrap: wrap;
}

.portal-schedule-day-row:nth-child(odd) {
  background: var(--soft);
}

.portal-schedule-day-toggle {
  min-width: 90px;
}

.portal-schedule-day-times {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-schedule-day-times input[type="time"] {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}

.portal-schedule-day-times span {
  font-size: 12px;
  color: var(--muted);
}

.portal-schedule-closed-label {
  font-size: 12px;
  font-style: italic;
}

.portal-doctor-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(50, 30, 90, 0.06);
}

.portal-doctor-card img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 8px;
  background: var(--soft);
}

.portal-doctor-card strong {
  display: block;
  font-size: 14px;
}

.portal-doctor-card span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.portal-doctor-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.portal-doctor-badge.is-available {
  background: #e4f9ec;
  color: #1f9d55;
}

.portal-doctor-badge.is-unavailable {
  background: var(--soft);
  color: var(--muted);
}

.portal-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.portal-photo-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(50, 30, 90, 0.06);
}

#login-submit,
#clinica-save {
  margin-top: 6px;
  background: linear-gradient(135deg, #6d38ee, #9c56ff);
  border: none;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
}

#login-submit:hover,
#clinica-save:hover {
  filter: brightness(1.08);
}

.portal-error {
  color: #d1264f;
  font-size: 13px;
  font-weight: 600;
}

.portal-success {
  color: #1f9d55;
  font-size: 13px;
  font-weight: 600;
}

/* Dashboard */
.portal-welcome h1 {
  font-size: 26px;
  margin: 0 0 4px;
}

.portal-tabs {
  display: flex;
  gap: 8px;
  margin: 24px 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}

.portal-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
}

.portal-tab.is-active {
  color: var(--purple);
  background: var(--soft);
}

.portal-panel-head h2 {
  font-size: 18px;
  margin: 0 0 4px;
}

.portal-panel-head {
  margin-bottom: 16px;
}

.portal-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 16px;
}

.portal-search-input {
  width: 100%;
  max-width: 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  margin-bottom: 18px;
}

.portal-search-input:focus {
  outline: none;
  border-color: var(--purple-bright);
}

.portal-rx-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.portal-rx-print {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  padding: 4px 11px;
  cursor: pointer;
}

.portal-rx-print:hover {
  border-color: var(--purple-bright);
  color: var(--purple);
}

.portal-pending-section {
  background: linear-gradient(135deg, rgba(109, 56, 238, 0.08), rgba(156, 86, 255, 0.08));
  border: 1px solid rgba(140, 80, 240, 0.25);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 24px;
}

.portal-pending-head {
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text);
}

.portal-pending-section .portal-card {
  background: var(--panel);
}

.portal-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.portal-approve-btn {
  background: linear-gradient(135deg, #6d38ee, #9c56ff);
  border: none;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.portal-reschedule-toggle {
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
}

.portal-reschedule-form {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.portal-reschedule-form input {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}

.portal-reschedule-save {
  background: var(--purple);
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.portal-citas-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}

.portal-citas-main {
  min-width: 0;
}

.portal-calendar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 6px;
  box-shadow: 0 12px 32px rgba(80, 40, 160, 0.1);
  overflow: hidden;
}

@media (max-width: 860px) {
  .portal-citas-layout {
    grid-template-columns: 1fr;
  }
  .portal-calendar {
    max-width: 360px;
    margin: 0 auto 20px;
  }
}

.portal-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 22px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #6d38ee, #9c56ff);
  border-radius: 20px 20px 0 0;
  color: #fff;
}

.portal-calendar-head strong {
  text-transform: capitalize;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.portal-calendar-head button {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.15s ease, transform 0.15s ease;
}

.portal-calendar-head button:hover {
  background: rgba(255, 255, 255, 0.32);
  transform: scale(1.06);
}

.portal-calendar-weekdays,
.portal-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.portal-calendar-weekdays {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin: 14px 0 2px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.portal-calendar-grid {
  padding: 4px 10px 14px;
}

.portal-cal-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
}

.portal-cal-day {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}

.portal-cal-day.is-outside {
  color: var(--line);
  cursor: default;
}

.portal-cal-day.has-apt {
  background: var(--soft);
  color: var(--purple);
  font-weight: 800;
}

.portal-cal-day.has-apt::after {
  content: "";
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--purple);
}

.portal-cal-day.is-today {
  box-shadow: inset 0 0 0 2px var(--purple-bright);
}

.portal-cal-day.is-selected {
  background: linear-gradient(135deg, #6d38ee, #9c56ff);
  color: #fff;
  box-shadow: 0 6px 14px rgba(124, 58, 237, 0.35);
}

.portal-cal-day.is-selected::after {
  background: #fff;
}

.portal-cal-day:not(.is-outside):hover {
  transform: scale(1.08);
}

.portal-cal-day[data-count]:not(.is-selected)::before {
  content: attr(data-count);
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.portal-cal-clear {
  display: block;
  margin: -6px 0 10px 20px;
  background: none;
  border: none;
  color: var(--purple);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.portal-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: 0 4px 16px rgba(50, 30, 90, 0.06);
}

.portal-card img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--soft);
}

.portal-card-body {
  flex: 1;
  min-width: 180px;
}

.portal-card-body strong {
  display: block;
  font-size: 15px;
}

.portal-card-body span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.portal-status {
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.portal-patient-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(50, 30, 90, 0.06);
}

.portal-patient-card img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 10px;
  background: var(--soft);
}

.portal-patient-card strong {
  display: block;
  font-size: 15px;
}

.portal-patient-card span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.portal-clinica-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: start;
}

.portal-clinic-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.portal-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.portal-field-row-actions {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}

.portal-clinica-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.portal-side-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 4px 16px rgba(50, 30, 90, 0.06);
}

.portal-side-block h3 {
  margin: 0 0 2px;
  font-size: 15px;
}

.portal-side-block .portal-muted {
  font-size: 12px;
  margin-bottom: 12px;
}

.portal-side-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.portal-add-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.portal-add-form input[type="text"] {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}

.portal-doctor-card {
  position: relative;
}

.portal-remove-x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(20, 10, 40, 0.55);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.portal-photo-item {
  position: relative;
}

.portal-side-block .portal-grid,
.portal-side-block .portal-photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

@media (max-width: 900px) {
  .portal-clinica-layout {
    grid-template-columns: 1fr;
  }
  .portal-field-row {
    grid-template-columns: 1fr;
  }
}

.portal-patient-card {
  cursor: pointer;
  transition: transform 0.12s ease;
}

.portal-patient-card:hover {
  transform: translateY(-2px);
}

.portal-back-btn {
  background: none;
  border: none;
  color: var(--purple);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  padding: 0 0 18px;
}

.portal-patient-hero {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 26px 28px;
  border-radius: 22px;
  background: linear-gradient(135deg, #6d38ee, #9c56ff);
  color: #fff;
  margin-bottom: 28px;
}

.portal-patient-hero-photo {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  padding: 3px;
  background: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.portal-patient-hero-photo img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.2);
  display: block;
}

.portal-patient-hero-info h2 {
  margin: 0 0 2px;
  font-size: 22px;
}

.portal-patient-hero-info p {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
}

.portal-patient-hero-stat {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.portal-timeline {
  position: relative;
  padding-left: 28px;
}

.portal-timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line);
}

.portal-timeline-item {
  position: relative;
  margin-bottom: 22px;
}

.portal-timeline-dot {
  position: absolute;
  left: -28px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--dot-color, var(--purple));
  box-shadow: 0 0 0 4px var(--panel), 0 0 0 5px var(--line);
}

.portal-timeline-card {
  margin: 0;
}

.portal-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: var(--pill-color, var(--purple));
  background: color-mix(in srgb, var(--pill-color, var(--purple)) 14%, transparent);
}

.portal-visit-date {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.portal-visit {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 12px;
  background: var(--panel);
  box-shadow: 0 4px 20px rgba(50, 30, 90, 0.05);
}

.portal-visit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  flex-wrap: wrap;
  gap: 6px;
}

.portal-visit-head strong {
  font-size: 15.5px;
  letter-spacing: -0.1px;
}

.portal-visit-head span {
  font-size: 12px;
  color: var(--muted);
}

.portal-visit-date {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px !important;
}

.portal-visit-notes-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  margin-bottom: 6px;
}

.portal-visit textarea {
  width: 100%;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  resize: vertical;
}

.portal-visit textarea:focus {
  outline: none;
  border-color: var(--purple-bright);
}

.portal-visit-save {
  margin-top: 8px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--purple);
  font-weight: 700;
  font-size: 11.5px;
  padding: 6px 14px;
  cursor: pointer;
}

.portal-visit-save:hover {
  border-color: var(--purple-bright);
  background: var(--soft);
}

.portal-visit-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.portal-visit-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.portal-visit-section-head > span:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.1px;
}

.portal-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  font-size: 13px;
  flex-shrink: 0;
}

.portal-section-icon.is-rx {
  background: linear-gradient(135deg, #fde68a, #f59e0b22);
}

.portal-section-icon.is-exam {
  background: linear-gradient(135deg, #a7f3d0, #10b98122);
}

.portal-visit-toggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--purple);
  font-weight: 700;
  font-size: 11.5px;
  padding: 6px 13px;
  cursor: pointer;
}

.portal-visit-toggle:hover {
  border-color: var(--purple-bright);
  background: var(--soft);
}

.portal-rx-list,
.portal-exam-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-rx-card {
  background: var(--soft);
  border-left: 3px solid var(--purple);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
}

.portal-rx-date {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.portal-rx-med {
  padding: 4px 0;
  font-size: 13px;
}

.portal-rx-med + .portal-rx-med {
  border-top: 1px dashed var(--line);
}

.portal-rx-med span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
  margin-top: 1px;
}

.portal-rx-form {
  margin-top: 10px;
  background: var(--soft);
  border-radius: 12px;
  padding: 12px;
}

.portal-rx-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.rx-notes {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  resize: vertical;
  margin-bottom: 8px;
}

.portal-rx-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}

.portal-rx-row-top {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 1fr 0.9fr auto;
  gap: 6px;
}

.portal-rx-row input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  min-width: 0;
  width: 100%;
}

.portal-rx-remove-line {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.portal-rx-add-line {
  background: none;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--purple);
  font-weight: 700;
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  margin-right: 8px;
}

.portal-rx-save {
  background: linear-gradient(135deg, #6d38ee, #9c56ff);
  border: none;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
}

.portal-exam-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--soft);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12px;
}

.portal-exam-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 13px;
  flex-shrink: 0;
}

.portal-exam-item .portal-exam-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.portal-exam-item button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--purple);
  font-weight: 700;
  font-size: 11.5px;
  padding: 5px 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.portal-exam-item button:hover {
  border-color: var(--purple-bright);
}

.portal-file-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--purple);
  font-weight: 700;
  font-size: 11.5px;
  padding: 6px 14px;
  cursor: pointer;
}

.portal-file-btn:hover {
  border-color: var(--purple-bright);
  background: var(--soft);
}

.portal-file-btn.is-uploading {
  opacity: 0.6;
  pointer-events: none;
}

@media (max-width: 600px) {
  .portal-shell {
    padding: 16px 14px 60px;
  }
  .portal-tabs {
    overflow-x: auto;
  }
  .portal-rx-row-top {
    grid-template-columns: 1fr 1fr;
  }
}
