@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("/assets/IBMPlexSansArabic-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("/assets/IBMPlexSansArabic-Medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("/assets/IBMPlexSansArabic-SemiBold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("/assets/IBMPlexSansArabic-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --brand: #ff3b30;
  --brand-strong: #dc2f28;
  --brand-soft: #fff1ef;
  --brand-wash: #fff8f7;
  --ink: #1b1d21;
  --ink-soft: #30343a;
  --muted: #737983;
  --muted-2: #9ba1aa;
  --paper: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #fafafa;
  --line: #e6e8eb;
  --line-strong: #d8dbe0;
  --charcoal: #17181b;
  --charcoal-2: #222429;
  --blue: #4169e1;
  --amber: #c98218;
  --green: #138a5b;
  --red: #c83e36;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --radius-sm: 9px;
  --shadow-xs: 0 1px 2px rgba(17, 24, 39, .04);
  --shadow-sm: 0 8px 24px rgba(17, 24, 39, .06);
  --shadow-lg: 0 24px 70px rgba(17, 24, 39, .16);
  font-family: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--paper); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
a, button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(255, 59, 48, .2);
  outline-offset: 2px;
}
.is-hidden { display: none !important; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

/* Shared brand */
.brand-line { display: flex; align-items: center; gap: 12px; margin: 0; font-weight: 800; }
.brand-wordmark img { width: 250px; height: auto; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand);
  color: white;
  font-weight: 900;
}

/* Authentication */
.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(500px, 1.05fr) minmax(430px, .95fr);
  direction: ltr;
  background: var(--surface);
}
.login-art {
  position: relative;
  min-height: 720px;
  overflow: hidden;
  direction: rtl;
  color: white;
  background:
    radial-gradient(circle at 48% 42%, rgba(255, 79, 68, .22), transparent 18%),
    radial-gradient(circle at 12% 90%, rgba(255, 59, 48, .14), transparent 30%),
    linear-gradient(145deg, #24262b 0%, #17181b 52%, #0f1012 100%);
}
.login-art::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .18;
  background-image:
    linear-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .12) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}
