/* ==========================================================================
   Rushd MVP — base stylesheet
   Mobile-first, bilingual (RTL/LTR aware via [dir] on <html>)
   ========================================================================== */

:root {
  --color-primary: #1F3864;
  --color-primary-light: #2E5395;
  --color-accent: #C08A2E;
  --color-bg: #F5F7FA;
  --color-surface: #FFFFFF;
  --color-border: #E1E5EB;
  --color-text: #1F2430;
  --color-text-muted: #5B6472;
  --color-success: #1E7A46;
  --color-success-bg: #E6F4EA;
  --color-warning: #8A5A00;
  --color-warning-bg: #FCEFD9;
  --color-danger: #A32626;
  --color-danger-bg: #FBE7E7;
  --color-gray-bg: #EEF0F3;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.10);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, 0.14);
  --transition: 150ms ease;
  --font: -apple-system, "Segoe UI", Tahoma, "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
}

* { box-sizing: border-box; }

.icon { vertical-align: middle; flex-shrink: 0; color: currentColor; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  line-height: 1.6;
  font-size: 16px;
}

a { color: var(--color-primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Topbar ---------------- */
.topbar {
  background: linear-gradient(155deg, var(--color-primary) 0%, #16294B 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-md);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 9px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--color-accent); color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 2px 8px rgba(192,138,46,0.45);
}
.brand-text { font-weight: 600; font-size: 18px; letter-spacing: .2px; }

.tenant-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px; padding: 4px 12px 4px 4px;
  order: 3;
}
[dir="rtl"] .tenant-chip { padding: 4px 4px 4px 12px; }
.tenant-logo { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: #fff; }
.tenant-logo-placeholder { display: inline-flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.85); }
.tenant-name { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.92); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-toggle {
  display: flex; align-items: center;
  background: none; border: none; cursor: pointer; padding: 8px; color: #fff;
  order: 4;
}

.main-nav { display: none; flex-direction: column; gap: 2px; width: 100%; order: 5; }
.main-nav.open { display: flex; }
.main-nav a {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,0.92); padding: 8px 12px; border-radius: 8px;
  font-size: 14.5px;
  transition: background var(--transition), color var(--transition);
}
.main-nav a:hover { background: rgba(255,255,255,0.14); text-decoration: none; color: #fff; }
.lang-toggle {
  border: 1px solid rgba(255,255,255,0.35); justify-content: center;
  /* A vertical rule before the language switch keeps it visually separate
     from the governance nav links instead of looking like a stray pill
     floating at the end of a wrapped row. */
  margin-inline-start: 10px; position: relative;
}
.lang-toggle::before {
  content: ''; position: absolute; inset-inline-start: -10px; top: 20%; bottom: 20%;
  width: 1px; background: rgba(255,255,255,0.25);
}

@media (min-width: 800px) {
  .nav-toggle { display: none; }
  /*
   * flex-wrap alone wasn't enough (first attempt at this fix) — .main-nav is
   * itself a flex ITEM inside .topbar-inner's row, and flex items default to
   * min-width: auto, which equals their unwrapped content width. That silently
   * blocks the browser from ever shrinking .main-nav enough to trigger its own
   * internal wrapping, so the row just kept overflowing past the viewport
   * regardless of flex-wrap. `flex: 1 1 auto` + `min-width: 0` overrides that
   * default and lets .main-nav actually shrink to the space left after
   * brand/tenant-chip, so flex-wrap can kick in and the language-switch link
   * (last item) lands on a visible second row instead of off-screen.
   */
  .main-nav {
    display: flex; flex-direction: row; flex-wrap: wrap; align-items: center;
    align-content: center; justify-content: flex-end; row-gap: 10px; gap: 4px;
    flex: 1 1 auto; min-width: 0; width: auto; order: 3;
  }
  .tenant-chip { order: 2; }
  /* Extra breathing room only matters once the row actually wraps onto two
     lines (short viewports / longer English labels) — harmless padding on a
     single-line row, but stops a wrapped second row from crowding the
     topbar's bottom edge. */
  .topbar-inner { padding-block: 14px; }
}

/* ---------------- Layout ---------------- */
.page { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.site-footer { text-align: center; color: var(--color-text-muted); padding: 24px 16px; font-size: 14px; }
.footer-legal-links { margin-top: 4px; font-size: 13px; }
.footer-legal-links a { color: var(--color-text-muted); }
.footer-legal-links span { margin: 0 6px; }

.legal-page { max-width: 760px; margin: 0 auto; }
.legal-page h3 { margin: 26px 0 8px; font-size: 16px; }
.legal-page p { color: var(--color-text-muted); line-height: 1.8; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.card h2, .card h3 { margin-top: 0; }
.stat-card { transition: box-shadow var(--transition), transform var(--transition); }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 640px) {
  .card-grid.cols-2 { grid-template-columns: 1fr 1fr; }
  .card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
}

.stat-card { text-align: center; }
.stat-value { font-size: 30px; font-weight: 700; color: var(--color-primary); }
.stat-label { color: var(--color-text-muted); font-size: 14px; margin-top: 4px; }

/* ---------------- Forms ---------------- */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=file], select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 16px;
  background: #fff;
  color: var(--color-text);
  margin-bottom: 14px;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 80px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}
.btn:hover { background: var(--color-primary-light); text-decoration: none; color: #fff; box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px); }
@media (min-width: 640px) { .btn { width: auto; } }
.btn-secondary { background: var(--color-gray-bg); color: var(--color-text); }
.btn-secondary:hover { background: var(--color-border); color: var(--color-text); box-shadow: none; }

.form-narrow { max-width: 420px; margin: 40px auto; }

/* ---------------- Badges ---------------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.badge-critical { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-high { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-medium { background: #EAF0FB; color: var(--color-primary-light); }
.badge-low { background: var(--color-gray-bg); color: var(--color-text-muted); }
.badge-compliant { background: var(--color-success-bg); color: var(--color-success); }
.badge-gap { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-pending { background: var(--color-gray-bg); color: var(--color-text-muted); }

/*
 * Regulatory-status badges: a DIFFERENT dimension from severity/status
 * (legal bindingness, not assessment weight or completion state), so they
 * get their own outlined visual language — indigo/violet hue, border-only
 * fill instead of solid — so they never get mistaken for a severity or
 * status pill even when the Arabic label is short and unfamiliar.
 */
.badge-reg {
  background: #fff;
  border: 1.5px solid currentColor;
  font-weight: 700;
}
.badge-reg-mandatory { color: #6D28D9; }       /* إلزامي — violet, strongest */
.badge-reg-conditional { color: #7C3AED; }     /* مشروط */
.badge-reg-contractual { color: #8B5CF6; }     /* تعاقدي */
.badge-reg-recommended { color: #A78BFA; }     /* موصى به */
.badge-reg-best_practice { color: #C4B5FD; }   /* أفضل الممارسات — lightest */

/*
 * Maturity-level badges (Phase C1, 0-5 COBIT/CMMI-style ladder): a THIRD
 * independent dimension from severity/status/regulatory-status, so it gets
 * its own solid blue/teal scale (darkest = least mature, brightest teal =
 * fully optimized) — never reusing the red/orange severity hues or the
 * green/gray status hues, for the same "don't let two different axes look
 * like the same badge" reason documented above for badge-reg.
 */
.badge-maturity { color: #fff; font-weight: 700; }
.badge-maturity-0 { background: #64748B; } /* غير موجود — slate */
.badge-maturity-1 { background: #475569; } /* مبدئي */
.badge-maturity-2 { background: #0E7490; } /* متكرر وغير رسمي */
.badge-maturity-3 { background: #0891B2; } /* موثّق */
.badge-maturity-4 { background: #0D9488; } /* مُدار ومتحقَّق */
.badge-maturity-5 { background: #059669; } /* مُحسَّن ومستدام — brightest */

/* ---------------- Requirement list ---------------- */
.req-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px; border: 1px solid var(--color-border); border-radius: 8px; margin-bottom: 10px;
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.req-item:hover { border-color: var(--color-primary-light); box-shadow: var(--shadow-md); transform: translateX(2px); }
[dir="rtl"] .req-item:hover { transform: translateX(-2px); }
.req-title { font-weight: 600; }
.req-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.req-meta-row { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
[dir="rtl"] .req-meta-row { align-items: flex-start; }
.req-meta-label {
  font-size: 11px; color: var(--color-text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .02em;
}

/* ---------------- Progress bar ---------------- */
.progress-track { background: var(--color-gray-bg); border-radius: 999px; height: 12px; overflow: hidden; }
.progress-fill { background: var(--color-primary); height: 100%; border-radius: 999px; transition: width .3s ease; }

/* ---------------- Flash messages ---------------- */
.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: var(--color-success-bg); color: var(--color-success); }
.flash-error { background: var(--color-danger-bg); color: var(--color-danger); }
.flash-info { background: #EAF0FB; color: var(--color-primary-light); }

/* ---------------- Privacy notice ---------------- */
.privacy-notice {
  background: #EAF0FB; border: 1px solid #C9D8F0; border-radius: 8px;
  padding: 10px 14px; font-size: 14px; color: var(--color-primary); margin-bottom: 14px;
}

/* ---------------- Print (governance report) ---------------- */
@media print {
  .topbar, .site-footer, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ---------------- Table (gaps register) ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px; border-bottom: 1px solid var(--color-border); text-align: start; }
th { color: var(--color-text-muted); font-weight: 600; }

/* ---------------- Tenant header (dashboard) ---------------- */
.tenant-header-card {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.tenant-header-logo {
  width: 56px; height: 56px; border-radius: 14px; object-fit: cover;
  border: 1px solid var(--color-border); background: #fff;
}
.tenant-logo-placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-gray-bg); color: var(--color-text-muted);
}
.tenant-header-info { flex: 1; min-width: 160px; }

/* Circular maturity-score ring, built with a conic-gradient — no JS/SVG needed. */
.score-ring {
  --pct: calc(var(--score) * 1%);
  width: 76px; height: 76px; border-radius: 50%;
  background: conic-gradient(var(--color-primary) var(--pct), var(--color-gray-bg) 0);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.score-ring-value {
  width: 60px; height: 60px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: var(--color-primary);
}

.stat-icon { color: var(--color-primary); margin-bottom: 6px; display: flex; justify-content: center; }

/* ---------------- AI analysis panel ---------------- */
.ai-panel { border-inline-start: 4px solid var(--color-primary-light); }
.ai-panel-pass { border-inline-start-color: var(--color-success); }
.ai-panel-fail { border-inline-start-color: var(--color-warning); }
.ai-panel-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.ai-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: #EAF0FB; color: var(--color-primary-light);
}
.ai-panel-title { font-weight: 700; font-size: 15px; }

.badge-method { border: 1px solid transparent; }
.badge-method-auto { background: var(--color-success-bg); color: var(--color-success); }
.badge-method-manual_fallback { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-method-unavailable { background: var(--color-gray-bg); color: var(--color-text-muted); }

.ai-details { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.ai-details dt { font-size: 12px; color: var(--color-text-muted); font-weight: 600; margin-bottom: 4px; }
.ai-details dd { margin: 0; }
.chip {
  display: inline-block; background: var(--color-gray-bg); color: var(--color-text);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; margin: 0 4px 4px 0;
}
.ai-explainer { margin-top: 10px; font-size: 13px; color: var(--color-text-muted); }
.ai-explainer summary { cursor: pointer; font-weight: 600; color: var(--color-primary-light); }
.ai-explainer p { margin: 8px 0 0; }

/* ---------------- Logo upload (register page) ---------------- */
.field-optional { font-weight: 400; color: var(--color-text-muted); font-size: 12px; }
.logo-upload { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.logo-preview {
  width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0;
  background: var(--color-gray-bg); color: var(--color-text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; text-align: center; overflow: hidden;
  background-size: cover; background-position: center;
  border: 1px dashed var(--color-border);
}
.logo-upload input[type=file] { margin-bottom: 0; }
.logo-preview-img { object-fit: cover; }

/* ---------------- Public landing page hero ---------------- */
.landing { margin: -20px -16px 0; }
.hero {
  background: linear-gradient(155deg, var(--color-primary) 0%, #16294B 100%);
  color: #fff;
  padding: 56px 16px 100px;
  text-align: center;
}
.hero-inner { max-width: 760px; margin: 0 auto; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px; padding: 6px 16px; font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,0.9); margin-bottom: 22px;
}
.hero-badge .icon { color: var(--color-accent); }
.hero-title {
  font-size: 30px; line-height: 1.4; font-weight: 700; margin: 0 0 18px;
}
@media (min-width: 640px) { .hero-title { font-size: 40px; } }
.hero-sub {
  font-size: 16px; line-height: 1.8; color: rgba(255,255,255,0.82);
  max-width: 620px; margin: 0 auto 28px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.btn-hero-primary {
  background: var(--color-accent); color: #fff; border: none;
  padding: 13px 26px; border-radius: 999px; font-weight: 700; font-size: 16px;
  cursor: pointer; transition: transform var(--transition), box-shadow var(--transition);
}
.btn-hero-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(192,138,46,0.5); color: #fff; text-decoration: none; }
.btn-hero-secondary {
  background: rgba(255,255,255,0.08); color: #fff; border: 1px solid rgba(255,255,255,0.35);
  padding: 13px 26px; border-radius: 999px; font-weight: 700; font-size: 16px;
  cursor: pointer; transition: background var(--transition);
}
.btn-hero-secondary:hover { background: rgba(255,255,255,0.18); color: #fff; text-decoration: none; }

.hero-stats {
  max-width: 900px; margin: -70px auto 40px;
  display: grid; grid-template-columns: 1fr; gap: 14px;
  padding: 0 16px;
}
@media (min-width: 640px) { .hero-stats { grid-template-columns: repeat(3, 1fr); } }
.hero-stat {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 26px 16px; text-align: center;
}
.hero-stat-value { font-size: 30px; font-weight: 700; color: var(--color-primary); }
.hero-stat-label { color: var(--color-text-muted); font-size: 14px; margin-top: 6px; }

.features-title { text-align: center; font-size: 24px; margin: 10px 0 26px; }
.feature-grid {
  display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 40px;
}
@media (min-width: 640px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
.feature-card { text-align: center; }
.feature-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 14px; margin-bottom: 12px;
  background: #EAF0FB; color: var(--color-primary-light);
}
.feature-card h3 { margin: 0 0 8px; font-size: 17px; }
.feature-card p { margin: 0; color: var(--color-text-muted); font-size: 14px; line-height: 1.7; }

/* ---------------- Trust badges (hero) ---------------- */
.trust-badges {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 30px;
}
.trust-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px; padding: 6px 14px; font-size: 12.5px; font-weight: 600;
  color: rgba(255,255,255,0.78);
}
.trust-badge .icon { width: 16px; height: 16px; color: var(--color-accent); }

/* ---------------- 3-steps section ---------------- */
.steps-section { margin: 8px 16px 44px; }
.steps-subtitle { text-align: center; color: var(--color-text-muted); margin: -14px 0 22px; font-size: 15px; }
.steps-card {
  max-width: 780px; margin: 0 auto; padding: 8px;
}
.step-item {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 16px 12px; border-bottom: 1px solid var(--color-border);
}
.step-item:last-child { border-bottom: none; }
.step-number {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--color-primary); color: #fff; font-weight: 700; font-size: 15px;
}
.step-item h3 { margin: 0 0 4px; font-size: 16px; }
.step-item p { margin: 0; color: var(--color-text-muted); font-size: 14px; line-height: 1.7; }

/* ---------------- Closing CTA banner ---------------- */
.cta-banner {
  background: linear-gradient(155deg, var(--color-primary) 0%, #16294B 100%);
  border-radius: var(--radius); margin: 0 16px 40px; padding: 46px 20px; text-align: center;
}
.cta-banner-inner { max-width: 560px; margin: 0 auto; }
.cta-banner h2 { color: #fff; font-size: 24px; margin: 0 0 10px; }
.cta-banner p { color: rgba(255,255,255,0.82); margin: 0 0 22px; font-size: 15px; line-height: 1.7; }

/* ---------------- Domain cards (dashboard) ---------------- */
.domain-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  text-decoration: none; color: inherit; cursor: pointer;
}
.domain-card:hover { text-decoration: none; border-color: var(--color-primary-light); box-shadow: var(--shadow-md); }
.domain-card-info { flex: 1; min-width: 0; }
.domain-card-score {
  font-size: 22px; font-weight: 700; color: var(--color-primary); flex-shrink: 0;
  width: 60px; text-align: center;
}

/* ---------------- Domain group headings (requirements list) ---------------- */
.domain-group-title {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 22px 0 10px;
}
.domain-group-title:first-child { margin-top: 0; }

/* ---------------- Printable report ---------------- */
.report-header { display: flex; align-items: center; gap: 16px; }
.report-logo { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; border: 1px solid var(--color-border); }

.report-summary-card { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.report-summary-card .score-ring { width: 92px; height: 92px; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.report-summary-card .score-ring-value { width: 74px; height: 74px; font-size: 18px; }
.report-summary-text { flex: 1; min-width: 220px; }
.exec-summary { color: var(--color-text-muted); line-height: 1.8; margin: 0; }
.exec-summary strong { color: var(--color-text); }

@media print {
  .score-ring { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* ==========================================================================
   Profile, Team & Admin (Feature 1 + Feature 2)
   ========================================================================== */

.muted { color: var(--color-text-muted); }
.muted.small { font-size: 12px; margin-top: 4px; }

.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.card-inset {
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: 8px; padding: 14px 16px; margin: 16px 0;
}
details.card-inset summary { cursor: pointer; font-weight: 600; color: var(--color-primary-light); }

/* Profile page */
.profile-card { max-width: 640px; margin: 0 auto; }
.profile-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.profile-header h2 { margin: 0 0 2px; font-size: 20px; }
.profile-header .btn { margin-inline-start: auto; width: auto; }
.avatar-lg {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--color-border); background: #fff; flex-shrink: 0;
}
.avatar-placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-gray-bg); color: var(--color-text-muted);
}
.avatar-sm {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--color-border); background: #fff; flex-shrink: 0;
  vertical-align: middle;
}
.cell-with-avatar { display: flex; align-items: center; gap: 8px; }
.profile-facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.profile-facts dt { color: var(--color-text-muted); font-size: 13px; font-weight: 600; }
.profile-facts dd { margin: 0; }

.form-grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 640px) { .form-grid-2 { grid-template-columns: 1fr 1fr; } }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.checkbox-row input { width: auto; margin: 0; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form-actions .btn, .form-actions .btn-secondary { width: auto; }

/* Data tables (team / admin users) */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 14px; }
.data-table th, .data-table td { padding: 10px; border-bottom: 1px solid var(--color-border); text-align: start; vertical-align: middle; }
.data-table th { color: var(--color-text-muted); font-weight: 600; font-size: 13px; }
.data-table th a { color: var(--color-text-muted); }
.actions-cell { display: flex; gap: 10px; flex-wrap: wrap; }

.inline-form { display: inline-block; margin: 0; }
.inline-form select { margin-bottom: 0; padding: 6px 8px; font-size: 13px; width: auto; }

.btn-link {
  background: none; border: none; padding: 0; color: var(--color-primary-light);
  cursor: pointer; font-size: 13px; text-decoration: underline; font-weight: 600;
}
.btn-link-danger { color: var(--color-danger); }
.btn-danger { background: var(--color-danger); }
.btn-danger:hover { background: #7d1d1d; }

.temp-password {
  display: inline-block; background: #fff; border: 1px dashed var(--color-border);
  border-radius: 6px; padding: 6px 12px; margin-top: 6px; font-size: 16px; letter-spacing: 1px;
  font-weight: 700; direction: ltr;
}

/* Two-Factor Authentication (migration_v19) */
.twofa-secret {
  display: inline-block; background: #fff; border: 1px dashed var(--color-border);
  border-radius: 6px; padding: 6px 12px; margin-top: 6px; font-size: 16px; letter-spacing: 2px;
  font-weight: 700; direction: ltr; word-break: break-all;
}
.twofa-steps { padding-inline-start: 20px; margin: 14px 0; }
.twofa-steps li { margin-bottom: 14px; line-height: 1.7; }
.backup-codes-list {
  list-style: none; padding: 0; margin: 10px 0 0; display: grid;
  grid-template-columns: repeat(2, 1fr); gap: 8px;
}
.backup-codes-list li code {
  display: block; background: #fff; border: 1px dashed var(--color-border);
  border-radius: 6px; padding: 6px 10px; font-size: 15px; letter-spacing: 1px;
  font-weight: 700; direction: ltr; text-align: center;
}
.twofa-verify-tabs { display: flex; gap: 10px; margin-bottom: 14px; }
.twofa-verify-tabs button { width: auto; }

/* Filters / search / pagination */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; align-items: center; }
.filter-bar input, .filter-bar select { margin-bottom: 0; width: auto; min-width: 160px; }
.filter-bar .btn { width: auto; }
.pagination { display: flex; align-items: center; gap: 14px; justify-content: center; margin-top: 16px; font-size: 14px; }

/* Admin dashboard stat grid */
.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 16px;
}
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }

.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 16px 0; }
.admin-actions .btn-secondary, .admin-actions .btn-danger { width: auto; }
