/* ============================================================
   Customer Portal
   ============================================================ */

.portal {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ---- Sidebar ---- */

.portal__sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  display: flex !important;
  flex-direction: column;
  padding: 24px 0;
  overflow: hidden;
  height: 100%;
}

.portal__user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 20px;
  border-bottom: 1px solid #f4f4f5;
  margin-bottom: 8px;
}

.portal__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #18181b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.portal__user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.portal__user-name {
  font-size: 14px;
  font-weight: 600;
  color: #18181b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal__user-email {
  font-size: 12px;
  color: #71717a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal__nav {
  flex: 1;
  padding: 8px 12px;
}

.portal__nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #52525b;
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.portal__nav-link:hover {
  background: #f4f4f5;
  color: #18181b;
}

.portal__nav-link--active {
  background: #f4f4f5;
  color: #18181b;
  font-weight: 600;
}

.portal__nav-link svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.portal__nav-link--active svg {
  opacity: 1;
}

.portal__nav-label {
  flex: 1;
}

.portal__nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 9999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
}

.portal__sidebar-footer {
  padding: 16px 20px 0;
  border-top: 1px solid #f4f4f5;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.portal__back-link,
.portal__signout-link {
  font-size: 13px;
  color: #71717a;
  text-decoration: none;
  transition: color 0.15s;
}

.portal__back-link:hover,
.portal__signout-link:hover {
  color: #18181b;
}

.portal__mobile-toggle {
  display: none;
}

/* ---- Main Content ---- */

.portal__main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px;
  background: #fafafa;
  overflow-y: auto;
}

.portal__header {
  margin-bottom: 32px;
}

.portal__header-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal__title {
  font-size: 24px;
  font-weight: 600;
  color: #18181b;
  margin: 0;
}

.portal__subtitle {
  font-size: 14px;
  color: #71717a;
  margin: 4px 0 0;
}

.portal__breadcrumb {
  font-size: 13px;
  color: #a1a1aa;
  margin-bottom: 8px;
}

.portal__breadcrumb a {
  color: #71717a;
  text-decoration: none;
}

.portal__breadcrumb a:hover {
  color: #18181b;
}

.portal__breadcrumb span {
  margin: 0 4px;
}

/* ---- Summary Cards ---- */

.portal__cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

@media (min-width: 768px) {
  .portal__cards {
    grid-template-columns: repeat(4, 1fr);
  }
}

