/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --orange:        #FF9900;
  --orange-dark:   #E07D00;
  --orange-light:  #FFF3DC;
  --orange-glow:   rgba(255,153,0,0.15);

  --navy:          #0B1426;
  --navy-mid:      #132039;
  --nav-item-hover:#1C2D4A;
  --nav-active-bg: #1C2D4A;

  --bg:            #F2F5FB;
  --surface:       #FFFFFF;
  --border:        #E4E8F0;
  --border-dark:   #C9D0DC;

  --text-primary:  #111827;
  --text-secondary:#5A6479;
  --text-muted:    #8E97A8;
  --text-nav:      #8FA3C0;
  --text-nav-active:#E2EAF7;

  --green:  #10B981;
  --green-bg:#ECFDF5;
  --yellow: #F59E0B;
  --yellow-bg:#FFFBEB;
  --red:    #EF4444;
  --red-bg: #FEF2F2;
  --blue:   #3B82F6;
  --blue-bg:#EFF6FF;
  --purple: #8B5CF6;
  --purple-bg:#F5F3FF;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);

  --sidebar-w: 248px;
  --topbar-h: 64px;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== LAYOUT ===== */
.partner-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.partner-nav {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  z-index: 100;
}
.partner-nav::-webkit-scrollbar { display: none; }

/* Sidebar top brand area */
.partner-nav-brand {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 0.5rem;
}

.partner-nav-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.partner-nav-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--orange);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.partner-nav-logo-icon svg {
  width: 18px;
  height: 18px;
  color: #fff;
}

.partner-nav-logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.partner-nav-subtitle {
  font-size: 0.72rem;
  color: var(--text-nav);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-left: 0.1rem;
}

/* Nav section label */
.partner-nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.25);
  padding: 0.5rem 1.25rem 0.35rem;
  margin-top: 0.5rem;
}

/* Nav items */
.partner-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-nav);
  padding: 0.6rem 1rem 0.6rem 1.25rem;
  margin: 0.1rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  background: none;
  width: calc(100% - 1.5rem);
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.18s, color 0.18s;
  position: relative;
}

.partner-nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.18s;
}

.partner-nav-item:hover {
  background: var(--nav-item-hover);
  color: var(--text-nav-active);
}
.partner-nav-item:hover svg { opacity: 1; }

.partner-nav-item.active {
  background: var(--nav-active-bg);
  color: #fff;
}
.partner-nav-item.active svg { opacity: 1; }
.partner-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--orange);
  border-radius: 0 3px 3px 0;
}

.partner-nav-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin: 0.75rem 1.25rem;
}

.partner-nav-footer {
  margin-top: auto;
  padding: 1rem 0.75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.partner-nav-footer a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-nav);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color 0.18s, background 0.18s;
}
.partner-nav-footer a svg {
  width: 15px;
  height: 15px;
  opacity: 0.6;
}
.partner-nav-footer a:hover {
  color: var(--text-nav-active);
  background: var(--nav-item-hover);
}

/* ===== MAIN CONTENT ===== */
.partner-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top bar inside main */
.partner-topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.partner-topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.partner-topbar-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.partner-content {
  padding: 2rem;
  flex: 1;
}

/* ===== SECTION ===== */
.partner-section {
  animation: fadeSlideIn 0.22s ease;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-header-left h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.section-header-left p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* backwards-compat: direct h1 inside .section-header */
.section-header > h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* ===== STAT CARDS ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.25rem 1.1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--orange);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card .label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

/* ===== DASHBOARD ===== */

/* Page header with quick actions */
.dash-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.dash-page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.dash-page-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.dash-quick-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.dash-action-btn {
  font-size: 0.8rem;
  padding: 0.45rem 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-dark);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.dash-action-btn:hover {
  border-color: var(--orange);
  color: var(--orange-dark);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

/* Notification strip */
.dash-notif-strip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--blue-bg);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  color: #1D4ED8;
  margin-bottom: 1rem;
}

.dash-notif-strip svg { flex-shrink: 0; }

.dash-notif-link {
  margin-left: auto;
  font-weight: 600;
  color: #1D4ED8;
  text-decoration: none;
  font-size: 0.8rem;
}

.dash-notif-link:hover { text-decoration: underline; }

/* Top grid layout */
.dash-grid-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 820px) {
  .dash-grid-top { grid-template-columns: 1fr; }
}

/* Section title shared */
.dash-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Loading skeleton */
.dash-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem;
}

.dash-loading span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-dark);
  animation: dash-pulse 1.2s ease-in-out infinite;
}

.dash-loading span:nth-child(2) { animation-delay: 0.2s; }
.dash-loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dash-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

/* ---- Slot Health ---- */
.dash-slot-health {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.dash-slot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 480px) {
  .dash-slot-grid { grid-template-columns: 1fr; }
}

