/**
 * Customer Portal Styles
 * Version: 8.7.0
 *
 * Professional, customer-focused design
 * Mobile-first responsive layout
 */

:root {
  --portal-primary: #2563EB; /* Blue */
  --portal-secondary: #10b981; /* Green */
  --portal-gradient: linear-gradient(135deg, #2563EB 0%, #10b981 100%);
  --header-height: 56px;
  --bottom-nav-height: 64px;
  --menu-width: 280px;
}

/* ========================================
   BASE LAYOUT
   ======================================== */
.portal-body {
  background: var(--surface-inset);
  min-height: 100vh;
  padding-top: var(--header-height);
  padding-bottom: var(--bottom-nav-height);
}

.portal-login {
  padding: 0;
}

/* ========================================
   LOGIN PAGE
   ======================================== */
.portal-login .login-header h1 {
  background: var(--portal-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.portal-help-text {
  margin-top: 24px;
  padding: 16px;
  background: var(--blue-wash);
  border-radius: 8px;
  border-left: 4px solid var(--portal-primary);
}

.portal-help-text p {
  font-size: 0.8125rem;
  color: var(--text-body);
  margin: 8px 0;
  line-height: 1.6;
}

.portal-help-text strong {
  color: var(--text-strong);
}

/* ========================================
   HEADER
   ======================================== */
.portal-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--portal-gradient);
  color: white;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  height: 100%;
  gap: 12px;
}

.portal-header .logo {
  height: 32px;
  display: flex;
  align-items: center;
}

.portal-header .logo img {
  height: 100%;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.portal-title {
  font-size: 1.125rem;
  font-weight: 600;
  flex: 1;
  text-align: center;
  margin: 0;
}

/* ========================================
   PORTAL MENU (Slide-in)
   ======================================== */
.portal-menu {
  position: fixed;
  top: 0;
  left: -100%;
  width: var(--menu-width);
  /* P1-5, same fix as the staff sidebar: 100vh is a fixed number taken at 100%
     zoom and ignores a phone's URL bar, so the panel clips. dvh tracks both.
     The vh line stays first as a fallback for anything that lacks dvh. */
  height: 100vh;
  height: 100dvh;
  background: white;
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
  z-index: 1100;
  transition: left 0.3s ease;
  overflow-y: auto;
}

.portal-menu.open {
  left: 0;
}

.menu-header {
  background: var(--portal-gradient);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.customer-info {
  display: flex;
  gap: 12px;
  flex: 1;
}

.customer-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: white;
  color: var(--portal-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  flex-shrink: 0;
}

.customer-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.customer-name {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
}

.customer-company {
  font-size: 0.8125rem;
  opacity: 0.9;
}

.close-menu {
  color: white;
  font-size: 2rem;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  min-width: 32px;
}

.menu-nav {
  padding: 8px 0;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 14px 20px;
  text-align: left;
  background: none;
  border: none;
  border-left: 4px solid transparent;
  font-size: 1rem;
  color: var(--text-strong);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s, opacity 0.2s;
  min-height: 48px;
}

.menu-item:active {
  background: var(--surface-inset);
}

.menu-item.active {
  background: var(--blue-wash);
  border-left-color: var(--portal-primary);
  color: var(--portal-primary);
  font-weight: 600;
}

/* ========================================
   BOTTOM NAVIGATION
   ======================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: white;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 900;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  height: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  min-width: 60px;
}

.bottom-nav-item .nav-icon {
  font-size: 1.5rem;
}

.bottom-nav-item .nav-label {
  font-size: 0.6875rem;
  font-weight: 500;
}

.bottom-nav-item.active {
  color: var(--portal-primary);
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.portal-main {
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.portal-view {
  display: none;
}

.portal-view.active {
  display: block;
}

.view-header {
  margin-bottom: 24px;
}

.view-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0 0 8px 0;
}

.view-filters {
  margin-top: 12px;
}

.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 0.875rem;
  background: white;
  cursor: pointer;
}

/* ========================================
   STATS GRID (Dashboard)
   ======================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.stat-icon {
  font-size: 2rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-strong);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ========================================
   QUICK ACTIONS
   ======================================== */
.quick-actions {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 32px;
}

.quick-actions h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-strong);
  margin: 0 0 16px 0;
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s, opacity 0.2s;
}

.action-btn:active {
  transform: scale(0.98);
  background: var(--surface-inset);
}

.action-icon {
  font-size: 1.75rem;
}

.action-text {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-body);
}

/* ========================================
   RECENT ACTIVITY
   ======================================== */
.recent-activity {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.recent-activity h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-strong);
  margin: 0 0 16px 0;
}

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

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--surface-muted);
  border-radius: 8px;
}

