:root {
  --ds-ink: #172033;
  --ds-muted: #637083;
  --ds-line: #d7dde8;
  --ds-surface: #ffffff;
  --ds-soft: #f5f7fb;
  --ds-primary: #285f8f;
  --ds-primary-strong: #16466e;
  --ds-accent: #f2c14e;
  --ds-good: #2b7a5b;
  --ds-warn: #a05f16;
  --ds-danger: #a53b3b;
  --ds-danger-strong: #842828;
  --ds-hero-overlay-a: rgba(21, 34, 56, .93);
  --ds-hero-overlay-b: rgba(21, 34, 56, .74);
  --bs-body-color: var(--ds-ink);
  --bs-body-bg: var(--ds-soft);
  --bs-secondary-color: var(--ds-muted);
  --bs-border-color: var(--ds-line);
  --bs-link-color: var(--ds-primary);
  --ds-toggler-filter: none;
  --ds-sidebar-bg: #152238;
  --ds-sidebar-ink: #e8edf5;
  --ds-sidebar-muted: rgba(255, 255, 255, .62);
  --ds-sidebar-hover: rgba(255, 255, 255, .1);
  --ds-sidebar-active: rgba(125, 183, 230, .22);
}

:root[data-theme="dark"] {
  --ds-ink: #edf3fb;
  --ds-muted: #aeb9c8;
  --ds-line: #344158;
  --ds-surface: #182234;
  --ds-soft: #0f1624;
  --ds-primary: #7db7e6;
  --ds-primary-strong: #b8dbf6;
  --ds-accent: #f2c14e;
  --ds-good: #65c49b;
  --ds-warn: #d28a35;
  --ds-danger: #ff9b9b;
  --ds-danger-strong: #ffc4c4;
  --ds-hero-overlay-a: rgba(8, 13, 22, .94);
  --ds-hero-overlay-b: rgba(8, 13, 22, .84);
  --bs-body-color: var(--ds-ink);
  --bs-body-bg: var(--ds-soft);
  --bs-secondary-color: var(--ds-muted);
  --bs-border-color: var(--ds-line);
  --bs-link-color: var(--ds-primary);
  --ds-toggler-filter: invert(1) grayscale(1);
  --ds-sidebar-bg: #152238;
  --ds-sidebar-ink: #e8edf5;
  --ds-sidebar-muted: rgba(255, 255, 255, .62);
  --ds-sidebar-hover: rgba(255, 255, 255, .1);
  --ds-sidebar-active: rgba(125, 183, 230, .22);
  color-scheme: dark;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  color: var(--ds-ink);
  background: var(--ds-soft);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

a {
  color: var(--ds-primary);
}

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

input,
select,
textarea,
.form-control,
.form-select {
  background-color: var(--ds-surface);
  border-color: var(--ds-line);
  color: var(--ds-ink);
}

input::placeholder,
textarea::placeholder,
.form-control::placeholder {
  color: var(--ds-muted);
}

option {
  background: var(--ds-surface);
  color: var(--ds-ink);
}

.btn-primary {
  background-color: var(--ds-primary);
  border-color: var(--ds-primary);
  color: var(--ds-surface);
}

:root[data-theme="dark"] .btn-primary {
  color: #07111e;
}

.btn-outline-primary,
.btn-outline-secondary {
  border-color: var(--ds-primary);
  color: var(--ds-primary-strong);
  background: transparent;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover {
  background: var(--ds-primary);
  border-color: var(--ds-primary);
  color: var(--ds-surface);
}

.btn-danger {
  background: var(--ds-danger);
  border-color: var(--ds-danger);
  color: var(--ds-surface);
}

:root[data-theme="dark"] .btn-danger {
  color: #07111e;
}

:root[data-theme="dark"] .btn-outline-primary:hover,
:root[data-theme="dark"] .btn-outline-secondary:hover {
  color: #07111e;
}

.text-danger,
.validation-summary,
.field-validation-error {
  color: var(--ds-danger-strong) !important;
}

.ds-navbar {
  background: var(--ds-surface);
  border-bottom: 1px solid var(--ds-line);
}

.navbar-brand {
  color: var(--ds-ink);
  font-weight: 750;
}

.navbar-nav .nav-link,
.navbar-nav .nav-link:focus,
.navbar-nav .nav-link:hover {
  color: var(--ds-ink);
}

.navbar-toggler {
  border-color: var(--ds-line);
  color: var(--ds-ink);
}

.navbar-toggler-icon {
  filter: var(--ds-toggler-filter);
}

.public-shell {
  min-height: calc(100vh - 122px);
}

.public-hero {
  min-height: 68vh;
  display: flex;
  align-items: center;
  padding: clamp(3rem, 7vw, 6rem);
  background:
    linear-gradient(90deg, var(--ds-hero-overlay-a), var(--ds-hero-overlay-b)),
    url("/icons/dragonstar-icon.svg") right 12% center / min(34vw, 22rem) no-repeat,
    #152238;
  color: white;
}

.public-hero h1 {
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: .95;
  margin: .3rem 0 1rem;
}

.lead {
  max-width: 42rem;
  color: #e8edf5;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.5rem;
}

.public-band,
.narrow-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 3rem 1rem;
}

.signal-grid,
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.signal-grid > *,
.module-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  padding: 1rem;
}