.dash-slot-card {
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.dash-slot-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.dash-slot-card--green::before  { background: var(--green); }
.dash-slot-card--amber::before  { background: var(--yellow); }
.dash-slot-card--red::before    { background: var(--red); }
.dash-slot-card--neutral::before { background: var(--border-dark); }

.dash-slot-card-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.dash-slot-nums {
  margin-bottom: 0.65rem;
  line-height: 1;
}

.dash-slot-remaining {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.dash-slot-purchased {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 0.15rem;
}

.dash-slot-used-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dash-slot-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.dash-slot-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.dash-slot-bar-fill--green  { background: var(--green); }
.dash-slot-bar-fill--amber  { background: var(--yellow); }
.dash-slot-bar-fill--red    { background: var(--red); }
.dash-slot-bar-fill--neutral { background: var(--border-dark); }

.dash-slot-bar-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.dash-slot-expiry {
  margin-top: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: var(--yellow-bg);
  border-left: 3px solid var(--yellow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.72rem;
  color: #92400E;
  line-height: 1.4;
}

/* ---- Exam Funnel ---- */
.dash-funnel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dash-funnel-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.dash-funnel-step {
  flex: 1;
  min-width: 68px;
  text-align: center;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.dash-funnel-step--blue   { background: var(--blue-bg);   border-color: #BFDBFE; }
.dash-funnel-step--orange { background: var(--orange-light); border-color: #FDE68A; }
.dash-funnel-step--purple { background: var(--purple-bg); border-color: #DDD6FE; }
.dash-funnel-step--green  { background: var(--green-bg);  border-color: #A7F3D0; }

.dash-funnel-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.dash-funnel-step--blue   .dash-funnel-value { color: var(--blue); }
.dash-funnel-step--orange .dash-funnel-value { color: var(--orange-dark); }
.dash-funnel-step--purple .dash-funnel-value { color: var(--purple); }
.dash-funnel-step--green  .dash-funnel-value { color: var(--green); }

.dash-funnel-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.dash-funnel-arrow {
  font-size: 1rem;
  color: var(--border-dark);
  flex-shrink: 0;
  padding: 0 0.1rem;
}

.dash-funnel-rate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: var(--green-bg);
  border: 1px solid #A7F3D0;
  border-radius: var(--radius-md);
}

.dash-funnel-rate-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green);
}

.dash-funnel-rate-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: -0.02em;
}

/* ---- Recent Schedules ---- */
.dash-recent-schedules {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.dash-section-header .dash-section-title { margin-bottom: 0; }

.dash-view-all {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--orange-dark);
  text-decoration: none;
}

.dash-view-all:hover { text-decoration: underline; }

.dash-sched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.dash-sched-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.dash-sched-table td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.dash-sched-table tbody tr:last-child td { border-bottom: none; }

.dash-sched-table tbody tr:hover td { background: var(--bg); }

.dash-sched-window {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dash-empty {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 1rem 0;
  text-align: center;
}

/* ===== ALERTS ===== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.875rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid transparent;
}

.alert svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-warning {
  background: var(--yellow-bg);
  border-color: #FCD34D;
  color: #78350F;
}

.alert-error {
  background: var(--red-bg);
  border-color: #FCA5A5;
  color: #7F1D1D;
}

.alert-success {
  background: var(--green-bg);
  border-color: #6EE7B7;
  color: #064E3B;
}

.alert-info {
  background: var(--blue-bg);
  border-color: #BFDBFE;
  color: #1E3A8A;
}

/* ===== TOOLBAR ===== */
.toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

/* ===== CARD CONTAINER ===== */
.table-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

/* ===== TABLES ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead tr {
  background: #F8FAFC;
  border-bottom: 2px solid var(--border);
}

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  vertical-align: middle;
  color: var(--text-primary);
}

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

.data-table tbody tr {
  transition: background 0.12s;
}

.data-table tbody tr:hover {
  background: #F8FAFC;
}

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.65rem;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge-invited      { background: var(--blue-bg);   color: #1D4ED8; }
.badge-registered   { background: var(--purple-bg); color: #6D28D9; }
.badge-scheduled    { background: var(--yellow-bg); color: #92400E; }
.badge-in_progress  { background: #FFF7ED;          color: #C2410C; }
.badge-passed       { background: var(--green-bg);  color: #065F46; }
.badge-failed       { background: var(--red-bg);    color: #991B1B; }
.badge-active       { background: var(--green-bg);  color: #065F46; }
.badge-expiring     { background: var(--yellow-bg); color: #92400E; }
.badge-expired      { background: var(--red-bg);    color: #991B1B; }
.badge-invite_failed{ background: var(--red-bg);    color: #991B1B; }
.badge-test         { background: #EFF6FF;          color: #1D4ED8; }
.badge-cert         { background: #F0FDF4;          color: #166534; }

/* ===== ACTION BUTTONS ===== */
.action-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ===== BUTTON SMALL (used by JS-generated buttons) ===== */
.btn-small {
  padding: 0.3rem 0.7rem !important;
  font-size: 0.78rem !important;
  border-radius: var(--radius-sm) !important;
  height: auto !important;
  line-height: 1.4 !important;
  font-weight: 500 !important;
}

/* ===== ROLE BADGES ===== */
[class^="badge-role-"] {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  line-height: 1.4;
}
.badge-role-admin {
  background: #EFF6FF;
  color: #1D4ED8;
}
.badge-role-manager {
  background: #F0FDF4;
  color: #15803D;
}
.badge-role-owner {
  background: #FFF7ED;
  color: #C2410C;
}

/* ===== MEMBER PICKER ROWS (assign-team / sched-member modals) ===== */
.member-pick-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.member-pick-row:hover {
  background: var(--bg-secondary, #f9fafb);
}
.member-pick-row input[type="checkbox"] {
  flex-shrink: 0;
  margin: 0;
}

/* ===== ROW ACTION BUTTONS ===== */
.row-actions-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.86rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: var(--border-dark);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

.form-group small {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ===== PANEL CARD ===== */
.info-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.info-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.info-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ===== IMPORT REPORT ===== */
.import-report {
  background: #F0FDF4;
  border: 1px solid #A7F3D0;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}

.import-report h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #065F46;
  margin-bottom: 0.5rem;
}

.import-report ul {
  margin: 0;
  padding-left: 1.25rem;
  color: #047857;
}

/* ===== ADD MEMBER PANEL ===== */
.add-member-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.add-member-panel h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.add-member-panel h3 svg {
  width: 18px;
  height: 18px;
  color: var(--orange);
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
  gap: 0.5rem;
}

/* ===== ADMINS LIST ===== */
#admins-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#admins-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: border-color 0.15s, box-shadow 0.15s;
}

#admins-list li:hover {
  border-color: var(--border-dark);
  box-shadow: var(--shadow-sm);
}

#admins-list .admin-email {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#admins-list .admin-email::before {
  content: '';
  display: inline-block;
  width: 28px;
  height: 28px;
  background: var(--orange-light);
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FF9900' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M6 20v-2a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px;
  flex-shrink: 0;
}

/* ===== SUPPORT CARDS ===== */
.support-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.support-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.support-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.support-card-icon svg {
  width: 20px;
  height: 20px;
}

.support-card-icon.red    { background: var(--red-bg);    color: var(--red); }
.support-card-icon.yellow { background: var(--yellow-bg); color: var(--yellow); }
.support-card-icon.blue   { background: var(--blue-bg);   color: var(--blue); }

.support-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.support-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.55;
}

.support-card a {
  color: var(--orange);
  font-weight: 600;
  text-decoration: none;
}
.support-card a:hover { text-decoration: underline; }

.support-sla {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(11, 20, 38, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-content {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp 0.22s ease;
}

@keyframes modalSlideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}

.close-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* ===== LOADING / EMPTY STATES ===== */
.table-placeholder {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Portal full-page loader */
#portal-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ===== SEARCH INPUT ===== */
.search-input {
  padding: 0.6rem 0.875rem 0.6rem 2.25rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--text-primary);
  min-width: 220px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E97A8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.65rem center;
  background-size: 15px;
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
}

.search-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

/* ===== GLOBAL NOTIFICATION ===== */
#portal-message {
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

/* ===== EXPIRY WARNINGS ===== */
#expiry-warnings { margin-bottom: 0.25rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .partner-layout { flex-direction: column; }

  .partner-nav {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    flex-direction: row;
    align-items: center;
    padding: 0 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 52px;
    gap: 0;
  }

  .partner-nav-brand,
  .partner-nav-section-label,
  .partner-nav-divider,
  .partner-nav-footer {
    display: none;
  }

  .partner-nav-item {
    width: auto;
    flex: 0 0 auto;
    margin: 0.375rem 0.2rem;
    padding: 0.45rem 0.875rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .partner-nav-item svg {
    width: 15px;
    height: 15px;
  }

  .partner-nav-item.active::before { display: none; }
  .partner-nav-item.active {
    background: var(--orange);
    color: #fff;
  }

  .partner-topbar { display: none; }

  .partner-content { padding: 1rem; }

  .partner-section { padding: 1.25rem 1rem; }

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

  .support-cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .data-table th:nth-child(n+4),
  .data-table td:nth-child(n+4) {
    display: none;
  }
}

/* ===== BTN DANGER ===== */
.btn-danger {
  background: var(--red);
  color: #fff;
  border: 1.5px solid transparent;
}
.btn-danger:hover:not(:disabled) {
  background: #DC2626;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.18);
}

/* ===== FILTER GROUP (Results tab) ===== */
.filter-group {
  display: flex;
  gap: 0.2rem;
  background: var(--bg);
  padding: 0.2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.filter-btn {
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  line-height: 1.5;
}

.filter-btn:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ===== SECTION HEADER ACTIONS ===== */
.section-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ===== RADIO GROUP (modal forms) ===== */
.radio-group {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.4rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
  user-select: none;
}

/* ===== MODAL SUBTITLE ===== */
.modal-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== MODAL META (Schedule Detail) ===== */
.modal-meta {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding: 0.875rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.modal-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0 1.25rem 0 0;
  margin-right: 1.25rem;
  border-right: 1px solid var(--border);
}

.modal-meta-item:last-child {
  border-right: none;
  margin-right: 0;
}

.meta-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.meta-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== MODAL WARNING BOX ===== */
.modal-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--red-bg);
  border: 1px solid #FCA5A5;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #991B1B;
  line-height: 1.5;
}

/* ===== BRANDING SECTION ===== */
.branding-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 800px) {
  .branding-grid { grid-template-columns: 1fr; }
}

.branding-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.branding-panel h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.branding-logo-preview-area {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 72px;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1.5px dashed var(--border-dark);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.branding-logo-preview-area img {
  height: 48px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.branding-logo-no-logo {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.branding-file-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
  line-height: 1.55;
}

.branding-upload-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.branding-msg {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Color rows inside branding panel */
.color-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.color-row:last-of-type { border-bottom: none; }

.color-row-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 90px;
}

.color-swatch {
  width: 36px;
  height: 32px;
  padding: 2px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  background: none;
}

.color-hex-input {
  width: 88px;
  font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 0.82rem;
  padding: 0.42rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  text-transform: uppercase;
}

.color-hex-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

.font-select {
  flex: 1;
  max-width: 220px;
  padding: 0.42rem 0.65rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  cursor: pointer;
}

.font-select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

.branding-save-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* Certificate preview card */
.branding-cert-wrapper {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.branding-cert-wrapper > h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.branding-cert-preview-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* ===== ADMIN TEAM ===== */
.admin-add-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.admin-add-row .form-group {
  flex: 1;
  min-width: 220px;
  margin: 0;
}

/* ===== MEMBER PICKER (schedule modal) ===== */
.member-picker {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  max-height: 180px;
  overflow-y: auto;
}

.member-picker-header {
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: sticky;
  top: 0;
}

.member-picker-select-all {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.member-picker-count {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.member-picker-list { padding: 0.25rem 0; }

.member-picker-list label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
  font-weight: 400;
  margin-bottom: 0;
}

.member-picker-list label:hover {
  background: var(--bg);
}

/* Reset form-group overrides for checkboxes inside the picker */
.member-picker input[type="checkbox"] {
  width: auto;
  padding: 0;
  flex-shrink: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

.member-picker-loading {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
}

/* ===== SCHEDULE TABLE ACTIONS ===== */
.sched-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.sched-cancel-btn {
  color: #dc2626 !important;
  border-color: #fca5a5 !important;
}

/* ===== RESPONSIVE: SCHEDULES TABLE ===== */
@media (max-width: 760px) {
  #schedules-table th:nth-child(7),
  #schedules-table td:nth-child(7),
  #schedules-table th:nth-child(8),
  #schedules-table td:nth-child(8) {
    display: none;
  }
}

/* ==================== Integration Section ==================== */

/* ── Two-column layout ─────────────────────────────────────── */
.integration-docs-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 2rem;
  align-items: start;
}

.integration-docs-nav {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.integration-docs-nav-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-top: 0;
  font-weight: 600;
}

.integration-docs-nav-link {
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  line-height: 1.5;
}

.integration-docs-nav-link:hover {
  color: var(--orange);
  background: var(--orange-light);
}

.integration-docs-nav-link.active {
  color: var(--orange);
  background: var(--orange-light);
  font-weight: 600;
}

/* ── API Key Card ──────────────────────────────────────────── */
.integration-api-key-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--orange);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.integration-api-key-card-stripe { display: none; }

.integration-api-key-inner { padding: 1.5rem; }

.integration-api-key-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.integration-api-key-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex: 1;
}

.integration-api-key-icon {
  width: 32px;
  height: 32px;
  background: var(--orange-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--orange);
  flex-shrink: 0;
}

.integration-api-key-header h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.integration-api-key-header p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.integration-manage-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.integration-manage-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
}

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

.integration-spinner-icon {
  width: 14px;
  height: 14px;
  animation: spin 1s linear infinite;
}

/* key display row (keep from original — JS renders into this) */
.integration-api-key-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
  min-height: 3rem;
}

.integration-api-key-value {
  font-family: monospace;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  word-break: break-all;
}

.integration-api-key-value.new-key {
  color: var(--green);
  font-weight: 600;
}

.integration-api-key-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

.integration-api-key-new-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--green);
  background: var(--green-bg);
  border-radius: 4px;
  padding: 2px 8px;
}

