:root {
  color-scheme: light;
  --sg-bg: #f6f7f9;
  --sg-bg-elevated: #fbfbfc;
  --sg-surface: rgba(255,255,255,.92);
  --sg-surface-soft: rgba(255,255,255,.74);
  --sg-surface-strong: #ffffff;
  --sg-text: #17191d;
  --sg-muted: #6f7580;
  --sg-border: rgba(19,24,32,.075);
  --sg-border-strong: rgba(19,24,32,.11);
  --sg-accent: #216cf4;
  --sg-accent-strong: #165bd6;
  --sg-accent-soft: rgba(33,108,244,.10);
  --sg-success: #168861;
  --sg-shadow: 0 18px 55px rgba(31,38,50,.07);
  --sg-shadow-soft: 0 8px 30px rgba(31,38,50,.055);
  --sg-radius-sm: 16px;
  --sg-radius-md: 24px;
  --sg-radius-lg: 36px;
  --sg-pill: 999px;
  --sg-sidebar: 252px;
  --sg-content: 1480px;
  --sg-font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --sg-bg: #111317;
  --sg-bg-elevated: #15181d;
  --sg-surface: rgba(27,30,35,.92);
  --sg-surface-soft: rgba(27,30,35,.76);
  --sg-surface-strong: #1a1d22;
  --sg-text: #f4f5f7;
  --sg-muted: #a2a7b0;
  --sg-border: rgba(255,255,255,.075);
  --sg-border-strong: rgba(255,255,255,.11);
  --sg-accent: #78a9ff;
  --sg-accent-strong: #91b9ff;
  --sg-accent-soft: rgba(120,169,255,.12);
  --sg-shadow: 0 18px 55px rgba(0,0,0,.22);
  --sg-shadow-soft: 0 8px 30px rgba(0,0,0,.16);
}

* { box-sizing: border-box; }

html { background: var(--sg-bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--sg-text);
  background:
    radial-gradient(circle at 78% -12%, rgba(69,139,255,.08), transparent 31rem),
    linear-gradient(180deg, var(--sg-bg-elevated) 0, var(--sg-bg) 28rem);
  font-family: var(--sg-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea { font: inherit; }

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

form { margin: 0; }

.btn,
.icon-btn {
  -webkit-tap-highlight-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 19px;
  border-radius: var(--sg-pill);
  border: 1px solid transparent;
  color: var(--sg-text);
  background: transparent;
  font-weight: 720;
  line-height: 1;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  color: #fff;
  background: var(--sg-accent);
  box-shadow: 0 8px 22px rgba(33,108,244,.18);
}

.btn-primary:hover { background: var(--sg-accent-strong); }

.btn-soft {
  color: var(--sg-text);
  background: var(--sg-surface);
  border-color: var(--sg-border-strong);
  box-shadow: 0 2px 10px rgba(31,38,50,.03);
}

html[data-theme="dark"] .btn-soft {
  background: var(--sg-surface-soft);
}

.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--sg-border);
  border-radius: 50%;
  color: var(--sg-text);
  background: var(--sg-surface);
  cursor: pointer;
}

.cms-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sg-sidebar) minmax(0,1fr);
}

.cms-sidebar {
  position: sticky;
  z-index: 30;
  top: 0;
  height: 100vh;
  padding: 24px 18px 20px;
  border-right: 1px solid var(--sg-border);
  background: rgba(249,250,252,.86);
  backdrop-filter: blur(24px) saturate(1.15);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

html[data-theme="dark"] .cms-sidebar {
  background: rgba(17,19,23,.88);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0 8px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--sg-accent), #61bcff);
  font-weight: 850;
  box-shadow: 0 8px 20px rgba(33,108,244,.18);
}

.brand-copy {
  min-width: 0;
  display: grid;
}

.brand-copy strong {
  font-size: 15px;
  letter-spacing: -.02em;
}

.brand-copy small {
  color: var(--sg-muted);
  font-size: 10px;
  letter-spacing: .14em;
}

.sidebar-close {
  display: none;
  font-size: 24px;
}

.cms-nav {
  display: grid;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.nav-label {
  margin: 18px 10px 6px;
  color: var(--sg-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 820;
}

.nav-item {
  padding: 11px 13px;
  border-radius: var(--sg-pill);
  color: var(--sg-muted);
  font-weight: 680;
  font-size: 14px;
  transition: color .16s ease, background .16s ease;
}

.nav-item:hover {
  color: var(--sg-text);
  background: rgba(20,24,30,.045);
}

html[data-theme="dark"] .nav-item:hover {
  background: rgba(255,255,255,.045);
}

.nav-item.is-active {
  color: var(--sg-accent);
  background: var(--sg-accent-soft);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  color: var(--sg-muted);
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sg-success);
  box-shadow: 0 0 0 5px rgba(22,136,97,.08);
}

.sidebar-backdrop {
  display: none;
}

.cms-main {
  min-width: 0;
  width: 100%;
}

.cms-topbar {
  max-width: var(--sg-content);
  margin: 0 auto;
  padding: 30px 38px 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.topbar-title-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  display: none;
}

.cms-topbar h1 {
  margin: 4px 0 0;
  font-size: clamp(28px,3vw,42px);
  letter-spacing: -.045em;
  line-height: 1;
}

.eyebrow,
.kicker {
  margin: 0;
  color: var(--sg-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .14em;
  font-weight: 820;
}

.topbar-actions,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.topbar-form {
  display: inline-flex;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  max-width: 230px;
  padding: 0 14px;
  overflow: hidden;
  color: var(--sg-muted);
  background: var(--sg-surface);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-pill);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cms-content {
  max-width: var(--sg-content);
  margin: 0 auto;
  padding: 22px 38px 60px;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  min-height: 330px;
  padding: clamp(30px,5vw,68px);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-lg);
  background:
    radial-gradient(circle at 78% 26%, rgba(70,148,255,.16), transparent 19rem),
    radial-gradient(circle at 62% 90%, rgba(115,229,198,.10), transparent 20rem),
    linear-gradient(145deg, rgba(255,255,255,.96), rgba(249,251,255,.93));
  box-shadow: var(--sg-shadow-soft);
}

html[data-theme="dark"] .hero-panel {
  background:
    radial-gradient(circle at 78% 26%, rgba(70,148,255,.15), transparent 19rem),
    radial-gradient(circle at 62% 90%, rgba(115,229,198,.08), transparent 20rem),
    var(--sg-surface-strong);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 750px;
}

.hero-copy h2 {
  margin: 12px 0 14px;
  max-width: 720px;
  font-size: clamp(34px,5vw,64px);
  line-height: .99;
  letter-spacing: -.055em;
}

.hero-copy p {
  max-width: 680px;
  margin: 0 0 26px;
  color: var(--sg-muted);
  font-size: 17px;
  line-height: 1.65;
}

.signal-orb {
  position: absolute;
  right: -28px;
  bottom: -112px;
  width: 320px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,.95), rgba(104,184,255,.58) 28%, rgba(39,108,238,.11) 65%, transparent 72%);
  opacity: .72;
}

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

.metric {
  min-width: 0;
  min-height: 145px;
  padding: 22px 24px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-md);
  background: var(--sg-surface);
  box-shadow: 0 2px 12px rgba(31,38,50,.025);
}

.metric span,
.metric small {
  color: var(--sg-muted);
}

.metric strong {
  display: block;
  margin: 13px 0 8px;
  font-size: 35px;
  letter-spacing: -.045em;
}

.public-placeholder {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 32px;
}

.public-placeholder h1 {
  font-size: clamp(56px,12vw,150px);
  letter-spacing: -.07em;
  margin: 8px 0;
}

.public-placeholder p {
  color: var(--sg-muted);
}

/* Authentication */
.auth-page {
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-shell {
  width: min(100%, 560px);
}

.auth-panel {
  padding: clamp(28px,5vw,54px);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-lg);
  background:
    radial-gradient(circle at 100% 0, rgba(83,157,255,.10), transparent 16rem),
    var(--sg-surface-strong);
  box-shadow: var(--sg-shadow-soft);
}