.activity-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.activity-details {
  flex: 1;
}

.activity-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-strong);
  margin-bottom: 2px;
}

.activity-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========================================
   JOB CARDS
   ======================================== */
.jobs-container,
.invoices-container,
.sites-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.job-card,
.invoice-card,
.site-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.job-card:active,
.invoice-card:active,
.site-card:active {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.job-header,
.invoice-header,
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.job-header h3,
.invoice-header h3,
.site-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-strong);
  margin: 0;
}

.job-details,
.invoice-details,
.site-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.job-detail-row,
.invoice-detail-row,
.site-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
}

.detail-label {
  color: var(--text-muted);
  font-weight: 500;
}

.detail-value {
  color: var(--text-strong);
  font-weight: 400;
}

/* ========================================
   BADGES
   ======================================== */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-blue {
  background: var(--blue-tint);
  color: var(--blue-deep);
}

.badge-green {
  background: var(--ok-tint);
  color: var(--ok-deep);
}

.badge-yellow {
  background: var(--warn-tint);
  color: var(--warn-deep);
}

.badge-red {
  background: var(--danger-tint);
  color: var(--danger-strong);
}

.badge-gray {
  background: var(--surface-inset);
  color: var(--text-body);
}

/* ========================================
   CONTACT FORM
   ======================================== */
.contact-container {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  max-width: 600px;
}

.contact-info-box {
  background: var(--blue-wash);
  border-left: 4px solid var(--portal-primary);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.contact-info-box h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-strong);
  margin: 0 0 8px 0;
}

.contact-info-box p {
  font-size: 0.875rem;
  color: var(--text-body);
  margin: 0;
  line-height: 1.6;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-success {
  text-align: center;
  padding: 32px;
}

.contact-success.hidden {
  display: none;
}

.success-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.contact-success h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ok-deep);
  margin: 0 0 8px 0;
}

.contact-success p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

/* ========================================
   EMPTY STATES
   ======================================== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-faint);
  font-size: 0.875rem;
}

.loading-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-faint);
  font-size: 0.875rem;
}

/* ========================================
   VERSION BADGE
   ======================================== */
.version-badge-bottom {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 12px);
  right: 12px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.6875rem;
  font-weight: 500;
  z-index: 850;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

/* ========================================
   JOB DETAIL ELEMENTS
   ======================================== */
.job-type {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 4px 0 0 0;
}

.job-card-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-align: right;
}

.view-details-link {
  font-size: 0.8125rem;
  color: var(--portal-primary);
  font-weight: 500;
  cursor: pointer;
}

.detail-header-gradient {
  background: linear-gradient(135deg, var(--brand) 0%, var(--ok-bright) 100%);
  color: white;
  padding: 24px;
  border-radius: 12px 12px 0 0;
  margin: -20px -20px 20px -20px;
}

.detail-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-header-content h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 0;
  color: white;
}

.detail-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-strong);
  margin: 0 0 12px 0;
  border-bottom: 2px solid var(--line);
  padding-bottom: 8px;
}

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

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-item .detail-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-item .detail-value {
  font-size: 0.875rem;
  color: var(--text-strong);
  font-weight: 400;
}

.detail-description {
  font-size: 0.875rem;
  color: var(--text-body);
  line-height: 1.6;
  margin: 0;
}

/* Visit History */
.visits-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.visit-item {
  background: var(--surface-muted);
  border-radius: 8px;
  padding: 16px;
  border-left: 4px solid var(--portal-primary);
}

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

.visit-header strong {
  font-size: 0.875rem;
  color: var(--text-strong);
}

.visit-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.visit-details p {
  font-size: 0.8125rem;
  color: var(--text-body);
  margin: 4px 0;
}

/* Photos Grid */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.photo-item {
  background: var(--surface-muted);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.photo-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.photo-category {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  padding: 8px 12px;
  margin: 0;
  background: white;
  border-top: 1px solid var(--line);
}

.photo-description {
  font-size: 0.75rem;
  color: var(--text-body);
  padding: 0 12px 12px 12px;
  margin: 0;
  line-height: 1.4;
}

/* Forms List */
.forms-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-item {
  background: var(--surface-muted);
  border-radius: 8px;
  padding: 16px;
  border-left: 4px solid var(--ok-bright);
}

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

.form-header strong {
  font-size: 0.875rem;
  color: var(--text-strong);
}

.form-details p {
  font-size: 0.8125rem;
  color: var(--text-body);
  margin: 4px 0;
}

/* ========================================
   INVOICE DETAIL ELEMENTS
   ======================================== */
.invoice-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 4px 0 0 0;
}

