﻿:root {
  --green: #008000;
  --green-700: #008000;
  --green-dark: #006600;
  --text: #0f172a;
  --muted: #64748b;
  --bg: #f1f5f9;
  --accent: #e2e8f0;
  --ring: rgba(15, 23, 42, 0.08);
  --white: #ffffff;
}

/* Reset / base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--green-700);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */
.portal-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
}

/* Header – MDHC-aligned */
.portal-header {
  background: var(--green);
  color: #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

/* Match main site height & padding feel */
.portal-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem; /* approx main-site header padding */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;        /* consistent header height */
}

/* Brand: logo + text */
.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}

/* Optional logo image */
.portal-logo-mark {
  display: flex;
  align-items: center;
}

.portal-logo-image {
  height: 40px;         /* adjust to match main site logo */
  width: auto;
  display: block;
}

/* Title + subtitle block */
.portal-logo-text {
  display: flex;
  flex-direction: column;
  align-items: center;  /* centers subtitle under full title */
  line-height: 1.1;
}

.portal-logo-main {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.2px;
}

.portal-logo-sub {
  margin-top: 2px;
  font-size: 0.9rem;
  opacity: 0.95;
}

/* Nav */
.portal-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.portal-nav a {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
}

.portal-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  text-decoration: none;
}

.portal-nav-logout {
  font-weight: 600;
}

/* Mobile-optimized header */
@media (max-width: 720px) {
  .portal-header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 0.75rem 1rem;
  }

  .portal-logo-image {
    height: 32px;
  }

  .portal-logo-main {
    font-size: 1.05rem;
    text-align: left;
  }

  .portal-logo-sub {
    font-size: 0.8rem;
  }

  .portal-logo-text {
    align-items: flex-start; /* subtitle under title, still visually tight */
  }

  .portal-nav {
    width: 100%;
    gap: 6px;
  }

  .portal-nav a {
    padding: 5px 9px;
    font-size: 0.85rem;
  }
}

.portal-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.portal-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.portal-logo-main {
  font-weight: 700;
  font-size: 1.25rem;
}

.portal-logo-sub {
  font-size: 0.9rem;
  opacity: 0.95;
  margin-top: 2px;
}

/* Nav */
.portal-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.portal-nav a {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
}

.portal-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

@media (max-width: 720px) {
  .portal-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .portal-nav {
    width: 100%;
    flex-wrap: wrap;
  }
}

/* Cards */
.card {
  background: var(--white);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 14px 0 22px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  border: 1px solid var(--accent);
}

.card h1 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.card h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.card p {
  margin-top: 4px;
  font-size: 0.95rem;
  color: var(--muted);
}

/* Forms / fields */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  margin-top: 12px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

label,
.field-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.field-control, .card input[type=text], .card input[type=email], .card input[type=password], .card input[type=date], .card input[type=number], .card select, .card textarea {
  width: 100%;
  padding: 8px 9px;
  border-radius: 8px;
  border: 1px solid #d0d7e2;
  font-size: 0.9rem;
  font-family: inherit;
  background: #ffffff;
}

.field-control:focus,
.card input:focus,
.card select:focus,
.card textarea:focus {
  outline: none;
  border-color: var(--green-700);
  box-shadow: 0 0 0 2px rgba(0, 128, 0, 0.12);
}

.field-help {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  border: none;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
  filter: brightness(0.96);
  text-decoration: none;
}

.btn-secondary {
  background: #ffffff;
  color: var(--green);
  border: 1px solid var(--green);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* Alerts */
.alert {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.85rem;
  margin: 10px 0;
}

.alert-error {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

/* Tables */
.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.portal-table th,
.portal-table td {
  padding: 8px 9px;
  border-bottom: 1px solid #e5e7eb;
}

.portal-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
  text-align: left;
}

.portal-table tr:last-child td {
  border-bottom: none;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-paid {
  background: #dcfce7;
  color: #166534;
}

/* Billing small links */
.billing-links {
  margin-top: 6px;
  font-size: 0.78rem;
}

/* Messages styling */
.section-divider {
  margin: 22px 0 14px;
  border: 0;
  border-top: 1px solid #e5e7eb;
}

.message-form {
  margin-top: 14px;
}

.messages-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.message-item {
  padding: 10px 0;
  border-bottom: 1px solid #e5e7eb;
}

.message-item:last-child {
  border-bottom: none;
}

.message-header {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 4px;
}

.from-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.from-patient {
  background: #e0f2fe;
  color: #075985;
}

.from-office {
  background: #ede9fe;
  color: #4c1d95;
}

.from-provider {
  background: #f5f3ff;
  color: #3730a3;
}

.message-subject {
  font-weight: 600;
  font-size: 0.9rem;
}

.message-meta {
  font-size: 0.75rem;
  color: #6b7280;
  margin-left: auto;
}

.message-context {
  margin-bottom: 4px;
}

.context-pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #eff6ff;
  color: #1d4ed8;
  margin-right: 4px;
  margin-top: 2px;
}

.pill-muted {
  background: #e5e7eb;
  color: #374151;
}

.message-body {
  font-size: 0.9rem;
  color: #111827;
  white-space: pre-wrap;
}

/* Context cards (bill/dispute) */
.context-card {
  padding: 10px 12px;
  border-radius: 10px;
  background: #f1f5f9;
  border: 1px solid #d4d7e3;
  font-size: 0.9rem;
  margin: 10px 0 16px;
}

/* Footer */
.portal-footer {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  margin-top: 24px;
}

.portal-footer-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 18px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.portal-footer-inner a {
  color: var(--green-700);
  font-weight: 500;
}

/* Small utilities */
.text-danger {
  color: #b91c1c;
}