.auth-panel h1 {
  margin: 10px 0 12px;
  font-size: clamp(38px,7vw,64px);
  line-height: .98;
  letter-spacing: -.055em;
}

.auth-lead {
  margin: 0 0 30px;
  color: var(--sg-muted);
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 16px;
}

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

.auth-form label > span {
  color: var(--sg-muted);
  font-size: 12px;
  font-weight: 750;
}

.auth-form input {
  width: 100%;
  min-height: 52px;
  padding: 0 17px;
  color: var(--sg-text);
  background: var(--sg-surface-strong);
  border: 1px solid var(--sg-border-strong);
  border-radius: 18px;
  outline: none;
}

.auth-form input:focus {
  border-color: color-mix(in srgb, var(--sg-accent) 46%, var(--sg-border));
  box-shadow: 0 0 0 4px var(--sg-accent-soft);
}

.auth-form input:disabled {
  opacity: .65;
}

.btn-wide { width: 100%; }

.alert {
  margin: 0 0 20px;
  padding: 13px 16px;
  border-radius: 18px;
  font-size: 14px;
}

.alert-error {
  color: #a62a37;
  background: rgba(214,65,81,.09);
  border: 1px solid rgba(214,65,81,.14);
}

.alert-success {
  color: #0d7652;
  background: rgba(22,136,97,.10);
  border: 1px solid rgba(22,136,97,.14);
}

html[data-theme="dark"] .alert-error {
  color: #ffadb6;
}

html[data-theme="dark"] .alert-success {
  color: #8ee6c8;
}

/* Deploy manager */
.deploy-hero {
  margin-bottom: 18px;
  padding: clamp(26px,4vw,48px);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-lg);
  background:
    radial-gradient(circle at 92% 10%, rgba(82,160,255,.12), transparent 18rem),
    var(--sg-surface-strong);
  box-shadow: var(--sg-shadow-soft);
}

.deploy-hero h2 {
  margin: 10px 0 12px;
  max-width: 780px;
  font-size: clamp(34px,5vw,62px);
  line-height: 1;
  letter-spacing: -.055em;
}

.deploy-hero p {
  max-width: 780px;
  margin: 0;
  color: var(--sg-muted);
  line-height: 1.65;
}

.deploy-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 14px;
  margin: 18px 0;
}

.deploy-card {
  min-width: 0;
  min-height: 150px;
  padding: 22px 24px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-md);
  background: var(--sg-surface);
}

.deploy-card > span,
.deploy-card > small {
  display: block;
  color: var(--sg-muted);
}

.deploy-card > strong {
  display: block;
  margin: 14px 0 8px;
  font-size: 24px;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}

.deploy-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-top: 18px;
  padding: 26px 28px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-md);
  background: var(--sg-surface-strong);
  box-shadow: var(--sg-shadow-soft);
}

.deploy-action h3 {
  margin: 7px 0 0;
  font-size: clamp(22px,3vw,32px);
  letter-spacing: -.035em;
}

/* Tablet */
@media (max-width: 1180px) {
  :root { --sg-sidebar: 224px; }

  .cms-topbar,
  .cms-content {
    padding-left: 28px;
    padding-right: 28px;
  }

  .user-chip {
    max-width: 180px;
  }

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

/* Mobile navigation */
@media (max-width: 980px) {
  .cms-shell {
    display: block;
  }

  .cms-sidebar {
    position: fixed;
    z-index: 70;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    height: 100dvh;
    padding-top: max(20px, env(safe-area-inset-top));
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 24px 0 70px rgba(19,24,32,.14);
  }

  .cms-shell.sidebar-open .cms-sidebar {
    transform: translateX(0);
  }

  .sidebar-close {
    display: inline-grid;
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 60;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: rgba(18,22,29,.26);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }

  .cms-shell.sidebar-open .sidebar-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-btn {
    display: inline-grid;
    flex: 0 0 auto;
  }

  .cms-topbar {
    padding-top: max(22px, env(safe-area-inset-top));
  }

  .cms-main {
    width: 100%;
  }

  .no-scroll-mobile {
    overflow: hidden;
  }

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

/* Small screens */
@media (max-width: 720px) {
  .cms-topbar,
  .cms-content {
    padding-left: 18px;
    padding-right: 18px;
  }

  .cms-topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 8px;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 2px 0 5px;
    scrollbar-width: none;
  }

  .topbar-actions::-webkit-scrollbar {
    display: none;
  }

  .topbar-actions > * {
    flex: 0 0 auto;
  }

  .user-chip {
    max-width: 190px;
  }

  .hero-panel,
  .deploy-hero {
    border-radius: 28px;
  }

  .hero-panel {
    min-height: auto;
    padding: 30px 24px 34px;
  }

  .signal-orb {
    right: -95px;
    bottom: -165px;
    width: 300px;
    opacity: .5;
  }

  .hero-copy h2 {
    font-size: clamp(38px,12vw,58px);
  }

  .hero-copy p {
    font-size: 15px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

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

  .metric {
    min-height: 128px;
  }

  .deploy-action {
    align-items: stretch;
    flex-direction: column;
  }

  .deploy-action .btn {
    width: 100%;
  }
}

@media (max-width: 460px) {
  .cms-topbar,
  .cms-content {
    padding-left: 14px;
    padding-right: 14px;
  }

  .cms-topbar h1 {
    font-size: 32px;
  }

  .topbar-actions {
    gap: 7px;
  }

  .btn {
    min-height: 42px;
    padding: 0 16px;
  }

  .user-chip {
    max-width: 160px;
  }

  .hero-panel,
  .deploy-hero,
  .auth-panel {
    border-radius: 24px;
  }

  .hero-panel {
    padding: 26px 20px 30px;
  }

  .auth-page {
    padding: 14px;
  }

  .auth-panel {
    padding: 28px 20px;
  }

  .deploy-action {
    padding: 22px 20px;
  }
}


/* CMS navigation icons + content sections */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item svg,
.btn svg,
.icon-btn svg,
.user-chip svg,
.search-field svg,
.empty-state svg,
.section-icon svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.user-chip {
  gap: 8px;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 18px;
  padding: 8px 2px 4px;
}

.page-intro > div {
  max-width: 820px;
}

.page-intro h2,
.section-placeholder h2 {
  margin: 8px 0 10px;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1;
  letter-spacing: -.055em;
}

.page-intro p,
.section-placeholder p {
  margin: 0;
  color: var(--sg-muted);
  line-height: 1.65;
}

.content-panel {
  overflow: hidden;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-lg);
  background: var(--sg-surface-strong);
  box-shadow: var(--sg-shadow-soft);
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--sg-border);
}

.panel-title {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.panel-title strong {
  font-size: 17px;
  letter-spacing: -.02em;
}

.panel-title span {
  color: var(--sg-muted);
  font-size: 12px;
}

.search-field {
  min-width: min(340px, 42vw);
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: var(--sg-muted);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-pill);
  background: var(--sg-surface-soft);
}

.search-field input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--sg-text);
  background: transparent;
}

.search-field input::placeholder {
  color: color-mix(in srgb, var(--sg-muted) 78%, transparent);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--sg-border);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--sg-muted);
  background: color-mix(in srgb, var(--sg-surface-strong) 92%, var(--sg-bg));
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
}

.data-table td {
  font-size: 14px;
}

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

.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--sg-accent-soft) 28%, transparent);
}

.data-table td strong,
.data-table td small {
  display: block;
}

.data-table td small {
  margin-top: 4px;
  color: var(--sg-muted);
  font-size: 12px;
}

.status-badge,
.section-count {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--sg-pill);
  color: var(--sg-muted);
  background: var(--sg-bg);
  border: 1px solid var(--sg-border);
  font-size: 11px;
  font-weight: 800;
}