.invoice-card-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-align: right;
}

.invoice-line-items {
  overflow-x: auto;
}

.line-items-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.line-items-table thead {
  background: var(--surface-muted);
  border-bottom: 2px solid var(--line);
}

.line-items-table th {
  padding: 12px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.line-items-table td {
  padding: 12px;
  border-bottom: 1px solid var(--surface-inset);
  font-size: 0.875rem;
  color: var(--text-strong);
}

.line-items-table tbody tr:last-child td {
  border-bottom: none;
}

.line-items-table .text-center {
  text-align: center;
}

.line-items-table .text-right {
  text-align: right;
}

.invoice-totals {
  background: var(--surface-muted);
  border-radius: 8px;
  padding: 16px;
  max-width: 400px;
  margin-left: auto;
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.875rem;
}

.total-label {
  color: var(--text-muted);
  font-weight: 500;
}

.total-value {
  color: var(--text-strong);
  font-weight: 500;
}

.total-value.discount {
  color: var(--ok);
}

.total-value.paid {
  color: var(--text-muted);
}

.total-row-final {
  border-top: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  margin: 8px 0;
  padding: 12px 0;
  font-size: 1rem;
}

.total-row-final .total-label,
.total-row-final .total-value {
  font-weight: 700;
  color: var(--text-strong);
}

.total-row-outstanding {
  font-size: 1rem;
  font-weight: 700;
}

/* Payment History */
.payments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payment-item {
  background: var(--blue-wash);
  border-radius: 8px;
  padding: 16px;
  border-left: 4px solid var(--ok);
}

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

.payment-header strong {
  font-size: 0.875rem;
  color: var(--text-strong);
}

.payment-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ok);
}

.payment-details p {
  font-size: 0.8125rem;
  color: var(--text-body);
  margin: 4px 0;
}

/* ========================================
   SITES & LIFTS
   ======================================== */

/* Site Cards */
.sites-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.site-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.site-card.clickable {
  cursor: pointer;
}

.site-card.clickable:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.site-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, var(--blue-wash) 0%, var(--ok-wash) 100%);
  border-bottom: 1px solid var(--line);
}

.site-icon {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 8px;
  flex-shrink: 0;
}

.site-title h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-strong);
}

.site-subtitle {
  margin: 4px 0 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.site-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.site-info-row .info-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 100px;
}

.site-info-row .info-value {
  font-size: 0.8125rem;
  color: var(--text-strong);
  font-weight: 500;
  text-align: right;
}

.site-card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--surface-inset);
  display: flex;
  justify-content: flex-end;
}

.view-details-link {
  font-size: 0.8125rem;
  color: var(--portal-primary);
  font-weight: 500;
}

/* Lifts List */
.lifts-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.lift-card {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.lift-card.clickable {
  cursor: pointer;
}

.lift-card.clickable:hover {
  border-color: var(--orange);
  box-shadow: 0 2px 8px rgba(251, 146, 60, 0.15);
}

.lift-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: linear-gradient(135deg, var(--warn-wash) 0%, var(--warn-tint) 100%);
  border-bottom: 1px solid var(--line);
  position: relative;
}

.lift-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 6px;
  flex-shrink: 0;
}

.lift-title h4 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-strong);
}

.lift-title .lift-subtitle {
  margin: 2px 0 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.lift-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lift-info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.lift-info-row .info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 100px;
}

.lift-info-row .info-value {
  font-size: 0.75rem;
  color: var(--text-strong);
  font-weight: 500;
  text-align: right;
}

.lift-card-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--surface-inset);
  display: flex;
  justify-content: flex-end;
}

/* Alert Badges */
.alert-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.alert-badge.alert-red {
  background: var(--danger-tint);
  color: var(--danger);
  border: 1px solid var(--danger-soft);
}

.alert-badge.alert-yellow {
  background: var(--warn-tint);
  color: var(--warn-strong);
  border: 1px solid var(--warn);
}

.alert-badge.alert-green {
  background: var(--ok-tint);
  color: var(--ok);
  border: 1px solid var(--ok-tint);
}

/* Lift Detail Gradient */
.lift-gradient {
  background: linear-gradient(135deg, var(--orange) 0%, var(--warn) 100%) !important;
}

/* Status Alerts */
.status-alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.status-alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-alert-error {
  background: var(--danger-tint);
  color: var(--danger);
  border-left: 4px solid var(--danger);
}

.status-alert-warning {
  background: var(--warn-tint);
  color: var(--warn-strong);
  border-left: 4px solid var(--warn-strong);
}

.status-alert-success {
  background: var(--ok-tint);
  color: var(--ok);
  border-left: 4px solid var(--ok);
}

