:root {
  color-scheme: light;
  --primary: #0B3C5D;
  --secondary: #1D70B8;
  --accent: #00A8A8;
  --bg: #FFFFFF;
  --bg-soft: #F7F9FB;
  --bg-dark: #0A1F2E;
  --text: #0A1F2E;
  --muted: #667A8A;
  --border: #D9E1E8;
  --card: #FFFFFF;
  --shadow: 0 8px 24px rgba(10, 31, 46, .08);
  --shadow-subtle: 0 1px 2px rgba(10, 31, 46, .08);
  --shadow-dark: 0 18px 50px rgba(0, 0, 0, .28);
  --font-ar: "IBM Plex Sans Arabic", "Cairo", sans-serif;
  --font-en: "Inter", "Manrope", sans-serif;
}

:root.dark {
  color-scheme: dark;
  --bg: #0A1F2E;
  --bg-soft: #102B3D;
  --text: #FFFFFF;
  --muted: #B7C4CF;
  --border: rgba(255, 255, 255, .10);
  --card: #102B3D;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ar);
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.loading-shell,
.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.loading-mark {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.brand img,
.footer img,
.admin-topbar img {
  width: auto;
  object-fit: contain;
}

.theme-logo {
  display: inline-grid;
  align-items: center;
}

.theme-logo img {
  grid-area: 1 / 1;
  transition: opacity .2s ease;
}

.logo-dark,
:root.dark .logo-light {
  opacity: 0;
  pointer-events: none;
}

:root.dark .logo-dark {
  opacity: 1;
}

.brand img {
  height: 34px;
}

.navbar nav {
  display: flex;
  gap: 28px;
  font-size: .92rem;
  color: var(--muted);
}

.navbar nav a:hover,
.admin-link:hover {
  color: var(--accent);
}

.nav-actions,
.hero-actions,
.admin-topbar nav,
.admin-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-link {
  color: var(--muted);
  font-family: var(--font-en);
  font-size: .86rem;
}

.language-toggle {
  min-width: 54px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-en);
  font-weight: 600;
  transition: border-color .2s ease, color .2s ease, transform .2s ease;
}

.login-link {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-en);
  font-weight: 700;
  transition: transform .2s ease, background .2s ease;
}

.login-link:hover {
  transform: translateY(-1px);
  background: var(--secondary);
}

.language-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.lucide {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

.section {
  padding: 112px 0;
}

.section-dark {
  background:
    radial-gradient(circle at 18% 20%, rgba(0, 168, 168, .10), transparent 30%),
    linear-gradient(135deg, #0A1F2E 0%, #0B3C5D 58%, #06283D 100%);
  color: #eaf6fb;
}

.hero {
  min-height: 92vh;
  position: relative;
  overflow: hidden;
  display: grid;
  align-items: center;
  padding: 120px 0 72px;
}

.hero-grid,
.split,
.contact-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .86fr);
  gap: 72px;
  align-items: center;
}

.hero-copy {
  max-width: 720px;
}

.lang-en {
  font-family: var(--font-en);
}

.lang-en .hero-copy,
.lang-en .section-heading,
.lang-en .contact-section,
.lang-en .split {
  text-align: left;
}

.lang-en .logo-orbit {
  margin-inline-start: 0;
  margin-inline-end: auto;
}

.eyebrow,
.section-kicker {
  font-family: var(--font-en);
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  font-size: .78rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0;
}

.eyebrow {
  padding: 8px 12px;
  border: 1px solid rgba(0, 168, 168, .28);
  border-radius: 999px;
  background: rgba(0, 168, 168, .08);
}

.eyebrow span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(0, 168, 168, .55);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.hero h1 {
  margin: 24px 0 18px;
  font-size: clamp(2.375rem, 5vw, 3.5rem);
  line-height: 1.14;
  font-weight: 600;
  max-width: 760px;
}

.hero p,
.lead {
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.9;
}

.hero p {
  color: #b8cbd7;
  max-width: 680px;
}

.btn {
  min-height: 40px;
  padding: 0 20px;
  border-radius: 6px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-subtle);
}