.status-badge.is-success {
  color: #0b7954;
  background: rgba(22,136,97,.08);
  border-color: rgba(22,136,97,.12);
}

.empty-state {
  min-height: 330px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 48px 28px;
}

.empty-state > svg {
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  color: var(--sg-accent);
}

.empty-state h3 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: -.035em;
}

.empty-state p {
  max-width: 520px;
  margin: 0;
  color: var(--sg-muted);
}

.section-placeholder {
  min-height: min(620px, 70vh);
  display: grid;
  place-items: start;
  align-content: center;
  padding: clamp(36px, 7vw, 88px);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-lg);
  background:
    radial-gradient(circle at 88% 10%, rgba(87,163,255,.11), transparent 20rem),
    var(--sg-surface-strong);
  box-shadow: var(--sg-shadow-soft);
}

.section-placeholder > * {
  max-width: 760px;
}

.section-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  color: var(--sg-accent);
  background: var(--sg-accent-soft);
  border-radius: 18px;
}

.section-icon svg {
  width: 26px;
  height: 26px;
}

.section-count {
  margin-top: 18px;
}

/* Better mobile action bar */
@media (max-width: 720px) {
  .cms-content {
    padding-top: 14px;
    padding-bottom: calc(36px + env(safe-area-inset-bottom));
  }

  .topbar-actions {
    padding-bottom: 3px;
  }

  .topbar-actions .user-chip {
    order: 4;
  }

  .topbar-actions .btn-primary span {
    display: none;
  }

  .topbar-actions .btn-primary {
    width: 42px;
    padding: 0;
    border-radius: 50%;
  }

  .page-intro {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
  }

  .page-intro > .btn {
    width: 100%;
  }

  .panel-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  .search-field {
    min-width: 0;
    width: 100%;
  }

  .content-panel {
    border-radius: 24px;
  }

  .table-wrap {
    overflow: visible;
  }

  .data-table {
    min-width: 0;
    display: block;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .data-table tr {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--sg-border);
    border-radius: 18px;
    background: var(--sg-surface-soft);
  }

  .data-table td {
    display: grid;
    grid-template-columns: minmax(96px, .7fr) minmax(0, 1.3fr);
    gap: 12px;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  .data-table td::before {
    color: var(--sg-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
  }

  .data-table td:nth-child(1)::before { content: "Elemento"; }
  .data-table td:nth-child(2)::before { content: "Dettaglio"; }
  .data-table td:nth-child(3)::before { content: "Categoria"; }
  .data-table td:nth-child(4)::before { content: "Info"; }
  .data-table td:nth-child(5)::before { content: "Stato"; }

  .data-table td:first-child {
    grid-template-columns: 1fr;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--sg-border);
  }

  .data-table td:first-child::before {
    display: none;
  }

  .empty-state {
    min-height: 270px;
    padding: 40px 22px;
  }

  .section-placeholder {
    min-height: 54vh;
    padding: 38px 24px;
    border-radius: 24px;
  }
}

@media (max-width: 460px) {
  .user-chip {
    display: none;
  }

  .cms-topbar {
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .topbar-title-wrap {
    align-items: center;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .page-intro h2,
  .section-placeholder h2 {
    font-size: 38px;
  }

  .data-table td {
    grid-template-columns: 84px minmax(0, 1fr);
  }
}


/* Users */
.users-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(300px,380px);
  gap: 18px;
  align-items: start;
}

.invite-panel {
  padding: 24px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-lg);
  background: var(--sg-surface-strong);
  box-shadow: var(--sg-shadow-soft);
}

.invite-panel h3 {
  margin: 8px 0 8px;
  font-size: 28px;
  letter-spacing: -.04em;
}

.invite-panel > p:not(.kicker) {
  margin: 0 0 22px;
  color: var(--sg-muted);
  line-height: 1.55;
}

.stack-form {
  display: grid;
  gap: 14px;
}

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

.stack-form label > span {
  color: var(--sg-muted);
  font-size: 12px;
  font-weight: 760;
}

.stack-form input,
.stack-form select,
.compact-select {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  color: var(--sg-text);
  background: var(--sg-surface-strong);
  border: 1px solid var(--sg-border-strong);
  border-radius: 14px;
  outline: none;
}

.compact-select {
  min-width: 150px;
  min-height: 38px;
  border-radius: var(--sg-pill);
}

.btn-compact {
  min-height: 36px;
  padding: 0 13px;
  font-size: 12px;
}

.alert-warning {
  color: #8a5b00;
  background: rgba(217,154,26,.10);
  border: 1px solid rgba(217,154,26,.16);
}

html[data-theme="dark"] .alert-warning {
  color: #ffd78a;
}

/* Public launch page: CMS is deliberately not advertised */
.public-launch {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 14%, rgba(255,190,74,.18), transparent 18rem),
    radial-gradient(circle at 28% 72%, rgba(61,184,229,.15), transparent 22rem),
    radial-gradient(circle at 82% 66%, rgba(104,170,255,.13), transparent 20rem),
    #f8f9fb;
}

.launch-shell {
  width: min(100%, 920px);
  display: grid;
  justify-items: center;
  text-align: center;
}

.launch-mark {
  width: 58px;
  height: 58px;
  margin-bottom: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #216cf4, #63bdfd);
  box-shadow: 0 18px 42px rgba(33,108,244,.18);
  font-weight: 850;
  font-size: 22px;
}

.launch-shell h1 {
  margin: 10px 0 6px;
  font-size: clamp(64px,15vw,156px);
  line-height: .88;
  letter-spacing: -.075em;
}

.launch-tagline {
  margin: 14px 0 28px;
  color: var(--sg-muted);
  font-size: clamp(18px,3vw,28px);
  letter-spacing: -.025em;
}

.launch-status {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 15px;
  border-radius: var(--sg-pill);
  color: var(--sg-muted);
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(20,24,30,.07);
  backdrop-filter: blur(12px);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
  letter-spacing: .12em;
}

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

@media (max-width: 720px) {
  .invite-panel {
    border-radius: 24px;
  }
}


/* Users management polish */
.page-intro-compact {
  margin-bottom: 20px;
  padding-top: 2px;
}

.page-intro-copy {
  max-width: 760px;
  margin-top: 8px !important;
  font-size: 15px;
}

.users-layout {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  gap: 20px;
}

.users-list-panel {
  min-width: 0;
}

.invite-panel {
  position: sticky;
  top: 22px;
}

.invite-panel-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.invite-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--sg-accent);
  background: var(--sg-accent-soft);
  border-radius: 15px;
}

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

.invite-panel-head h3 {
  margin: 4px 0 0;
}

.invite-copy {
  margin: 0 0 22px !important;
}

.user-row-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-row-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--sg-accent);
  background: var(--sg-accent-soft);
  font-size: 13px;
  font-weight: 850;
}

.status-badge.is-warning {
  color: #8a5b00;
  background: rgba(217,154,26,.10);
  border-color: rgba(217,154,26,.16);
}

.muted-dash {
  color: var(--sg-muted);
}

.users-table td:last-child {
  width: 1%;
  white-space: nowrap;
}

.stack-form input,
.stack-form select,
.compact-select {
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.stack-form input:focus,
.stack-form select:focus,
.compact-select:focus {
  border-color: color-mix(in srgb, var(--sg-accent) 44%, var(--sg-border));
  box-shadow: 0 0 0 4px var(--sg-accent-soft);
}

@media (max-width: 1180px) {
  .users-layout {
    grid-template-columns: 1fr;
  }

  .invite-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .page-intro-compact {
    margin-bottom: 16px;
  }

  .users-layout {
    gap: 14px;
  }

  .invite-panel {
    padding: 20px;
  }

  .users-table td:first-child {
    padding-bottom: 12px;
  }

  .user-row-avatar {
    width: 34px;
    height: 34px;
  }
}


/* Animated public teaser */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.public-launch {
  position: relative;
  isolation: isolate;
}

.public-launch::before,
.public-launch::after {
  content: "";
  position: fixed;
  inset: auto;
  z-index: -1;
  pointer-events: none;
  filter: blur(20px);
  opacity: .72;
}

.public-launch::before {
  width: min(58vw, 760px);
  aspect-ratio: 1;
  left: -14vw;
  bottom: -28vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76,181,227,.16), rgba(76,181,227,0) 68%);
  animation: launchGlowA 11s ease-in-out infinite alternate;
}