/* Service History */
.service-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.service-history-item {
  background: var(--surface-muted);
  border-radius: 8px;
  padding: 12px;
  border-left: 4px solid var(--portal-primary);
}

.service-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.service-date {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.service-history-body h4 {
  margin: 0 0 4px 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-strong);
}

.service-history-body p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-body);
  line-height: 1.5;
}

.service-engineer {
  margin-top: 4px !important;
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
}

/* ========================================
   BREAKDOWN REQUESTS
   ======================================== */

/* Breakdown Container */
.breakdown-container {
  max-width: 800px;
  margin: 0 auto;
}

.breakdown-intro {
  text-align: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--danger-tint) 0%, var(--warn-tint) 100%);
  border-radius: 12px;
  margin-bottom: 24px;
}

.breakdown-intro .intro-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.breakdown-intro h2 {
  margin: 0 0 8px 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-strong);
}

.breakdown-intro p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-body);
  line-height: 1.6;
}

/* Breakdown Form */
.breakdown-form {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.form-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.form-section h3 {
  margin: 0 0 16px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-strong);
}

.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

/* Entrapment tick-box on the breakdown form. Urgency alone can't carry this —
   a customer may pick "urgent" while someone is genuinely inside the lift. */
.portal-entrapment {
  padding: 12px 14px;
  border: 1px solid var(--danger-tint);
  border-radius: 8px;
  background: var(--danger-wash);
}

.portal-entrapment-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  font-weight: 600;
  color: var(--danger-deep);
  cursor: pointer;
}

.portal-entrapment-check input[type='checkbox'] {
  width: auto;
  margin: 0;
  flex-shrink: 0;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-body);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.875rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: white;
  color: var(--text-strong);
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--portal-primary);
  box-shadow: 0 0 0 3px var(--blue-alpha-10);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-help {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-breakdown {
  background: linear-gradient(135deg, var(--danger) 0%, var(--orange) 100%) !important;
  font-weight: 600;
}

.btn-breakdown:hover {
  opacity: 0.9;
}

.btn-secondary {
  padding: 12px 24px;
  background: var(--surface-inset);
  color: var(--text-body);
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.btn-secondary:hover {
  background: var(--line);
}

/* Success Message */
.breakdown-success {
  background: white;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.breakdown-success .success-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.breakdown-success h3 {
  margin: 0 0 12px 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-strong);
}

.breakdown-success p {
  margin: 0 0 24px 0;
  font-size: 0.875rem;
  color: var(--text-body);
  line-height: 1.6;
}

.success-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 300px;
  margin: 0 auto;
}

/* History View */
.breakdown-history {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.breakdown-history h3 {
  margin: 0 0 16px 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-strong);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.breakdown-history-item {
  background: var(--surface-muted);
  border-radius: 8px;
  padding: 16px;
  border-left: 4px solid var(--warn-strong);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.history-item-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.history-item-title .urgency-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
}

.history-item-title strong {
  font-size: 0.9375rem;
  color: var(--text-strong);
}

.history-item-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.history-item-status.status-new {
  background: var(--blue-tint);
  color: var(--blue-deep);
}

.history-item-status.status-acknowledged {
  background: var(--indigo-tint);
  color: var(--indigo);
}

.history-item-status.status-assigned {
  background: var(--warn-tint);
  color: var(--warn-strong);
}

.history-item-status.status-in_progress {
  background: var(--warn-tint);
  color: var(--warn-strong);
}

.history-item-status.status-completed {
  background: var(--ok-tint);
  color: var(--ok);
}

.history-item-status.status-cancelled {
  background: var(--surface-inset);
  color: var(--text-muted);
}

.history-item-body p {
  margin: 0 0 8px 0;
  font-size: 0.8125rem;
  color: var(--text-body);
}

.history-item-body p:last-child {
  margin-bottom: 0;
}

.history-item-description {
  margin-top: 12px !important;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--text-muted) !important;
  font-style: italic;
}

/* ========================================
   COMPLIANCE DOCUMENTS
   ======================================== */

/* Documents Container */
.documents-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.document-site-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.site-group-header {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-strong);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--portal-primary);
}

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

/* Document Cards */
.document-card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.document-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--portal-primary);
}

.document-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, var(--blue-wash) 0%, var(--blue-wash) 100%);
  border-bottom: 1px solid var(--line);
  position: relative;
}

.document-icon {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 8px;
  flex-shrink: 0;
}

.document-type {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
}

.doc-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.doc-badge-expired {
  background: var(--danger-tint);
  color: var(--danger);
}