.integration-api-key-loading,
.integration-api-key-error {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.integration-api-key-error { color: var(--red); }

.integration-api-key-note {
  margin: 0.5rem 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.integration-copy-inline-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  transition: color 0.15s;
}

.integration-copy-inline-btn:hover { color: var(--orange); }

/* ── Documentation area ────────────────────────────────────── */
.integration-docs {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.integration-docs-section {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0;
}

.integration-docs-section:first-child { border-top: none; }

.integration-docs-section h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.75rem;
}

.integration-docs-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.25rem 0 0.5rem;
}

.integration-docs-section p {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.integration-docs-section code {
  background: var(--bg);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 0.85em;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.integration-docs-section-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.integration-docs-section-head h2 { margin: 0; }

/* ── Step chip (numbered orange circle) ────────────────────── */
.integration-step-chip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Sub-headings with orange accent ───────────────────────── */
.integration-sub-heading {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.5rem 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 6px;
  border-left: 3px solid var(--orange);
  padding-left: 8px;
}

/* ── Info callout (blue) ───────────────────────────────────── */
.integration-info-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--blue-bg);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-size: 0.84rem;
  color: #1E40AF;
  margin: 0.75rem 0;
  line-height: 1.55;
}

/* ── Code blocks ───────────────────────────────────────────── */
.integration-code-block {
  background: #1e1e2e;
  border-radius: var(--radius-md);
  margin: 0.5rem 0 1rem;
  overflow: hidden;
}