.portal-frame {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.portal-sidebar {
  background: var(--ds-sidebar-bg);
  color: var(--ds-sidebar-ink);
  padding: 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  display: block;
  color: var(--ds-sidebar-ink);
  font-weight: 750;
  margin-bottom: 1rem;
  text-decoration: none;
}

.portal-sidebar nav {
  display: grid;
  gap: .25rem;
}

.portal-sidebar a {
  color: var(--ds-sidebar-ink);
  border-radius: 6px;
  padding: .55rem .7rem;
  text-decoration: none;
}

.portal-sidebar a:hover {
  background: var(--ds-sidebar-hover);
}

.portal-main {
  min-width: 0;
}

.portal-topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1rem;
  background: var(--ds-surface);
  border-bottom: 1px solid var(--ds-line);
}

.mobile-sidebar-button,
.sidebar-scrim {
  display: none;
}

:root[data-topbar-pinned="true"] .portal-topbar {
  position: sticky;
  top: 0;
  z-index: 24;
  box-shadow: 0 10px 28px rgba(23, 32, 51, .12);
}

[data-topbar-pin][aria-pressed="true"] {
  background: var(--ds-primary);
  color: var(--ds-surface);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.global-search input {
  width: min(42vw, 28rem);
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  padding: .55rem .75rem;
}

.portal-content {
  padding: 1.25rem;
}

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

.module-card {
  display: grid;
  gap: .5rem;
}

.module-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ds-primary) 18%, var(--ds-surface));
  color: var(--ds-primary-strong);
  font-size: .85rem;
  font-weight: 700;
  overflow: hidden;
  text-transform: uppercase;
  white-space: nowrap;
}

.module-meta,
.module-navbar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.module-meta span,
.chip,
.status-pill {
  border: 1px solid var(--ds-line);
  border-radius: 999px;
  background: var(--ds-surface);
  color: var(--ds-muted);
  padding: .2rem .55rem;
  font-size: .85rem;
}

.module-layout {
  display: grid;
  gap: 1rem;
}

.module-navbar {
  border-bottom: 1px solid var(--ds-line);
  padding-bottom: .75rem;
}

.module-dashboard h1,
.dashboard-header h1,
.narrow-page h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.breadcrumbs {
  display: flex;
  gap: .5rem;
  padding: .65rem 1rem;
  background: color-mix(in srgb, var(--ds-primary) 12%, var(--ds-surface));
  border-bottom: 1px solid var(--ds-line);
  font-size: .9rem;
}

.account-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.account-panel {
  width: min(100%, 30rem);
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  padding: 1.25rem;
}

.account-panel-wide {
  width: min(100%, 52rem);
}

.account-panel form {
  display: grid;
  gap: .65rem;
}

.account-links {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-weight: 700;
}

.account-panel input {
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  padding: .65rem .75rem;
}

.environment-badge {
  position: fixed;
  z-index: 10;
  right: .75rem;
  bottom: .75rem;
  background: var(--ds-warn);
  color: #07111e;
  border-radius: 999px;
  padding: .3rem .65rem;
  font-size: .8rem;
  box-shadow: 0 8px 24px rgba(23, 32, 51, .2);
}

.icon-button {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-surface);
  color: var(--ds-ink);
}

.theme-toggle {
  border: 1px solid var(--ds-line);
  border-radius: 999px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  padding: .35rem .7rem;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.mobile-navbar {
  display: none;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-top: 1px solid var(--ds-line);
  background: var(--ds-surface);
  color: var(--ds-muted);
}

.status-banner {
  border: 1px solid color-mix(in srgb, var(--ds-good) 35%, var(--ds-line));
  background: color-mix(in srgb, var(--ds-good) 10%, var(--ds-surface));
  color: var(--ds-ink);
  padding: .8rem 1rem;
  margin: 1rem 0;
  border-radius: 8px;
}

.status-banner-danger {
  border-color: var(--ds-danger);
  background: color-mix(in srgb, var(--ds-danger) 12%, var(--ds-surface));
}

.admin-inline-form {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) minmax(9rem, .4fr) auto;
  gap: .75rem;
  align-items: end;
}

.admin-table {
  display: grid;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--ds-surface);
}

.admin-table-row {
  display: grid;
  grid-template-columns: minmax(14rem, 1.5fr) 1fr 1fr minmax(14rem, 1.4fr);
  gap: 1rem;
  align-items: center;
  padding: .85rem 1rem;
  border-top: 1px solid var(--ds-line);
}

.admin-table-row:first-child {
  border-top: 0;
}

.admin-table-head {
  background: var(--ds-soft);
  color: var(--ds-muted);
  font-weight: 700;
}