.btn-secondary {
  background: color-mix(in srgb, var(--card) 88%, transparent);
  border-color: var(--border);
  color: var(--text);
}

.section-dark .btn-secondary {
  color: #fff;
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .18);
}

.btn-light {
  background: #fff;
  color: var(--primary);
}

.hero-visual {
  position: relative;
  min-height: 430px;
}

.logo-orbit {
  width: min(420px, 80vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
  margin-inline-start: auto;
}

.logo-orbit img {
  width: 64%;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, .24));
  animation: float 6s ease-in-out infinite;
}

.orbit-logo {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.orbit-logo img {
  max-width: 64%;
  width: 64%;
}

.orbit {
  position: absolute;
  inset: 10%;
  border: 1px solid rgba(0, 168, 168, .28);
  border-radius: 42% 58% 50% 50%;
  animation: rotate 18s linear infinite;
}

.orbit-two {
  inset: 21%;
  border-color: rgba(29, 112, 184, .38);
  animation-duration: 13s;
  animation-direction: reverse;
}

.orbiting-signal {
  position: absolute;
  inset: 2%;
  border-radius: 50%;
  animation: rotate var(--orbit-duration, 22s) linear infinite;
  animation-delay: var(--orbit-delay, 0s);
  pointer-events: none;
}

.orbiting-signal .signal-card {
  position: absolute;
  top: -2px;
  left: 50%;
  min-width: 132px;
  transform: translateX(-50%) rotate(calc(-1 * 1turn));
  animation: counter-rotate var(--orbit-duration, 22s) linear infinite;
  animation-delay: var(--orbit-delay, 0s);
}

.signal-card {
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background: rgba(10, 31, 46, .82);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  font-family: var(--font-en);
  text-align: left;
}

.signal-card strong,
.signal-card span {
  display: block;
}

.signal-card strong {
  color: #b8cbd7;
  font-size: .78rem;
}

.signal-card span {
  color: #fff;
  font-size: 1.7rem;
  font-weight: 600;
}

.signal-a {
  top: 12%;
  left: 0;
}

.signal-b {
  right: 0;
  bottom: 14%;
}

.scroll-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  cursor: pointer;
  transition: opacity .2s ease, transform .2s ease, border-color .2s ease;
}

.scroll-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.neural-canvas {
  position: absolute;
  inset: 0;
  opacity: .38;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 60px 60px;
}

.neural-canvas span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(0, 168, 168, .55);
  animation: pulse 4s ease-in-out infinite;
  animation-delay: var(--d);
}

.section-heading {
  text-align: center;
  margin-bottom: 44px;
}

.section-heading h2,
.split h2,
.contact-section h2 {
  font-size: clamp(1.75rem, 3vw, 2.125rem);
  line-height: 1.24;
  font-weight: 600;
  margin: 8px 0 16px;
}

.muted-band {
  background: var(--bg-soft);
}

.mission-panel,
.feature-card,
.product-card,
.contact-card,
.metrics-grid article,
.admin-section {
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  border-radius: 8px;
}

.mission-panel {
  padding: 26px;
  display: grid;
  gap: 8px;
}

.mission-panel strong {
  color: var(--accent);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.metrics-grid article {
  min-height: 142px;
  display: grid;
  place-items: center;
  text-align: center;
}

.metrics-grid article:last-child {
  grid-column: 1 / -1;
}

.metrics-grid strong {
  font-family: var(--font-en);
  font-size: 3rem;
  color: var(--primary);
}

:root.dark .metrics-grid strong {
  color: var(--accent);
}

.card-grid,
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.services-grid .feature-card:first-child {
  grid-column: span 2;
}

.feature-card,
.product-card {
  padding: 28px;
  position: relative;
  overflow: hidden;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.feature-card:hover,
.product-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 8px 24px rgba(10, 31, 46, .10);
}

.feature-card.featured {
  background: linear-gradient(135deg, rgba(0, 168, 168, .12), var(--card));
  border-color: rgba(0, 168, 168, .46);
}

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  margin-bottom: 18px;
}

.feature-card h3,
.product-card h3 {
  margin-bottom: 4px;
  font-size: 1.25rem;
  line-height: 1.4;
  font-weight: 600;
}