.integration-code-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0,0,0,0.30);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.integration-code-lang {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6C8EBF;
  font-weight: 600;
}

.integration-copy-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  color: #8FA3C0;
  font-size: 0.72rem;
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.integration-copy-btn:hover {
  background: rgba(255,255,255,0.16);
  color: #cdd6f4;
}

.integration-code-block pre {
  margin: 0;
  padding: 1rem;
  font-family: monospace;
  font-size: 0.78rem;
  line-height: 1.65;
  color: #cdd6f4;
  overflow-x: auto;
  white-space: pre;
}

/* ── Tables ────────────────────────────────────────────────── */
.integration-table-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 0.75rem 0;
}

.integration-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.integration-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.integration-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.integration-table tr:last-child td { border-bottom: none; }

.integration-table tr:hover td { background: var(--bg); }

.integration-table--endpoints td:first-child { width: 60px; text-align: center; }
.integration-table--endpoints td:nth-child(2) { width: 300px; }

/* ── Auth badges ───────────────────────────────────────────── */
.integration-auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
}

.integration-auth-badge--apikey {
  background: var(--orange-light);
  color: var(--orange-dark);
}

.integration-auth-badge--bearer {
  background: var(--blue-bg);
  color: var(--blue);
}

/* ── Method badges ─────────────────────────────────────────── */
.integration-method-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
  text-transform: uppercase;
}