.admin-table small {
  display: block;
  color: var(--ds-muted);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.btn-sm {
  padding: .35rem .6rem;
  font-size: .9rem;
}

.btn-outline-danger {
  border: 1px solid var(--ds-danger);
  color: var(--ds-danger-strong);
  background: transparent;
}

.btn-outline-danger:hover {
  background: var(--ds-danger);
  color: var(--ds-surface);
}

:root[data-theme="dark"] .btn-outline-danger:hover {
  color: #07111e;
}

.offline-page {
  max-width: 42rem;
  margin: 10vh auto;
  padding: 1rem;
}

.eyebrow {
  margin: 0 0 .35rem;
  color: var(--ds-primary-strong);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.btn,
button.btn {
  border-radius: 8px;
  font-weight: 700;
  transform-origin: center;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease;
}

.btn-action {
  min-height: 2.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .58rem .9rem;
  white-space: nowrap;
  line-height: 1.1;
}

.module-card,
.profile-panel,
.signal-grid > *,
.account-panel,
.user-menu-button,
.theme-switch,
.icon-button {
  transform-origin: center;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.module-card:hover,
.profile-panel:hover,
.signal-grid > *:hover,
.account-panel:hover {
  transform: translateY(-4px) scale(1.012);
  border-color: color-mix(in srgb, var(--ds-primary) 45%, var(--ds-line));
  box-shadow: 0 16px 36px rgba(23, 32, 51, .12);
}

.btn:hover,
.user-menu-button:hover,
.theme-switch:hover,
.icon-button:hover {
  transform: translateY(-2px) scale(1.015);
}

@media (prefers-reduced-motion: reduce) {
  .module-card:hover,
  .profile-panel:hover,
  .signal-grid > *:hover,
  .account-panel:hover,
  .btn:hover,
  .user-menu-button:hover,
  .theme-switch:hover,
  .icon-button:hover {
    animation: none;
    transform: none;
  }
}

.header-actions,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}

.section-heading {
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin: 0;
}

.theme-switch {
  width: 3.35rem;
  height: 2rem;
  border: 1px solid var(--ds-line);
  border-radius: 999px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  padding: .15rem;
}

.theme-switch-track {
  position: relative;
  display: block;
  height: 100%;
  border-radius: inherit;
  background: color-mix(in srgb, var(--ds-primary) 14%, var(--ds-soft));
}

.theme-switch-thumb {
  position: absolute;
  top: .14rem;
  left: .14rem;
  width: 1.42rem;
  height: 1.42rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  color: var(--ds-primary-strong);
  font-size: .72rem;
  font-weight: 900;
  transition: transform .18s ease;
}

:root[data-theme="dark"] .theme-switch-thumb {
  transform: translateX(1.3rem);
}

.portal-frame {
  transition: grid-template-columns .18s ease;
}

body.sidebar-collapsed .portal-frame {
  grid-template-columns: 96px 1fr;
}

.sidebar-header {
  display: grid;
  gap: .75rem;
  margin-bottom: 1rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 2.4rem;
}

.sidebar-logo,
.nav-icon {
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, .12);
  color: var(--ds-sidebar-ink);
  font-weight: 850;
  font-size: .78rem;
}

.nav-icon svg,
.icon-button svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
}

.sidebar-controls {
  display: flex;
  gap: .45rem;
}

.sidebar-controls .icon-button {
  background: rgba(255, 255, 255, .08);
  color: var(--ds-sidebar-ink);
  border-color: rgba(255, 255, 255, .18);
}

body.sidebar-pinned [data-sidebar-pin] {
  background: var(--ds-accent);
  color: #07111e;
}

.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 8rem);
  overflow: auto;
  padding-right: .15rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .45) transparent;
}

.portal-sidebar .sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 2.75rem;
}

.portal-sidebar a.active {
  background: var(--ds-sidebar-active);
  color: var(--ds-sidebar-ink);
  box-shadow: inset 3px 0 0 var(--ds-accent);
}

.sidebar-footer {
  flex: 0 0 auto;
  padding-top: .75rem;
  border-top: 1px solid rgba(255, 255, 255, .12);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 2.75rem;
  color: var(--ds-sidebar-ink);
  border-radius: 6px;
  padding: .55rem .7rem;
  text-decoration: none;
}

.sidebar-section {
  margin: .9rem .2rem .35rem;
  color: var(--ds-sidebar-muted);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
}

body.sidebar-collapsed .sidebar-label {
  display: none;
}

body.sidebar-collapsed .portal-sidebar {
  padding-inline: .75rem;
}

body.sidebar-collapsed .sidebar-controls {
  display: grid;
}

body.sidebar-collapsed .sidebar-nav {
  max-height: calc(100vh - 11rem);
  padding-right: 0;
  scrollbar-width: none;
}

body.sidebar-collapsed .sidebar-nav::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body.sidebar-collapsed .portal-sidebar .sidebar-nav a,
body.sidebar-collapsed .sidebar-footer a {
  justify-content: center;
  padding-inline: .35rem;
}

.global-search {
  position: relative;
  width: min(42vw, 32rem);
}

.global-search input {
  width: 100%;
  min-height: 2.55rem;
  padding-left: 2.35rem;
  background:
    linear-gradient(transparent, transparent),
    var(--ds-surface);
  box-shadow: 0 1px 0 rgba(23, 32, 51, .04);
}

.global-search::before {
  content: "S";
  position: absolute;
  left: .75rem;
  top: .68rem;
  color: var(--ds-muted);
  font-size: .78rem;
  font-weight: 900;
  z-index: 1;
}

