/* ============================================
   Infused Labs Portal — scoped reset
   All styles prefixed with #ilp-portal or
   #ilp-login-wrap to avoid theme bleed
   ============================================ */

/* Force white canvas regardless of theme */
#ilp-portal,
#ilp-login-wrap {
  all: initial;
  display: block;
  font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #111;
  background: #fff;
  box-sizing: border-box;
}

#ilp-portal *,
#ilp-login-wrap * {
  box-sizing: border-box;
  color: inherit;
  font-family: inherit;
  line-height: inherit;
}

/* Re-declare variables inside the scope */
#ilp-portal,
#ilp-login-wrap {
  --brand: #136770;
  --brand-dark: #0d4d55;
  --brand-light: #e8f4f5;
  --text: #111;
  --text-muted: #666;
  --border: #e0e0e0;
  --bg: #f9f9f9;
  --white: #fff;
  --radius: 8px;
  --success: #1a7a4a;
  --success-bg: #eaf7f0;
  --warning: #a05c00;
  --warning-bg: #fff8ec;
  --danger: #c0392b;
  --danger-bg: #fff0ee;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

#ilp-portal {
  font-family: var(--font-sans);
  color: var(--text);
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

/* Header */
.ilp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.ilp-header-left h1 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 400;
  color: var(--text);
}
.ilp-header-left p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}
.ilp-logout {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: var(--radius);
  transition: all 0.15s;
}
.ilp-logout:hover { border-color: var(--brand); color: var(--brand); }

/* Nav */
.ilp-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.ilp-nav-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 7px;
}
.ilp-nav-btn:hover { color: var(--brand); }
.ilp-nav-btn.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 500; }
.ilp-badge {
  background: var(--brand);
  color: #fff !important;
  font-size: 10px;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

/* Summary cards */
.ilp-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.ilp-summary-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.ilp-summary-card .label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.ilp-summary-card .value {
  font-family: var(--font-serif);
  font-size: 28px;
  color: var(--text);
}
.ilp-summary-card.accent { background: var(--brand); border-color: var(--brand); }
.ilp-summary-card.accent .label { color: rgba(255,255,255,0.7); }
.ilp-summary-card.accent .value { color: #fff; }

/* Section title */
.ilp-section-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 16px;
}

/* Table */
.ilp-table-wrap { overflow-x: auto; }
.ilp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.ilp-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.ilp-table td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ilp-table tr:last-child td { border-bottom: none; }
.ilp-table tr:hover td { background: var(--bg); }
.ilp-table-wrap { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

/* Status badges */
.ilp-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 99px;
}
.ilp-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.6; }
.ilp-status.paid, .ilp-status.resolved, .ilp-status.accepted { background: var(--success-bg); color: var(--success); }
.ilp-status.sent, .ilp-status.open, .ilp-status.in_progress { background: var(--warning-bg); color: var(--warning); }
.ilp-status.draft, .ilp-status.closed, .ilp-status.invoiced { background: #f0f0f0; color: #555; }
.ilp-status.overdue, .ilp-status.declined, .ilp-status.cancelled { background: var(--danger-bg); color: var(--danger); }

/* Buttons */
.ilp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-family: var(--font-sans);
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.ilp-btn-primary { background: var(--brand) !important; color: #fff !important; border-color: var(--brand); }
.ilp-btn-primary:hover { background: var(--brand-dark) !important; color: #fff !important; }
.ilp-btn-outline { background: transparent; color: var(--brand); border-color: var(--brand); }
.ilp-btn-outline:hover { background: var(--brand-light); }
.ilp-btn-danger { background: transparent; color: var(--danger); border-color: #f5c6c1; }
.ilp-btn-danger:hover { background: var(--danger-bg); }
.ilp-btn-sm { padding: 6px 12px; font-size: 12px; }
.ilp-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Detail panel */
.ilp-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.ilp-panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ilp-panel-header h3 { font-family: var(--font-serif); font-size: 18px; font-weight: 400; }
.ilp-panel-body { padding: 24px; }

/* Line items */
.ilp-line-items { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.ilp-line-items th { text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.ilp-line-items td { padding: 12px 12px; border-bottom: 1px solid var(--border); }
.ilp-line-items tfoot td { font-weight: 600; font-size: 16px; padding-top: 16px; }
.ilp-phase-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand); background: var(--brand-light); padding: 2px 8px; border-radius: 99px; display: inline-block; }

/* Stripe payment */
.ilp-payment-wrap { border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-top: 20px; }
.ilp-payment-wrap h4 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
#ilp-card-element { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--white); }
.ilp-payment-error { color: var(--danger); font-size: 13px; margin-top: 10px; }

/* Ticket thread */
.ilp-thread { display: flex; flex-direction: column; gap: 16px; }
.ilp-message { display: flex; gap: 12px; }
.ilp-message.admin { flex-direction: row-reverse; }
.ilp-message-bubble {
  max-width: 70%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.6;
}
.ilp-message.admin .ilp-message-bubble {
  background: var(--brand-light);
  border-color: var(--brand);
  border-radius: var(--radius) 0 var(--radius) var(--radius);
}
.ilp-message-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.ilp-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0; margin-top: 2px;
}
.ilp-message.admin .ilp-avatar { background: var(--brand-dark); }

/* Forms */
.ilp-form-group { margin-bottom: 18px; }
.ilp-form-group label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 6px; }
.ilp-form-group input[type=text],
.ilp-form-group textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
}
.ilp-form-group input:focus,
.ilp-form-group textarea:focus { border-color: var(--brand); }
.ilp-form-group textarea { min-height: 100px; resize: vertical; }

/* Back link */
.ilp-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); cursor: pointer; margin-bottom: 20px; border: none; background: none; padding: 0; text-decoration: none; }
.ilp-back:hover { color: var(--brand); }