.feature-card span,
.product-card small {
  color: var(--muted);
  font-family: var(--font-en);
  font-weight: 600;
  text-transform: uppercase;
  font-size: .72rem;
}

.feature-card p,
.product-card dd {
  color: var(--muted);
  line-height: 1.75;
}

.why-band .split {
  grid-template-columns: .8fr 1.2fr;
}

.why-list {
  display: grid;
  gap: 14px;
}

.why-list article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
}

.why-list h3,
.why-list p {
  margin-bottom: 4px;
}

.why-list strong {
  color: var(--accent);
  font-family: var(--font-en);
  font-size: .78rem;
}

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

.product-card dl {
  margin: 18px 0 0;
  display: grid;
  gap: 9px;
}

.product-card dt {
  color: var(--accent);
  font-weight: 600;
}

.product-card dd {
  margin: 0;
  padding: 12px;
  background: color-mix(in srgb, var(--bg-soft) 72%, transparent);
  border-radius: 8px;
}

.tech-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 820px;
  margin: 0 auto;
}

.tech-grid span {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--muted);
  font-family: var(--font-en);
  font-weight: 600;
  font-size: .86rem;
}

.cta-band {
  padding: 92px 0;
  text-align: center;
  background: linear-gradient(135deg, #0A1F2E 0%, #0B3C5D 58%, #06283D 100%);
  color: #fff;
}

.cta-band h2 {
  font-size: clamp(1.75rem, 4vw, 3.5rem);
  font-weight: 600;
  margin-bottom: 8px;
}

.cta-band p {
  color: rgba(255, 255, 255, .78);
  font-family: var(--font-en);
  text-transform: uppercase;
  font-weight: 600;
}

.contact-lines {
  display: grid;
  gap: 14px;
  color: var(--muted);
}

.contact-lines a,
.contact-lines span {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}

.contact-card {
  padding: 26px;
  display: grid;
  gap: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  color: var(--text);
  border-radius: 6px;
  min-height: 44px;
  padding: 12px 14px;
  outline: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(29, 112, 184, .14);
}

.form-status,
.admin-status {
  color: var(--accent);
  margin: 0;
  font-weight: 600;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 30px 0;
  color: var(--muted);
}

.footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.footer img {
  height: 30px;
}

.footer div div {
  display: flex;
  gap: 10px;
}

.footer a {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
}

[data-animate] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .7s ease, transform .7s ease;
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

.admin-login form {
  width: min(390px, calc(100% - 32px));
  display: grid;
  gap: 14px;
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}

.admin-login img {
  height: 48px;
  width: fit-content;
  margin: 0 auto 8px;
}

.admin-login h1 {
  margin-bottom: 0;
  font-family: var(--font-en);
}

.admin-login p,
.admin-login span {
  color: var(--muted);
}

.admin-page {
  min-height: 100vh;
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font-en);
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 max(20px, calc((100vw - 920px) / 2));
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(18px);
}

.admin-topbar > div {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-topbar img {
  height: 34px;
}

.admin-topbar nav button:not(.icon-button) {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.admin-container {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 46px 0 70px;
}

.admin-heading {
  margin-bottom: 26px;
}

.admin-heading h1 {
  margin-bottom: 6px;
}

.admin-heading p {
  color: var(--muted);
}

.admin-section {
  margin-bottom: 26px;
  overflow: hidden;
}

.admin-section header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
}

.admin-section h2 {
  font-size: 1.05rem;
  margin: 0;
}

.admin-section-body {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.admin-grid {
  display: grid;
  gap: 16px;
}

.admin-grid.two,
.logo-editor {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 800;
}

.field span {
  font-size: .86rem;
}

.logo-editor {
  display: grid;
  gap: 18px;
}

.logo-editor label {
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
}

.upload-box {
  min-height: 160px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 18px;
}

.upload-box.dark-preview {
  background: #0a1f2e;
}

.upload-box img {
  max-width: 210px;
  max-height: 78px;
  object-fit: contain;
}

.repeater {
  display: grid;
  gap: 14px;
}

.repeater-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.repeater-row textarea {
  grid-column: 1 / -1;
}

.product-editor {
  grid-template-columns: 1fr 1fr;
}

.signal-editor {
  grid-template-columns: .6fr 1fr 1fr .7fr .8fr .8fr;
  align-items: end;
}

.product-editor textarea:last-child {
  grid-column: 1 / -1;
}

.switch-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.switch-line input {
  width: 18px;
  min-height: 18px;
}

.ssl-line {
  align-self: end;
}

.admin-actions {
  justify-content: space-between;
  margin-top: 30px;
}

#blazor-error-ui {
  background: #fff3cd;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
  display: none;
  left: 0;
  padding: .6rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: .75rem;
  top: .5rem;
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}

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

@keyframes counter-rotate {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(-360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: .25; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.7); }
}