.search-results,
.dropdown-panel,
.search-select-panel {
  position: absolute;
  z-index: 30;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  box-shadow: 0 18px 48px rgba(23, 32, 51, .18);
}

.search-results {
  left: 0;
  right: 0;
  top: calc(100% + .35rem);
  display: none;
  max-height: 24rem;
  overflow: auto;
  padding: .35rem;
}

.global-search.is-open .search-results {
  display: grid;
}

.search-results a,
.dropdown-panel a,
.dropdown-panel button {
  display: grid;
  gap: .12rem;
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ds-ink);
  padding: .7rem .8rem;
  text-align: left;
  text-decoration: none;
}

.search-results a:hover,
.dropdown-panel a:hover,
.dropdown-panel button:hover,
.search-select-option:hover {
  background: color-mix(in srgb, var(--ds-primary) 12%, var(--ds-surface));
}

.search-results small,
.dropdown-panel small,
.field-hint {
  color: var(--ds-muted);
}

.user-menu {
  position: relative;
}

.user-menu-button {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  padding: .25rem .5rem;
}

.user-menu-text {
  display: grid;
  line-height: 1.15;
  text-align: left;
}

.user-menu-text small {
  max-width: 14rem;
  overflow: hidden;
  color: var(--ds-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  color: var(--ds-muted);
  font-size: .8rem;
}

.dropdown-panel {
  right: 0;
  top: calc(100% + .45rem);
  display: none;
  min-width: 18rem;
  padding: .4rem;
}

[data-dropdown].is-open .dropdown-panel {
  display: block;
}

.dropdown-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .8rem;
  border-bottom: 1px solid var(--ds-line);
  margin-bottom: .35rem;
}

.avatar {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ds-primary) 16%, var(--ds-surface));
  color: var(--ds-primary-strong);
  border: 1px solid var(--ds-line);
  font-weight: 850;
}

.avatar-sm {
  width: 2rem;
  height: 2rem;
  font-size: .78rem;
}

.avatar-xl {
  width: clamp(5rem, 9vw, 7rem);
  height: clamp(5rem, 9vw, 7rem);
  font-size: 1.4rem;
}

.avatar img,
.avatar-crop-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.module-card {
  min-height: 16rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.module-card-body {
  display: grid;
  gap: .65rem;
}

.module-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}

.module-card h2,
.module-card h3 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.25;
}

.module-card p {
  color: var(--ds-muted);
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.module-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-top: .85rem;
}

.module-card-footer .btn-action {
  min-width: 8.5rem;
}

.profile-hero,
.profile-panel,
.form-savebar {
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 8px;
}

.profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.profile-identity h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.65rem);
}

.profile-identity p:not(.eyebrow) {
  color: var(--ds-muted);
  margin: .2rem 0 .55rem;
}

.profile-shell {
  display: grid;
  grid-template-columns: minmax(18rem, .8fr) minmax(24rem, 1.2fr);
  gap: 1rem;
}

.profile-panel {
  padding: 1rem;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.25rem;
}

.avatar-editor form {
  display: grid;
  gap: .9rem;
}

.avatar-crop-frame {
  position: relative;
  width: min(100%, 18rem);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  justify-self: center;
  overflow: hidden;
  border-radius: 50%;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--ds-line) 65%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--ds-line) 65%, transparent) 25%, transparent 25%),
    var(--ds-soft);
  background-size: 1rem 1rem;
  border: 1px solid var(--ds-line);
}

.avatar-crop-frame img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center;
}

.avatar-crop-frame img:not(.has-image) {
  display: none;
}

.avatar-crop-frame span {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--ds-primary-strong);
}

.file-drop {
  position: relative;
  display: grid;
  gap: .15rem;
  padding: .9rem;
  border: 1px dashed var(--ds-line);
  border-radius: 8px;
  background: var(--ds-soft);
  cursor: pointer;
}

.file-drop.is-dragover {
  border-color: var(--ds-primary);
  background: color-mix(in srgb, var(--ds-primary) 12%, var(--ds-soft));
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.file-picker-row {
  min-height: 2.65rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .5rem;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-surface);
  padding: .25rem;
}

.file-picker-button {
  min-height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--ds-primary);
  color: var(--ds-surface);
  padding: .45rem .75rem;
  font-weight: 800;
  white-space: nowrap;
}

:root[data-theme="dark"] .file-picker-button {
  color: #07111e;
}

.file-picker-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ds-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.appearance-theme-grid {
  display: grid;
  gap: 1rem;
}

.theme-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
}

.theme-preview {
  min-height: 3.25rem;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
}

.theme-preview-primary {
  background: var(--ds-primary);
}

.theme-preview-accent {
  background: var(--ds-accent);
}

.theme-preview-surface {
  background: linear-gradient(135deg, var(--ds-surface), var(--ds-soft));
}

.company-map-panel {
  grid-column: 1 / -1;
}

.company-map {
  display: grid;
  gap: 1.25rem;
  justify-items: center;
}

.company-node {
  position: relative;
  min-width: min(100%, 14rem);
  display: grid;
  gap: .2rem;
  justify-items: center;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-soft);
  padding: .85rem;
  text-align: center;
}