.public-launch::after {
  width: min(52vw, 680px);
  aspect-ratio: 1;
  right: -10vw;
  top: -22vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,188,80,.17), rgba(255,188,80,0) 68%);
  animation: launchGlowB 13s ease-in-out infinite alternate;
}

.launch-shell {
  position: relative;
  padding: clamp(18px, 4vw, 48px);
}

.launch-kicker {
  margin-bottom: clamp(18px, 3vw, 30px);
}

.launch-word-wrap {
  width: 100%;
  min-height: clamp(72px, 16vw, 160px);
  display: grid;
  place-items: center;
}

.launch-word {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: nowrap;
  font-size: clamp(64px, 15vw, 156px);
  line-height: .88;
  letter-spacing: -.075em;
  font-weight: 760;
  white-space: nowrap;
}

.launch-prefix,
.launch-suffix {
  display: inline-flex;
}

.launch-suffix {
  min-width: .7em;
  transition:
    opacity .24s ease,
    transform .34s cubic-bezier(.2,.75,.25,1),
    filter .28s ease;
}

.launch-suffix.is-leaving {
  opacity: 0;
  transform: translateY(-.12em) scale(.985);
  filter: blur(8px);
}

.launch-suffix.is-entering {
  opacity: 0;
  transform: translateY(.16em) scale(.985);
  filter: blur(8px);
}

.launch-letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(.22em) rotateX(-18deg);
  filter: blur(5px);
  animation: launchLetterIn .58s cubic-bezier(.18,.82,.2,1) forwards;
  animation-delay: calc(var(--letter-index) * 55ms);
}

.launch-message-wrap {
  min-height: 104px;
  display: grid;
  align-content: start;
  justify-items: center;
}

.launch-tagline,
.launch-subline {
  transition:
    opacity .26s ease,
    transform .34s cubic-bezier(.2,.75,.25,1),
    filter .28s ease;
}

.launch-tagline {
  margin: 18px 0 6px;
}

.launch-subline {
  max-width: 660px;
  margin: 0;
  color: var(--sg-muted);
  font-size: clamp(14px, 2vw, 18px);
  line-height: 1.55;
}

.launch-tagline.is-leaving,
.launch-subline.is-leaving {
  opacity: 0;
  transform: translateY(-8px);
  filter: blur(5px);
}

.launch-tagline.is-entering,
.launch-subline.is-entering {
  opacity: 0;
  transform: translateY(10px);
  filter: blur(5px);
}

.launch-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 18px;
  margin: 12px 0 20px;
}

.launch-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(23,25,29,.16);
  transition: width .24s ease, background .24s ease, border-radius .24s ease;
}

.launch-dots span.is-active {
  width: 22px;
  border-radius: 999px;
  background: var(--sg-accent);
}

.launch-status {
  box-shadow: 0 8px 28px rgba(24,31,42,.04);
}

@keyframes launchLetterIn {
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0);
    filter: blur(0);
  }
}

@keyframes launchGlowA {
  from { transform: translate3d(-2%, 2%, 0) scale(.96); }
  to { transform: translate3d(5%, -3%, 0) scale(1.04); }
}

@keyframes launchGlowB {
  from { transform: translate3d(2%, -2%, 0) scale(.97); }
  to { transform: translate3d(-4%, 4%, 0) scale(1.05); }
}

@media (max-width: 720px) {
  .public-launch {
    padding: 18px;
  }

  .launch-shell {
    padding: 14px 4px;
  }

  .launch-word-wrap {
    min-height: 86px;
  }

  .launch-word {
    font-size: clamp(58px, 20vw, 96px);
  }

  .launch-message-wrap {
    min-height: 118px;
    padding: 0 8px;
  }

  .launch-tagline {
    margin-top: 14px;
    font-size: clamp(18px, 5vw, 24px);
  }

  .launch-subline {
    max-width: 420px;
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .public-launch::before,
  .public-launch::after,
  .launch-letter {
    animation: none !important;
  }

  .launch-letter {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .launch-suffix,
  .launch-tagline,
  .launch-subline {
    transition: none !important;
  }
}


/* Operational content editors */
.editor-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(300px,360px);
  gap: 20px;
  align-items: start;
}

.editor-main,
.editor-sidebar {
  min-width: 0;
}

.editor-sidebar {
  position: sticky;
  top: 22px;
}

.form-section {
  padding: 24px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-lg);
  background: var(--sg-surface-strong);
  box-shadow: var(--sg-shadow-soft);
}

.form-section + .form-section {
  margin-top: 16px;
}

.form-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.form-section h3 {
  margin: 5px 0 0;
  font-size: 26px;
  letter-spacing: -.04em;
}

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

.field {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field > span,
.toggle-row strong {
  color: var(--sg-muted);
  font-size: 12px;
  font-weight: 760;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  color: var(--sg-text);
  background: var(--sg-surface-strong);
  border: 1px solid var(--sg-border-strong);
  border-radius: 16px;
  outline: 0;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.field input,
.field select {
  min-height: 48px;
  padding: 0 14px;
}

.field textarea {
  padding: 14px;
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: color-mix(in srgb, var(--sg-accent) 44%, var(--sg-border));
  box-shadow: 0 0 0 4px var(--sg-accent-soft);
}

.editor-sidebar .field {
  margin: 16px 0 20px;
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0 20px;
  border-top: 1px solid var(--sg-border);
}

.toggle-row > span {
  display: grid;
  gap: 5px;
}

.toggle-row small {
  color: var(--sg-muted);
  line-height: 1.45;
}

.toggle-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  accent-color: var(--sg-accent);
}

@media (max-width: 1080px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  .form-section {
    padding: 20px;
    border-radius: 24px;
  }

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

  .field-wide {
    grid-column: auto;
  }

  .page-intro > .btn {
    align-self: stretch;
  }
}


/* Migration status */
.migration-panel {
  margin-top: 18px;
  padding: 24px 26px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-md);
  background: var(--sg-surface-strong);
  box-shadow: var(--sg-shadow-soft);
}

.migration-panel h3 {
  margin: 7px 0 0;
  font-size: 24px;
  letter-spacing: -.035em;
}

.migration-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.migration-list code {
  display: block;
  padding: 10px 12px;
  overflow-wrap: anywhere;
  border: 1px solid var(--sg-border);
  border-radius: 12px;
  background: var(--sg-bg);
  font-size: 12px;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 720px) {
  .migration-panel {
    padding: 20px;
  }
}


/* Media Manager */
.media-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.media-summary-card {
  padding: 20px 22px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-md);
  background: var(--sg-surface);
  box-shadow: var(--sg-shadow-soft);
}

.media-summary-card > span,
.media-summary-card > small {
  display: block;
  color: var(--sg-muted);
}

.media-summary-card > strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 26px;
  letter-spacing: -.04em;
}

.media-manager-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 18px;
  align-items: start;
}

.media-library-panel {
  min-width: 0;
}

.media-library-toolbar {
  align-items: center;
}

.media-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.media-search-form .search-field {
  min-width: min(340px, 36vw);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.media-card {
  min-width: 0;
  overflow: hidden;
  display: grid;
  border: 1px solid var(--sg-border);
  border-radius: 18px;
  background: var(--sg-surface-soft);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.media-card:hover {
  transform: translateY(-2px);
  border-color: var(--sg-border-strong);
  box-shadow: var(--sg-shadow-soft);
}

.media-card-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--sg-bg);
}