@media (max-width: 900px) {
  .navbar nav {
    display: none;
  }

  .hero-grid,
  .split,
  .contact-section,
  .why-band .split {
    grid-template-columns: 1fr;
    gap: 42px;
  }

  .hero {
    text-align: center;
    min-height: auto;
  }

  .hero-actions {
    justify-content: center;
    flex-wrap: wrap;
  }

  .hero-visual {
    min-height: 320px;
  }

  .logo-orbit {
    margin: 0 auto;
  }

  .card-grid,
  .product-grid,
  .services-grid .feature-card:first-child,
  .admin-grid.two,
  .logo-editor {
    grid-template-columns: 1fr;
  }

  .services-grid .feature-card:first-child {
    grid-column: auto;
  }

  .footer .container,
  .admin-topbar {
    flex-direction: column;
    padding-top: 18px;
    padding-bottom: 18px;
  }
}

@media (max-width: 560px) {
  .section {
    padding: 78px 0;
  }

  .hero {
    padding-top: 86px;
  }

  .hero h1 {
    font-size: clamp(2.125rem, 12vw, 2.375rem);
  }

  .hero-actions,
  .admin-actions {
    display: grid;
  }

  .btn {
    width: 100%;
  }

  .metrics-grid,
  .repeater-row,
  .product-editor,
  .signal-editor {
    grid-template-columns: 1fr;
  }

  .signal-card {
    display: none;
  }
}

.saas-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background: #f4f7fb;
  color: #102033;
  font-family: var(--font-en);
}

.saas-shell.rtl {
  font-family: var(--font-ar);
}

.saas-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  background: #ffffff;
  border-inline-end: 1px solid #dfe7ef;
}

.saas-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  font-weight: 800;
}

.saas-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.saas-sidebar nav {
  display: grid;
  gap: 6px;
}

.saas-sidebar nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border-radius: 8px;
  color: #5b6f82;
  font-weight: 700;
}

.saas-sidebar nav a.active,
.saas-sidebar nav a:hover {
  background: #e8f4f4;
  color: #087f83;
}

.saas-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  font-size: 1rem;
}

.saas-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.saas-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  background: rgba(255, 255, 255, .84);
  border-bottom: 1px solid #dfe7ef;
  backdrop-filter: blur(16px);
}

.saas-topbar-actions,
.saas-topbar-left,
.row-actions,
.form-buttons,
.pagination-row,
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.saas-content {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 70px;
}

.saas-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.saas-page-header p {
  margin-bottom: 7px;
  color: #00a8a8;
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.saas-page-header h1 {
  margin-bottom: 6px;
  font-size: 2rem;
}

.saas-page-header span,
.saas-panel header span,
.list-row span,
.saas-state span,
.gap-notice p,
.gap-notice li {
  color: #60758a;
}

.saas-page-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tenant-selector,
.toolbar-row select {
  min-height: 40px;
  border: 1px solid #d8e3ec;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: #102033;
}

.tenant-chip,
.user-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #d8e3ec;
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  color: #60758a;
  font-weight: 700;
  font-size: .86rem;
}

.saas-panel,
.gap-notice {
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(19, 39, 60, .06);
  overflow: hidden;
}

.saas-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid #e8eef4;
}

.saas-panel h2 {
  margin: 0;
  font-size: 1.05rem;
}