.company-node span {
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ds-primary) 18%, var(--ds-surface));
  color: var(--ds-primary-strong);
  font-size: .8rem;
  font-weight: 900;
}

.company-node small {
  color: var(--ds-muted);
}

.company-node-hq {
  background: color-mix(in srgb, var(--ds-primary) 9%, var(--ds-surface));
}

.company-map-branches {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
  padding-top: 1.25rem;
}

.company-map-branches::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 1.25rem;
  background: var(--ds-line);
}

.documents-hero,
.documents-panel,
.documents-main,
.document-stats article {
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 8px;
}

.documents-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.documents-hero-actions,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
}

.documents-hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
}

.documents-hero p:not(.eyebrow) {
  color: var(--ds-muted);
  margin: .35rem 0 0;
}

.documents-search {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.documents-search input {
  min-height: 2.55rem;
  min-width: min(50vw, 22rem);
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  padding: .6rem .75rem;
}

.document-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.document-stats article {
  display: grid;
  gap: .15rem;
  padding: 1rem;
}

.document-stats strong {
  font-size: 1.55rem;
}

.document-stats span {
  color: var(--ds-muted);
}

.documents-workspace,
.documents-browser {
  display: grid;
  grid-template-columns: minmax(18rem, .45fr) minmax(32rem, 1.55fr);
  gap: 1rem;
}

.documents-panel,
.documents-main {
  padding: 1rem;
  min-width: 0;
}

.stack-form {
  display: grid;
  gap: .85rem;
  margin-bottom: 1.25rem;
}

.document-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}

.folder-tile {
  display: grid;
  gap: .4rem;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-soft);
  color: var(--ds-ink);
  padding: .85rem;
  text-decoration: none;
  min-width: 0;
}

.folder-tile strong,
.tree-item span:last-child,
.document-name-stack strong,
.document-name-stack small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-list {
  display: grid;
  gap: .02rem;
  padding: .35rem;
  border: 1px solid color-mix(in srgb, var(--ds-line) 82%, transparent);
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--ds-line) 24%, transparent) 1px, transparent 1px) 1.86rem 0 / 1.35rem 100% no-repeat,
    color-mix(in srgb, var(--ds-soft) 72%, var(--ds-surface));
}

.tree-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: .08rem .18rem .08rem calc(.2rem + var(--tree-indent, 0rem));
  min-width: 0;
}

.tree-item {
  position: relative;
  display: grid;
  grid-template-columns: 1rem 1.45rem minmax(0, 1fr);
  gap: .45rem;
  align-items: center;
  min-height: 2.15rem;
  color: var(--ds-ink);
  text-decoration: none;
  border-radius: 4px;
  padding: .18rem .3rem;
  min-width: 0;
}

.tree-row[data-folder-depth]:not([data-folder-depth="0"])::before {
  content: "";
  position: absolute;
  left: calc(.82rem + var(--tree-guide, 0rem));
  top: -.25rem;
  bottom: 50%;
  width: 1px;
  background: color-mix(in srgb, var(--ds-line) 70%, transparent);
}

.tree-row[data-folder-depth]:not([data-folder-depth="0"]) .tree-item::before {
  content: "";
  position: absolute;
  left: calc(-.58rem);
  top: 50%;
  width: .58rem;
  height: 1px;
  background: color-mix(in srgb, var(--ds-line) 70%, transparent);
}

.tree-expander {
  display: inline-grid;
  place-items: center;
  width: 1rem;
  color: var(--ds-muted);
  font-size: .78rem;
  font-weight: 900;
}

.tree-row:hover,
.tree-row.active,
.tree-row.is-drop-target {
  border-color: var(--ds-line);
  background: var(--ds-soft);
}

.tree-row:hover .tree-action-button,
.tree-row.active .tree-action-button,
.tree-action-button:focus,
.tree-actions.show .tree-action-button {
  opacity: 1;
}

.folder-glyph,
.drive-glyph {
  position: relative;
  display: inline-block;
  width: 1.35rem;
  height: .95rem;
  border-radius: 3px;
  background: #f5c84c;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12);
}

.folder-glyph::before {
  content: "";
  position: absolute;
  left: .08rem;
  top: -.26rem;
  width: .65rem;
  height: .32rem;
  border-radius: 3px 3px 0 0;
  background: #e8b63e;
}

.drive-glyph {
  height: 1rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--ds-primary) 25%, var(--ds-surface));
  border: 1px solid var(--ds-line);
}

.drive-glyph::after {
  content: "";
  position: absolute;
  right: .18rem;
  bottom: .16rem;
  width: .18rem;
  height: .18rem;
  border-radius: 50%;
  background: var(--ds-good);
}

.tree-action-button,
.round-icon-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--ds-line);
  background: var(--ds-surface);
  color: var(--ds-ink);
  font-weight: 900;
}

.tree-action-button {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 6px;
  opacity: .82;
}

.round-icon-button {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 1;
}

.tree-action-button:hover,
.round-icon-button:hover {
  background: color-mix(in srgb, var(--ds-primary) 16%, var(--ds-surface));
  color: var(--ds-primary-strong);
  transform: translateY(-1px);
}