.login-art::after {
  content: "";
  position: absolute;
  width: 480px;
  height: 480px;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(255, 59, 48, .16);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 120px rgba(255, 255, 255, .015), 0 0 0 240px rgba(255, 255, 255, .01);
}
.orbit {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  border: 1px dashed rgba(255, 99, 88, .35);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.orbit-one { width: 340px; height: 340px; }
.orbit-two { width: 610px; height: 610px; opacity: .52; }
.hub-mark {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 126px;
  height: 126px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 35px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 25px 70px rgba(0, 0, 0, .38), 0 0 0 12px rgba(255, 59, 48, .08);
  transform: translate(-50%, -50%);
}
.hub-mark img { width: 100%; }
.signal-card {
  position: absolute;
  z-index: 4;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 9px;
  min-width: 150px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 14px;
  background: rgba(34, 36, 41, .84);
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 38px rgba(0, 0, 0, .22);
}
.signal-card i {
  grid-row: span 2;
  align-self: center;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #37d08b;
  box-shadow: 0 0 0 5px rgba(55, 208, 139, .12);
}
.signal-card span { font-size: 12px; font-weight: 800; }
.signal-card small { color: #a9afb8; font-size: 9px; }
.signal-a { top: 20%; left: 51%; }
.signal-b { top: 47%; left: 10%; }
.signal-c { bottom: 17%; left: 48%; }
.signal-d { top: 46%; right: 8%; }
.login-art-copy {
  position: absolute;
  z-index: 5;
  right: 46px;
  bottom: 42px;
  display: grid;
  gap: 8px;
}
.login-art-copy span { color: #adb1b8; font-size: 12px; }
.login-art-copy strong { max-width: 420px; font-size: clamp(20px, 2.4vw, 31px); line-height: 1.45; }
.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  direction: rtl;
  padding: clamp(42px, 7vw, 100px);
  background: var(--surface);
  color: var(--ink);
}
.login-panel > .brand-line { margin-bottom: 68px; }
.login-copy h1 {
  max-width: 520px;
  margin: 0 0 13px;
  font-size: clamp(35px, 4vw, 52px);
  line-height: 1.2;
  letter-spacing: -.035em;
}
.login-copy > p:last-child {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
}
.login-form { display: grid; gap: 16px; max-width: 520px; margin-top: 36px; }
.login-form label, .form-grid label, .identity-form label {
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: .18s border-color, .18s box-shadow, .18s background;
}
input, select { min-height: 47px; padding: 0 14px; }
textarea {
  min-height: 130px;
  padding: 13px;
  resize: vertical;
  direction: ltr;
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
}
input::placeholder, textarea::placeholder { color: #a8adb5; }
input:hover, select:hover, textarea:hover { border-color: #c5c9cf; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(255, 59, 48, .09);
  background: white;
}
.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 12px;
  transition: .18s transform, .18s background, .18s border-color, .18s box-shadow;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button-primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 8px 20px rgba(255, 59, 48, .18);
}
.button-primary:hover { background: var(--brand-strong); box-shadow: 0 10px 24px rgba(255, 59, 48, .24); }
.button-secondary { background: var(--charcoal); color: white; }
.button-secondary:hover { background: #2a2c31; }
.button-quiet { border-color: var(--line-strong); background: white; color: var(--ink-soft); }
.button-quiet:hover { border-color: #bfc3ca; background: var(--surface-muted); }
.button-wide { width: 100%; min-height: 52px; }
.text-button {
  width: fit-content;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--brand-strong);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}
.text-button:hover { color: var(--brand); text-decoration: underline; }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; }
.form-success { margin: 0; color: var(--green); font-size: 12px; font-weight: 700; line-height: 1.7; }
.security-note { margin: 28px 0 0; color: var(--muted); font-size: 11px; }
.pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: #31bc78;
  box-shadow: 0 0 0 5px rgba(49, 188, 120, .12);
}

/* Identity and authorization */
.identity-screen, .authorization-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 80% 10%, rgba(255, 59, 48, .18), transparent 32%),
    linear-gradient(145deg, #24262b, #111214);
}
.identity-card, .authorization-card {
  width: min(560px, 100%);
  padding: clamp(27px, 5vw, 42px);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.authorization-card { width: min(660px, 100%); }
.identity-card .brand-line { margin-bottom: 40px; }
.identity-card .brand-wordmark img { width: 210px; }
.identity-card h1 { margin: 0 0 12px; font-size: 32px; }
.identity-description { margin: 0 0 26px; color: var(--muted); line-height: 1.8; }
.identity-form { display: grid; gap: 16px; margin-bottom: 15px; }
.authorization-brand { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.authorization-brand .brand-line { margin: 0; }
.authorization-brand .brand-wordmark img { width: 190px; }
.authorization-lock {
  padding: 8px 11px;
  border: 1px solid #bfe3d2;
  border-radius: 999px;
  background: #effaf5;
  color: #18764f;
  font-size: 10px;
  font-weight: 800;
}
.authorization-copy { margin: 40px 0 25px; }
.authorization-copy h1 { margin: 0 0 12px; font-size: 34px; }
.authorization-copy > p:last-child { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.85; }
.authorization-account {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}
.authorization-account .platform-dot { width: 44px; height: 44px; }
.authorization-account strong, .authorization-account small { display: block; }
.authorization-account strong { font-size: 13px; }
.authorization-account small { margin-top: 6px; color: var(--muted); direction: ltr; text-align: right; font-size: 10px; }
.authorization-form { display: grid; gap: 18px; margin-top: 22px; }
.authorization-form > label { display: grid; gap: 8px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.authorization-security {
  padding: 16px 18px;
  border: 1px solid #f4dedb;
  border-right: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-wash);
}
.authorization-security strong { font-size: 12px; }
.authorization-security p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.authorization-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Member portal */
.member-portal { min-height: 100vh; background: var(--paper); }
.member-topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(18px);
}
.member-topbar .brand-line { margin: 0; font-size: 16px; }
.member-brand img { width: 43px; height: 43px; }
.member-topbar .brand-line strong, .member-topbar .brand-line small { display: block; }
.member-topbar .brand-line small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.member-top-actions { display: flex; align-items: center; gap: 12px; }
.member-top-actions > label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.member-top-actions select { min-width: 220px; min-height: 40px; }
.member-content { max-width: 1380px; margin: auto; padding: 34px 32px 72px; }
.member-hero {
  position: relative;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  padding: 38px 42px;
  border-radius: var(--radius-xl);
  color: white;
  background:
    radial-gradient(circle at 10% 50%, rgba(255, 59, 48, .34), transparent 27%),
    linear-gradient(130deg, #24262b, #141518);
  box-shadow: var(--shadow-sm);
}
.member-hero::after {
  content: "";
  position: absolute;
  left: -50px;
  bottom: -120px;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
  box-shadow: 0 0 0 55px rgba(255, 255, 255, .025);
}
.member-hero > * { position: relative; z-index: 1; }
.member-hero h1 { margin: 0 0 10px; font-size: clamp(30px, 4vw, 44px); }
.member-hero p:last-child { margin: 0; color: #b7bbc2; line-height: 1.8; }
.member-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.member-span-2 { grid-column: span 2; }
.member-invitations { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.member-invitation {
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 10px;
}
.member-tenant-grid { grid-template-columns: repeat(2, 1fr); }
.compact-list .subscription-card { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
.compact-list .subscription-summary { text-align: right; }

/* Admin shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 268px minmax(0, 1fr); direction: rtl; }
.sidebar {
  position: sticky;
  z-index: 30;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 22px 16px 18px;
  background: var(--charcoal);
  color: white;
  scrollbar-width: thin;
  scrollbar-color: #3a3d43 transparent;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 0 9px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand img { width: 42px; height: 42px; flex: 0 0 auto; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { letter-spacing: .12em; font-size: 15px; }
.sidebar-brand small { margin-top: 4px; color: #90959f; font-size: 10px; letter-spacing: 0; }
.sidebar-close-button {
  display: none;
  margin-right: auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 9px;
  background: transparent;
  color: white;
  font-size: 22px;
}
.nav-label {
  margin: 24px 12px 8px;
  color: #686d77;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
}
.main-nav { display: grid; gap: 5px; }
.nav-item {
  position: relative;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #aeb2ba;
  text-align: right;
  font-size: 12px;
  font-weight: 650;
  transition: .18s color, .18s background, .18s transform;
}
.nav-item:hover { color: white; background: rgba(255, 255, 255, .055); transform: translateX(-2px); }
.nav-item.is-active {
  color: white;
  background: linear-gradient(100deg, rgba(255, 59, 48, .22), rgba(255, 59, 48, .09));
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  top: 11px;
  right: -16px;
  width: 3px;
  height: 26px;
  border-radius: 4px 0 0 4px;
  background: var(--brand);
}
.nav-icon {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 9px;
  color: #8f949d;
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 15px;
  font-weight: 400;
}
.nav-item.is-active .nav-icon { border-color: rgba(255, 59, 48, .34); background: rgba(255, 59, 48, .12); color: #ff7169; }
.sidebar-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 18px 11px 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-status strong, .sidebar-status small { display: block; font-size: 10px; }
.sidebar-status small { margin-top: 4px; color: #858b95; }
.logout-button {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  background: rgba(255, 255, 255, .025);
  color: #aeb2ba;
  font-size: 11px;
  text-align: right;
}
.logout-button:hover { border-color: rgba(255, 59, 48, .28); background: rgba(255, 59, 48, .08); color: white; }
.workspace { min-width: 0; background: var(--paper); }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 78px;
  display: flex;
  align-items: center;
  padding: 0 32px;
  border-bottom: 1px solid rgba(230, 232, 235, .86);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(18px);
}
.page-heading { min-width: 220px; }
.page-heading h1 { margin: 0; font-size: 21px; letter-spacing: -.015em; }
.page-heading .eyebrow { margin-bottom: 4px; color: var(--muted); font-size: 9px; letter-spacing: .04em; }
.topbar-actions { display: flex; align-items: center; gap: 11px; margin-right: auto; }
.organization-filter { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.organization-filter select { min-width: 195px; min-height: 40px; background: var(--surface-muted); }
.refresh-button { min-height: 40px; }
.refresh-button span { font-size: 17px; font-weight: 400; }
.operator-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 12px;
  border-right: 1px solid var(--line);
}
.operator-chip > span {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--charcoal);
  color: white;
  font-weight: 900;
}
.operator-chip strong, .operator-chip small { display: block; font-size: 10px; }
.operator-chip small { margin-top: 3px; color: var(--muted); }
.menu-button {
  display: none;
  align-items: center;
  gap: 7px;
  min-height: 39px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
}
.content-area { max-width: 1540px; margin: auto; padding: 30px 32px 72px; }
.view { display: none; }
.view.is-active { display: block; animation: view-in .22s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.loading-bar {
  position: fixed;
  z-index: 80;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  transform: translateX(100%);
}
.loading-bar.is-loading { opacity: 1; animation: loading 1.2s infinite; }
@keyframes loading { to { transform: translateX(-100%); } }

/* Dashboard */
.hero-panel {
  position: relative;
  min-height: 230px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 38px;
  overflow: hidden;
  padding: 42px 46px;
  border-radius: var(--radius-xl);
  color: white;
  background:
    radial-gradient(circle at 12% 50%, rgba(255, 59, 48, .34), transparent 27%),
    linear-gradient(125deg, #24262b, #121315);
  box-shadow: 0 16px 40px rgba(25, 27, 31, .14);
}
.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .12;
  background-image:
    linear-gradient(rgba(255, 255, 255, .18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .18) 1px, transparent 1px);
  background-size: 45px 45px;
  mask-image: linear-gradient(90deg, transparent, black 60%, transparent);
}
.hero-panel::after {
  content: "";
  position: absolute;
  left: 55px;
  top: -80px;
  width: 285px;
  height: 285px;
  border: 1px solid rgba(255, 59, 48, .22);
  border-radius: 50%;
  box-shadow: 0 0 0 50px rgba(255, 255, 255, .02), 0 0 0 100px rgba(255, 255, 255, .012);
}
.hero-panel > * { position: relative; z-index: 1; }
.hero-copy { max-width: 720px; }
.hero-panel .eyebrow { color: #ff8179; }
.hero-panel h2 { margin: 0 0 12px; font-size: clamp(30px, 4vw, 47px); letter-spacing: -.025em; }
.hero-panel p:not(.eyebrow) { max-width: 650px; margin: 0; color: #b7bbc2; font-size: 14px; line-height: 1.8; }
.hero-meta { display: flex; gap: 18px; margin-top: 24px; color: #a5aab3; font-size: 10px; }
.hero-meta span { display: flex; align-items: center; gap: 7px; }
.hero-meta i { width: 7px; height: 7px; border-radius: 50%; background: #37d08b; box-shadow: 0 0 0 4px rgba(55, 208, 139, .12); }
.hero-health { min-width: 235px; display: flex; align-items: center; gap: 16px; }
.hero-health strong, .hero-health small { display: block; }
.hero-health strong { font-size: 12px; }
.hero-health small { margin-top: 5px; color: #9fa4ad; font-size: 10px; }
.health-ring {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 7px solid rgba(255, 255, 255, .1);
  border-top-color: var(--brand);
  border-right-color: #ff6b62;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}
.health-ring i { font-style: normal; font-size: 20px; font-weight: 900; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin: 16px 0; }
.metric-grid.compact { margin: 0 0 18px; }
.metric-card {
  position: relative;
  min-height: 132px;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: .2s transform, .2s box-shadow, .2s border-color;
}
.metric-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 22px;
  width: 34px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--brand);
}
.metric-card:hover { transform: translateY(-2px); border-color: #dddfe3; box-shadow: var(--shadow-sm); }
.metric-card small { color: var(--muted); font-size: 11px; }
.metric-card strong { display: block; margin: 16px 0 6px; font-size: 30px; letter-spacing: -.035em; }
.metric-card em { color: var(--green); font-style: normal; font-size: 10px; font-weight: 700; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.panel {
  min-width: 0;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.view > .panel + .panel { margin-top: 16px; }
.panel-span-2 { grid-column: span 2; }
.panel-header {
  min-height: 46px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 19px;
}
.panel-header h3 { margin: 0; font-size: 15px; }
.panel-header p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.connection-map { display: grid; gap: 9px; }
.map-row {
  display: grid;
  grid-template-columns: 1fr 80px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}
.map-platform { display: flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 800; }
.platform-dot {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 8px;
  font-weight: 900;
}
.map-line { position: relative; height: 1px; background: #d5d8dd; }
.map-line::after {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}
.status-badge {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0 10px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}
.status-active, .status-paid, .status-delivered, .status-published {
  border-color: #b9e0cf;
  background: #effaf5;
  color: #16734f;
}
.status-pending_authorization, .status-pending_payment, .status-pending, .status-open, .status-trialing {
  border-color: #ecd29d;
  background: #fff8e9;
  color: #95631a;
}
.status-paused, .status-suspended, .status-cancelled, .status-revoked, .status-void {
  border-color: #dfe1e4;
  background: #f3f4f5;
  color: #69707a;
}
.status-dead_letter, .status-failed, .status-past_due, .status-degraded {
  border-color: #efb7b2;
  background: #fff1ef;
  color: #aa352e;
}
.status-retrying, .status-delivering {
  border-color: #bdc9ef;
  background: #f0f3ff;
  color: #4560b4;
}
.health-list, .breakdown-list, .attention-list, .event-list, .customization-list { display: grid; gap: 3px; }
.health-item, .breakdown-item, .attention-item, .event-item, .customization-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 0;
  border-bottom: 1px solid #eef0f2;
}
.health-item:last-child, .breakdown-item:last-child, .attention-item:last-child, .event-item:last-child, .customization-item:last-child { border-bottom: 0; }
.customization-item {
  width: 100%;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  background: transparent;
  color: var(--ink);
  text-align: right;
}
.customization-item:hover { background: var(--surface-muted); }
.health-item div, .attention-item div, .event-item div, .customization-item div { min-width: 0; }
.health-item strong, .attention-item strong, .event-item strong, .customization-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}
.health-item small, .attention-item small, .event-item small, .customization-item small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}
.health-state { color: var(--green); font-size: 9px; font-weight: 800; }
.breakdown-item { display: grid; grid-template-columns: 90px 1fr 25px; font-size: 10px; }
.progress { height: 7px; overflow: hidden; border-radius: 999px; background: #eceef0; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }

/* Directory, connections, subscriptions and operations */
.section-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 24px;
}
.section-toolbar h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.02em; }
.section-toolbar p:last-child { max-width: 760px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.toolbar-actions, .filter-row { display: flex; gap: 9px; flex-wrap: wrap; }
.filter-row { margin: -8px 0 17px; }
.filter-row select { width: auto; min-width: 180px; background: var(--surface); }
.search-box { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.search-box input { min-height: 40px; width: 230px; }
.table-wrap { overflow: auto; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.table-wrap table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.table-wrap th {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  text-align: right;
  font-size: 10px;
  font-weight: 700;
}
.table-wrap td { padding: 15px 12px; border-bottom: 1px solid #eef0f2; font-size: 11px; }
.table-wrap tbody tr { transition: .15s background; }
.table-wrap tbody tr:hover { background: #fbfbfc; }
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.entity-name strong, .entity-name small { display: block; }
.entity-name small { margin-top: 4px; color: var(--muted); direction: ltr; text-align: right; }
.tenant-grid, .owner-grid, .connection-cards, .subscription-list, .offer-grid { display: grid; gap: 14px; }
.tenant-grid, .owner-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tenant-card, .owner-card {
  min-width: 0;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: .18s border-color, .18s box-shadow, .18s transform;
}
.tenant-card:hover, .owner-card:hover { transform: translateY(-2px); border-color: #d8dade; box-shadow: var(--shadow-sm); }
.tenant-card header, .owner-card header, .owner-entry { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tenant-card h4, .owner-card h4 { margin: 17px 0 7px; font-size: 13px; }
.tenant-card p { margin: 0; color: var(--muted); font-size: 9px; direction: ltr; text-align: right; }
.owner-card header { min-width: 0; padding-bottom: 12px; border-bottom: 1px solid #eef0f2; }
.owner-card header strong { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.owner-card header .mini-button { flex: 0 0 auto; }
.owner-list { display: grid; gap: 11px; margin-top: 13px; }
.owner-entry { min-width: 0; align-items: flex-start; }
.owner-entry > div:first-child { min-width: 0; flex: 1; }
.owner-entry strong, .owner-entry small { display: block; }
.owner-entry strong { overflow-wrap: anywhere; font-size: 10px; line-height: 1.5; }
.owner-entry small { max-width: 100%; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; word-break: break-word; font-size: 8px; direction: ltr; text-align: right; line-height: 1.45; }
.owner-entry-meta { min-width: fit-content; display: flex; align-items: flex-end; gap: 4px; flex: 0 0 auto; flex-direction: column; }
.owner-summary { display: flex; align-items: center; gap: 7px; }
.owner-summary span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.owner-security-note {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid #f4dedb;
  border-right: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-wash);
}
.owner-security-note strong { font-size: 10px; }
.owner-security-note span { color: var(--muted); font-size: 9px; line-height: 1.7; }
.platform-chip {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 8px;
  font-weight: 900;
}
.connection-cards { grid-template-columns: repeat(2, 1fr); }
.connection-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.connection-card-head { display: flex; align-items: flex-start; justify-content: space-between; }
.connection-route { display: flex; align-items: center; gap: 12px; }
.route-platform strong, .route-platform small { display: block; }
.route-platform strong { font-size: 12px; }
.route-platform small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.route-arrow { color: var(--brand); font-size: 17px; font-weight: 900; }
.scope-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 19px 0; }
.scope {
  padding: 6px 8px;
  border-radius: 7px;
  background: #f0f1f3;
  color: #555b64;
  font-size: 8px;
  direction: ltr;
}
.card-meta { display: flex; justify-content: space-between; padding-top: 14px; border-top: 1px solid #eceef0; color: var(--muted); font-size: 9px; }
.card-actions { display: flex; gap: 7px; margin-top: 14px; }
.mini-button {
  min-height: 33px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 9px;
  font-weight: 800;
}
.mini-button:hover { border-color: #bfc3c9; background: var(--surface-muted); }
.mini-button.danger { color: var(--red); }
.member-offers { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 5px; }
.member-offer {
  min-width: 180px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}
.member-offer strong, .member-offer small { display: block; }
.member-offer small { margin-top: 5px; color: var(--muted); }
.member-offer .mini-button { width: 100%; margin-top: 10px; }
.subscription-card {
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(300px, 1.6fr) auto;
  gap: 24px;
  align-items: center;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.subscription-card h3 { margin: 9px 0 5px; font-size: 15px; }
.subscription-card p { margin: 0; color: var(--muted); font-size: 9px; }
.subscription-items { display: flex; flex-wrap: wrap; gap: 7px; }
.subscription-item {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  font-size: 9px;
}
.subscription-item.is-disabled { opacity: .45; text-decoration: line-through; }
.subscription-summary { text-align: left; }
.subscription-summary strong { display: block; margin-bottom: 6px; font-size: 18px; }
.subscription-summary small { color: var(--muted); font-size: 9px; }
.tabs { display: flex; gap: 24px; margin-bottom: 17px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 0 2px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.tab.is-active { border-color: var(--brand); color: var(--ink); }
.offer-grid { grid-template-columns: repeat(3, 1fr); }
.offer-card {
  min-height: 270px;
  display: flex;
  flex-direction: column;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.offer-card header { display: flex; justify-content: space-between; }
.offer-card h3 { margin: 18px 0 7px; }
.offer-card > p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.offer-price { margin-top: auto; padding-top: 18px; border-top: 1px solid #eceef0; }
.offer-price strong { font-size: 22px; }
.offer-price small { color: var(--muted); font-size: 9px; }
.entitlement-count { color: var(--brand-strong); font-size: 9px; font-weight: 800; }
.operations-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.event-item .event-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.empty-state {
  padding: 34px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  background: var(--surface-muted);
}
.customization-layout { display: grid; grid-template-columns: .85fr 1.15fr; gap: 18px; }
.preview-panel { padding: 28px; border-radius: var(--radius-lg); background: #e9ebee; }
.preview-browser { overflow: hidden; border-radius: 15px; background: white; box-shadow: 0 25px 65px rgba(20, 24, 29, .16); }
.preview-bar { min-height: 36px; display: flex; align-items: center; gap: 5px; padding: 0 12px; background: #e9eaec; direction: ltr; }
.preview-bar i { width: 7px; height: 7px; border-radius: 50%; background: #b9bdc4; }
.preview-bar i:first-child { background: #ff6a61; }
.preview-bar span { margin-left: 15px; color: #737983; font-size: 8px; }
.preview-content {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 50px;
  background: white;
}
.preview-content h3 { max-width: 420px; margin: 12px 0; font-size: 34px; }
.preview-content p { color: var(--muted); line-height: 1.8; }
.preview-content button {
  min-height: 44px;
  margin-top: 17px;
  padding: 0 20px;
  border: 0;
  border-radius: 9px;
  background: var(--brand);
  color: white;
  font-weight: 800;
}
.preview-kicker { color: var(--brand); font-size: 9px; font-weight: 900; letter-spacing: .12em; }

/* Dialogs and notifications */
dialog {
  width: min(670px, calc(100vw - 30px));
  max-height: calc(100vh - 30px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-xl);
  background: transparent;
}
dialog::backdrop { background: rgba(16, 17, 19, .7); backdrop-filter: blur(5px); }
.modal-card { overflow: hidden; border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-lg); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 25px 27px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 22px; }
.modal-close {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 21px;
}
.modal-close:hover { background: var(--surface-muted); color: var(--ink); }
.modal-body { max-height: 62vh; overflow: auto; padding: 25px 27px; }
.modal-error { min-height: 0; margin: 0; padding: 0 27px; font-weight: 700; }
.modal-error:not(:empty) { padding-top: 13px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 27px; border-top: 1px solid var(--line); background: var(--surface-muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checkbox-card {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 8px !important;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
  direction: ltr;
  font-size: 9px !important;
}
.checkbox-card input { width: 16px; min-height: 16px; accent-color: var(--brand); }
.form-hint { margin: -5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.7; }
.toast-region { position: fixed; z-index: 100; left: 22px; bottom: 22px; display: grid; gap: 8px; }
.toast {
  min-width: 300px;
  padding: 15px 17px;
  border-right: 4px solid #31bc78;
  border-radius: 11px;
  background: var(--charcoal);
  color: white;
  box-shadow: var(--shadow-lg);
  font-size: 11px;
}
.toast.error { border-color: var(--brand); }

/* Responsive */
@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .panel-span-2 { grid-column: span 2; }
  .tenant-grid, .owner-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .offer-grid { grid-template-columns: repeat(2, 1fr); }
  .subscription-card { grid-template-columns: 1fr; }
  .subscription-summary { text-align: right; }
}

@media (max-width: 920px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-panel { min-height: 650px; grid-row: 1; padding: 48px max(26px, 8vw); }
  .login-panel > .brand-line { margin-bottom: 48px; }
  .login-art { min-height: 430px; grid-row: 2; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    right: 0;
    width: 278px;
    transform: translateX(105%);
    transition: .22s transform;
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: -24px 0 60px rgba(0, 0, 0, .28); }
  .sidebar-close-button { display: grid; place-items: center; }
  .menu-button { display: inline-flex; margin-left: 12px; }
  .organization-filter, .topbar .operator-chip { display: none; }
  .topbar { padding: 0 18px; }
  .content-area { padding: 22px 18px 58px; }
  .hero-panel, .section-toolbar { align-items: flex-start; flex-direction: column; }
  .hero-health { min-width: auto; }
  .dashboard-grid, .connection-cards, .operations-grid, .customization-layout, .member-grid { grid-template-columns: 1fr; }
  .panel-span-2, .member-span-2 { grid-column: auto; }
  .offer-grid { grid-template-columns: 1fr; }
  .section-toolbar { gap: 17px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .member-topbar { align-items: flex-start; padding: 16px; }
  .member-top-actions { align-items: stretch; flex-direction: column; }
  .member-top-actions .operator-chip { display: none; }
  .member-content { padding: 22px 16px 58px; }
  .member-hero { align-items: flex-start; flex-direction: column; padding: 30px 24px; }
}

@media (max-width: 560px) {
  .brand-wordmark img { width: 210px; }
  .login-panel { min-height: 620px; }
  .login-copy h1 { font-size: 34px; }
  .login-art { min-height: 390px; }
  .orbit-one { width: 270px; height: 270px; }
  .orbit-two { width: 440px; height: 440px; }
  .hub-mark { width: 96px; height: 96px; padding: 17px; border-radius: 27px; }
  .signal-card { min-width: 125px; padding: 11px 12px; }
  .signal-card span { font-size: 10px; }
  .signal-a { top: 19%; left: 48%; }
  .signal-b { top: 48%; left: 4%; }
  .signal-c { bottom: 16%; left: 44%; }
  .signal-d { top: 49%; right: 3%; }
  .login-art-copy { right: 24px; bottom: 24px; }
  .login-art-copy strong { font-size: 18px; }
  .metric-grid, .tenant-grid, .owner-grid { grid-template-columns: 1fr; }
  .hero-panel { padding: 30px 24px; }
  .hero-meta { flex-direction: column; gap: 8px; }
  .topbar-actions .button { padding: 0 11px; }
  .refresh-button { font-size: 0; }
  .refresh-button span { font-size: 18px; }
  .page-heading { min-width: 0; }
  .page-heading .eyebrow { display: none; }
  .map-row { grid-template-columns: 1fr auto 1fr; }
  .map-row .status-badge { grid-column: 1 / -1; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .section-toolbar h2 { font-size: 26px; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .button { flex: 1 1 auto; }
  .panel { padding: 19px; }
  .member-topbar { gap: 16px; flex-direction: column; }
  .member-top-actions, .member-top-actions > label, .member-top-actions select { width: 100%; }
  .authorization-actions { align-items: stretch; flex-direction: column-reverse; }
  .authorization-actions .button { width: 100%; }
  .toast-region { right: 14px; left: 14px; bottom: 14px; }
  .toast { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