.media-card-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.media-usage-chip {
  position: absolute;
  right: 9px;
  top: 9px;
  min-height: 28px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: var(--sg-pill);
  color: #fff;
  background: rgba(18, 22, 29, .72);
  backdrop-filter: blur(10px);
  font-size: 11px;
  font-weight: 800;
}

.media-usage-chip svg {
  width: 14px;
  height: 14px;
}

.media-card-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 12px 13px 14px;
}

.media-card-copy strong,
.media-card-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-card-copy strong {
  font-size: 13px;
}

.media-card-copy small {
  color: var(--sg-muted);
  font-size: 11px;
}

.media-upload-panel {
  position: sticky;
  top: 22px;
  padding: 24px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-lg);
  background: var(--sg-surface-strong);
  box-shadow: var(--sg-shadow-soft);
}

.media-upload-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.media-upload-head h3 {
  margin: 4px 0 0;
  font-size: 28px;
  letter-spacing: -.04em;
}

.media-upload-panel > p {
  margin: 0 0 20px;
  color: var(--sg-muted);
  line-height: 1.55;
}

.media-dropzone {
  min-height: 230px;
  padding: 24px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  border: 1.5px dashed var(--sg-border-strong);
  border-radius: 22px;
  background: var(--sg-bg);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.media-dropzone:hover,
.media-dropzone.is-dragging {
  border-color: var(--sg-accent);
  background: var(--sg-accent-soft);
}

.media-dropzone.is-dragging {
  transform: scale(.995);
}

.media-dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.media-dropzone-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 13px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: var(--sg-accent);
  background: var(--sg-accent-soft);
}

.media-dropzone-icon svg {
  width: 23px;
  height: 23px;
}

.media-dropzone strong {
  font-size: 15px;
}

.media-dropzone small {
  margin-top: 5px;
  color: var(--sg-muted);
  font-size: 12px;
}

.media-file-count {
  margin-top: 14px;
  color: var(--sg-accent);
  font-size: 11px;
  font-weight: 800;
}

.media-upload-panel form > .btn {
  margin-top: 12px;
}

.media-upload-notes {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--sg-muted);
  font-size: 11px;
}

.media-upload-notes span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.media-upload-notes svg {
  width: 15px;
  height: 15px;
}

.pagination {
  min-height: 62px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-top: 1px solid var(--sg-border);
}

.pagination > span {
  color: var(--sg-muted);
  font-size: 12px;
}

.media-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
  gap: 20px;
  align-items: start;
}

.media-detail-preview {
  overflow: hidden;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-lg);
  background: var(--sg-surface-strong);
  box-shadow: var(--sg-shadow-soft);
}

.media-detail-preview > img {
  width: 100%;
  max-height: 70vh;
  display: block;
  object-fit: contain;
  background:
    linear-gradient(45deg, var(--sg-bg) 25%, transparent 25%),
    linear-gradient(-45deg, var(--sg-bg) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--sg-bg) 75%),
    linear-gradient(-45deg, transparent 75%, var(--sg-bg) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.media-technical-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--sg-border);
  background: var(--sg-border);
}

.media-technical-grid > div {
  min-width: 0;
  padding: 16px;
  display: grid;
  gap: 5px;
  background: var(--sg-surface-strong);
}

.media-technical-grid span,
.media-technical-grid small {
  color: var(--sg-muted);
  font-size: 11px;
}

.media-technical-grid strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.media-variants {
  padding: 20px;
  border-top: 1px solid var(--sg-border);
}

.media-variant-row {
  display: grid;
  grid-template-columns: minmax(100px, .8fr) minmax(120px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--sg-border);
}

.media-variant-row:last-child {
  border-bottom: 0;
}

.media-variant-row span,
.media-variant-row small {
  color: var(--sg-muted);
  font-size: 12px;
}

.media-detail-editor {
  display: grid;
  gap: 16px;
}

.field-help {
  color: var(--sg-muted);
  font-size: 11px;
  line-height: 1.45;
}

.media-file-info dl {
  margin: 16px 0 0;
  display: grid;
  gap: 12px;
}

.media-file-info dl > div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sg-border);
}

.media-file-info dl > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.media-file-info dt {
  color: var(--sg-muted);
  font-size: 11px;
}

.media-file-info dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.media-file-info code {
  overflow-wrap: anywhere;
}

.danger-zone h3 {
  margin: 8px 0 6px;
  font-size: 22px;
}

.danger-zone > p:not(.kicker) {
  margin: 0 0 18px;
  color: var(--sg-muted);
  line-height: 1.55;
}

@media (max-width: 1240px) {
  .media-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .media-manager-layout {
    grid-template-columns: 1fr;
  }

  .media-upload-panel {
    position: static;
  }
}

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

  .media-summary-card-wide {
    grid-column: 1 / -1;
  }

  .media-detail-layout {
    grid-template-columns: 1fr;
  }
}

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

  .media-summary-card-wide {
    grid-column: auto;
  }

  .media-library-toolbar {
    align-items: stretch;
  }

  .media-search-form,
  .media-search-form .search-field {
    width: 100%;
  }

  .media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    padding: 10px;
  }

  .media-card {
    border-radius: 15px;
  }

  .media-card-copy {
    padding: 10px;
  }

  .media-upload-panel {
    padding: 20px;
    border-radius: 24px;
  }

  .media-dropzone {
    min-height: 190px;
  }

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

  .media-variant-row {
    grid-template-columns: 1fr auto;
  }

  .media-variant-row small {
    grid-column: 1 / -1;
  }
}

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

  .media-card {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .media-card-image {
    aspect-ratio: 1;
  }

  .media-card-copy {
    align-content: center;
  }
}


/* Featured media picker */
.featured-media-picker {
  margin: 18px 0;
  padding: 16px 0 18px;
  border-top: 1px solid var(--sg-border);
  border-bottom: 1px solid var(--sg-border);
}

.featured-media-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.featured-media-picker-head small {
  display: block;
  margin-top: 5px;
  color: var(--sg-muted);
  line-height: 1.45;
}

.featured-media-preview {
  min-height: 150px;
  margin-bottom: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--sg-border);
  border-radius: 18px;
  background: var(--sg-bg);
}

.featured-media-preview > span {
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--sg-muted);
  text-align: center;
}

.featured-media-preview > span svg {
  width: 28px;
  height: 28px;
}

.featured-media-preview > span small {
  font-size: 11px;
}

.featured-media-preview.has-image {
  aspect-ratio: 16 / 10;
  min-height: 0;
}

.featured-media-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.featured-media-empty {
  margin: 10px 0 0;
  color: var(--sg-muted);
  font-size: 11px;
  line-height: 1.45;
}

.featured-media-empty a {
  color: var(--sg-accent);
  font-weight: 750;
}

@media (max-width: 720px) {
  .featured-media-preview {
    min-height: 130px;
  }
}


/* Analytics dashboard */
.dashboard-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 20px;
  padding: 8px 2px 4px;
}

.dashboard-intro > div:first-child {
  max-width: 760px;
}

.dashboard-intro h2 {
  margin: 8px 0 10px;
  font-size: clamp(38px, 5vw, 68px);
  line-height: .98;
  letter-spacing: -.06em;
}

.dashboard-intro p:not(.kicker) {
  margin: 0;
  color: var(--sg-muted);
  line-height: 1.65;
}

.analytics-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.analytics-metric-card,
.analytics-card {
  border: 1px solid var(--sg-border);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--sg-surface-strong) 96%, var(--sg-accent-soft)) 0%, var(--sg-surface-strong) 100%);
  box-shadow: var(--sg-shadow-soft);
}

.analytics-metric-card {
  min-width: 0;
  padding: 20px 21px;
  border-radius: var(--sg-radius-md);
}