.integration-method-badge--get {
  background: var(--green-bg);
  color: var(--green);
}

.integration-endpoint-path {
  font-family: monospace;
  font-size: 0.8rem;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

/* ── Rate limit card (dark navy) ───────────────────────────── */
.integration-rate-limit-card {
  background: var(--navy);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.integration-rate-limit-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
}

.integration-rate-limit-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--orange);
  line-height: 1;
}

.integration-rate-limit-unit {
  font-size: 0.78rem;
  color: #8FA3C0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
  text-align: center;
}

.integration-rate-limit-detail {
  font-size: 0.85rem;
  color: #8FA3C0;
  flex: 1;
  line-height: 1.6;
  margin: 0;
}

.integration-rate-limit-detail code {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #cdd6f4;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ── Support card ──────────────────────────────────────────── */
.integration-support-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.integration-support-card:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow-sm);
}

.integration-support-icon {
  width: 40px;
  height: 40px;
  background: var(--orange-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--orange);
  flex-shrink: 0;
}

.integration-support-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.integration-support-body strong {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.integration-support-body span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.integration-support-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.15s, color 0.15s;
}

.integration-support-card:hover .integration-support-arrow {
  color: var(--orange);
  transform: translateX(3px);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .integration-docs-layout {
    grid-template-columns: 1fr;
  }

  .integration-docs-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
  }

  .integration-docs-nav-label { display: none; }

  .integration-rate-limit-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
  }

  .integration-rate-limit-stat {
    flex-direction: row;
    align-items: baseline;
    gap: 0.5rem;
    min-width: unset;
  }

  .integration-rate-limit-number { font-size: 2rem; }
}

/* ===== LIVE PROGRESS SECTION ===== */