.dashboard-grid,
.roles-grid,
.permission-catalog,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  min-height: 118px;
  display: grid;
  gap: 8px;
  align-content: center;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #fff;
  padding: 20px;
}

.metric-card span {
  color: #60758a;
  font-weight: 700;
}

.metric-card strong {
  font-size: 2rem;
  color: #0b3c5d;
}

.metric-card.warning strong {
  color: #a15c00;
}

.table-wrap {
  overflow-x: auto;
}

.saas-panel table {
  width: 100%;
  border-collapse: collapse;
}

.saas-panel th,
.saas-panel td {
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f6;
  text-align: start;
  vertical-align: middle;
}

.saas-panel th {
  color: #60758a;
  font-size: .78rem;
  text-transform: uppercase;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef3f7;
  color: #516779;
  font-size: .78rem;
  font-weight: 800;
}

.status-badge.positive {
  background: #e8f7ee;
  color: #167146;
}

.status-badge.warning {
  background: #fff3d7;
  color: #8c5a00;
}

.saas-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 1px dashed #cbd8e3;
  border-radius: 8px;
  background: #fff;
  padding: 26px;
  text-align: center;
}

.saas-state.error {
  border-color: #f0b9b9;
  background: #fff7f7;
}

.gap-notice {
  padding: 22px;
}

.gap-notice strong {
  display: block;
  margin-bottom: 8px;
}

.gap-notice ul {
  margin: 14px 0 0;
}

.toolbar-row {
  margin-bottom: 18px;
}

.search-box {
  min-width: min(360px, 100%);
  display: grid;
  gap: 5px;
}

.search-box span,
.form-grid label span,
.saas-login label span {
  color: #60758a;
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
}

.form-grid label {
  display: grid;
  gap: 6px;
}

.form-buttons {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.detail-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 12px 18px;
  padding: 20px;
  margin: 0;
}

.detail-list dt {
  color: #60758a;
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 14px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #edf2f6;
}

.list-row .status-badge,
.list-row .row-actions {
  grid-row: span 2;
}

.role-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 14px 20px;
  border: 0;
  border-bottom: 1px solid #edf2f6;
  background: #fff;
  color: inherit;
  text-align: start;
  cursor: pointer;
}

.role-row.active {
  background: #e8f4f4;
}

.role-row span {
  color: #60758a;
}

.permission-group {
  padding: 18px 20px;
  border-bottom: 1px solid #edf2f6;
}

.permission-group h3 {
  font-size: .95rem;
}

.permission-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 10px 0;
}

.permission-line input {
  width: 18px;
  min-height: 18px;
  grid-row: span 2;
}

.permission-line small {
  color: #60758a;
}

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

.settings-list {
  display: grid;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(260px, 1fr);
  gap: 18px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #edf2f6;
}

.setting-row > div {
  display: grid;
  gap: 6px;
}

.setting-row small {
  color: #7d8da0;
  font-family: var(--font-en);
}

.setting-row select {
  min-height: 44px;
  border: 1px solid #d8e3ec;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: #102033;
}

.pagination-row {
  justify-content: space-between;
  padding: 14px 16px;
}

.saas-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #f4f7fb;
}

.saas-login form {
  width: min(430px, calc(100% - 32px));
  display: grid;
  gap: 14px;
  padding: 34px;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(19, 39, 60, .10);
}

.saas-login img {
  height: 52px;
  object-fit: contain;
  justify-self: center;
}

.saas-login h1,
.saas-login p {
  text-align: center;
  margin-bottom: 0;
}

.saas-login p {
  color: #60758a;
}

.saas-login label {
  display: grid;
  gap: 6px;
}

.inline-alert {
  border: 1px solid #f0b9b9;
  border-radius: 8px;
  background: #fff7f7;
  color: #8a3030;
  padding: 12px;
}

@media (max-width: 980px) {
  .saas-shell {
    grid-template-columns: 1fr;
  }

  .saas-sidebar {
    position: static;
    height: auto;
  }

  .saas-sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid,
  .dashboard-grid,
  .roles-grid,
  .permission-catalog,
  .settings-grid,
  .setting-row,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .saas-page-header,
  .saas-topbar {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 16px;
    padding-bottom: 16px;
  }
}