.analytics-metric-head {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.analytics-icon,
.analytics-card-icon {
  display: grid;
  place-items: center;
  color: var(--sg-accent);
  background: var(--sg-accent-soft);
}

.analytics-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.analytics-icon svg {
  width: 17px;
  height: 17px;
}

.analytics-trend {
  max-width: 58%;
  min-height: 27px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--sg-pill);
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-trend.is-positive {
  color: var(--sg-success);
  background: color-mix(in srgb, var(--sg-success) 10%, transparent);
}

.analytics-trend.is-neutral {
  color: var(--sg-muted);
  background: var(--sg-bg);
}

.analytics-metric-card > strong {
  display: block;
  margin-bottom: 2px;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1;
  letter-spacing: -.055em;
}

.analytics-metric-card > span:not(.analytics-trend) {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 760;
}

.analytics-metric-card > small {
  display: block;
  margin-top: 5px;
  color: var(--sg-muted);
  font-size: 11px;
}

.analytics-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.analytics-grid-main {
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr);
}

.analytics-grid-secondary {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.analytics-card {
  min-width: 0;
  overflow: hidden;
  padding: 22px;
  border-radius: var(--sg-radius-lg);
}

.analytics-card-head {
  min-height: 58px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.analytics-card-head h3 {
  margin: 6px 0 5px;
  font-size: clamp(21px, 2vw, 28px);
  letter-spacing: -.04em;
}

.analytics-card-head p:not(.kicker) {
  margin: 0;
  color: var(--sg-muted);
  font-size: 12px;
  line-height: 1.5;
}

.analytics-card-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 14px;
}

.analytics-card-icon svg {
  width: 19px;
  height: 19px;
}

.analytics-chart {
  position: relative;
  width: 100%;
}

.analytics-chart-line {
  height: 310px;
}

.analytics-chart-bar {
  height: 285px;
}

.analytics-donut-wrap {
  min-height: 310px;
  display: grid;
  place-items: center;
}

.analytics-chart-donut {
  width: min(100%, 310px);
  height: 290px;
}

.analytics-donut-center {
  position: absolute;
  left: 50%;
  top: 47%;
  z-index: 2;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.analytics-donut-center strong {
  font-size: 30px;
  line-height: 1;
  letter-spacing: -.05em;
}

.analytics-donut-center span {
  margin-top: 5px;
  color: var(--sg-muted);
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.dashboard-event-list {
  display: grid;
  margin-top: 4px;
}

.dashboard-event-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 13px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--sg-border);
  transition: transform .16s ease, opacity .16s ease;
}

.dashboard-event-row:last-child {
  border-bottom: 0;
}

.dashboard-event-row:hover {
  transform: translateX(3px);
}

.dashboard-event-date {
  width: 46px;
  min-height: 48px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 15px;
  color: var(--sg-accent);
  background: var(--sg-accent-soft);
}

.dashboard-event-date strong {
  font-size: 17px;
  line-height: 1;
}

.dashboard-event-date small {
  margin-top: 4px;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .08em;
}

.dashboard-event-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.dashboard-event-copy strong,
.dashboard-event-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-event-copy strong {
  font-size: 13px;
}

.dashboard-event-copy small {
  color: var(--sg-muted);
  font-size: 10px;
}

.dashboard-event-row > svg {
  width: 16px;
  height: 16px;
  color: var(--sg-muted);
}

.analytics-empty {
  min-height: 255px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 28px;
}

.analytics-empty svg {
  width: 34px;
  height: 34px;
  margin-bottom: 13px;
  color: var(--sg-accent);
}

.analytics-empty strong {
  font-size: 15px;
}

.analytics-empty span {
  max-width: 320px;
  margin-top: 6px;
  color: var(--sg-muted);
  font-size: 11px;
  line-height: 1.5;
}

html[data-theme="dark"] .analytics-metric-card,
html[data-theme="dark"] .analytics-card {
  background:
    radial-gradient(circle at 90% 5%, rgba(120,169,255,.055), transparent 14rem),
    var(--sg-surface-strong);
}

@media (max-width: 1180px) {
  .analytics-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-grid-main,
  .analytics-grid-secondary {
    grid-template-columns: 1fr;
  }

  .analytics-donut-wrap {
    min-height: 280px;
  }
}

@media (max-width: 720px) {
  .dashboard-intro {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
  }

  .dashboard-intro .hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-intro .hero-actions .btn {
    width: 100%;
  }

  .analytics-metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .analytics-metric-card {
    padding: 16px;
    border-radius: 20px;
  }

  .analytics-metric-card > strong {
    font-size: 32px;
  }

  .analytics-card {
    padding: 18px;
    border-radius: 24px;
  }

  .analytics-chart-line {
    height: 260px;
  }

  .analytics-chart-bar {
    height: 250px;
  }
}

@media (max-width: 460px) {
  .dashboard-intro h2 {
    font-size: 40px;
  }

  .dashboard-intro .hero-actions {
    grid-template-columns: 1fr;
  }

  .analytics-metrics-grid {
    grid-template-columns: 1fr;
  }

  .analytics-metric-card {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 14px;
  }

  .analytics-metric-head {
    grid-row: 1 / span 3;
    min-height: 0;
    margin: 0;
    display: grid;
    align-content: start;
    justify-items: start;
  }

  .analytics-trend {
    max-width: 110px;
    margin-top: 8px;
  }

  .analytics-metric-card > strong,
  .analytics-metric-card > span:not(.analytics-trend),
  .analytics-metric-card > small {
    grid-column: 2;
  }

  .analytics-metric-card > span:not(.analytics-trend) {
    margin-top: 4px;
  }
}


/* Platform responsive interaction rules
   Summary/metric card collections become horizontal snap rails on phones.
   Dense content sections and forms continue to stack vertically. */
@media (max-width: 720px) {
  .mobile-card-rail,
  .metrics-grid {
    display: grid !important;
    grid-template-columns: none !important;
    grid-auto-flow: column;
    grid-auto-columns: minmax(238px, 82vw);
    gap: 10px;
    width: calc(100% + 18px);
    margin-right: -18px;
    padding: 2px 18px 10px 0;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 0 18px;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x pan-y;
  }

  .mobile-card-rail::-webkit-scrollbar,
  .metrics-grid::-webkit-scrollbar {
    display: none;
  }

  .mobile-card-rail > *,
  .metrics-grid > * {
    min-width: 0;
    scroll-snap-align: start;
    scroll-snap-stop: normal;
  }

  .mobile-card-rail > .analytics-metric-card {
    display: block;
    min-height: 154px;
    padding: 18px;
  }

  .mobile-card-rail > .analytics-metric-card .analytics-metric-head {
    min-height: 34px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .mobile-card-rail > .analytics-metric-card > strong,
  .mobile-card-rail > .analytics-metric-card > span:not(.analytics-trend),
  .mobile-card-rail > .analytics-metric-card > small {
    display: block;
  }

  .media-summary-grid.mobile-card-rail .media-summary-card-wide {
    grid-column: auto;
  }

  .deploy-grid.mobile-card-rail .deploy-card,
  .media-summary-grid.mobile-card-rail .media-summary-card,
  .metrics-grid > .metric {
    min-height: 140px;
  }

  /* Every mobile table card declares its own labels in markup. */
  .data-table td::before {
    content: attr(data-label) !important;
  }

  .data-table td:not([data-label])::before {
    content: none !important;
  }

  .data-table td:first-child::before {
    display: none;
  }

  /* Prevent nested wide controls from becoming page-level overflow. */
  .cms-content,
  .content-panel,
  .panel-toolbar,
  .editor-layout,
  .users-layout,
  .media-manager-layout,
  .analytics-grid {
    min-width: 0;
  }
}

@media (max-width: 460px) {
  .mobile-card-rail,
  .metrics-grid {
    grid-auto-columns: minmax(228px, 86vw);
    width: calc(100% + 14px);
    margin-right: -14px;
    padding-right: 14px;
    scroll-padding-inline-end: 14px;
  }
}


/* Media Manager mobile information hierarchy */
@media (max-width: 720px) {
  .media-manager-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .media-upload-panel {
    order: 1;
  }

  .media-library-panel {
    order: 2;
  }

  .media-upload-panel {
    padding: 18px;
  }

  .media-upload-head {
    margin-bottom: 10px;
  }

  .media-upload-head h3 {
    font-size: 26px;
  }

  .media-upload-panel > p {
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
  }

  .media-dropzone {
    min-height: 160px;
    padding: 20px 16px;
  }

  .media-upload-notes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .media-upload-notes span {
    min-width: 0;
    align-items: flex-start;
    font-size: 10px;
    line-height: 1.35;
  }

  .media-upload-notes svg {
    margin-top: 1px;
    flex: 0 0 auto;
  }

  .media-library-toolbar {
    gap: 14px;
  }

  .media-library-panel .empty-state {
    min-height: 230px;
  }
}

@media (max-width: 460px) {
  .media-upload-notes {
    grid-template-columns: 1fr;
  }

  .media-upload-panel {
    padding: 16px;
  }

  .media-dropzone {
    min-height: 150px;
  }

  .media-library-panel .empty-state {
    min-height: 210px;
  }
}


/* Permissions and ownership */
.user-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.access-scope-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.access-scope-card {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-lg);
  background: var(--sg-surface-strong);
  box-shadow: var(--sg-shadow-soft);
}

.access-scope-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.access-scope-head .section-icon {
  flex: 0 0 auto;
  margin: 0;
}

.access-scope-head h3 {
  margin: 5px 0 6px;
  font-size: 25px;
  letter-spacing: -.04em;
}

.access-scope-head p:not(.kicker) {
  margin: 0;
  color: var(--sg-muted);
  font-size: 12px;
  line-height: 1.55;
}

.scope-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 16px;
  padding: 12px 13px;
  border: 1px solid var(--sg-border);
  border-radius: 14px;
  color: var(--sg-muted);
  background: var(--sg-bg);
  font-size: 11px;
  line-height: 1.45;
}