/* Empty state */
.ilp-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.ilp-empty .icon { font-size: 36px; margin-bottom: 12px; }
.ilp-empty p { font-size: 15px; }

/* Loading */
.ilp-loading { display: flex; align-items: center; justify-content: center; padding: 60px; }
.ilp-spinner { width: 28px; height: 28px; border: 2px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: ilp-spin 0.7s linear infinite; }
@keyframes ilp-spin { to { transform: rotate(360deg); } }

/* Quote actions */
.ilp-quote-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

/* Notes */
.ilp-notes { background: var(--bg); border-left: 3px solid var(--brand); padding: 14px 16px; border-radius: 0 var(--radius) var(--radius) 0; font-size: 14px; color: var(--text-muted); margin-top: 16px; line-height: 1.6; }

@media (max-width: 600px) {
  .ilp-summary { grid-template-columns: 1fr 1fr; }
  .ilp-nav-btn { padding: 10px 12px; font-size: 13px; }
  .ilp-message-bubble { max-width: 85%; }
}

/* ============================================
   Login form styles (scoped to #ilp-login-wrap)
   ============================================ */
#ilp-login-wrap {
  max-width: 480px;
  margin: 48px auto;
  padding: 40px 48px 36px;
  background: #fff;
  color: #111;
  border-radius: 14px;
  border: 1px solid #dce8ea;
  box-shadow: 0 4px 24px rgba(19,103,112,0.08);
}
.ilp-portal-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.ilp-portal-brand-mark {
  width: 32px; height: 32px;
  background: #136770;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ilp-portal-brand-mark svg { width: 16px; height: 16px; fill: white; }
.ilp-portal-brand-name { font-size: 15px; font-weight: 400; color: #111; display: block; }
.ilp-portal-brand-sub  { font-size: 12px; color: #888; display: block; }
#ilp-login-wrap h2 {
  font-size: 26px; color: #111; margin: 0 0 6px; font-weight: 400;
  font-family: Georgia, serif;
}
#ilp-login-wrap p.sub {
  color: #666; font-size: 14px; margin: 0 0 28px; line-height: 1.5;
}
#ilp-login-wrap label {
  display: block; font-size: 11px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase; color: #555; margin-bottom: 6px;
}
#ilp-login-wrap input[type=email],
#ilp-login-wrap input[type=password] {
  width: 100%; padding: 12px 14px;
  border: 1px solid #ddd; border-radius: 6px;
  font-size: 15px; box-sizing: border-box; margin-bottom: 18px;
  transition: border-color 0.2s; outline: none;
  background: #f4f6f7; color: #111;
}
#ilp-login-wrap input[type=email]:focus,
#ilp-login-wrap input[type=password]:focus {
  background: #fff;
  border-color: #136770;
  box-shadow: 0 0 0 3px rgba(19,103,112,0.1);
}
#ilp-login-wrap button[type=submit] {
  width: 100%; background: #136770 !important; color: #fff !important; border: none;
  padding: 13px; font-size: 14px; font-weight: 600; border-radius: 6px;
  cursor: pointer; letter-spacing: 0.02em; transition: background 0.15s;
}
#ilp-login-wrap button[type=submit]:hover { background: #0f5059; }
#ilp-login-wrap button[type=submit]:disabled { opacity: 0.6; cursor: not-allowed; }
.ilp-error {
  background: #fff3f3; border: 1px solid #f5c6c1; color: #c0392b;
  padding: 10px 14px; border-radius: 6px;
  font-size: 13px; margin-bottom: 18px; display: none;
}
.ilp-forgot {
  display: block; text-align: center; margin-top: 16px;
  font-size: 13px; color: #888; text-decoration: none;
}
.ilp-forgot:hover { color: #136770; }
.ilp-notice {
  background: #eaf7f0; border: 1px solid #b2dfc8; color: #1a7a4a;
  padding: 12px 14px; border-radius: 6px; font-size: 14px;
}

/* Form input backgrounds — light gray for readability */
#ilp-portal .ilp-form-group input[type=text],
#ilp-portal .ilp-form-group textarea,
#ilp-portal .reply-input,
#ilp-portal #ilp-reply-message,
#ilp-portal #ilp-ticket-subject,
#ilp-portal #ilp-ticket-message {
  background: #f4f6f7 !important;
  color: #111 !important;
}
#ilp-portal .ilp-form-group input[type=text]:focus,
#ilp-portal .ilp-form-group textarea:focus,
#ilp-portal .reply-input:focus {
  background: #fff !important;
  border-color: #136770 !important;
}