.tree-actions .dropdown-menu {
  z-index: 1080;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  box-shadow: 0 16px 36px rgba(23, 32, 51, .22);
}

.tree-actions .dropdown-item {
  color: var(--ds-ink);
}

.tree-actions .dropdown-item:hover {
  background: var(--ds-soft);
}

.tree-icon,
.file-type-icon {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: var(--ds-soft);
  color: var(--ds-primary-strong);
  font-size: .72rem;
  font-weight: 900;
}

.folder-tile small {
  color: var(--ds-muted);
}

.document-table {
  display: grid;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  overflow: visible;
  max-width: 100%;
  min-width: 0;
}

.document-row {
  display: grid;
  grid-template-columns: minmax(14rem, 1.6fr) minmax(6rem, .55fr) minmax(6rem, .45fr) minmax(9rem, .7fr) minmax(7rem, .45fr);
  gap: .75rem;
  align-items: center;
  padding: .8rem;
  border-top: 1px solid var(--ds-line);
  min-width: 0;
}

.document-row:first-child {
  border-top: 0;
}

.document-head {
  background: var(--ds-soft);
  color: var(--ds-muted);
  font-weight: 800;
}

.document-head a {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.document-head small {
  display: inline;
  color: var(--ds-primary-strong);
  font-size: .75rem;
  line-height: 1;
}

.document-name-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .7rem;
  min-width: 0;
}

.document-name-stack {
  display: grid;
  min-width: 0;
}

.document-meta-cell,
.document-actions-cell {
  min-width: 0;
}

.file-browser-table .dropdown-toggle {
  min-width: 2.6rem;
  padding-left: .55rem;
  padding-right: .55rem;
}

.file-browser-table .dropdown-menu {
  z-index: 1080;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  box-shadow: 0 16px 36px rgba(23, 32, 51, .22);
}

.file-browser-table .dropdown-item {
  color: var(--ds-ink);
}

.file-browser-table .dropdown-item:hover {
  background: var(--ds-soft);
}

.danger-note {
  border: 1px solid var(--ds-danger);
  border-radius: 8px;
  background: color-mix(in srgb, var(--ds-danger) 12%, var(--ds-surface));
  color: var(--ds-danger-strong);
  padding: .85rem;
  font-weight: 800;
}

.trash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: 1rem;
}

.trash-list {
  display: grid;
  gap: .75rem;
}

.trash-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-soft);
  padding: .85rem;
  min-width: 0;
}

.admin-trash-item {
  border-color: color-mix(in srgb, var(--ds-danger) 38%, var(--ds-line));
}

.trash-item-body {
  display: grid;
  min-width: 0;
}

.trash-item-body strong,
.trash-item-body small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-modal-content {
  background: var(--ds-surface);
  color: var(--ds-ink);
  border: 1px solid var(--ds-line);
  border-radius: 8px;
}

.ds-modal-content .modal-header {
  border-bottom-color: var(--ds-line);
}

.ds-modal-content .modal-footer {
  border-top-color: var(--ds-line);
}

.ds-modal-content .btn-close {
  --bs-btn-close-bg: none;
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  margin: -.35rem -.35rem -.35rem auto;
  padding: 0;
  border: 1px solid var(--ds-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--ds-surface) 72%, var(--ds-ink) 10%);
  color: var(--ds-ink);
  opacity: 1;
  box-shadow: none;
  transition: transform .18s ease, background-color .18s ease, color .18s ease, border-color .18s ease;
}

.ds-modal-content .btn-close::before,
.ds-modal-content .btn-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1rem;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.ds-modal-content .btn-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.ds-modal-content .btn-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.ds-modal-content .btn-close:hover {
  background: color-mix(in srgb, var(--ds-primary) 16%, var(--ds-surface));
  color: var(--ds-primary-strong);
  border-color: color-mix(in srgb, var(--ds-primary) 45%, var(--ds-line));
  transform: translateY(-1px) rotate(90deg);
}

.ds-modal-content .btn-close:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ds-primary) 38%, transparent);
  outline-offset: 2px;
}

.upload-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
}

.upload-preview,
.document-preview-body {
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-soft);
  padding: .85rem;
}

.upload-preview {
  min-height: 7rem;
  display: grid;
  gap: .5rem;
}

.upload-preview img {
  max-width: 100%;
  max-height: 14rem;
  border-radius: 8px;
  object-fit: contain;
}

.document-preview-body {
  min-height: 28rem;
}

.document-preview-body iframe,
.document-preview-body img {
  width: 100%;
  min-height: 28rem;
  border: 0;
  border-radius: 8px;
  background: var(--ds-surface);
}

.document-preview-body img {
  object-fit: contain;
  max-height: 70vh;
}

.document-row small,
.activity-list small,
.activity-list time {
  display: block;
  color: var(--ds-muted);
}

.activity-list {
  display: grid;
  gap: .75rem;
}

.activity-list > div {
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-soft);
  padding: .75rem;
}

.empty-state {
  padding: 1rem;
}

.empty-state p {
  color: var(--ds-muted);
}

.control-grid,
.form-grid {
  display: grid;
  gap: .85rem;
}

.control-grid {
  grid-template-columns: repeat(3, 1fr);
}