.portal-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.portal-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.portal-card__icon--blue { background: #dbeafe; color: #2563eb; }
.portal-card__icon--green { background: #dcfce7; color: #16a34a; }
.portal-card__icon--purple { background: #ede9fe; color: #7c3aed; }
.portal-card__icon--amber { background: #fef3c7; color: #d97706; }

.portal-card__content {
  display: flex;
  flex-direction: column;
}

.portal-card__value {
  font-size: 24px;
  font-weight: 700;
  color: #18181b;
  line-height: 1;
}

.portal-card__label {
  font-size: 12px;
  color: #71717a;
  margin-top: 4px;
}

/* ---- Sections ---- */

.portal__section {
  margin-bottom: 32px;
}

.portal__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.portal__section-title {
  font-size: 16px;
  font-weight: 600;
  color: #18181b;
  margin: 0;
}

.portal__section-link {
  font-size: 13px;
  color: #71717a;
  text-decoration: none;
}

.portal__section-link:hover {
  color: #18181b;
}

/* ---- Lists ---- */

.portal__list {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

.portal__empty {
  text-align: center;
  padding: 60px 24px;
  color: #a1a1aa;
}

.portal__empty svg {
  margin: 0 auto 16px;
}

.portal__empty p {
  font-size: 15px;
  margin: 0 0 16px;
}

.portal__empty--small {
  padding: 32px 24px;
}

/* ---- Notification Items ---- */

.notif {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #f4f4f5;
  transition: background 0.1s;
}

.notif:last-child { border-bottom: none; }

.notif--unread {
  background: #fafbff;
}

.notif__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  flex-shrink: 0;
  margin-top: 6px;
}

.notif__dot--unread {
  background: #3b82f6;
}

.notif__content {
  flex: 1;
  min-width: 0;
}

.notif__title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #18181b;
}

.notif__body {
  display: block;
  font-size: 13px;
  color: #52525b;
  margin-top: 2px;
  line-height: 1.4;
}

.notif__time {
  display: block;
  font-size: 12px;
  color: #a1a1aa;
  margin-top: 4px;
}

.notif__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.notif__action {
  font-size: 13px;
  font-weight: 500;
  color: #18181b;
  text-decoration: none;
}

.notif__action:hover { text-decoration: underline; }

.notif__action--muted {
  color: #a1a1aa;
}

/* ---- Order Rows ---- */

.order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f4f4f5;
  text-decoration: none;
  transition: background 0.1s;
}

.order-row:last-child { border-bottom: none; }

.order-row--link:hover { background: #f9fafb; }

.order-row__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.order-row__id {
  font-size: 14px;
  font-weight: 600;
  color: #18181b;
}

.order-row__date,
.order-row__items {
  font-size: 13px;
  color: #71717a;
}

.order-row__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-row__total {
  font-size: 15px;
  font-weight: 600;
  color: #18181b;
}

/* ---- Treatment Rows ---- */

.treatment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f4f4f5;
  text-decoration: none;
  transition: background 0.1s;
}

.treatment-row:last-child { border-bottom: none; }

.treatment-row--link:hover { background: #f9fafb; }

.treatment-row__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.treatment-row__name {
  font-size: 14px;
  font-weight: 600;
  color: #18181b;
}

.treatment-row__date {
  font-size: 13px;
  color: #71717a;
}

.treatment-row__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.treatment-row__link {
  font-size: 13px;
  font-weight: 500;
  color: #18181b;
  text-decoration: none;
}

.refill-pill {
  display: inline-block;
  align-self: flex-start;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: 9999px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.refill-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.refill-summary__counts {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.refill-summary__remaining {
  font-size: 28px;
  font-weight: 700;
  color: #18181b;
}

.refill-summary__total {
  font-size: 14px;
  color: #71717a;
}

.refill-summary__note {
  margin: 0;
  font-size: 13px;
  color: #71717a;
}

.refill-bar {
  width: 100%;
  height: 8px;
  background: #f4f4f5;
  border-radius: 9999px;
  overflow: hidden;
}

.refill-bar__fill {
  height: 100%;
  background: #2563eb;
  transition: width 0.3s ease;
}

.outcome-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.outcome-card__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
}

.outcome-card__body {
  flex: 1;
  min-width: 0;
}

.outcome-card__title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: #18181b;
}

.outcome-card__text {
  margin: 0;
  font-size: 13px;
  color: #52525b;
  line-height: 1.5;
}

.outcome-card--approved .outcome-card__icon {
  background: #dcfce7;
  color: #166534;
}

.outcome-card--rejected .outcome-card__icon {
  background: #fee2e2;
  color: #991b1b;
}

.shipment-placeholder {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shipment-placeholder__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.shipment-placeholder__note {
  margin: 8px 0 0;
  font-size: 12px;
  color: #71717a;
  font-style: italic;
}

.refill-summary--inline {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #f4f4f5;
}

.refill-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
  background: #f9fafb;
  border-radius: 10px;
}

.refill-stats__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.refill-stats__value {
  font-size: 20px;
  font-weight: 700;
  color: #18181b;
  line-height: 1.1;
}

.refill-stats__label {
  font-size: 11px;
  font-weight: 500;
  color: #71717a;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.shipment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shipment-row {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  background: #fafafa;
}

.shipment-row__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.shipment-row__fill {
  font-size: 14px;
  font-weight: 600;
  color: #18181b;
}

.shipment-row__meta {
  font-size: 12px;
  color: #71717a;
  margin-bottom: 12px;
}

.shipment-row__details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.shipment-row__detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shipment-row__detail .portal__detail-value a {
  color: #2563eb;
  text-decoration: none;
}

.shipment-row__note {
  margin: 10px 0 0;
  font-size: 12px;
  color: #71717a;
  font-style: italic;
}

.status-badge--in_transit { background: #dbeafe; color: #1e40af; }
.status-badge--delivered { background: #dcfce7; color: #166534; }
.status-badge--returned { background: #fee2e2; color: #991b1b; }

.subscription-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-left: 4px solid;
}

.subscription-banner__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.subscription-banner__body {
  flex: 1;
  min-width: 0;
}

.subscription-banner__title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: #18181b;
}

.subscription-banner__text {
  margin: 0;
  font-size: 13px;
  color: #52525b;
  line-height: 1.5;
}

.subscription-banner--ended {
  background: #fffbeb;
  border-left-color: #f59e0b;
}

.subscription-banner--ended .subscription-banner__icon {
  color: #b45309;
}

.subscription-banner--cancelled {
  background: #f4f4f5;
  border-left-color: #71717a;
}

.subscription-banner--cancelled .subscription-banner__icon {
  color: #52525b;
}

.portal__tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
}

.portal__tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #71717a;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.1s, border-color 0.1s;
}

.portal__tab:hover { color: #18181b; }

.portal__tab--active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.portal__tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 9999px;
  background: #f4f4f5;
  color: #52525b;
  font-size: 11px;
  font-weight: 600;
}

.portal__tab--active .portal__tab-count {
  background: #dbeafe;
  color: #1e40af;
}

/* ---- Subscription Rows ---- */

.sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f4f4f5;
}

.sub-row:last-child { border-bottom: none; }

.sub-row__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sub-row__name {
  font-size: 14px;
  font-weight: 600;
  color: #18181b;
}

.sub-row__date {
  font-size: 13px;
  color: #71717a;
}

/* ---- Status Badges ---- */

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-badge--sm { font-size: 10px; padding: 2px 8px; }
.status-badge--lg { font-size: 12px; padding: 4px 14px; }

.status-badge--pending,
.status-badge--awaiting_prescription,
.status-badge--waiting { background: #fef3c7; color: #92400e; }
.status-badge--paid,
.status-badge--active,
.status-badge--completed,
.status-badge--approved { background: #dcfce7; color: #166534; }
.status-badge--failed,
.status-badge--cancelled { background: #fee2e2; color: #991b1b; }
.status-badge--refunded,
.status-badge--paused { background: #f3f4f6; color: #374151; }
.status-badge--created,
.status-badge--assigned,
.status-badge--processing { background: #dbeafe; color: #1e40af; }
.status-badge--support { background: #fef3c7; color: #92400e; }

/* ---- Detail Cards ---- */

.portal__detail-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.portal__detail-title {
  font-size: 15px;
  font-weight: 600;
  color: #18181b;
  margin: 0 0 16px;
}

.portal__detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.portal__detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.portal__detail-label {
  font-size: 12px;
  font-weight: 500;
  color: #a1a1aa;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.portal__detail-value {
  font-size: 14px;
  font-weight: 500;
  color: #18181b;
}

.portal__detail-value a {
  color: #2563eb;
  text-decoration: none;
}

/* ---- Order Detail ---- */

.order-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f4f4f5;
}

.order-item-row:last-child { border-bottom: none; }

.order-item-row__name {
  font-size: 14px;
  font-weight: 500;
  color: #18181b;
  display: block;
}

.order-item-row__freq {
  font-size: 13px;
  color: #71717a;
  display: block;
  margin-top: 2px;
}

.order-item-row__price {
  font-size: 14px;
  font-weight: 600;
  color: #18181b;
}

.order-total-row {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #e5e7eb;
  margin-top: 12px;
  padding-top: 16px;
  font-size: 16px;
  font-weight: 600;
  color: #18181b;
}

/* ---- Timeline ---- */

.timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding: 8px 0;
}

.timeline__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  position: relative;
  min-width: 80px;
}

.timeline__step::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: #e5e7eb;
}

.timeline__step:last-child::after { display: none; }

.timeline__step--done::after {
  background: #16a34a;
}

.timeline__dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e5e7eb;
  position: relative;
  z-index: 1;
  transition: all 0.3s;
}

.timeline__step--done .timeline__dot {
  background: #16a34a;
}

.timeline__step--current .timeline__dot {
  background: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.timeline__label {
  font-size: 11px;
  font-weight: 500;
  color: #a1a1aa;
  text-align: center;
}

.timeline__step--done .timeline__label { color: #166534; }
.timeline__step--current .timeline__label { color: #1e40af; font-weight: 600; }

.timeline__step--denied .timeline__dot { background: #dc2626; box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15); }
.timeline__step--denied .timeline__label { color: #991b1b; font-weight: 600; }
.timeline__step--denied::after { background: #dc2626; }

.timeline-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.timeline-notice__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  margin-top: 2px;
}

.timeline-notice__body { flex: 1; min-width: 0; }

.timeline-notice__link {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}

.timeline-notice--action {
  background: #fef3c7;
  color: #92400e;
}

.timeline-notice--awaiting {
  background: #dbeafe;
  color: #1e40af;
}

/* ---- Messages ---- */

.msg-thread {
  display: flex;
  flex-direction: column;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  height: min(600px, 70vh);
  overflow: hidden;
}

.msg-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.msg-thread .portal__empty--small {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  min-width: 0;
}

.msg--received {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.msg--sent {
  background: #18181b;
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

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

.msg__sender {
  font-size: 12px;
  font-weight: 600;
}

.msg--received .msg__sender { color: #18181b; }
.msg--sent .msg__sender { color: rgba(255, 255, 255, 0.7); }

.msg__time {
  font-size: 11px;
  white-space: nowrap;
}

.msg--received .msg__time { color: #a1a1aa; }
.msg--sent .msg__time { color: rgba(255, 255, 255, 0.5); }

.msg__body {
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: break-word;
}

.msg--received .msg__body { color: #3f3f46; }

.msg__files {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.msg__file {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.05);
  text-decoration: none;
}

.msg--received .msg__file { color: #2563eb; }
.msg--sent .msg__file { color: rgba(255, 255, 255, 0.8); background: rgba(255, 255, 255, 0.1); }

/* Compose bar */

.msg-compose-bar {
  border-top: 1px solid #e5e7eb;
  padding: 12px 16px;
  background: #ffffff;
  flex-shrink: 0;
}

.msg-compose {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.msg-compose__row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.msg-compose__input {
  flex: 1 1 auto;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  box-sizing: border-box;
  max-height: 120px;
  line-height: 1.4;
  overflow-y: auto;
}

.msg-compose__input:focus {
  outline: none;
  border-color: #a1a1aa;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.05);
}

.msg-compose__send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #18181b;
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.msg-compose__send:hover { background: #3f3f46; }

/* Attach button */
.msg-compose__attach {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #6b7280;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s;
}

.msg-compose__attach:hover { color: #18181b; }

/* Attachment preview */
.msg-compose__attachment-preview[hidden] { display: none; }

.msg-compose__attachment-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin-bottom: 4px;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 13px;
  color: #3f3f46;
}

.msg-compose__attachment-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.msg-compose__attachment-remove {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #a1a1aa;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}

.msg-compose__attachment-remove:hover { color: #ef4444; }

/* Send icon / spinner toggle */
.msg-compose__spinner { display: none; }
.msg-compose-bar--sending .msg-compose__icon { display: none; }
.msg-compose-bar--sending .msg-compose__spinner { display: block; animation: msg-spin 0.7s linear infinite; }
.msg-compose-bar--sending .msg-compose__send { opacity: 0.6; pointer-events: none; }
.msg-compose-bar--sending .msg-compose__input { opacity: 0.5; }

@keyframes msg-spin { to { transform: rotate(360deg); } }

/* ---- Payment History ---- */

.payment-log {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

.payment-log__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.payment-log__table thead {
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.payment-log__table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.payment-log__row { border-bottom: 1px solid #f3f4f6; }
.payment-log__row:last-child { border-bottom: none; }

.payment-log__table td {
  padding: 14px 16px;
  vertical-align: middle;
}

.payment-log__date {
  white-space: nowrap;
  color: #6b7280;
}

.payment-log__desc { color: #18181b; }

.payment-log__meta {
  display: block;
  font-size: 12px;
  color: #a1a1aa;
  margin-top: 2px;
}

th.payment-log__amount,
td.payment-log__amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

@media (max-width: 640px) {
  .payment-log__table th,
  .payment-log__table td { padding: 10px 12px; font-size: 13px; }
}

/* ---- Profile Form ---- */

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

.portal__form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .portal__form-row {
    grid-template-columns: 1fr;
  }
}

.portal__form-field {
  display: flex;
  flex-direction: column;
}

.portal__form-hint {
  font-size: 12px;
  color: #a1a1aa;
  margin-top: 4px;
}

.portal__form-actions {
  margin-top: 8px;
}

/* ---- Bell Icon ---- */

.site-header__bell {
  position: relative;
}

.site-header__bell-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
  body.body--portal {
    height: auto;
    overflow: auto;
  }

  .portal {
    flex-direction: column;
    min-height: 0;
  }

  .portal__sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 0;
    overflow: visible;
  }

  .portal__sidebar.hidden {
    display: none !important;
  }

  .portal__sidebar {
    display: flex !important;
  }

  .portal__mobile-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #ffffff;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: #18181b;
    cursor: pointer;
    width: 100%;
  }

  .portal__main {
    padding: 24px 16px;
    overflow-y: visible;
  }

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

  .portal__detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Action Center
   ============================================================ */

.action-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid #f4f4f5;
  text-decoration: none;
  transition: background 0.1s;
}

.action-row:last-child { border-bottom: none; }

.action-row--pending:hover { background: #fffbeb; }
.action-row--completed { opacity: 0.7; }

.action-row__icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-row__icon--id { background: #dbeafe; color: #2563eb; }
.action-row__icon--video { background: #fef3c7; color: #d97706; }
.action-row__icon--file { background: #ede9fe; color: #7c3aed; }
.action-row__icon--medical { background: #dcfce7; color: #16a34a; }
.action-row__icon--done { background: #dcfce7; color: #16a34a; }

.action-row__content {
  flex: 1;
  min-width: 0;
}

.action-row__title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #18181b;
}

.action-row__desc {
  display: block;
  font-size: 13px;
  color: #52525b;
  margin-top: 2px;
  line-height: 1.4;
}

.action-row__time {
  display: block;
  font-size: 12px;
  color: #a1a1aa;
  margin-top: 4px;
}

.action-row__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.action-complete-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  color: #166534;
  font-size: 14px;
  font-weight: 500;
}

.action-completed-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  color: #166534;
  font-size: 14px;
  font-weight: 500;
  margin-top: 24px;
}

.action-description {
  font-size: 15px;
  line-height: 1.6;
  color: #3f3f46;
  margin: 0;
}

.action-form__title {
  font-size: 16px;
  font-weight: 600;
  color: #18181b;
  margin: 0 0 8px;
}

.action-form__hint {
  font-size: 13px;
  color: #71717a;
  margin: 0 0 16px;
}