/* Ticket form & reply box — light gray inputs */
#ilp-portal textarea,
#ilp-portal input[type=text] {
  background: #f4f6f7 !important;
  color: #111 !important;
}
#ilp-portal textarea:focus,
#ilp-portal input[type=text]:focus {
  background: #fff !important;
  outline: none;
  border-color: #136770 !important;
}
/* Ensure all teal buttons have white text regardless of theme inheritance */
#ilp-portal button.ilp-btn-primary,
#ilp-portal a.ilp-btn-primary,
#ilp-portal .ilp-pay-btn,
#ilp-portal .send-btn,
#ilp-portal .new-ticket-btn {
  color: #fff !important;
}

/* ============================================
   Skeleton loading & progress bar
   ============================================ */

/* Shimmer animation */
@keyframes ilp-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

#ilp-portal .ilp-skel {
  display: block;
  border-radius: 4px;
  background: linear-gradient(90deg, #b2d8dc 25%, #e3f4f6 50%, #b2d8dc 75%);
  background-size: 600px 100%;
  animation: ilp-shimmer 1.4s ease-in-out infinite;
}

/* Skeleton summary cards */
#ilp-portal .ilp-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
#ilp-portal .ilp-skeleton-card {
  background: #eaf4f5;
  border: 1px solid #c8e4e7;
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#ilp-portal .ilp-skel-label {
  width: 60%;
  height: 11px;
}
#ilp-portal .ilp-skel-value {
  width: 40%;
  height: 28px;
  border-radius: 4px;
}

/* Skeleton table section */
#ilp-portal .ilp-skeleton-section {
  margin-bottom: 24px;
}
#ilp-portal .ilp-skeleton-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}
#ilp-portal .ilp-skeleton-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid #c8e4e7;
  background: #fff;
}
#ilp-portal .ilp-skeleton-row:last-child {
  border-bottom: none;
}

/* Progress bar for tab loading */
#ilp-portal .ilp-tab-loading {
  padding: 40px 0 20px;
}
#ilp-portal .ilp-progress-bar {
  height: 4px;
  background: #c8e4e7;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 16px;
}
@keyframes ilp-progress {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}
#ilp-portal .ilp-progress-fill {
  height: 100%;
  width: 45%;
  background: var(--brand);
  border-radius: 99px;
  animation: ilp-progress 1.4s ease-in-out infinite;
}
#ilp-portal .ilp-loading-msg {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 600px) {
  #ilp-portal .ilp-skeleton-grid {
    grid-template-columns: 1fr 1fr;
  }
}

#ilp-portal .ilp-summary-card.accent .label,
#ilp-portal .ilp-summary-card.accent-danger .label { color: rgba(255,255,255,0.7) !important; }
#ilp-portal .ilp-summary-card.accent .value,
#ilp-portal .ilp-summary-card.accent-danger .value { color: #fff !important; }
#ilp-portal .ilp-summary-card.accent-danger { background: #c0392b !important; border-color: #c0392b !important; }