.field {
  display: grid;
  gap: .35rem;
  color: var(--ds-ink);
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.search-select-button,
.search-select-input,
.admin-inline-form select {
  width: 100%;
  min-height: 2.7rem;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  padding: .6rem .75rem;
}

.field textarea {
  min-height: 9rem;
  resize: vertical;
}

.check-row {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  color: var(--ds-ink);
  font-weight: 700;
}

.check-row input {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: .2rem;
  flex: 0 0 auto;
}

.terms-document,
.terms-card {
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-soft);
  padding: 1rem;
}

.terms-document {
  max-height: 22rem;
  overflow: auto;
  margin: 1rem 0;
}

.terms-document h2 {
  font-size: 1.15rem;
  margin: 0 0 .75rem 0;
}

.terms-document p,
.terms-card p {
  color: var(--ds-muted);
}

.tenant-registration-page {
  display: grid;
  gap: 1rem;
}

.tenant-registration-shell {
  min-height: calc(100vh - 12rem);
  display: grid;
  grid-template-columns: minmax(18rem, .8fr) minmax(28rem, 1.2fr);
  gap: 1.25rem;
  align-items: start;
}

.tenant-registration-intro,
.tenant-registration-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  padding: 1.25rem;
}

.tenant-registration-intro {
  position: sticky;
  top: 1rem;
}

.tenant-registration-intro h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
  margin: .25rem 0 .75rem;
}

.tenant-registration-intro p {
  color: var(--ds-muted);
}

.tenant-registration-form {
  display: grid;
  gap: 1rem;
}

.phone-field {
  display: grid;
  grid-template-columns: minmax(10rem, .65fr) minmax(10rem, 1fr);
  gap: .5rem;
}

.confirmation-panel {
  max-width: 48rem;
  margin: 0 auto;
}

.summary-list {
  display: grid;
  gap: .65rem;
  margin: 1rem 0;
}

.summary-list div {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: .75rem;
  border-bottom: 1px solid var(--ds-line);
  padding-bottom: .65rem;
}

.summary-list dt {
  color: var(--ds-muted);
  font-weight: 800;
}

.summary-list dd {
  margin: 0;
  color: var(--ds-ink);
  overflow-wrap: anywhere;
}

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

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

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.access-list,
.security-list {
  display: grid;
  gap: .65rem;
}

.access-row,
.security-list {
  align-items: center;
}

.access-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .75rem;
  padding: .75rem;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-soft);
}

.access-row small,
.security-list small {
  display: block;
  color: var(--ds-muted);
}

.security-list {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: .75rem;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-soft);
}

.backoffice-page {
  display: grid;
  gap: 1rem;
}

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

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

.compact-list,
.audit-list {
  display: grid;
  gap: .65rem;
}

.compact-row,
.audit-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: var(--ds-soft);
  padding: .75rem;
}

.compact-row small,
.audit-row small {
  display: block;
  color: var(--ds-muted);
}

.audit-row p {
  margin: .2rem 0;
  color: var(--ds-muted);
}

.audit-table {
  min-width: 68rem;
}

.audit-table td {
  vertical-align: top;
}

.muted-text {
  color: var(--ds-muted);
  margin: 0;
}

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

.form-savebar {
  position: sticky;
  bottom: 1rem;
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  padding: .8rem;
  box-shadow: 0 12px 32px rgba(23, 32, 51, .12);
}

.search-select-shell {
  position: relative;
}

.compact-select + .search-select-button,
.compact-select.search-select-button {
  min-width: 14rem;
}

.visually-hidden-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.search-select-button {
  position: relative;
  text-align: left;
  padding-right: 2.1rem;
}

.search-select-button::after {
  content: "v";
  position: absolute;
  right: .75rem;
  top: .72rem;
  color: var(--ds-muted);
  font-size: .8rem;
  font-weight: 900;
}

.search-select-panel {
  left: 0;
  right: 0;
  top: calc(100% + .35rem);
  display: none;
  padding: .45rem;
}

.search-select-shell.is-open .search-select-panel {
  display: grid;
  gap: .45rem;
}

.search-select-list {
  max-height: 15rem;
  overflow: auto;
}

.search-select-option {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ds-ink);
  padding: .55rem .6rem;
  text-align: left;
}

.search-select-option[aria-selected="true"] {
  background: color-mix(in srgb, var(--ds-primary) 16%, var(--ds-surface));
  color: var(--ds-primary-strong);
  font-weight: 800;
}

.admin-layout {
  display: grid;
  gap: 1rem;
}