.scope-note svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--sg-accent);
}

.scope-picker {
  max-height: 480px;
  display: grid;
  gap: 7px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.scope-choice {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--sg-border);
  border-radius: 15px;
  background: var(--sg-surface-soft);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}

.scope-choice:hover {
  border-color: var(--sg-border-strong);
  background: var(--sg-accent-soft);
}

.scope-choice input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--sg-accent);
}

.scope-choice > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.scope-choice strong,
.scope-choice small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-choice strong {
  font-size: 13px;
}

.scope-choice small {
  color: var(--sg-muted);
  font-size: 10px;
}

.scope-empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--sg-muted);
  border: 1px dashed var(--sg-border-strong);
  border-radius: 16px;
  font-size: 12px;
}

.access-scope-actions {
  grid-column: 1 / -1;
  position: sticky;
  bottom: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-pill);
  background: color-mix(in srgb, var(--sg-surface-strong) 88%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: var(--sg-shadow);
}

@media (max-width: 980px) {
  .access-scope-layout {
    grid-template-columns: 1fr;
  }

  .access-scope-actions {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .access-scope-card {
    padding: 19px;
    border-radius: 24px;
  }

  .scope-picker {
    max-height: 400px;
  }

  .access-scope-actions {
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .access-scope-actions .btn {
    flex: 1 1 0;
  }
}


/* Owner-only temporary password */
.temporary-password-layout {
  display: grid;
  grid-template-columns: minmax(0, 620px);
}

.temporary-password-card {
  margin: 0;
}

.temporary-password-user {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--sg-border);
}

.temporary-password-user > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.temporary-password-user strong,
.temporary-password-user small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.temporary-password-user small {
  color: var(--sg-muted);
  font-size: 12px;
}

@media (max-width: 720px) {
  .temporary-password-layout {
    grid-template-columns: 1fr;
  }
}


/* Scoped management context */
.scope-context-badge {
  width: fit-content;
  min-height: 34px;
  margin-top: 14px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-pill);
  color: var(--sg-accent);
  background: var(--sg-accent-soft);
  font-size: 11px;
  font-weight: 800;
}

.scope-context-badge svg {
  width: 15px;
  height: 15px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .scope-context-badge {
    margin-top: 12px;
  }
}


/* Global icon rhythm */
.btn {
  gap: 8px;
}

.btn-compact {
  gap: 6px;
}

.nav-item,
.user-chip,
.search-field,
.scope-note,
.scope-context-badge,
.media-upload-notes span,
.invite-panel-note,
.table-actions,
.user-actions {
  column-gap: 9px;
}

.btn > svg,
.btn > [data-lucide],
.btn-compact > svg,
.btn-compact > [data-lucide] {
  margin: 0;
}

.btn-compact svg {
  width: 15px;
  height: 15px;
}

.btn-danger-soft {
  color: #a33a46;
}

html[data-theme="dark"] .btn-danger-soft {
  color: #ff9ca7;
}

/* User management V2 */
.users-summary-grid {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.users-summary-card {
  min-width: 0;
  min-height: 112px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius-md);
  background: var(--sg-surface);
  box-shadow: var(--sg-shadow-soft);
}

.users-summary-card > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.users-summary-card strong {
  font-size: 28px;
  line-height: 1;
  letter-spacing: -.045em;
}

.users-summary-card > div > span {
  color: var(--sg-muted);
  font-size: 11px;
  font-weight: 700;
}

.users-summary-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--sg-accent);
  background: var(--sg-accent-soft);
}

.users-summary-icon.is-success {
  color: var(--sg-success);
  background: color-mix(in srgb,var(--sg-success) 10%,transparent);
}

.users-summary-icon.is-warning {
  color: #b77800;
  background: rgba(217,154,26,.10);
}

.users-summary-icon svg {
  width: 19px;
  height: 19px;
}

.users-layout {
  grid-template-columns: minmax(0,1.35fr) minmax(320px,360px);
}

.invite-panel {
  position: sticky;
  top: 22px;
}

.invite-panel-note {
  margin: -6px 0 18px;
  padding: 11px 12px;
  display: flex;
  align-items: flex-start;
  border: 1px solid var(--sg-border);
  border-radius: 14px;
  color: var(--sg-muted);
  background: var(--sg-bg);
  font-size: 11px;
  line-height: 1.45;
}

.invite-panel-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--sg-accent);
}

.users-table .user-actions {
  min-width: 0;
  max-width: 300px;
}

.users-table .user-actions form {
  display: inline-flex;
}

.users-table td[data-label="Azioni"] {
  min-width: 250px;
}

.users-table td[data-label="Ruolo"] {
  min-width: 170px;
}

.users-table .compact-select {
  min-width: 160px;
}

@media (max-width: 1320px) {
  .users-layout {
    grid-template-columns: 1fr;
  }

  .invite-panel {
    position: static;
  }

  .users-list-panel {
    order: 2;
  }

  .invite-panel {
    order: 1;
  }
}

@media (max-width: 980px) {
  .users-summary-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}

@media (max-width: 720px) {
  .users-summary-grid.mobile-card-rail {
    grid-template-columns: none !important;
    grid-auto-flow: column;
    grid-auto-columns: minmax(210px,78vw);
  }

  .users-summary-card {
    min-height: 104px;
  }

  .users-layout {
    display: flex;
    flex-direction: column;
  }

  .invite-panel {
    order: 1;
  }

  .users-list-panel {
    order: 2;
  }

  .users-table td[data-label="Azioni"],
  .users-table td[data-label="Ruolo"] {
    min-width: 0;
  }

  .users-table .user-actions {
    max-width: none;
  }

  .users-table .user-actions .btn {
    flex: 0 0 auto;
  }
}


/* Municipality dashboard */
.municipality-dashboard-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 18px;
  padding: 8px 2px 4px;
}

.municipality-dashboard-hero > div:first-child {
  max-width: 760px;
}

.municipality-dashboard-hero h2 {
  margin: 8px 0 10px;
  font-size: clamp(38px, 5vw, 64px);
  line-height: .98;
  letter-spacing: -.055em;
}