/* Summary strip */
.prog-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.prog-summary-card {
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border: 1px solid transparent;
}
.prog-summary-active { background: #FFF7ED; border-color: #FDBA74; }
.prog-summary-done   { background: #F0FDF4; border-color: #86EFAC; }
.prog-summary-idle   { background: #F1F5F9; border-color: #CBD5E1; }
.prog-summary-value  { font-size: 1.75rem; font-weight: 700; color: #111827; line-height: 1; }
.prog-summary-label  { font-size: 0.78rem; color: #6b7280; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

/* Filter + search row */
.prog-filter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.prog-search-input {
  margin-left: auto;
  padding: 0.4rem 0.75rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #111827;
  background: #fff;
  outline: none;
  width: 200px;
  transition: border-color 0.15s;
}
.prog-search-input:focus { border-color: #143264; }

/* Cards grid */
.prog-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1rem;
}

.prog-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: #9ca3af;
  font-size: 0.9rem;
}

/* Individual member card */
.prog-card {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.prog-card:hover {
  box-shadow: 0 4px 16px rgba(20,50,100,0.10);
  border-color: #143264;
  transform: translateY(-1px);
}
.prog-card--in_progress { border-left: 4px solid #F97316; }
.prog-card--completed   { border-left: 4px solid #22C55E; }
.prog-card--not_started { border-left: 4px solid #CBD5E1; }

/* Card header row */
.prog-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.prog-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #EFF6FF;
  color: #1D4ED8;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.prog-card-info { flex: 1; min-width: 0; }
.prog-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prog-card-exam { font-size: 0.78rem; color: #6b7280; margin-top: 2px; }

/* Status pill on card */
.prog-status-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}
.prog-status-pill--in_progress { background: #FFF7ED; color: #C2410C; }
.prog-status-pill--completed   { background: #F0FDF4; color: #166534; }
.prog-status-pill--not_started { background: #F1F5F9; color: #475569; }

/* Progress bar area */
.prog-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.prog-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: #6b7280;
}
.prog-bar-track {
  height: 6px;
  background: #f3f4f6;
  border-radius: 99px;
  overflow: hidden;
}
.prog-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: #F97316;
  transition: width 0.4s ease;
}
.prog-bar-fill--completed { background: #22C55E; }
.prog-bar-fill--not_started { background: #CBD5E1; }

/* Stats row on card */
.prog-card-stats {
  display: flex;
  gap: 0.75rem;
}
.prog-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: #6b7280;
}
.prog-stat svg { flex-shrink: 0; }
.prog-stat-value { font-weight: 600; color: #374151; }

/* Timer chip */
.prog-timer {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #C2410C;
  background: #FFF7ED;
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
}
.prog-timer--low { color: #991B1B; background: #FEE2E2; animation: prog-pulse 1s infinite; }

@keyframes prog-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ── Detail Drawer ──────────────────────────────────────── */
.prog-drawer {
  position: fixed;
  top: 0;
  right: -480px;
  width: 460px;
  max-width: 95vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 32px rgba(0,0,0,0.12);
  z-index: 400;
  display: flex;
  flex-direction: column;
  transition: right 0.25s ease;
}
.prog-drawer.open { right: 0; }

.prog-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}
.prog-drawer-name { font-size: 1rem; font-weight: 700; color: #111827; }
.prog-drawer-meta { font-size: 0.8rem; color: #6b7280; margin-top: 2px; }
.prog-drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  padding: 0.25rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: background 0.12s;
  flex-shrink: 0;
}
.prog-drawer-close:hover { background: #f3f4f6; color: #111827; }

.prog-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Drawer section blocks */
.prog-detail-block {
  background: #f9fafb;
  border-radius: 10px;
  padding: 1rem;
}
.prog-detail-block-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 0.75rem;
}

/* Question timeline grid in drawer */
.prog-q-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}
.prog-q-cell {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 600;
  cursor: default;
  border: 1px solid transparent;
  position: relative;
}
.prog-q-cell[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  font-size: 0.65rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}
.prog-q-answered  { background: #DBEAFE; border-color: #93C5FD; color: #1D4ED8; }
.prog-q-correct   { background: #D1FAE5; border-color: #6EE7B7; color: #065F46; }
.prog-q-wrong     { background: #FEE2E2; border-color: #FCA5A5; color: #991B1B; }
.prog-q-skipped   { background: #FEF9C3; border-color: #FDE047; color: #854D0E; }
.prog-q-unseen    { background: #f3f4f6; border-color: #e5e7eb; color: #9ca3af; }

/* Legend row */
.prog-q-legend {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.prog-q-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: #6b7280;
}
.prog-q-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Drawer overlay */
.prog-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 399;
}

/* Score gauge in drawer */
.prog-score-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.prog-score-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  flex-shrink: 0;
  border: 3px solid;
}
.prog-score-circle--pass { border-color: #22C55E; color: #166534; background: #F0FDF4; }
.prog-score-circle--fail { border-color: #EF4444; color: #991B1B; background: #FEF2F2; }
.prog-score-circle--na   { border-color: #CBD5E1; color: #475569; background: #F8FAFC; }

/* Responsive */
@media (max-width: 768px) {
  .prog-summary-strip { grid-template-columns: 1fr 1fr; }
  .prog-cards-grid { grid-template-columns: 1fr; }
  .prog-drawer { width: 100vw; }
  .prog-q-grid { grid-template-columns: repeat(8, 1fr); }
  .prog-search-input { width: 100%; margin-left: 0; }
  .prog-filter-row { flex-direction: column; align-items: flex-start; }
}

/* ===================================================================
   POLISH — Dropdowns, Ticket Modal, Support, Teams, Misc
   =================================================================== */

/* ── Custom select arrow (applied to ALL selects in the portal) ── */
.form-group select,
.team-filter-select,
.filter-select,
.font-select,
#admin-role-select,
#admin-team-select,
#sched-vendor,
#sched-exam-code,
#sched-timezone,
#sched-duration {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E97A8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 15px 15px;
  padding-right: 2.25rem !important;
  cursor: pointer;
}

/* ── Standalone selects used in section headers (team filters, exam filters) ── */
.team-filter-select,
.filter-select {
  height: 38px;
  padding: 0 2.25rem 0 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: inherit;
  background-color: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E97A8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 14px 14px;
}

.team-filter-select:hover,
.filter-select:hover {
  border-color: var(--border-dark);
}

.team-filter-select:focus,
.filter-select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

/* Admin section bare selects */
#admin-role-select,
#admin-team-select {
  height: 42px;
  padding: 0 2.25rem 0 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: inherit;
  background-color: var(--surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  width: 100%;
}

#admin-role-select:focus,
#admin-team-select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

/* ── btn-sm (used in Integration / Webhooks section) ── */
.btn-sm {
  padding: 0.3rem 0.75rem !important;
  font-size: 0.8rem !important;
  height: auto !important;
  line-height: 1.5 !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 500 !important;
}

/* ── Settings card (Integration, Teams) ── */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.settings-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

/* Integration icon badge */
.integration-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Event pills (Webhooks) ── */
.event-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.event-pill--green  { background: var(--green-bg);   color: #065F46; border: 1px solid #A7F3D0; }
.event-pill--red    { background: var(--red-bg);     color: #991B1B; border: 1px solid #FCA5A5; }
.event-pill--yellow { background: var(--yellow-bg);  color: #92400E; border: 1px solid #FCD34D; }

.event-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

.event-checkbox-label input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: none;
  box-shadow: none;
  flex-shrink: 0;
  cursor: pointer;
}

/* ── form-input / form-select / form-textarea (ticket modal) ── */
.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E97A8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 15px 15px;
  padding-right: 2.25rem;
  cursor: pointer;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-dark);
}

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

/* ── form-row (two-column layout inside modals) ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.form-row > .form-group {
  margin-bottom: 0;
}

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

/* ── Required asterisk ── */
.required {
  color: var(--red);
  margin-left: 2px;
  font-weight: 600;
}

/* ── form-error (inline error in modals) ── */
.form-error {
  background: var(--red-bg);
  border: 1px solid #FCA5A5;
  border-radius: var(--radius-md);
  padding: 0.65rem 0.875rem;
  font-size: 0.85rem;
  color: #991B1B;
  margin-top: 0.5rem;
  line-height: 1.5;
}

/* ── Char counter (description textarea) ── */
.char-counter {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ── modal-overlay / modal-box / modal-close (ticket modals) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(11, 20, 38, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  animation: modalFadeIn 0.2s ease;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: modalSlideUp 0.22s ease;
}

.modal-box .modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  margin-bottom: 0;
}

.modal-box .modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.modal-body {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Ticket detail footer has a full-width reply box */
.ticket-detail-footer {
  padding: 1rem 1.5rem;
  flex-direction: column;
  align-items: stretch;
}

/* Close button in overlay modals */
.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* ── Ticket detail box (wider modal) ── */
.ticket-detail-box {
  max-width: 700px;
}

.ticket-detail-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.ticket-detail-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ticket-detail-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Message thread (ticket detail) */
.message-thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Ticket reply area */
.ticket-reply-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ticket-reply-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* Ticket ID badge */
.ticket-id-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
  letter-spacing: 0.03em;
}

/* Ticket status badge */
.ticket-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.6rem;
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 600;
  background: var(--green-bg);
  color: #065F46;
}

/* Ticket SLA label */
.ticket-sla-label {
  font-size: 0.73rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Priority badge (in ticket detail header) */
.priority-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.6rem;
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ── Priority radio group (ticket creation modal) ── */
.priority-radio-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.priority-radio-option {
  flex: 1;
  min-width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.65rem 0.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  text-align: center;
  background: var(--surface);
}

.priority-radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.priority-radio-option:hover {
  border-color: var(--border-dark);
  background: var(--bg);
}

.priority-radio-option.p1:has(input:checked),
.priority-radio-option.p1--selected {
  border-color: var(--red);
  background: var(--red-bg);
  color: #991B1B;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}

.priority-radio-option.p2:has(input:checked),
.priority-radio-option.p2--selected {
  border-color: var(--yellow);
  background: var(--yellow-bg);
  color: #92400E;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.12);
}

.priority-radio-option.p3:has(input:checked),
.priority-radio-option.p3--selected {
  border-color: var(--blue);
  background: var(--blue-bg);
  color: #1E3A8A;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.priority-hint {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* Fallback for browsers without :has() — JS adds --selected class */
.priority-radio-option.p1 { border-color: var(--border); }
.priority-radio-option.p2 { border-color: var(--border); }
.priority-radio-option.p3 { border-color: var(--border); }

/* ── Support section ── */
.support-help-section {
  margin-bottom: 2rem;
}

.support-help-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.support-help-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.support-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.support-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.support-card-cta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--orange-dark);
}

/* Priority card left-border accents */
.support-card--p1 { border-left: 3px solid var(--red); }
.support-card--p2 { border-left: 3px solid var(--yellow); }
.support-card--p3 { border-left: 3px solid var(--blue); }

.support-card--p1:hover { border-color: var(--red); box-shadow: var(--shadow-md); }
.support-card--p2:hover { border-color: var(--yellow); box-shadow: var(--shadow-md); }
.support-card--p3:hover { border-color: var(--blue); box-shadow: var(--shadow-md); }

/* Keyboard focus for card-as-button */
.support-card:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* Priority badges in the "How can we help" cards */
.support-priority-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.65rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.p1-badge { background: var(--red-bg);    color: #991B1B; }
.p2-badge { background: var(--yellow-bg); color: #92400E; }
.p3-badge { background: var(--blue-bg);   color: #1E3A8A; }

/* Your Tickets panel */
.support-tickets-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.support-tickets-panel-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: #F8FAFC;
}

.section-subheading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.ticket-list-wrap {
  overflow: hidden;
}

.ticket-table {
  display: table;
}

/* Loading indicator */
.loading-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.loading-indicator::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-dark);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* Support empty state */
.support-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 2rem;
  text-align: center;
}

.support-empty-icon {
  width: 72px;
  height: 72px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border-dark);
  margin-bottom: 0.25rem;
}

.support-empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.support-empty-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 380px;
  margin: 0;
  line-height: 1.6;
}

/* ── Buy Slots modal selects (inline styles set the arrow, add focus ring) ── */
#purchase-vendor:focus,
#purchase-exam-code:focus {
  border-color: var(--orange) !important;
  box-shadow: 0 0 0 3px var(--orange-glow) !important;
  outline: none;
}

/* ── btn-danger-outline (close ticket button) ── */
.btn-danger-outline {
  background: transparent;
  border: 1.5px solid #FCA5A5;
  color: var(--red);
  border-radius: var(--radius-md);
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.4;
}

.btn-danger-outline:hover:not(:disabled) {
  background: var(--red-bg);
  border-color: var(--red);
}

/* ── Section header right (Teams) ── */
.section-header-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ── Teams empty state ── */
.teams-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-secondary);
  border: 1px dashed var(--border-dark);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  background: var(--bg);
}

.teams-empty-state svg {
  color: var(--border-dark);
}

.teams-empty-state h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.teams-empty-state p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
  max-width: 360px;
  line-height: 1.6;
}

/* ── Assign team "select all" button ── */
.assign-team-select-all-btn {
  background: none;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--orange-dark);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.assign-team-select-all-btn:hover {
  background: var(--orange-light);
}

/* ── Reminder checkboxes (schedule modal) ── */
.reminder-checkboxes {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.reminder-checkboxes label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 400;
  color: var(--text-secondary);
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.reminder-checkboxes label:hover {
  border-color: var(--orange);
  color: var(--orange-dark);
  background: var(--orange-light);
}

.reminder-checkboxes input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: none;
  box-shadow: none;
  flex-shrink: 0;
  cursor: pointer;
}

.reminder-checkboxes label:has(input:checked) {
  border-color: var(--orange);
  background: var(--orange-light);
  color: var(--orange-dark);
}

/* ── Members tip bar ── */
.members-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--blue-bg);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  font-size: 0.83rem;
  color: #1E40AF;
  margin-bottom: 1rem;
  line-height: 1.55;
}

/* ── Members bulk action bar ── */
.members-bulk-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--navy-mid);
  color: #E2EAF7;
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  margin-bottom: 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
}

/* ── write-action-btn guard class (no style — just semantic marker) ── */
.write-action-btn { /* intentionally empty — class used by JS for permission checks */ }

/* ── schedule-exam-room-note ── */
.schedule-exam-room-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: var(--blue-bg);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.84rem;
  color: #1E3A8A;
  margin-bottom: 1.25rem;
  line-height: 1.55;
}

.schedule-exam-room-note svg {
  flex-shrink: 0;
  margin-top: 1px;
  width: 16px;
  height: 16px;
  fill: #3B82F6;
}

/* ── Ticket table priority badge columns ── */
#ticket-table .priority-badge { font-weight: 700; }

.priority-badge.p1 { background: var(--red-bg);    color: #991B1B; }
.priority-badge.p2 { background: var(--yellow-bg); color: #92400E; }
.priority-badge.p3 { background: var(--blue-bg);   color: #1E3A8A; }

/* ── modal-content-accented (Team modals) ── */
.modal-content-accented {
  border-top: 3px solid var(--orange);
}

/* ── Skeleton loading line ── */
.skeleton-line {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-sweep 1.4s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-sweep {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Section header: prevent overflow on small screens ── */
@media (max-width: 680px) {
  .section-header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .team-filter-select,
  .filter-select {
    flex: 1;
    min-width: 120px;
  }

  .modal-box { max-height: 96vh; }

  .form-row { grid-template-columns: 1fr; }

  .priority-radio-group { flex-direction: column; }
}