.admin-rail {
  color: var(--ds-muted);
  font-size: .82rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-body {
  min-width: 0;
}

.admin-inline-form {
  grid-template-columns: minmax(16rem, 1fr) minmax(10rem, .42fr) minmax(9rem, auto);
}

.admin-table-row {
  grid-template-columns: minmax(14rem, 1.4fr) minmax(10rem, 1fr) minmax(10rem, 1fr) minmax(17rem, 1.4fr);
}

.admin-actions .btn-action {
  min-height: 2.25rem;
  font-size: .86rem;
}

:root[data-theme="dark"] .search-results,
:root[data-theme="dark"] .dropdown-panel,
:root[data-theme="dark"] .search-select-panel,
:root[data-theme="dark"] .profile-hero,
:root[data-theme="dark"] .profile-panel,
:root[data-theme="dark"] .form-savebar,
:root[data-theme="dark"] .module-card,
:root[data-theme="dark"] .signal-grid > * {
  box-shadow: none;
}

@media (max-width: 800px) {
  .environment-badge {
    right: .75rem;
    bottom: 4.9rem;
    z-index: 26;
  }

  .portal-frame {
    display: block;
    padding-bottom: 4rem;
  }

  .portal-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1050;
    display: flex;
    width: min(20rem, 86vw);
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 18px 0 48px rgba(0, 0, 0, .35);
  }

  body.mobile-sidebar-open {
    overflow: hidden;
  }

  body.mobile-sidebar-open .portal-sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(0, 0, 0, .48);
    border: 0;
    padding: 0;
  }

  body.mobile-sidebar-open .sidebar-scrim {
    display: block;
  }

  body.sidebar-collapsed .portal-sidebar {
    padding-inline: 1rem;
  }

  body.sidebar-collapsed .sidebar-label {
    display: inline;
  }

  body.sidebar-collapsed .sidebar-controls {
    display: flex;
  }

  body.sidebar-collapsed .sidebar-nav {
    max-height: calc(100vh - 8rem);
    scrollbar-width: thin;
  }

  body.sidebar-collapsed .sidebar-nav::-webkit-scrollbar {
    width: .5rem;
    height: .5rem;
  }

  body.sidebar-collapsed .portal-sidebar .sidebar-nav a,
  body.sidebar-collapsed .sidebar-footer a {
    justify-content: flex-start;
    padding-inline: .7rem;
  }

  .portal-topbar,
  .dashboard-header {
    display: grid;
  }

  .portal-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }

  .mobile-sidebar-button {
    display: inline-grid;
    place-items: center;
  }

  .global-search input {
    width: 100%;
  }

  .admin-inline-form,
  .admin-table-row,
  .backoffice-grid,
  .tenant-registration-shell,
  .form-grid,
  .control-grid,
  .owner-user-form {
    grid-template-columns: 1fr;
  }

  .summary-list div {
    grid-template-columns: 1fr;
  }

  .mobile-navbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: var(--ds-surface);
    border-top: 1px solid var(--ds-line);
    z-index: 1030;
  }

  .mobile-navbar a,
  .mobile-navbar button {
    padding: .8rem .4rem;
    text-align: center;
    text-decoration: none;
    border: 0;
    background: transparent;
    color: var(--ds-primary);
    font: inherit;
  }

  .public-hero {
    min-height: 72vh;
    padding: 2rem 1rem;
    background:
      linear-gradient(180deg, var(--ds-hero-overlay-a), var(--ds-hero-overlay-b)),
      url("/icons/dragonstar-icon.svg") center 85% / 9rem no-repeat,
      #152238;
  }

  .global-search {
    width: 100%;
  }

  .user-menu-text,
  .chevron,
  .topbar-actions .chip,
  .topbar-actions > :not(.user-menu):not(.theme-switch) {
    display: none;
  }

  .profile-hero,
  .profile-identity,
  .security-list {
    display: grid;
  }

  .profile-shell,
  .hq-form,
  .form-grid,
  .documents-workspace,
  .documents-browser,
  .document-stats,
  .control-grid,
  .upload-modal-grid {
    grid-template-columns: 1fr;
  }

  .documents-hero,
  .documents-search,
  .document-toolbar {
    display: grid;
  }

  .portal-content {
    padding: .85rem;
    overflow-x: hidden;
  }

  .documents-hero {
    gap: 1rem;
  }

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

  .documents-main,
  .documents-panel,
  .documents-browser,
  .document-toolbar,
  .document-table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .document-toolbar {
    align-items: stretch;
  }

  .toolbar-actions,
  .documents-search {
    width: 100%;
  }

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

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

  .document-table {
    border: 0;
    gap: .65rem;
  }

  .document-head {
    display: none;
  }

  .document-row {
    grid-template-columns: 1fr;
    gap: .55rem;
    border: 1px solid var(--ds-line);
    border-radius: 8px;
    background: var(--ds-surface);
    padding: .85rem;
  }

  .document-row:first-child {
    border-top: 1px solid var(--ds-line);
  }

  .document-meta-cell,
  .document-actions-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
  }

  .document-meta-cell::before,
  .document-actions-cell::before {
    content: attr(data-label);
    color: var(--ds-muted);
    font-size: .8rem;
    font-weight: 800;
  }

  .document-actions-cell .dropdown {
    margin-left: auto;
  }

  .trash-grid,
  .trash-item {
    grid-template-columns: 1fr;
  }

  .trash-item form,
  .trash-item button {
    width: 100%;
  }

  .tree-list {
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .tree-row {
    min-width: 17rem;
  }

  .tenant-registration-intro {
    position: static;
  }

  .phone-field {
    grid-template-columns: 1fr;
  }

  .dropdown-panel.user-dropdown {
    position: fixed;
    left: .75rem;
    right: .75rem;
    top: 7.25rem;
    min-width: 0;
    max-width: none;
  }

  .form-savebar {
    position: static;
  }
}