.municipality-dashboard-hero p:not(.kicker) {
  margin: 0;
  color: var(--sg-muted);
  line-height: 1.6;
}

.municipality-switcher-form {
  min-width: 190px;
}

.municipality-switcher-form .field {
  gap: 5px;
}

.municipality-dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.municipality-dashboard-main {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
}

.municipality-profile-health-card {
  display: flex;
  flex-direction: column;
}

.profile-completeness-meter {
  min-height: 190px;
  display: grid;
  place-items: center;
}

.profile-completeness-ring {
  width: 154px;
  height: 154px;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--sg-surface-strong) 58%, transparent 59%),
    conic-gradient(var(--sg-accent) var(--profile-progress), var(--sg-border) 0);
}

.profile-completeness-ring::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid var(--sg-border);
  border-radius: 50%;
}

.profile-completeness-ring span {
  position: relative;
  z-index: 1;
  font-size: 31px;
  font-weight: 850;
  letter-spacing: -.05em;
}

.profile-check-list {
  display: grid;
  gap: 8px;
}

.profile-check-list > div {
  min-height: 40px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--sg-border);
  border-radius: 13px;
  color: var(--sg-muted);
  background: var(--sg-bg);
  font-size: 11px;
  font-weight: 700;
}

.profile-check-list > div svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.profile-check-list > div.is-complete {
  color: var(--sg-success);
  background: color-mix(in srgb, var(--sg-success) 7%, var(--sg-surface-strong));
}

.municipality-dashboard-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-start;
}

.municipality-activity-list {
  display: grid;
}

.municipality-activity-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 11px 2px;
  border-bottom: 1px solid var(--sg-border);
  transition: transform .16s ease, background .16s ease;
}

.municipality-activity-row:last-child {
  border-bottom: 0;
}

.municipality-activity-row:hover {
  transform: translateX(3px);
}

.municipality-activity-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--sg-accent);
  background: var(--sg-accent-soft);
}

.municipality-activity-icon svg {
  width: 16px;
  height: 16px;
}

.municipality-activity-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.municipality-activity-copy strong,
.municipality-activity-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.municipality-activity-copy strong {
  font-size: 12px;
}

.municipality-activity-copy small,
.municipality-activity-row time {
  color: var(--sg-muted);
  font-size: 10px;
}

@media (max-width: 1180px) {
  .municipality-dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .municipality-dashboard-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .municipality-dashboard-hero {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
  }

  .municipality-dashboard-hero .hero-actions {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .municipality-dashboard-hero .hero-actions::-webkit-scrollbar {
    display: none;
  }

  .municipality-dashboard-hero .hero-actions > * {
    flex: 0 0 auto;
  }

  .municipality-dashboard-hero .hero-actions .btn {
    width: auto;
  }

  .municipality-dashboard-metrics.mobile-card-rail {
    grid-template-columns: none !important;
  }

  .profile-completeness-meter {
    min-height: 170px;
  }

  .profile-completeness-ring {
    width: 138px;
    height: 138px;
  }

  .municipality-activity-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .municipality-activity-row time {
    grid-column: 2;
  }
}


/* Single-title CMS hierarchy
   The topbar carries only product context. Each page owns one visible H1/H2-equivalent title. */
.cms-topbar {
  padding-top: 22px;
  padding-bottom: 6px;
  align-items: center;
}

.topbar-title-wrap {
  min-height: 42px;
}

.topbar-context {
  color: var(--sg-muted);
  font-size: 11px;
  font-weight: 840;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.cms-content {
  padding-top: 16px;
}

.page-intro-compact h2 {
  margin: 8px 0 8px;
}

@media (max-width: 980px) {
  .cms-topbar {
    padding-top: max(16px, env(safe-area-inset-top));
  }
}

@media (max-width: 720px) {
  .cms-topbar {
    gap: 12px;
    padding-bottom: 4px;
  }

  .topbar-title-wrap {
    min-height: 42px;
  }

  .topbar-context {
    font-size: 10px;
  }

  .cms-content {
    padding-top: 14px;
  }
}


/* Event recurrence / occurrences */
.event-recurrence-block {
  padding: 18px;
  border: 1px solid var(--sg-border);
  border-radius: 18px;
  background: var(--sg-bg);
}

.event-recurrence-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 9px;
  margin-top: 8px;
}

.event-recurrence-choice {
  min-width: 0;
  min-height: 76px;
  padding: 13px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--sg-border);
  border-radius: 15px;
  background: var(--sg-surface-strong);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}

.event-recurrence-choice:has(input:checked) {
  border-color: color-mix(in srgb,var(--sg-accent) 44%,var(--sg-border));
  background: var(--sg-accent-soft);
}

.event-recurrence-choice input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  flex: 0 0 auto;
  accent-color: var(--sg-accent);
}

.event-recurrence-choice > span {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.event-recurrence-choice strong {
  font-size: 12px;
}

.event-recurrence-choice small {
  color: var(--sg-muted);
  font-size: 10px;
  line-height: 1.4;
}

.event-recurrence-options {
  margin-top: 12px;
}

.event-recurrence-options[hidden] {
  display: none;
}

.event-occurrences-section {
  margin-top: 16px;
}

.event-occurrences-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.event-occurrences-head h3 {
  margin: 5px 0 0;
  font-size: 24px;
  letter-spacing: -.04em;
}

.event-occurrences-head > span {
  color: var(--sg-muted);
  font-size: 11px;
  font-weight: 750;
}

.event-occurrences-list {
  display: grid;
}

.event-occurrence-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--sg-border);
}

.event-occurrence-row:last-child {
  border-bottom: 0;
}

.event-occurrence-date {
  min-height: 54px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 15px;
  color: var(--sg-accent);
  background: var(--sg-accent-soft);
}

.event-occurrence-date strong {
  font-size: 19px;
  line-height: 1;
}

.event-occurrence-date small {
  margin-top: 4px;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .06em;
}

.event-occurrence-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.event-occurrence-copy strong {
  font-size: 13px;
}

.event-occurrence-copy small {
  color: var(--sg-muted);
  font-size: 10px;
}

.event-recurrence-inline {
  width: fit-content;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--sg-accent);
  font-size: 10px;
  font-weight: 760;
}

.event-recurrence-inline svg {
  width: 13px;
  height: 13px;
}

@media (max-width: 720px) {
  .event-recurrence-grid {
    grid-template-columns: 1fr;
  }

  .event-occurrence-row {
    grid-template-columns: 52px minmax(0,1fr);
  }

  .event-occurrence-row > .status-badge {
    grid-column: 2;
    justify-self: start;
  }
}


/* Mobile CMS header + robust table filtering */
.data-table tr.is-filtered-out {
  display: none !important;
}

.table-search-empty {
  min-height: 190px;
  padding: 30px 18px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  border-top: 1px solid var(--sg-border);
}

.table-search-empty[hidden] {
  display: none !important;
}

.table-search-empty svg {
  width: 30px;
  height: 30px;
  margin-bottom: 10px;
  color: var(--sg-accent);
}

.table-search-empty strong {
  font-size: 15px;
}

.table-search-empty span {
  margin-top: 5px;
  color: var(--sg-muted);
  font-size: 11px;
}

@media (max-width: 720px) {
  .cms-topbar {
    min-height: 66px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: 8px;
  }

  .topbar-title-wrap {
    width: auto;
    min-width: 0;
    min-height: 42px;
    flex: 1 1 auto;
    justify-content: flex-start;
  }

  .mobile-menu-btn {
    flex: 0 0 42px;
  }

  .topbar-context {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
    justify-content: flex-end;
    overflow: visible;
    padding: 0;
    gap: 7px;
  }

  .topbar-actions .user-chip {
    display: none;
  }

  .topbar-actions .icon-btn,
  .topbar-actions .btn-primary {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 50%;
  }

  .table-search-empty {
    min-height: 160px;
    border-top: 0;
  }
}

@media (max-width: 360px) {
  .topbar-context {
    display: none;
  }
}