.doc-badge-expiring {
  background: var(--warn-tint);
  color: var(--warn-strong);
}

.document-card-body {
  padding: 16px;
}

.document-title {
  margin: 0 0 12px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.4;
}

.document-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meta-item {
  display: flex;
  gap: 8px;
  font-size: 0.8125rem;
}

.meta-label {
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 90px;
}

.meta-value {
  color: var(--text-strong);
  font-weight: 500;
}

.document-card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--surface-inset);
  display: flex;
  gap: 8px;
  background: var(--surface-muted);
}

.btn-document {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-view {
  background: var(--portal-primary);
  color: white;
}

.btn-view:hover {
  background: var(--brand);
}

.btn-download {
  background: var(--ok-bright);
  color: white;
}

.btn-download:hover {
  background: var(--ok);
}

.doc-no-file {
  flex: 1;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-faint);
  font-style: italic;
  padding: 10px;
}

/* Empty State for Documents */
.empty-state {
  text-align: center;
  padding: 64px 24px;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.empty-state h3 {
  margin: 0 0 8px 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-strong);
}

.empty-state p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ========================================
   NOTIFICATIONS & PREFERENCES
   ======================================== */

/* Notifications Container */
.notifications-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 900px;
  margin: 0 auto;
}

.notification-section {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.section-intro {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--surface-inset);
}

.section-intro h2 {
  margin: 0 0 8px 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-strong);
}

.section-intro p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Preferences Form */
.preferences-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.pref-category {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pref-category h3 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-body);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.pref-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface-muted);
  border-radius: 8px;
  transition: background 0.2s ease;
}

.pref-item:hover {
  background: var(--surface-inset);
}

.pref-info {
  flex: 1;
}

.pref-info label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-strong);
  margin-bottom: 4px;
  cursor: pointer;
}

.pref-description {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--line-strong);
  transition: 0.3s;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: '';
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--portal-primary);
}

input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px var(--blue-alpha-20);
}

/* Notification History */
.notification-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notification-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--surface-muted);
  border-radius: 8px;
  border-left: 4px solid var(--portal-primary);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.notification-item:hover {
  background: var(--surface-inset);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.notification-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 8px;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

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

.notification-type {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--portal-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.notification-status {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.notification-status.status-sent {
  background: var(--ok-tint);
  color: var(--ok);
}

.notification-status.status-failed {
  background: var(--danger-tint);
  color: var(--danger);
}

.notification-status.status-pending {
  background: var(--warn-tint);
  color: var(--warn-strong);
}

.notification-subject {
  margin: 0 0 6px 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.4;
}

.notification-preview {
  margin: 0 0 8px 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-faint);
}

.notification-date {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 480px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

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

  .action-buttons {
    grid-template-columns: repeat(4, 1fr);
  }

  .portal-main {
    padding: 24px;
  }

  .bottom-nav {
    display: none;
  }

  .portal-body {
    padding-bottom: 0;
  }

  .photos-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

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

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

@media (min-width: 1024px) {
  /* ⚠️ THE HEADER USED TO BE HIDDEN HERE, LEAVING NO NAVIGATION AT ALL.
     `.bottom-nav` is already hidden from 768px up, so hiding `.portal-header`
     from 1024px up removed BOTH navigations — on any normal laptop a customer
     saw the dashboard with no menu, no way to reach Sites, Documents,
     Notifications or Contact Us, and NO WAY TO LOG OUT. On a shared machine
     that last one matters.
     It was evidently written for a desktop sidebar that was never built. Until
     one exists, the header stays: it is responsive, it carries the menu, and a
     visible header on a wide screen is a far smaller problem than no navigation.
     Found by Paul 2026-08-17 simply by widening the window. */
  .portal-main {
    padding: 32px;
    max-width: 1200px;   /* stop content stretching to a 27" width */
    margin: 0 auto;
  }
}

/* ============================================================================
   A1 — engineer reports withheld
   Shown when the tenant has NOT opted in to letting customers see engineer
   reports. Styled as a calm note, not a warning: nothing has gone wrong, and a
   red/amber panel would imply a fault and generate the phone call this text
   exists to prevent.
   ============================================================================ */
.portal-note {
  border-left: 4px solid var(--portal-primary, #2563EB);
  background: var(--surface-muted);
}

.portal-note p {
  margin: 0 0 8px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-body);
}

.portal-note p:last-child { margin-bottom: 0; }

/* v8.73.0 — the company's own logo in the header: a white chip so any logo reads on any colour. */
.portal-header .logo.company-logo { background: var(--surface, #fff); border-radius: 6px; padding: 3px 8px; height: 36px; }
.portal-header .logo.company-logo img { filter: none; }
