:root {
  color-scheme: light;
  --bg: #edf1f5;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: #ffffff;
  --text: #162533;
  --muted: #627282;
  --line: #d8e0e8;
  --accent: #a6814f;
  --accent-strong: #7f6038;
  --success: #1f9d67;
  --danger: #c24747;
  --shadow: 0 30px 70px rgba(16, 28, 40, 0.12);
  --radius: 22px;
  --sidebar-bg: #101923;
  --sidebar-surface: rgba(255, 255, 255, 0.06);
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-text: #f2f5f7;
  --sidebar-muted: rgba(242, 245, 247, 0.64);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(166, 129, 79, 0.12), transparent 24%),
    radial-gradient(circle at top right, rgba(22, 37, 51, 0.08), transparent 24%),
    linear-gradient(180deg, #f7f8fa, var(--bg));
  color: var(--text);
}

body.platform-wide {
  --shell-pad: 12px;
}

.d-none {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-card {
  width: min(1100px, 100%);
  background: var(--panel);
  border: 1px solid rgba(220, 231, 239, 0.82);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(420px, 1.2fr);
}

.auth-brand {
  padding: 38px 34px;
  background:
    linear-gradient(160deg, rgba(11, 127, 171, 0.12), rgba(11, 127, 171, 0.03)),
    linear-gradient(180deg, #ffffff, #f4f9fc);
  border-right: 1px solid var(--line);
}

.auth-logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border-radius: 20px;
  background: #fff;
  padding: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 14px 28px rgba(23, 48, 66, 0.08);
}

.auth-eyebrow {
  margin-top: 18px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.auth-brand h1 {
  margin: 10px 0 10px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1;
}

.auth-brand p {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-points {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

.auth-point {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.auth-point strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
}

.auth-forms {
  padding: 34px;
}

.auth-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.auth-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  color: var(--muted);
  padding: 9px 14px;
  font-weight: 600;
}

.auth-tab.active {
  border-color: transparent;
  background: var(--text);
  color: #fff;
}

.auth-pane {
  display: none;
}

.auth-pane.active {
  display: block;
}

.section-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
}

.section-card h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.section-card p {
  margin: 0 0 16px;
  color: var(--muted);
}

.status-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  min-height: 54px;
  color: var(--muted);
}

.status-box.success {
  border-color: rgba(31, 157, 103, 0.3);
  color: var(--success);
}

.status-box.error {
  border-color: rgba(194, 71, 71, 0.32);
  color: var(--danger);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  width: 100%;
  transition: grid-template-columns 0.22s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 104px minmax(0, 1fr);
}

.sidebar {
  padding: 24px 20px;
  border-right: 1px solid var(--sidebar-line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    linear-gradient(180deg, #13202c, var(--sidebar-bg));
  color: var(--sidebar-text);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow: auto;
  transition: padding 0.22s ease;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.brand-row img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-row strong {
  display: block;
  font-size: 1.15rem;
}

.brand-row span {
  display: block;
  color: var(--sidebar-muted);
  font-size: 0.92rem;
}

.sidebar-toolbar {
  margin-bottom: 14px;
}

.profile-card {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--sidebar-line);
  margin-bottom: 18px;
  color: var(--sidebar-text);
}

.profile-card .role-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(166, 129, 79, 0.18);
  color: #f6e9d5;
}

.sidebar .section-title {
  margin: 20px 0 10px;
  color: var(--sidebar-muted);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.module-nav {
  display: grid;
  gap: 8px;
}

.module-nav button {
  text-align: left;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--sidebar-text);
  padding: 12px 14px;
  font-weight: 600;
}

.module-nav-main {
  display: inline;
}

.module-nav-mini {
  display: none;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.module-nav button.active,
.module-nav button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(166, 129, 79, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.content-shell {
  padding: 14px;
  min-width: 0;
  min-height: 100vh;
  height: 100vh;
  overflow: auto;
  scroll-padding-top: 88px;
}

body.platform-wide .content-shell {
  padding: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border: 1px solid rgba(216, 224, 232, 0.9);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 250, 252, 0.96));
  box-shadow: 0 18px 44px rgba(16, 28, 40, 0.08);
  position: sticky;
  top: 12px;
  z-index: 30;
}

.topbar h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.view-section {
  margin-top: 20px;
}

body.platform-wide .view-section {
  margin-top: 14px;
}

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

.module-card {
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 250, 252, 0.96));
  border: 1px solid rgba(216, 224, 232, 0.9);
  box-shadow: 0 20px 46px rgba(16, 28, 40, 0.06);
}

.module-card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.module-card p {
  margin: 0 0 16px;
  color: var(--muted);
}

.module-card .meta {
  font-size: 0.92rem;
  color: var(--accent-strong);
  font-weight: 600;
}

.module-frame-wrap {
  border: 1px solid rgba(216, 224, 232, 0.9);
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 46px rgba(23, 48, 66, 0.08);
  min-height: calc(100vh - 112px);
}

.module-frame {
  width: 100%;
  min-height: calc(100vh - 112px);
  border: 0;
  background: #fff;
}

#appShell .topbar {
  display: none !important;
}

#appShell .content-shell {
  padding-top: 12px;
}

#appShell .module-frame-wrap {
  border-radius: 18px;
  min-height: calc(100vh - 88px);
}

#appShell .module-frame {
  min-height: calc(100vh - 88px);
}

#appShell .ai-widget.is-hidden,
#appShell .ai-widget {
  display: none !important;
}

/* Restore the original top header shell without touching module-local styling. */
#appShell.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(166, 129, 79, 0.08), transparent 22%),
    linear-gradient(180deg, #eef3f8, #e7edf3);
}

#appShell.sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

#appShell .shell-header {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(205, 217, 226, 0.95);
  background: linear-gradient(180deg, #2e79bb, #2467a2);
  position: sticky;
  top: 0;
  z-index: 50;
}

#appShell .brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#appShell .brand-block__logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  padding: 5px;
  flex: 0 0 auto;
}

#appShell .brand-block__copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

#appShell .brand-block__copy strong {
  color: #fff;
  font-size: 0.98rem;
  line-height: 1.1;
}

#appShell .brand-block__copy span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.77rem;
}

#appShell .top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

#appShell .top-nav > * {
  flex: 0 0 auto;
}

#appShell .top-nav-item,
#appShell .top-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  min-width: 86px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  text-align: center;
}

#appShell .top-nav-item.active,
#appShell .top-nav button.active,
#appShell .top-nav-item:hover,
#appShell .top-nav button:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.32);
}

#appShell .shell-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

#appShell .content-shell {
  grid-column: 1 / -1;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 16px !important;
  min-height: calc(100vh - 84px);
  height: auto;
  overflow: visible;
}

body.platform-wide #appShell .content-shell {
  grid-template-columns: minmax(0, 1fr);
  padding: 14px !important;
}

#appShell.sidebar-collapsed .content-shell {
  grid-template-columns: minmax(0, 1fr);
}

#appShell .sidebar {
  position: sticky;
  top: 96px;
  align-self: start;
  height: auto;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

#appShell .sidebar .section-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.96));
  border: 1px solid rgba(216, 224, 232, 0.95);
  box-shadow: 0 18px 40px rgba(16, 28, 40, 0.08);
}

#appShell .workspace-main {
  min-width: 0;
  display: grid;
  gap: 16px;
  align-content: start;
}

#appShell .view-shell {
  display: block;
  min-width: 0;
}

#appShell .module-frame-wrap,
#appShell .table-shell,
#appShell .admin-panel,
#appShell .workspace-panel,
#appShell .section-card {
  background: rgba(255, 255, 255, 0.96);
}

@media (max-width: 1100px) {
  #appShell .shell-header {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  #appShell .top-nav {
    justify-content: flex-start;
  }

  #appShell .content-shell,
  body.platform-wide #appShell .content-shell,
  #appShell.sidebar-collapsed .content-shell {
    grid-template-columns: 1fr;
  }

  #appShell .sidebar {
    position: static;
    max-height: none;
  }
}

#aiAssistantWidget,
.placeholder-hero,
#appShell .workspace-hero {
  display: none !important;
}

body.app-booting {
  overflow: hidden;
}

body.app-booting .auth-screen,
body.app-booting .app-shell {
  visibility: hidden;
}

body.auth-mode {
  overflow: hidden;
}

.auth-card--compact {
  width: min(980px, 100%);
  grid-template-columns: minmax(260px, 0.85fr) minmax(360px, 1fr);
}

.auth-card--compact .auth-brand {
  background: linear-gradient(180deg, #173e70, #244f86);
  color: #fff;
}

.auth-card--compact .auth-brand p,
.auth-card--compact .auth-eyebrow {
  color: rgba(255, 255, 255, 0.82) !important;
}

.auth-card--compact .auth-points {
  display: none !important;
}

.auth-forgot-link {
  padding-left: 0 !important;
  text-decoration: none;
}

.auth-forgot-link:hover {
  text-decoration: underline;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

.admin-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.card-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.table-shell {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.table-shell table {
  margin-bottom: 0;
  min-width: 820px;
}

.compact-help {
  color: var(--muted);
  font-size: 0.92rem;
}

.access-user-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.permission-grid {
  display: grid;
  gap: 12px;
}

.permission-summary {
  display: grid;
  gap: 12px;
  margin-bottom: 4px;
}

.permission-summary__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.permission-stat {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f5fafc);
}

.permission-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 4px;
}

.permission-stat strong {
  font-size: 1.15rem;
}

.permission-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.permission-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #fff, #f8fbfd);
}

.permission-card__head {
  margin-bottom: 10px;
}

.permission-card__head strong {
  display: block;
  margin-bottom: 4px;
}

.permission-card__head span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.permission-card__flags {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.permission-flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.94rem;
}

.messenger-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
}

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

.thread-item {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

.thread-item.active,
.thread-item:hover {
  border-color: rgba(11, 127, 171, 0.25);
  box-shadow: 0 14px 24px rgba(23, 48, 66, 0.05);
}

.thread-item small {
  color: var(--muted);
}

.messages-panel {
  display: flex;
  flex-direction: column;
  min-height: 72vh;
}

.messages-list {
  flex: 1;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 10px 2px 18px;
}

.message-bubble {
  max-width: min(720px, 92%);
  padding: 12px 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
}

.message-bubble.mine {
  margin-left: auto;
  background: rgba(11, 127, 171, 0.08);
  border-color: rgba(11, 127, 171, 0.2);
}

.message-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.placeholder-card {
  padding: 26px;
  border: 1px dashed rgba(11, 127, 171, 0.28);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
}

.placeholder-shell {
  display: grid;
  gap: 18px;
}

.placeholder-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 4px;
}

.placeholder-eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 700;
}

.placeholder-hero h3 {
  margin: 8px 0;
  font-size: 1.5rem;
}

.placeholder-hero p {
  margin: 0;
  max-width: 820px;
  color: var(--muted);
  line-height: 1.6;
}

.placeholder-status {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

.placeholder-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.9rem;
  font-weight: 600;
}

.placeholder-metrics,
.placeholder-sections,
.placeholder-board {
  display: grid;
  gap: 14px;
}

.placeholder-metrics {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.placeholder-metric,
.placeholder-panel,
.placeholder-lane {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f8fbfd);
}

.placeholder-metric span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
  font-size: 0.88rem;
}

.placeholder-metric strong {
  font-size: 1rem;
}

.placeholder-sections {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.placeholder-panel h4,
.placeholder-lane h4 {
  margin: 0 0 10px;
  font-size: 1.04rem;
}

.placeholder-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.placeholder-list li + li {
  margin-top: 8px;
}

.placeholder-board {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.placeholder-lane {
  display: grid;
  gap: 10px;
}

.placeholder-task {
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(11, 127, 171, 0.08);
  border: 1px solid rgba(11, 127, 171, 0.14);
}

.placeholder-links {
  display: grid;
  gap: 10px;
}

.schema-warning {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(194, 71, 71, 0.26);
  background: rgba(194, 71, 71, 0.06);
  color: #7e2f2f;
}

.workspace-shell {
  display: grid;
  gap: 18px;
}

.workspace-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}

.workspace-hero h3 {
  margin: 8px 0;
  font-size: 1.6rem;
}

.workspace-hero p {
  margin: 0;
  max-width: 900px;
  color: var(--muted);
  line-height: 1.6;
}

.workspace-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(216, 224, 232, 0.9);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 248, 250, 0.96));
}

.workspace-toolbar__group {
  display: flex;
  flex: 1 1 320px;
  flex-wrap: wrap;
  gap: 10px;
}

.workspace-toolbar__group > * {
  flex: 1 1 180px;
}

.workspace-toolbar__group--end {
  justify-content: flex-end;
  flex: 0 0 auto;
}

.workspace-toolbar__group--end > * {
  flex: 0 0 auto;
}

.workspace-note {
  color: var(--muted);
  font-size: 0.92rem;
  align-self: center;
}

.workspace-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.workspace-metric {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f7fbfd);
  box-shadow: 0 14px 24px rgba(23, 48, 66, 0.05);
}

.workspace-metric span,
.workspace-metric small {
  display: block;
  color: var(--muted);
}

.workspace-metric span {
  margin-bottom: 6px;
  font-size: 0.88rem;
}

.workspace-metric strong {
  display: block;
  font-size: 1.35rem;
  margin-bottom: 4px;
}

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

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

.workspace-panel {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 32px rgba(23, 48, 66, 0.05);
}

.panel-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h4 {
  margin: 0 0 4px;
  font-size: 1.08rem;
}

.panel-heading--compact {
  margin-bottom: 10px;
}

.workspace-form {
  display: grid;
  gap: 12px;
}

.workspace-form label > span {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 6px;
}

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

.workspace-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.workspace-stack {
  display: grid;
  gap: 10px;
}

.workspace-list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f8fbfd);
}

.workspace-list-item__meta,
.workspace-table__sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.workspace-board {
  display: grid;
  gap: 14px;
}

.workspace-board--crm {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workspace-board--tasks {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.workspace-lane {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #fdfefe, #f4f9fc);
}

.workspace-lane__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-weight: 700;
}

.workspace-lane__body {
  display: grid;
  gap: 10px;
  align-content: start;
}

.workspace-card {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 10px 22px rgba(23, 48, 66, 0.05);
}

.workspace-card--neutral {
  border-color: rgba(107, 125, 140, 0.22);
}

.workspace-card--info {
  border-color: rgba(11, 127, 171, 0.2);
  background: rgba(11, 127, 171, 0.04);
}

.workspace-card--accent {
  border-color: rgba(14, 102, 196, 0.2);
  background: rgba(14, 102, 196, 0.04);
}

.workspace-card--warning {
  border-color: rgba(196, 137, 14, 0.22);
  background: rgba(196, 137, 14, 0.06);
}

.workspace-card--success {
  border-color: rgba(31, 157, 103, 0.22);
  background: rgba(31, 157, 103, 0.05);
}

.workspace-card--danger {
  border-color: rgba(194, 71, 71, 0.24);
  background: rgba(194, 71, 71, 0.05);
}

.workspace-card__head,
.workspace-card__footer,
.workspace-card__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.workspace-card__head strong {
  font-size: 0.98rem;
}

.workspace-card__meta {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 6px;
}

.workspace-card__note {
  margin-top: 8px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.workspace-inline-select {
  min-width: 160px;
}

.workspace-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.workspace-tag--neutral {
  color: var(--text);
}

.workspace-tag--info,
.workspace-tag--accent {
  color: var(--accent-strong);
}

.workspace-tag--success {
  color: var(--success);
}

.workspace-tag--warning {
  color: #a96709;
}

.workspace-tag--danger {
  color: var(--danger);
}

.workspace-empty {
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed rgba(11, 127, 171, 0.24);
  background: rgba(11, 127, 171, 0.04);
  color: var(--muted);
}

.workspace-empty--tight {
  padding: 10px 12px;
  font-size: 0.92rem;
}

.workspace-links {
  display: grid;
  gap: 10px;
}

.workspace-sprint-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.workspace-sprint-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f8fbfd);
}

.workspace-sprint-card.active {
  border-color: rgba(11, 127, 171, 0.24);
  box-shadow: 0 14px 24px rgba(11, 127, 171, 0.08);
}

.app-shell.sidebar-collapsed .sidebar {
  padding-inline: 12px;
}

.app-shell.sidebar-collapsed .brand-row {
  justify-content: center;
}

.app-shell.sidebar-collapsed .brand-row > div,
.app-shell.sidebar-collapsed .sidebar .section-title,
.app-shell.sidebar-collapsed .profile-card .fw-bold,
.app-shell.sidebar-collapsed .profile-card .small {
  display: none;
}

.app-shell.sidebar-collapsed .profile-card {
  padding: 12px 8px;
  display: flex;
  justify-content: center;
}

.app-shell.sidebar-collapsed .role-pill {
  width: 100%;
  justify-content: center;
}

.app-shell.sidebar-collapsed .module-nav button {
  text-align: center;
  padding-inline: 10px;
}

.app-shell.sidebar-collapsed .module-nav-main {
  display: none;
}

.app-shell.sidebar-collapsed .module-nav-mini {
  display: inline;
}

@media (max-width: 1100px) {
  .auth-card,
  .app-shell,
  .admin-grid,
  .messenger-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    position: static;
    height: auto;
  }

  .content-shell {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .module-frame-wrap,
  .module-frame {
    min-height: calc(100vh - 140px);
  }

  .workspace-grid--2,
  .workspace-board--crm,
  .workspace-board--tasks,
  .workspace-form-grid {
    grid-template-columns: 1fr;
  }

  .workspace-command-bar {
    padding: 12px;
  }

  .workspace-command-bar__actions > * {
    flex: 1 1 160px;
  }

  .workspace-mode-tabs,
  .workspace-view-tabs {
    flex-wrap: nowrap;
  }
}

:root {
  --bg: #ece9e1;
  --panel: rgba(255, 251, 245, 0.94);
  --panel-strong: #fffdfa;
  --text: #17212b;
  --muted: #6e6b66;
  --line: #ddd2c1;
  --accent: #8e6b3a;
  --accent-strong: #6d5128;
  --success: #27664a;
  --danger: #8b3b32;
  --shadow: 0 24px 70px rgba(23, 33, 43, 0.1);
}

body {
  background:
    radial-gradient(circle at top left, rgba(142, 107, 58, 0.08), transparent 24%),
    radial-gradient(circle at top right, rgba(23, 33, 43, 0.06), transparent 26%),
    linear-gradient(180deg, #f7f3ed, #e7e1d7 48%, #ece9e1);
}

.app-shell {
  grid-template-columns: 286px minmax(0, 1fr);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 96px minmax(0, 1fr);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(14, 22, 31, 0.98), rgba(20, 30, 40, 0.96)),
    #0e161f;
  border-right-color: rgba(255, 255, 255, 0.08);
  color: #f4ede4;
}

.brand-row span,
.sidebar .section-title,
.profile-card .small {
  color: rgba(244, 237, 228, 0.68) !important;
}

.brand-row strong,
.profile-card .fw-bold {
  color: #fff7ed;
}

.brand-row img {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.18);
}

.profile-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  border-color: rgba(255, 255, 255, 0.08);
}

.role-pill {
  background: rgba(142, 107, 58, 0.18) !important;
  color: #f7e8cf !important;
}

.auth-card {
  background: rgba(255, 252, 247, 0.96);
}

.auth-brand {
  background:
    linear-gradient(160deg, rgba(142, 107, 58, 0.12), rgba(142, 107, 58, 0.03)),
    linear-gradient(180deg, #fffdf9, #f4ede4);
}

.auth-tab.active,
.btn-dark {
  background: #17212b;
  border-color: #17212b;
}

.btn-dark:hover,
.btn-dark:focus {
  background: #0f171f;
  border-color: #0f171f;
}

.btn-outline-dark {
  color: #17212b;
  border-color: rgba(23, 33, 43, 0.18);
}

.btn-outline-dark:hover,
.btn-outline-dark:focus {
  background: #17212b;
  border-color: #17212b;
  color: #fff7ed;
}

.module-nav button {
  background: transparent;
  color: rgba(244, 237, 228, 0.84);
  border: 1px solid transparent;
}

.module-nav button:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.module-nav button.active {
  background: linear-gradient(135deg, rgba(142, 107, 58, 0.28), rgba(255, 255, 255, 0.08));
  color: #fff8ee;
  border-color: rgba(199, 167, 118, 0.34);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.content-shell {
  padding: 14px;
}

body.platform-wide .content-shell {
  padding: 10px;
}

.topbar,
.module-card,
.section-card,
.admin-grid > .section-card,
.messenger-shell,
.placeholder-card,
.module-frame-wrap {
  border-color: rgba(150, 131, 103, 0.22);
  box-shadow: 0 24px 48px rgba(23, 33, 43, 0.08);
}

.topbar {
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(249, 244, 237, 0.94));
  position: sticky;
  top: 10px;
  z-index: 20;
}

.view-section {
  margin-top: 14px;
}

.dashboard-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.module-card {
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(249, 244, 237, 0.9));
}

.module-card .meta {
  color: var(--accent-strong);
}

.module-frame-wrap,
.module-frame {
  min-height: calc(100vh - 92px);
}

.module-frame-wrap {
  height: calc(100vh - 92px);
}

.module-frame {
  height: calc(100vh - 92px);
}

.placeholder-card {
  padding: 18px;
  border-style: solid;
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.96), rgba(248, 242, 234, 0.92));
}

.workspace-shell {
  display: grid;
  gap: 18px;
}

.workspace-hero,
.workspace-panel,
.workspace-metric,
.workspace-card,
.workspace-list-item,
.builder-card {
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(248, 242, 234, 0.94));
  border: 1px solid rgba(150, 131, 103, 0.2);
  box-shadow: 0 22px 44px rgba(23, 33, 43, 0.06);
}

.workspace-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.workspace-mode-tabs,
.workspace-command-bar__actions,
.workspace-command-bar__meta,
.workspace-stage-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.workspace-mode-tabs {
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.workspace-mode-tab {
  border: 1px solid rgba(150, 131, 103, 0.22);
  background: rgba(255, 252, 247, 0.82);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  white-space: nowrap;
}

.workspace-mode-tab.active {
  background: #17212b;
  color: #fff7ed;
  border-color: transparent;
}

.workspace-command-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid rgba(150, 131, 103, 0.2);
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(248, 242, 234, 0.94));
  box-shadow: 0 12px 28px rgba(23, 33, 43, 0.05);
}

.workspace-command-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(150, 131, 103, 0.18);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.workspace-inline-hint {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(142, 107, 58, 0.16);
  background: rgba(142, 107, 58, 0.06);
  color: var(--accent-strong);
  font-size: 0.9rem;
}

.workspace-stage-card {
  min-width: 120px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(150, 131, 103, 0.16);
  background: rgba(255, 255, 255, 0.68);
}

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

.workspace-stage-card span {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.workspace-stage-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.workspace-panel--active {
  border-color: rgba(142, 107, 58, 0.32);
  box-shadow: 0 18px 34px rgba(142, 107, 58, 0.1);
}

.workspace-panel--muted {
  opacity: 0.78;
}

.workspace-view-tab {
  border: 1px solid rgba(150, 131, 103, 0.22);
  background: rgba(255, 252, 247, 0.82);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
}

.workspace-view-tab.active {
  background: #17212b;
  color: #fff7ed;
  border-color: transparent;
}

.workspace-view-tab--ghost {
  opacity: 0.72;
}

.workspace-builder {
  padding: 20px;
}

.builder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.builder-card {
  border-radius: 22px;
  padding: 18px;
}

.builder-card__head {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.builder-card__head span {
  color: var(--muted);
  font-size: 0.93rem;
}

.builder-form {
  display: grid;
  gap: 12px;
}

.builder-form--stack {
  align-content: start;
}

.builder-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.builder-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.builder-list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(150, 131, 103, 0.16);
}

.builder-list-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.workspace-custom-block {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(150, 131, 103, 0.16);
  background: rgba(249, 244, 237, 0.74);
}

.workspace-custom-block__head {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.workspace-custom-block__head span {
  color: var(--muted);
  font-size: 0.92rem;
}

.workspace-custom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.workspace-custom-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.workspace-data-pill {
  display: grid;
  gap: 3px;
  min-width: 130px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(150, 131, 103, 0.16);
  background: rgba(255, 255, 255, 0.76);
}

.workspace-data-pill small {
  color: var(--muted);
  font-size: 0.78rem;
}

.workspace-empty--tight {
  padding: 12px 14px;
}

body {
  background:
    radial-gradient(circle at top left, rgba(60, 101, 130, 0.08), transparent 28%),
    linear-gradient(180deg, #f5f2ec, #eef3f7 34%, #f4f7fa 100%);
}

.app-shell {
  min-height: 100vh;
  display: block;
  width: 100%;
}

.platform-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 14px 18px 10px;
  background:
    linear-gradient(180deg, rgba(8, 20, 32, 0.98), rgba(13, 27, 42, 0.94)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06), transparent 40%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 44px rgba(6, 16, 28, 0.24);
  display: grid;
  grid-template-columns: minmax(260px, auto) auto minmax(260px, 320px);
  gap: 16px;
  align-items: center;
  backdrop-filter: blur(18px);
}

.platform-header .brand-row {
  margin: 0;
}

.platform-header .brand-row span,
.platform-header .section-title,
.platform-header .profile-card .text-muted,
.platform-header .profile-card .small {
  color: rgba(234, 241, 247, 0.7) !important;
}

.platform-header .brand-row strong,
.platform-header .profile-card .fw-bold,
.platform-header .role-pill {
  color: #f4f7fb;
}

.platform-header .sidebar-toolbar {
  margin: 0;
  justify-self: center;
}

.platform-header .sidebar-toolbar .btn {
  min-width: 138px;
  border-color: rgba(255, 255, 255, 0.18);
  color: #f6fbff;
}

.platform-header .profile-card {
  margin: 0;
  min-height: 88px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}

.platform-header .section-title {
  display: none;
}

.module-nav.module-nav--top {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.module-nav.module-nav--top button {
  min-width: 102px;
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #eff5fa;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.module-nav.module-nav--top button:hover,
.module-nav.module-nav--top button.active {
  transform: translateY(-1px);
  border-color: rgba(71, 170, 230, 0.5);
  background: linear-gradient(180deg, rgba(39, 119, 168, 0.38), rgba(255, 255, 255, 0.09));
}

.module-nav-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.05rem;
}

.module-nav.module-nav--top .module-nav-main {
  display: block;
  font-size: 0.86rem;
  line-height: 1.15;
}

.module-nav.module-nav--top .module-nav-mini {
  display: block;
  font-size: 0.68rem;
  opacity: 0.68;
}

.app-shell.sidebar-collapsed .module-nav.module-nav--top {
  display: none;
}

.content-shell {
  padding: 16px 18px 24px;
  min-width: 0;
  min-height: calc(100vh - 124px);
  height: auto;
  overflow: visible;
}

.topbar {
  position: static;
  margin-top: 0;
  border-radius: 28px;
  padding: 24px 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 252, 251, 0.96));
  border: 1px solid rgba(197, 206, 216, 0.92);
  box-shadow: 0 16px 40px rgba(18, 34, 48, 0.06);
}

.topbar h2 {
  font-size: clamp(1.8rem, 2.6vw, 2.55rem);
  letter-spacing: -0.04em;
}

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

.module-card,
.section-card,
.placeholder-card,
.module-frame-wrap {
  border-radius: 26px;
  border: 1px solid rgba(201, 210, 220, 0.88);
  box-shadow: 0 22px 42px rgba(12, 29, 44, 0.05);
}

.module-frame-wrap {
  min-height: calc(100vh - 240px);
}

.module-frame {
  min-height: calc(100vh - 240px);
}

.ai-widget {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 70;
  display: grid;
  gap: 10px;
}

.ai-widget__toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  color: #f5fbff;
  background: linear-gradient(135deg, #0d2438, #123f6c);
  box-shadow: 0 22px 42px rgba(13, 36, 56, 0.28);
}

.ai-widget__icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.1rem;
}

.ai-widget__label {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ai-widget__panel {
  width: min(360px, calc(100vw - 32px));
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(204, 214, 222, 0.92);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 50px rgba(10, 30, 48, 0.16);
}

.ai-widget__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.ai-widget__panel p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.94rem;
}

.ai-widget__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

  .platform-header .sidebar-toolbar,
  .platform-header .profile-card {
    justify-self: stretch;
  }
}

@media (max-width: 840px) {
  .topbar {
    padding: 18px;
  }

  .module-nav.module-nav--top button {
    min-width: 88px;
    padding: 10px 10px 9px;
  }

  .module-nav.module-nav--top .module-nav-main {
    font-size: 0.78rem;
  }

  .ai-widget {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }

  .ai-widget__toggle {
    width: 100%;
    justify-content: center;
  }
}

.app-shell,
.app-shell.sidebar-collapsed {
  display: block;
  grid-template-columns: 1fr;
}

.platform-header {
  padding: 14px 20px 12px;
  background:
    linear-gradient(135deg, rgba(14, 85, 142, 0.98), rgba(16, 57, 112, 0.96)),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.14), transparent 28%);
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(180px, 240px) minmax(260px, 320px);
  gap: 14px 18px;
  align-items: center;
}

.platform-header .brand-row strong {
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.platform-header .brand-row span {
  font-size: 0.88rem;
}

.platform-header .profile-card {
  min-height: 84px;
  padding: 14px 16px;
  backdrop-filter: blur(12px);
}

.platform-header .module-nav.module-nav--top {
  margin-top: 4px;
  padding-bottom: 4px;
}

.platform-header .module-nav.module-nav--top button {
  min-width: 104px;
  min-height: 82px;
  padding: 11px 12px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.platform-header .module-nav.module-nav--top button:hover,
.platform-header .module-nav.module-nav--top button.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.09));
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.platform-header .module-nav-icon {
  width: 34px;
  height: 34px;
  font-size: 1.08rem;
}

.platform-header .module-nav-main {
  font-size: 0.9rem;
  font-weight: 700;
}

.platform-header .module-nav-mini {
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.content-shell {
  width: min(1680px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

body.platform-wide .content-shell {
  width: calc(100% - 24px);
}

.topbar {
  margin-top: 14px;
}

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

.workspace-form--inline {
  display: flex;
  align-items: end;
  gap: 12px;
}

.workspace-form__grow {
  flex: 1 1 auto;
}

.workspace-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 0;
}

.workspace-list-item--button {
  width: 100%;
  border: 1px solid rgba(201, 210, 220, 0.86);
  background: #fff;
  text-align: left;
}

.workspace-list-item--button:hover,
.workspace-list-item--active {
  border-color: rgba(31, 88, 142, 0.38);
  background: linear-gradient(180deg, rgba(238, 246, 252, 0.98), rgba(252, 254, 255, 0.98));
  box-shadow: 0 14px 30px rgba(18, 49, 78, 0.08);
}

.workspace-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  padding: 32px 20px;
  background: rgba(10, 18, 30, 0.5);
  backdrop-filter: blur(12px);
  overflow: auto;
}

.workspace-modal {
  width: min(1100px, 100%);
  margin: 0 auto;
  border-radius: 28px;
  border: 1px solid rgba(201, 210, 220, 0.94);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(250, 251, 252, 0.99));
  box-shadow: 0 34px 80px rgba(6, 24, 38, 0.2);
  overflow: hidden;
}

.workspace-modal__head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid rgba(210, 218, 226, 0.8);
}

.workspace-modal__head h3 {
  margin: 0 0 4px;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.workspace-modal__head p {
  margin: 0;
  color: var(--muted);
}

.workspace-modal__body {
  padding: 22px 26px 26px;
}

.ai-widget {
  left: 16px;
  bottom: 16px;
}

.ai-widget__toggle {
  min-width: 228px;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, #0f3159, #0b5c96);
}

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

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

  .content-shell,
  body.platform-wide .content-shell {
    width: calc(100% - 16px);
  }
}

@media (max-width: 720px) {
  .workspace-form--inline {
    flex-direction: column;
    align-items: stretch;
  }

  .workspace-modal-backdrop {
    padding: 12px;
  }

  .workspace-modal__head,
  .workspace-modal__body {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Final shell reset: top navigation layout */
#appShell.app-shell,
#appShell.app-shell.sidebar-collapsed {
  display: flex !important;
  flex-direction: column !important;
  min-height: 100vh;
  width: 100%;
  background:
    radial-gradient(circle at top right, rgba(65, 150, 212, 0.14), transparent 18%),
    radial-gradient(circle at top left, rgba(166, 129, 79, 0.1), transparent 22%),
    linear-gradient(180deg, #eef2f6 0%, #f7f5f0 100%);
}

#appShell > .platform-header {
  position: sticky;
  top: 0;
  z-index: 120;
  display: grid !important;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  align-items: start;
  gap: 10px 18px;
  padding: 10px 16px 9px;
  border-bottom: 1px solid rgba(13, 37, 60, 0.1);
  background:
    linear-gradient(135deg, rgba(17, 112, 177, 0.98), rgba(15, 80, 146, 0.98)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  box-shadow: 0 18px 38px rgba(13, 39, 64, 0.18);
}

#appShell .platform-header__brand,
#appShell .platform-header__nav,
#appShell .platform-header__utility {
  min-width: 0;
}

#appShell .platform-header__brand {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
}

#appShell .platform-header__nav {
  grid-column: 1 / -1;
  grid-row: 2;
  overflow: visible;
}

#appShell .brand-row {
  margin: 0;
  gap: 10px;
}

#appShell .brand-row img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 24px rgba(9, 26, 45, 0.16);
}

#appShell .brand-row strong {
  color: #ffffff;
  font-size: 1.08rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

#appShell .brand-row span {
  color: rgba(240, 246, 252, 0.82);
  font-size: 0.74rem;
  margin-top: 2px;
}

#appShell .module-nav.module-nav--top {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  overflow: visible;
  justify-content: flex-start;
}

#appShell .module-nav.module-nav--top button {
  flex: 0 1 86px;
  min-width: 72px;
  min-height: 62px;
  padding: 7px 8px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(247, 251, 255, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  box-shadow: none;
}

#appShell .module-nav.module-nav--top button:hover,
#appShell .module-nav.module-nav--top button.active {
  transform: translateY(0);
  border-color: rgba(255, 255, 255, 0.34);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.1));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

#appShell .module-nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.82rem;
}

#appShell .module-nav-main {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.08;
}

#appShell .module-nav-mini {
  display: none !important;
}

#appShell .platform-header__utility {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

#appShell .sidebar-toolbar,
#appShell .section-title {
  display: none !important;
}

#appShell .profile-card {
  min-width: 248px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

#appShell .profile-card__inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

#appShell .profile-card__avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

#appShell .profile-card__meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

#appShell .profile-card__meta strong {
  color: #ffffff;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#appShell .profile-card__meta > span {
  color: rgba(241, 247, 253, 0.82);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#appShell .profile-card__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 3px;
}

#appShell .profile-card .role-pill {
  margin: 0;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff7ea;
  font-size: 0.72rem;
  padding: 4px 9px;
}

#appShell .profile-card__scope {
  color: rgba(241, 247, 253, 0.76);
  font-size: 0.68rem;
}

#appShell .profile-card__menu {
  position: relative;
  margin-left: auto;
}

#appShell .profile-card__menu-toggle {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

#appShell .profile-card__menu-toggle:hover {
  background: rgba(255, 255, 255, 0.18);
}

#appShell .profile-card__dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(197, 209, 221, 0.88);
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 18px 36px rgba(11, 27, 42, 0.2);
  z-index: 160;
}

#appShell .profile-card__action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(218, 225, 233, 0.9);
  border-radius: 12px;
  background: #ffffff;
  color: #17324a;
  font-weight: 600;
  text-align: left;
}

#appShell .profile-card__action:hover {
  background: rgba(240, 246, 252, 0.98);
  border-color: rgba(52, 115, 171, 0.24);
}

#appShell .profile-card__action--danger {
  color: #9a2d2d;
}

#appShell .profile-card__action--danger:hover {
  background: rgba(255, 245, 245, 0.98);
  border-color: rgba(194, 71, 71, 0.22);
}

#appShell .content-shell,
body.platform-wide #appShell .content-shell {
  width: min(1820px, calc(100% - 28px));
  margin: 0 auto;
  padding: 20px 0 34px;
  min-height: calc(100vh - 108px);
  overflow: visible;
  overflow-x: hidden;
}

#appShell .topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-top: 0;
  padding: 26px 30px;
  border-radius: 24px;
  border: 1px solid rgba(196, 205, 214, 0.88);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 248, 244, 0.96)),
    radial-gradient(circle at top left, rgba(65, 150, 212, 0.08), transparent 28%);
  box-shadow: 0 18px 36px rgba(15, 34, 54, 0.08);
}

#appShell .topbar__copy {
  min-width: 0;
}

#appShell .topbar h2 {
  margin: 0 0 8px;
  font-size: clamp(1.9rem, 2.4vw, 2.8rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

#appShell .topbar p {
  margin: 0;
  color: #5f6f7f;
  font-size: 1.02rem;
}

#appShell .topbar__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 420px;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(15, 80, 146, 0.12);
  background: rgba(247, 250, 253, 0.96);
  color: #37506a;
  font-size: 0.9rem;
  text-align: center;
}

#appShell .view-section {
  margin-top: 18px;
  min-width: 0;
}

#appShell .dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

#appShell .module-card {
  padding: 26px 26px 24px;
  border-radius: 24px;
  border: 1px solid rgba(198, 206, 214, 0.86);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 34px rgba(18, 34, 52, 0.06);
}

#appShell .module-card h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

#appShell .module-card p {
  min-height: 82px;
}

#appShell .module-card .meta {
  color: #7c5a29;
  font-weight: 600;
}

#appShell .module-frame-wrap,
#appShell .section-card,
#appShell .placeholder-card {
  border-radius: 24px;
  min-width: 0;
}

#appShell .admin-grid {
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  align-items: start;
}

#appShell .admin-grid > * {
  min-width: 0;
}

#appShell .admin-grid .section-card,
#appShell .admin-grid .table-shell,
#appShell .admin-grid .card-toolbar,
#appShell .admin-grid .permission-card,
#appShell .admin-grid .permission-card__flags {
  min-width: 0;
}

#appShell .admin-stack,
#appShell .messenger-shell,
#appShell .permission-grid,
#appShell .permission-summary,
#appShell .permission-summary__stats,
#appShell .view-section > * {
  min-width: 0;
}

#appShell .table-shell {
  max-width: 100%;
  overflow: auto;
}

#appShell .table-shell table {
  min-width: 680px;
}

#appShell .card-toolbar > * {
  min-width: 0;
}

#appShell .permission-card__flags {
  gap: 10px;
}

#appShell .permission-flag {
  min-width: 0;
  font-size: 0.9rem;
}

@media (max-width: 1380px) {
  #appShell > .platform-header {
    grid-template-columns: minmax(170px, 220px) minmax(0, 1fr);
  }

  #appShell .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  #appShell > .platform-header {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  #appShell .platform-header__utility {
    grid-column: 1 / -1;
    grid-row: 3;
    flex-direction: column;
    align-items: stretch;
    justify-self: stretch;
  }

  #appShell .profile-card {
    min-width: 0;
  }

  #appShell .platform-header__nav {
    grid-row: 2;
  }

  #appShell .content-shell,
  body.platform-wide #appShell .content-shell {
    width: calc(100% - 16px);
  }

  #appShell .topbar {
    grid-template-columns: 1fr;
    padding: 20px 22px;
  }

  #appShell .topbar__badge {
    max-width: none;
    width: 100%;
  }

  #appShell .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #appShell > .platform-header {
    padding: 12px 12px 10px;
  }

  #appShell .module-nav.module-nav--top button {
    flex-basis: 72px;
    min-width: 66px;
    min-height: 58px;
    padding: 6px 7px;
  }

  #appShell .module-nav-main {
    font-size: 0.61rem;
  }

  #appShell .profile-card__foot {
    flex-direction: column;
    align-items: start;
    gap: 4px;
  }

  #appShell .profile-card__dropdown {
    left: 0;
    right: auto;
    min-width: 100%;
  }

  #appShell .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Compact header + KPI dashboard */
#appShell > .platform-header {
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(220px, 260px);
  align-items: center;
  gap: 10px 12px;
  padding: 8px 14px;
}

#appShell .platform-header__brand,
#appShell .platform-header__nav,
#appShell .platform-header__utility {
  grid-row: 1;
}

#appShell .platform-header__brand {
  grid-column: 1;
}

#appShell .platform-header__nav {
  grid-column: 2;
  overflow: hidden;
}

#appShell .platform-header__utility {
  grid-column: 3;
  justify-self: stretch;
}

#appShell .brand-row {
  gap: 8px;
}

#appShell .brand-row img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  padding: 4px;
}

#appShell .brand-row strong {
  font-size: 0.96rem;
}

#appShell .brand-row span {
  font-size: 0.67rem;
}

#appShell .module-nav.module-nav--top {
  flex-wrap: nowrap;
  gap: 6px;
  overflow: hidden;
  align-items: stretch;
}

#appShell .module-nav.module-nav--top button {
  flex: 1 1 0;
  min-width: 0;
  max-width: 86px;
  min-height: 54px;
  padding: 6px 5px;
  border-radius: 14px;
}

#appShell .module-nav-icon {
  width: 20px;
  height: 20px;
  font-size: 0.72rem;
  border-radius: 7px;
}

#appShell .module-nav-main {
  font-size: 0.61rem;
  line-height: 1.08;
}

#appShell .profile-card {
  min-width: 0;
  max-width: 260px;
  margin-left: auto;
  padding: 7px 9px;
}

#appShell .profile-card__inner {
  gap: 8px;
}

#appShell .profile-card__avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 0.84rem;
}

#appShell .profile-card__meta strong {
  font-size: 0.84rem;
}

#appShell .profile-card__meta > span {
  font-size: 0.68rem;
}

#appShell .profile-card .role-pill {
  font-size: 0.68rem;
  padding: 3px 8px;
}

#appShell .profile-card__scope {
  font-size: 0.66rem;
}

#appShell .profile-card__menu-toggle {
  width: 30px;
  height: 30px;
  border-radius: 10px;
}

#appShell .content-shell,
body.platform-wide #appShell .content-shell {
  width: min(1840px, calc(100% - 24px));
  padding: 14px 0 28px;
}

#appShell .view-section,
#appShell .section-card,
#appShell .workspace-panel,
#appShell .module-frame-wrap {
  min-width: 0;
}

#appShell .section-card {
  overflow: hidden;
}

#appShell .topbar {
  padding: 22px 26px;
}

#appShell .topbar h2 {
  font-size: clamp(1.7rem, 2.2vw, 2.5rem);
}

#appShell .dashboard-grid {
  display: block;
}

#appShell .dashboard-shell {
  display: grid;
  gap: 18px;
}

#appShell .dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

#appShell .dashboard-kpi {
  padding: 18px 18px 16px;
  border-radius: 22px;
  border: 1px solid rgba(198, 206, 214, 0.86);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 30px rgba(18, 34, 52, 0.05);
}

#appShell .dashboard-kpi span,
#appShell .dashboard-kpi small {
  display: block;
}

#appShell .dashboard-kpi span {
  color: #5c6e81;
  font-size: 0.82rem;
  margin-bottom: 8px;
}

#appShell .dashboard-kpi strong {
  display: block;
  font-size: 1.36rem;
  line-height: 1.05;
  margin-bottom: 6px;
}

#appShell .dashboard-kpi small {
  color: #70808f;
  font-size: 0.8rem;
  line-height: 1.35;
}

#appShell .dashboard-kpi--accent strong { color: #8b6233; }
#appShell .dashboard-kpi--warning strong { color: #a56612; }
#appShell .dashboard-kpi--info strong { color: #1762a6; }
#appShell .dashboard-kpi--danger strong { color: #b43a3a; }
#appShell .dashboard-kpi--success strong { color: #1d8d61; }

#appShell .dashboard-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.82fr);
  gap: 18px;
}

#appShell .dashboard-chart-card,
#appShell .dashboard-alerts-card,
#appShell .dashboard-panel,
#appShell .dashboard-module-card,
#appShell .dashboard-fallback {
  border-radius: 24px;
  border: 1px solid rgba(198, 206, 214, 0.86);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 34px rgba(18, 34, 52, 0.05);
}

#appShell .dashboard-chart-card,
#appShell .dashboard-alerts-card,
#appShell .dashboard-panel,
#appShell .dashboard-fallback {
  padding: 20px 22px;
}

#appShell .dashboard-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: #5e7286;
  font-size: 0.86rem;
}

#appShell .dashboard-chart {
  width: 100%;
  overflow: hidden;
}

#appShell .dashboard-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

#appShell .dashboard-chart__grid {
  stroke: rgba(36, 91, 140, 0.12);
  stroke-width: 1;
}

#appShell .dashboard-chart__label {
  fill: #8292a0;
  font-size: 10px;
}

#appShell .dashboard-chart__area {
  fill: rgba(51, 126, 191, 0.1);
}

#appShell .dashboard-chart__bar {
  fill: rgba(170, 187, 204, 0.72);
}

#appShell .dashboard-chart__line {
  fill: none;
  stroke: #1670b1;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#appShell .dashboard-axis {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

#appShell .dashboard-axis__item {
  text-align: center;
}

#appShell .dashboard-axis__item span {
  display: block;
  color: #6b7b89;
  font-size: 0.77rem;
}

#appShell .dashboard-axis__item strong {
  font-size: 0.86rem;
}

#appShell .dashboard-alerts {
  display: grid;
  gap: 10px;
}

#appShell .dashboard-alert {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(208, 216, 224, 0.9);
  background: #fbfcfd;
}

#appShell .dashboard-alert strong {
  display: block;
  margin-bottom: 4px;
}

#appShell .dashboard-alert__meta {
  color: #6a7b8a;
  font-size: 0.83rem;
}

#appShell .dashboard-alert--warning { border-left: 4px solid #d19b43; }
#appShell .dashboard-alert--danger { border-left: 4px solid #c24747; }
#appShell .dashboard-alert--accent { border-left: 4px solid #3b7ac2; }
#appShell .dashboard-alert--info { border-left: 4px solid #2a8db3; }

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

#appShell .dashboard-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#appShell .dashboard-mini {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(209, 217, 225, 0.88);
  background: #fbfcfd;
}

#appShell .dashboard-mini span {
  display: block;
  color: #677988;
  font-size: 0.8rem;
  margin-bottom: 6px;
}

#appShell .dashboard-mini strong {
  font-size: 1rem;
}

#appShell .dashboard-mini--accent strong { color: #1762a6; }
#appShell .dashboard-mini--warning strong { color: #a56612; }
#appShell .dashboard-mini--danger strong { color: #b43a3a; }
#appShell .dashboard-mini--info strong { color: #2488aa; }

#appShell .dashboard-progress {
  display: grid;
  gap: 8px;
}

#appShell .dashboard-progress__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.88rem;
}

#appShell .dashboard-progress__bar {
  height: 9px;
  border-radius: 999px;
  background: rgba(217, 224, 232, 0.86);
  overflow: hidden;
}

#appShell .dashboard-progress__bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f96d5, #1b6ead);
}

#appShell .dashboard-stack {
  display: grid;
  gap: 12px;
}

#appShell .dashboard-demand {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(209, 217, 225, 0.88);
  background: #fbfcfd;
}

#appShell .dashboard-demand span {
  font-weight: 700;
  white-space: nowrap;
}

#appShell .dashboard-modules__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

#appShell .dashboard-module-card {
  padding: 18px 18px 16px;
}

#appShell .dashboard-module-card__top {
  display: flex;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

#appShell .dashboard-module-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(23, 104, 167, 0.08);
  color: #1668a7;
  font-size: 1rem;
}

#appShell .dashboard-module-card h4 {
  margin: 0 0 4px;
  font-size: 1rem;
}

#appShell .dashboard-module-card__meta {
  color: #7a5b34;
  font-size: 0.82rem;
  font-weight: 600;
}

#appShell .dashboard-module-card p {
  min-height: 64px;
  margin: 0 0 14px;
  color: #60717f;
}

#appShell .dashboard-skeleton {
  display: grid;
  gap: 16px;
}

#appShell .dashboard-skeleton__hero,
#appShell .dashboard-skeleton__card {
  border-radius: 22px;
  background: linear-gradient(90deg, rgba(228, 234, 240, 0.92), rgba(244, 247, 250, 0.98), rgba(228, 234, 240, 0.92));
  background-size: 200% 100%;
  animation: dashboardPulse 1.4s linear infinite;
}

#appShell .dashboard-skeleton__hero {
  min-height: 240px;
}

#appShell .dashboard-skeleton__row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

#appShell .dashboard-skeleton__card {
  min-height: 170px;
}

@keyframes dashboardPulse {
  0% { background-position: 0 0; }
  100% { background-position: -200% 0; }
}

@media (max-width: 1500px) {
  #appShell > .platform-header {
    grid-template-columns: minmax(170px, 200px) minmax(0, 1fr) minmax(210px, 240px);
  }

  #appShell .dashboard-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #appShell .dashboard-modules__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {
  #appShell > .platform-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #appShell .platform-header__brand,
  #appShell .platform-header__nav,
  #appShell .platform-header__utility {
    grid-column: 1;
  }

  #appShell .platform-header__nav {
    overflow-x: auto;
  }

  #appShell .platform-header__utility {
    justify-self: end;
  }

  #appShell .module-nav.module-nav--top {
    overflow-x: auto;
  }

  #appShell .dashboard-overview,
  #appShell .dashboard-panels {
    grid-template-columns: 1fr;
  }

  #appShell .dashboard-modules__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  #appShell .dashboard-kpis,
  #appShell .dashboard-mini-grid,
  #appShell .dashboard-skeleton__row,
  #appShell .dashboard-modules__grid {
    grid-template-columns: 1fr;
  }

  #appShell .dashboard-alert {
    grid-template-columns: 1fr;
  }

  #appShell .platform-header__utility {
    justify-self: stretch;
  }

  #appShell .profile-card {
    max-width: none;
  }
}

/* Final shell polish: compact topbar, active KPI chart, unified auth and AI */
body {
  background:
    radial-gradient(circle at top left, rgba(14, 129, 212, 0.14), transparent 22%),
    radial-gradient(circle at top right, rgba(34, 53, 76, 0.14), transparent 24%),
    linear-gradient(180deg, #eaf0f6, #edf2f7 48%, #f5f7fa 100%);
}

.auth-screen {
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(16, 126, 204, 0.2), transparent 18%),
    linear-gradient(180deg, #0f4f8b, #1f6aa8 18%, #edf2f7 18.1%, #edf2f7 100%);
}

.auth-card {
  width: min(1280px, calc(100vw - 40px));
  border-radius: 34px;
  grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
  overflow: hidden;
  box-shadow: 0 34px 90px rgba(9, 24, 40, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.auth-brand {
  color: #f7fbff;
  border-right: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0)),
    linear-gradient(165deg, #0f5b97 0%, #1f76b7 38%, #225f96 100%);
}

.auth-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  padding: 8px;
}

.auth-eyebrow,
.auth-brand p,
.auth-brand .auth-point {
  color: rgba(247, 251, 255, 0.82);
}

.auth-brand h1 {
  color: #ffffff;
}

.auth-brand .auth-point {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.auth-brand .auth-point strong {
  color: #ffffff;
}

.auth-forms {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), #ffffff);
  padding: 30px 30px 26px;
}

.auth-tabs {
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tab {
  padding: 8px 14px;
  font-size: 0.92rem;
  font-weight: 700;
}

.auth-tab.active {
  background: linear-gradient(180deg, #133454, #1b2430);
}

.auth-forms .section-card {
  border-radius: 24px;
  box-shadow: 0 18px 34px rgba(19, 41, 64, 0.06);
}

.auth-forms .form-control,
.auth-forms .form-select {
  min-height: 46px;
  border-radius: 14px;
}

#appShell > .platform-header {
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr) minmax(250px, 320px);
  gap: 6px 12px;
  padding: 8px 16px;
  min-height: 74px;
  background: linear-gradient(180deg, #1567a8 0%, #1d5f9b 100%);
  box-shadow: 0 18px 40px rgba(14, 35, 58, 0.16);
}

#appShell .platform-header__brand,
#appShell .platform-header__nav,
#appShell .platform-header__utility {
  align-self: center;
}

#appShell .brand-row {
  gap: 10px;
}

#appShell .brand-row img {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.96);
}

#appShell .brand-row strong {
  font-size: 0.72rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
}

#appShell .brand-row span {
  display: block;
  margin-top: 2px;
  font-size: 0.54rem;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.78);
}

#appShell .platform-header__nav {
  min-width: 0;
  overflow: hidden;
}

#appShell .module-nav.module-nav--top {
  gap: 5px;
  overflow: hidden;
}

#appShell .module-nav.module-nav--top button {
  flex: 1 1 0;
  min-width: 0;
  max-width: 74px;
  min-height: 50px;
  padding: 5px 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

#appShell .module-nav.module-nav--top button:hover,
#appShell .module-nav.module-nav--top button.active {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.22);
}

#appShell .module-nav-icon {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  font-size: 0.62rem;
}

#appShell .module-nav-main {
  font-size: 0.58rem;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

#appShell .module-nav-mini {
  display: none;
}

#appShell .platform-header__utility {
  justify-self: end;
  width: min(100%, 320px);
}

#appShell .profile-card {
  max-width: 320px;
  padding: 6px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

#appShell .profile-card__inner {
  gap: 8px;
}

#appShell .profile-card__avatar {
  width: 32px;
  height: 32px;
  font-size: 0.82rem;
}

#appShell .profile-card__meta strong {
  font-size: 0.82rem;
  line-height: 1.05;
}

#appShell .profile-card__meta > span,
#appShell .profile-card__scope {
  font-size: 0.64rem;
}

#appShell .profile-card .role-pill {
  padding: 3px 7px;
  font-size: 0.64rem;
}

#appShell .profile-card__menu-toggle {
  width: 28px;
  height: 28px;
  border-radius: 10px;
}

#appShell .content-shell,
body.platform-wide #appShell .content-shell {
  width: min(1860px, calc(100vw - 20px));
  padding: 12px 0 28px;
}

#appShell .topbar {
  padding: 18px 22px;
  min-height: 100px;
}

#appShell .topbar h2 {
  font-size: clamp(1.48rem, 1.9vw, 2.4rem);
}

#appShell .topbar p {
  font-size: 0.96rem;
}

#appShell .topbar__badge {
  padding: 14px 20px;
  min-height: 56px;
  font-size: 0.88rem;
}

#appShell .dashboard-chart-card__controls {
  display: grid;
  gap: 10px;
  justify-items: end;
}

#appShell .dashboard-periods {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(197, 207, 217, 0.88);
  background: rgba(249, 251, 253, 0.96);
}

#appShell .dashboard-period {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #5f7286;
}

#appShell .dashboard-period.active {
  background: linear-gradient(180deg, #153455, #1c2431);
  color: #ffffff;
}

#appShell .dashboard-chart {
  position: relative;
  overflow: hidden;
}

#appShell .dashboard-chart__dot {
  fill: #ffffff;
  stroke: #1d6ead;
  stroke-width: 4;
}

#appShell .dashboard-chart__hotspot {
  fill: transparent;
  cursor: pointer;
}

#appShell .dashboard-axis {
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
}

#appShell .dashboard-axis__item[data-chart-label] {
  cursor: pointer;
}

#appShell .dashboard-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 180px;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(21, 33, 48, 0.96);
  color: #f6f9fc;
  box-shadow: 0 20px 40px rgba(12, 22, 37, 0.25);
  pointer-events: none;
}

#appShell .dashboard-tooltip strong {
  font-size: 0.82rem;
}

#appShell .dashboard-tooltip span {
  font-size: 0.76rem;
  color: rgba(246, 249, 252, 0.82);
}

#appShell .admin-grid,
#appShell .admin-stack,
#appShell .messenger-shell,
#appShell .view-section,
#appShell .placeholder-card,
#appShell .section-card {
  min-width: 0;
}

#appShell .table-shell {
  max-width: 100%;
  overflow: auto;
}

#appShell .workspace-table,
#appShell table {
  min-width: 0;
}

#appShell .ai-assistant-shell {
  display: grid;
  gap: 18px;
}

#appShell .ai-assistant-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 24px 26px;
  border-radius: 24px;
  border: 1px solid rgba(198, 206, 214, 0.86);
  background:
    radial-gradient(circle at top right, rgba(25, 117, 183, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 251, 253, 0.98));
  box-shadow: 0 18px 34px rgba(18, 34, 52, 0.05);
}

#appShell .ai-assistant-hero h2 {
  margin: 4px 0 8px;
  font-size: clamp(1.5rem, 2vw, 2.2rem);
}

#appShell .section-eyebrow {
  color: #7b5a35;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#appShell .ai-assistant-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#appShell .ai-assistant-badges span,
#appShell .ai-prompt-chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(194, 204, 214, 0.9);
  background: rgba(255, 255, 255, 0.96);
  color: #34516b;
  font-size: 0.8rem;
  font-weight: 700;
}

#appShell .ai-assistant-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
}

#appShell .ai-assistant-side {
  display: grid;
  gap: 18px;
}

#appShell .ai-prompt-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#appShell .ai-prompt-chip {
  cursor: pointer;
}

#appShell .ai-capability-list {
  margin: 0;
  padding-left: 18px;
  color: #5f7387;
  display: grid;
  gap: 8px;
}

#appShell .ai-chat-card {
  display: grid;
  gap: 16px;
}

#appShell .ai-chat-log,
.ai-widget__messages {
  display: grid;
  gap: 12px;
  min-height: 200px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

#appShell .ai-message,
.ai-widget .ai-message {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(209, 217, 225, 0.88);
  background: #fbfcfd;
}

#appShell .ai-message--user,
.ai-widget .ai-message--user {
  background: rgba(23, 104, 167, 0.08);
  border-color: rgba(23, 104, 167, 0.18);
}

#appShell .ai-message__role,
.ai-widget .ai-message__role {
  font-size: 0.76rem;
  font-weight: 700;
  color: #7b5a35;
}

#appShell .ai-message__body,
.ai-widget .ai-message__body {
  color: #233a51;
  line-height: 1.55;
}

#appShell .ai-message__body mark,
.ai-widget .ai-message__body mark {
  background: rgba(252, 218, 120, 0.64);
  border-radius: 4px;
  padding: 0 2px;
}

#appShell .ai-message__sources,
.ai-widget .ai-message__sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#appShell .ai-message__sources a,
#appShell .ai-message__sources span,
.ai-widget .ai-message__sources a,
.ai-widget .ai-message__sources span {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(226, 233, 240, 0.92);
  color: #36536d;
  font-size: 0.74rem;
  text-decoration: none;
}

#appShell .ai-chat-form {
  display: grid;
  gap: 12px;
}

#appShell .ai-chat-form__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

#appShell .ai-empty-state,
.ai-widget .ai-empty-state {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px dashed rgba(187, 198, 208, 0.95);
  background: rgba(250, 251, 253, 0.96);
  color: #627688;
}

.ai-widget {
  left: 18px;
  bottom: 18px;
}

.ai-widget__toggle {
  min-width: 232px;
  min-height: 56px;
  border-radius: 18px;
}

.ai-widget__panel {
  width: min(420px, calc(100vw - 28px));
  border-radius: 22px;
}

.ai-widget__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.ai-widget__suggestion {
  border: 1px solid rgba(198, 206, 214, 0.88);
  background: rgba(249, 251, 253, 0.98);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.76rem;
  color: #36536d;
}

.ai-widget__form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.ai-widget__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 1500px) {
  #appShell > .platform-header {
    grid-template-columns: minmax(136px, 170px) minmax(0, 1fr) minmax(220px, 280px);
  }

  #appShell .module-nav.module-nav--top button {
    max-width: 68px;
  }

  #appShell .module-nav-main {
    font-size: 0.54rem;
  }
}

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

  #appShell > .platform-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #appShell .platform-header__utility {
    justify-self: stretch;
    width: 100%;
  }

  #appShell .platform-header__nav {
    overflow-x: auto;
  }

  #appShell .module-nav.module-nav--top {
    min-width: max-content;
  }

  #appShell .ai-assistant-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  #appShell .brand-row span,
  #appShell .profile-card__scope {
    display: none;
  }

  #appShell .topbar {
    padding: 16px 18px;
  }

  #appShell .topbar__badge {
    display: none;
  }
}

/* Final shell pass: tighter top row, denser dashboard, safer overflow */
#appShell > .platform-header {
  grid-template-columns: minmax(132px, 180px) minmax(0, 1fr) minmax(236px, 272px);
  gap: 4px 10px;
  padding: 6px 14px;
  min-height: 64px;
}

#appShell .brand-row {
  gap: 8px;
}

#appShell .brand-row img {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  border-radius: 6px;
  padding: 1px;
}

#appShell .brand-row strong {
  font-size: 0.68rem;
  letter-spacing: 0.01em;
}

#appShell .brand-row span {
  font-size: 0.54rem;
  line-height: 1.05;
  opacity: 0.82;
}

#appShell .platform-header__nav {
  min-width: 0;
}

#appShell .module-nav.module-nav--top {
  gap: 4px;
  justify-content: space-between;
}

#appShell .module-nav.module-nav--top button {
  flex: 1 1 0;
  min-width: 0;
  max-width: 70px;
  min-height: 44px;
  padding: 4px 3px;
  border-radius: 12px;
}

#appShell .module-nav-icon {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  font-size: 0.56rem;
}

#appShell .module-nav-main {
  font-size: 0.54rem;
  line-height: 1;
  word-break: break-word;
}

#appShell .platform-header__utility {
  width: min(100%, 272px);
}

#appShell .profile-card {
  max-width: 272px;
  padding: 5px 8px;
  border-radius: 18px;
}

#appShell .profile-card__inner {
  gap: 6px;
}

#appShell .profile-card__avatar {
  width: 30px;
  height: 30px;
  font-size: 0.78rem;
}

#appShell .profile-card__meta strong {
  font-size: 0.78rem;
}

#appShell .profile-card__meta > span,
#appShell .profile-card__scope {
  font-size: 0.6rem;
}

#appShell .profile-card .role-pill {
  padding: 2px 6px;
  font-size: 0.6rem;
}

#appShell .profile-card__menu-toggle {
  width: 24px;
  height: 24px;
}

#appShell .content-shell,
body.platform-wide #appShell .content-shell {
  width: min(1880px, calc(100vw - 16px));
  padding: 10px 0 24px;
}

#appShell .topbar {
  padding: 16px 18px;
  min-height: 86px;
  border-radius: 24px;
}

#appShell .topbar h2 {
  font-size: clamp(1.32rem, 1.7vw, 2rem);
}

#appShell .topbar p {
  font-size: 0.88rem;
}

#appShell .topbar__badge {
  padding: 10px 14px;
  min-height: 44px;
  font-size: 0.78rem;
  max-width: 480px;
}

#appShell .dashboard-shell {
  display: grid;
  gap: 16px;
}

#appShell .dashboard-focus-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

#appShell .dashboard-focus-card {
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(198, 206, 214, 0.86);
  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(248,250,252,.97));
  box-shadow: 0 14px 28px rgba(18, 34, 52, 0.05);
  display: grid;
  gap: 6px;
}

#appShell .dashboard-focus-card span {
  color: #6a7c8f;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#appShell .dashboard-focus-card strong {
  color: #18314a;
  font-size: clamp(1.2rem, 1.7vw, 1.85rem);
  line-height: 1.05;
}

#appShell .dashboard-focus-card small {
  color: #738598;
  font-size: 0.78rem;
}

#appShell .dashboard-focus-card--primary {
  background:
    linear-gradient(135deg, rgba(16, 111, 184, 0.12), rgba(255, 255, 255, 0.98)),
    linear-gradient(180deg, rgba(255,255,255,.99), rgba(248,250,252,.97));
  border-color: rgba(23, 104, 167, 0.18);
}

#appShell .dashboard-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

#appShell .dashboard-kpi {
  padding: 14px 16px;
  border-radius: 20px;
}

#appShell .dashboard-chart-card__controls {
  justify-items: end;
}

#appShell .dashboard-period-caption {
  color: #6f8194;
  font-size: 0.76rem;
  font-weight: 600;
}

#appShell .dashboard-chart {
  border-radius: 18px;
}

#appShell .dashboard-axis__item {
  padding: 6px 4px;
  border-radius: 12px;
  transition: background-color 0.16s ease, transform 0.16s ease;
}

#appShell .dashboard-axis__item:hover {
  background: rgba(21, 103, 168, 0.08);
  transform: translateY(-1px);
}

#appShell .dashboard-tooltip {
  box-shadow: 0 18px 36px rgba(18, 34, 52, 0.16);
}

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

#appShell .dashboard-modules__grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#appShell .table-shell,
#appShell .admin-grid,
#appShell .admin-stack,
#appShell .section-card,
#appShell .placeholder-card {
  min-width: 0;
}

#appShell .table-shell {
  overflow: auto;
}

#appShell .admin-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

#appShell .admin-stack {
  min-width: 0;
}

#appShell .admin-grid .section-card,
#appShell .placeholder-card .section-card {
  overflow: hidden;
}

@media (max-width: 1540px) {
  #appShell > .platform-header {
    grid-template-columns: minmax(124px, 164px) minmax(0, 1fr) minmax(220px, 250px);
  }

  #appShell .module-nav.module-nav--top button {
    max-width: 64px;
  }

  #appShell .module-nav-main {
    font-size: 0.5rem;
  }
}

@media (max-width: 1320px) {
  #appShell > .platform-header {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #appShell .platform-header__utility {
    justify-self: end;
  }

  #appShell .platform-header__nav {
    overflow-x: auto;
  }

  #appShell .module-nav.module-nav--top {
    min-width: max-content;
    justify-content: flex-start;
  }

  #appShell .dashboard-focus-strip,
  #appShell .dashboard-kpis,
  #appShell .dashboard-panels,
  #appShell .dashboard-modules__grid,
  #appShell .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  #appShell .dashboard-focus-strip,
  #appShell .dashboard-kpis,
  #appShell .dashboard-panels,
  #appShell .dashboard-modules__grid,
  #appShell .admin-grid {
    grid-template-columns: 1fr;
  }

  #appShell .topbar {
    padding: 14px 16px;
    min-height: 74px;
  }
}

/* Final enterprise pass: tighter header, unified live workspaces, safer width handling */
html,
body {
  overflow-x: hidden;
}

#appShell.app-shell {
  overflow-x: hidden;
}

#appShell > .platform-header {
  grid-template-columns: minmax(148px, 188px) minmax(0, 1fr) minmax(232px, 262px);
  gap: 6px 10px;
  padding: 6px 12px;
  min-height: 58px;
  align-items: center;
}

#appShell .platform-header__brand,
#appShell .platform-header__nav,
#appShell .platform-header__utility {
  align-self: center;
}

#appShell .brand-row {
  gap: 8px;
}

#appShell .brand-row img {
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  border-radius: 5px;
  padding: 1px;
}

#appShell .brand-row strong {
  font-size: 0.66rem;
  letter-spacing: 0.01em;
}

#appShell .brand-row span {
  margin-top: 1px;
  font-size: 0.48rem;
  line-height: 1.15;
}

#appShell .platform-header__nav {
  display: flex;
  min-width: 0;
  overflow: visible;
}

#appShell .module-nav.module-nav--top {
  display: flex;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  overflow: visible;
}

#appShell .module-nav.module-nav--top button {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  min-height: 44px;
  padding: 4px 2px;
  border-radius: 13px;
}

#appShell .module-nav-icon {
  width: 16px;
  height: 16px;
  border-radius: 6px;
  font-size: 0.58rem;
}

#appShell .module-nav-main {
  font-size: 0.52rem;
  line-height: 1.03;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

#appShell .platform-header__utility {
  justify-self: end;
  width: min(100%, 262px);
}

#appShell .profile-card {
  max-width: 262px;
  min-height: 46px;
  padding: 5px 8px;
}

#appShell .profile-card__avatar {
  width: 30px;
  height: 30px;
  font-size: 0.78rem;
}

#appShell .profile-card__meta strong {
  font-size: 0.76rem;
}

#appShell .profile-card__meta > span,
#appShell .profile-card__scope {
  font-size: 0.59rem;
}

#appShell .profile-card__meta > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#appShell .profile-card .role-pill {
  font-size: 0.6rem;
}

#appShell .profile-card__menu-toggle {
  width: 26px;
  height: 26px;
}

#appShell .content-shell,
body.platform-wide #appShell .content-shell {
  width: min(1920px, calc(100vw - 12px));
  padding: 10px 0 26px;
}

#appShell .view-section,
#appShell .dashboard-grid,
#appShell .placeholder-card,
#appShell .section-card,
#appShell .module-frame-wrap,
#appShell .admin-grid,
#appShell .admin-stack,
#appShell .table-shell {
  min-width: 0;
}

#appShell .view-section {
  overflow-x: hidden;
}

#appShell .topbar {
  padding: 14px 18px;
  min-height: 86px;
  border-radius: 20px;
}

#appShell .topbar h2 {
  font-size: clamp(1.32rem, 1.8vw, 2.1rem);
}

#appShell .topbar p {
  font-size: 0.86rem;
}

#appShell .topbar__badge {
  padding: 10px 14px;
  min-height: 44px;
  max-width: 420px;
  font-size: 0.76rem;
}

#appShell .auth-card {
  width: min(1180px, calc(100vw - 24px));
  border-radius: 28px;
}

#appShell .dashboard-shell {
  gap: 14px;
}

#appShell .dashboard-focus-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

#appShell .dashboard-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

#appShell .dashboard-panels {
  gap: 14px;
}

#appShell .dashboard-modules__grid {
  gap: 12px;
}

#appShell .workspace-shell {
  gap: 14px;
  min-width: 0;
}

#appShell .workspace-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 24px;
  border: 1px solid rgba(197, 206, 214, 0.86);
  background:
    radial-gradient(circle at top right, rgba(27, 109, 173, 0.1), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  box-shadow: 0 18px 34px rgba(18, 34, 52, 0.05);
}

#appShell .workspace-hero__copy,
#appShell .workspace-hero > div:first-child {
  min-width: 0;
  display: grid;
  gap: 6px;
}

#appShell .workspace-hero .placeholder-eyebrow,
#appShell .workspace-hero__eyebrow {
  color: #7b5a35;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#appShell .workspace-hero h3 {
  margin: 0;
  font-size: 1.24rem;
  line-height: 1.08;
}

#appShell .workspace-hero p {
  margin: 0;
  max-width: 960px;
  color: #5f7387;
  font-size: 0.9rem;
  line-height: 1.55;
}

#appShell .workspace-hero__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: start;
  gap: 8px;
}

#appShell .workspace-hero__chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(197, 206, 214, 0.9);
  background: rgba(255, 255, 255, 0.96);
  color: #35516c;
  font-size: 0.74rem;
  font-weight: 700;
}

#appShell .workspace-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

#appShell .workspace-metric {
  min-height: 108px;
  padding: 14px 16px;
  border-radius: 18px;
}

#appShell .workspace-metric span {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#appShell .workspace-metric strong {
  font-size: 1.18rem;
  margin-bottom: 2px;
}

#appShell .workspace-metric small {
  font-size: 0.76rem;
}

#appShell .workspace-view-tabs,
#appShell .workspace-mode-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow: auto;
  padding: 2px 2px 4px;
  scrollbar-width: thin;
}

#appShell .workspace-view-tab,
#appShell .workspace-mode-tab {
  padding: 8px 12px;
  font-size: 0.77rem;
}

#appShell .workspace-command-bar {
  padding: 12px 14px;
  border-radius: 18px;
  gap: 10px;
  align-items: center;
}

#appShell .workspace-command-bar__meta {
  flex: 1 1 280px;
  gap: 8px;
}

#appShell .workspace-command-bar__actions {
  flex: 1 1 360px;
  justify-content: flex-end;
}

#appShell .workspace-command-bar__actions > *,
#appShell .workspace-toolbar .btn,
#appShell .workspace-form__actions .btn {
  min-height: 38px;
  border-radius: 12px;
}

#appShell .workspace-command-chip {
  padding: 6px 10px;
  font-size: 0.73rem;
}

#appShell .workspace-toolbar {
  padding: 12px 14px;
  border-radius: 18px;
  gap: 10px;
}

#appShell .workspace-toolbar__group {
  flex: 1 1 300px;
  gap: 8px;
  min-width: 0;
}

#appShell .workspace-toolbar__group > * {
  flex: 1 1 180px;
  min-width: 0;
}

#appShell .workspace-panel {
  padding: 16px 18px;
  border-radius: 20px;
  min-width: 0;
  overflow: hidden;
}

#appShell .panel-heading {
  margin-bottom: 12px;
}

#appShell .panel-heading h4 {
  font-size: 1rem;
}

#appShell .compact-help,
#appShell .workspace-note,
#appShell .workspace-list-item__meta,
#appShell .workspace-table__sub {
  font-size: 0.78rem;
  line-height: 1.45;
}

#appShell .workspace-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#appShell .workspace-board--crm,
#appShell .workspace-board--tasks {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

#appShell .workspace-stage-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

#appShell .workspace-stage-card {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 16px;
}

#appShell .workspace-list-item,
#appShell .workspace-card,
#appShell .builder-card,
#appShell .workspace-sprint-card {
  min-width: 0;
}

#appShell .workspace-list-item {
  padding: 12px 14px;
  align-items: flex-start;
}

#appShell .workspace-form {
  gap: 10px;
}

#appShell .workspace-form label > span {
  font-size: 0.78rem;
  margin-bottom: 5px;
}

#appShell .workspace-form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

#appShell .workspace-table {
  width: 100%;
  table-layout: fixed;
}

#appShell .workspace-table th,
#appShell .workspace-table td {
  white-space: normal;
  word-break: break-word;
  vertical-align: top;
}

#appShell .workspace-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(247, 250, 252, 0.98), rgba(241, 246, 250, 0.98));
}

#appShell .workspace-modal-backdrop {
  padding: 18px;
}

#appShell .workspace-modal {
  width: min(1240px, 100%);
  border-radius: 24px;
}

#appShell .workspace-modal__head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 18px 20px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.995), rgba(248, 250, 252, 0.985));
}

#appShell .workspace-modal__title {
  min-width: 0;
}

#appShell .workspace-modal__head > .btn {
  min-height: 38px;
  border-radius: 12px;
}

#appShell .workspace-modal__body {
  padding: 18px 20px 20px;
  max-height: calc(100vh - 150px);
  overflow: auto;
}

#appShell #adminView .admin-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 14px;
}

#appShell #adminView .table-shell {
  overflow: auto;
}

#appShell #adminView .table-shell table {
  width: 100%;
  table-layout: fixed;
}

#appShell #adminView th,
#appShell #adminView td {
  white-space: normal;
  word-break: break-word;
  vertical-align: top;
}

#appShell #adminView .permission-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-widget {
  left: 14px;
  bottom: 14px;
}

.ai-widget__toggle {
  min-width: 196px;
  min-height: 48px;
  border-radius: 16px;
}

@media (max-width: 1660px) {
  #appShell .dashboard-kpis,
  #appShell .workspace-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #appShell #adminView .admin-grid,
  #appShell .workspace-grid--2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1480px) {
  #appShell > .platform-header {
    grid-template-columns: minmax(128px, 162px) minmax(0, 1fr) minmax(210px, 236px);
  }

  #appShell .brand-row span,
  #appShell .profile-card__scope {
    display: none;
  }

  #appShell .module-nav-main {
    font-size: 0.48rem;
  }
}

@media (max-width: 1280px) {
  #appShell > .platform-header {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #appShell .platform-header__utility {
    justify-self: stretch;
    width: 100%;
  }

  #appShell .platform-header__nav {
    overflow-x: auto;
  }

  #appShell .module-nav.module-nav--top {
    min-width: max-content;
  }

  #appShell .dashboard-focus-strip,
  #appShell .dashboard-kpis,
  #appShell .dashboard-panels,
  #appShell .dashboard-modules__grid,
  #appShell .workspace-metrics,
  #appShell #adminView .permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  #appShell .dashboard-focus-strip,
  #appShell .dashboard-kpis,
  #appShell .dashboard-panels,
  #appShell .dashboard-modules__grid,
  #appShell .workspace-metrics,
  #appShell #adminView .permission-grid {
    grid-template-columns: 1fr;
  }

  #appShell .platform-header__utility {
    width: 100%;
  }

  #appShell .profile-card {
    max-width: none;
  }
}

.auth-card {
  width: min(1180px, calc(100vw - 24px));
  border-radius: 28px;
}

/* Final shell pass: organic header sizing, safer overflow, AI close control */
#appShell > .platform-header {
  grid-template-columns: minmax(176px, 228px) minmax(0, 1fr) minmax(256px, 312px);
  gap: 8px 12px;
  padding: 8px 16px;
  min-height: 72px;
}

#appShell .brand-row {
  gap: 10px;
}

#appShell .brand-row img {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  border-radius: 6px;
  padding: 1px;
}

#appShell .brand-row strong {
  font-size: 0.86rem;
  line-height: 1.05;
}

#appShell .brand-row span {
  font-size: 0.64rem;
  line-height: 1.15;
}

#appShell .platform-header__nav,
#appShell .module-nav.module-nav--top {
  min-width: 0;
}

#appShell .module-nav.module-nav--top {
  gap: 6px;
}

#appShell .module-nav.module-nav--top button {
  min-height: 54px;
  padding: 6px 4px;
  border-radius: 15px;
}

#appShell .module-nav-icon {
  width: 20px;
  height: 20px;
  border-radius: 7px;
  font-size: 0.72rem;
}

#appShell .module-nav-main {
  font-size: 0.6rem;
  line-height: 1.08;
}

#appShell .platform-header__utility {
  width: min(100%, 312px);
}

#appShell .profile-card {
  max-width: 312px;
  min-height: 58px;
  padding: 8px 10px;
  border-radius: 22px;
}

#appShell .profile-card__avatar {
  width: 38px;
  height: 38px;
  font-size: 0.96rem;
}

#appShell .profile-card__meta strong {
  font-size: 0.88rem;
}

#appShell .profile-card__meta > span,
#appShell .profile-card__scope {
  font-size: 0.68rem;
}

#appShell .profile-card .role-pill {
  font-size: 0.68rem;
}

#appShell .profile-card__menu-toggle {
  width: 30px;
  height: 30px;
}

#appShell .content-shell,
body.platform-wide #appShell .content-shell {
  width: min(1920px, calc(100vw - 18px));
}

#appShell .view-shell,
#appShell .view-section,
#appShell .dashboard-grid,
#appShell .placeholder-card,
#appShell .admin-grid,
#appShell .admin-stack,
#appShell .table-shell,
#appShell .workspace-shell,
#appShell .workspace-panel,
#appShell .section-card {
  min-width: 0;
  max-width: 100%;
}

#appShell .admin-grid > *,
#appShell .admin-stack > *,
#appShell .dashboard-shell > *,
#appShell .dashboard-panels > *,
#appShell .dashboard-modules__grid > *,
#appShell .workspace-grid--2 > * {
  min-width: 0;
}

#appShell #adminView .table-shell,
#appShell #adminView .section-card,
#appShell .workspace-panel .table-shell {
  overflow-x: auto;
}

#appShell .ai-assistant-hero {
  align-items: center;
}

#appShell .ai-assistant-hero__side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

#appShell .ai-assistant-hero__side .btn {
  min-height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 1480px) {
  #appShell > .platform-header {
    grid-template-columns: minmax(156px, 198px) minmax(0, 1fr) minmax(238px, 284px);
  }

  #appShell .brand-row strong {
    font-size: 0.78rem;
  }

  #appShell .brand-row span {
    font-size: 0.58rem;
  }

  #appShell .module-nav.module-nav--top button {
    min-height: 50px;
  }

  #appShell .module-nav-main {
    font-size: 0.55rem;
  }
}

@media (max-width: 1280px) {
  #appShell > .platform-header {
    grid-template-columns: 1fr;
  }
}

.auth-brand {
  padding: 22px 22px 20px;
}

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.auth-tabs {
  flex-wrap: wrap;
}

.auth-tab {
  padding: 7px 12px;
  font-size: 0.84rem;
}

.auth-forms {
  padding: 24px 24px 22px;
}

/* Final interior pass: auth, admin, workspaces, tables, modals */

body {
  background:
    radial-gradient(circle at top left, rgba(255, 247, 232, 0.82), transparent 42%),
    linear-gradient(180deg, #eef3f8 0%, #e8eef5 100%);
}

.auth-screen {
  padding: clamp(18px, 3vw, 40px);
  background:
    radial-gradient(circle at top right, rgba(38, 112, 186, 0.16), transparent 26%),
    radial-gradient(circle at bottom left, rgba(189, 135, 58, 0.14), transparent 28%),
    linear-gradient(180deg, #eff5fb 0%, #e5edf6 100%);
}

.auth-card {
  border-radius: 32px;
  border: 1px solid rgba(24, 58, 102, 0.10);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(249,251,254,0.98) 100%);
  box-shadow: 0 30px 70px rgba(16, 38, 67, 0.14);
  overflow: hidden;
}

.auth-brand {
  background:
    radial-gradient(circle at top left, rgba(43, 120, 196, 0.16), transparent 34%),
    linear-gradient(180deg, #173a67 0%, #1f548d 100%);
  color: #f5f8fd;
}

.auth-eyebrow,
.auth-brand p,
.auth-brand .auth-point {
  color: rgba(233, 242, 255, 0.84);
}

.auth-brand h1,
.auth-brand .auth-point strong {
  color: #ffffff;
}

.auth-point {
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  border-radius: 18px;
}

.auth-forms {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(247,249,252,0.98) 100%);
}

.auth-forms .section-card {
  border-radius: 24px;
  border: 1px solid rgba(24, 58, 102, 0.10);
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
  box-shadow: 0 18px 44px rgba(24, 52, 92, 0.08);
}

.auth-forms .form-control,
.auth-forms .form-select {
  min-height: 48px;
  border-radius: 14px;
  border-color: rgba(27, 56, 93, 0.14);
  box-shadow: none;
}

.auth-forms .form-control:focus,
.auth-forms .form-select:focus {
  border-color: rgba(32, 107, 184, 0.44);
  box-shadow: 0 0 0 0.2rem rgba(41, 122, 203, 0.12);
}

#appShell .topbar,
#appShell .section-card,
#appShell .workspace-panel,
#appShell .table-shell,
#appShell .dashboard-chart-card,
#appShell .dashboard-alerts-card,
#appShell .dashboard-panel,
#appShell .dashboard-module-card,
#appShell .workspace-modal {
  border: 1px solid rgba(20, 47, 81, 0.10);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(249,251,254,0.98) 100%);
  box-shadow: 0 18px 40px rgba(23, 48, 84, 0.08);
}

#appShell .section-card,
#appShell .workspace-panel,
#appShell .table-shell {
  border-radius: 24px;
}

#appShell .card-toolbar,
#appShell .panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

#appShell .card-toolbar h2,
#appShell .panel-heading h3,
#appShell .section-card h3 {
  margin-bottom: 6px;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #18314d;
}

#appShell .compact-help {
  color: #647792;
  line-height: 1.55;
}

#appShell .table-shell {
  padding: 14px 16px;
}

#appShell .table-shell table {
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

#appShell .table-shell thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  color: #5b6d86;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(24, 58, 102, 0.12);
}

#appShell .table-shell tbody td {
  padding-top: 12px;
  padding-bottom: 12px;
  border-color: rgba(24, 58, 102, 0.08);
}

#appShell .table-shell tbody tr:hover {
  background: rgba(43, 122, 201, 0.04);
}

#appShell .workspace-panel,
#appShell .section-card {
  padding: clamp(18px, 2vw, 26px);
}

#appShell .workspace-hero {
  border-radius: 28px;
  border: 1px solid rgba(20, 47, 81, 0.10);
  background:
    radial-gradient(circle at top right, rgba(46, 124, 199, 0.10), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(246,249,253,0.98) 100%);
  box-shadow: 0 24px 54px rgba(23, 48, 84, 0.09);
}

#appShell .workspace-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 18px;
}

#appShell .workspace-form label > span,
#appShell .workspace-form .form-label {
  display: block;
  margin-bottom: 8px;
  color: #58708c;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#appShell .workspace-form .form-control,
#appShell .workspace-form .form-select,
#appShell .workspace-form textarea {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(23, 52, 92, 0.14);
  background: #fbfdff;
  box-shadow: none;
}

#appShell .workspace-form textarea {
  min-height: 120px;
}

#appShell .workspace-form .form-control:focus,
#appShell .workspace-form .form-select:focus,
#appShell .workspace-form textarea:focus {
  border-color: rgba(42, 113, 184, 0.44);
  box-shadow: 0 0 0 0.22rem rgba(44, 123, 201, 0.12);
}

#appShell .workspace-form__actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#appShell .workspace-modal-backdrop {
  backdrop-filter: blur(9px);
  background: rgba(14, 32, 55, 0.46);
}

#appShell .workspace-modal {
  width: min(1180px, calc(100vw - 30px));
  max-height: calc(100vh - 34px);
  border-radius: 30px;
  overflow: hidden;
}

#appShell .workspace-modal__head {
  padding: 22px 28px 18px;
  border-bottom: 1px solid rgba(18, 47, 82, 0.10);
  background:
    radial-gradient(circle at top right, rgba(42, 114, 185, 0.08), transparent 40%),
    linear-gradient(180deg, #ffffff 0%, #f5f8fc 100%);
}

#appShell .workspace-modal__title h3 {
  font-size: 1.42rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

#appShell .workspace-modal__title p {
  color: #627792;
}

#appShell .workspace-modal__body {
  padding: 24px 28px 28px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f7fb 100%);
}

#appShell .workspace-modal__body .workspace-form {
  display: grid;
  gap: 18px;
}

#appShell #adminView .admin-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 20px;
}

#appShell #adminView .section-card {
  min-height: 0;
}

#appShell #adminView .permission-summary__stats,
#appShell #adminView .permission-grid {
  gap: 12px;
}

#appShell .ai-widget__panel,
#appShell .ai-assistant-shell .section-card {
  border: 1px solid rgba(20, 47, 81, 0.10);
  box-shadow: 0 18px 42px rgba(23, 48, 84, 0.10);
}

@media (max-width: 1280px) {
  #appShell #adminView .admin-grid {
    grid-template-columns: 1fr;
  }
}

#appShell .content-shell {
  padding: 14px 16px 24px;
}

#appShell .topbar {
  padding: 22px 24px;
  margin-bottom: 14px;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(247, 241, 232, 0.94));
  border: 1px solid rgba(141, 118, 81, 0.14);
  box-shadow: 0 20px 40px rgba(23, 33, 43, 0.06);
}

#appShell .topbar h2 {
  margin-bottom: 6px;
  font-size: clamp(2rem, 3vw, 2.8rem);
}

#appShell .section-card,
#appShell .workspace-panel,
#appShell .placeholder-card,
#appShell .dashboard-chart-card,
#appShell .dashboard-kpi {
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(248, 242, 234, 0.94));
  border-color: rgba(141, 118, 81, 0.14);
  box-shadow: 0 18px 36px rgba(23, 33, 43, 0.05);
}

#appShell .workspace-toolbar,
#appShell .workspace-command-bar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 248, 250, 0.94));
  border-color: rgba(216, 224, 232, 0.82);
}

#appShell .table-shell {
  overflow: auto;
  box-shadow: inset 0 0 0 1px rgba(141, 118, 81, 0.08);
}

#appShell .table-shell table {
  min-width: 960px;
}

#appShell .workspace-card,
#appShell .workspace-list-item,
#appShell .workspace-metric,
#appShell .workspace-sprint-card {
  box-shadow: 0 12px 24px rgba(23, 48, 66, 0.04);
}

#appShell .workspace-modal {
  max-width: min(1080px, calc(100vw - 48px));
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.99), rgba(247, 241, 232, 0.95));
}

#appShell .workspace-modal__head {
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(141, 118, 81, 0.12);
}

#appShell .workspace-modal__body {
  max-height: min(78vh, 920px);
  overflow: auto;
  padding-right: 6px;
}

#appShell .workspace-form input,
#appShell .workspace-form select,
#appShell .workspace-form textarea {
  border-radius: 14px;
}

#appShell .module-frame-wrap {
  min-height: calc(100vh - 210px);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(141, 118, 81, 0.14);
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(247, 241, 232, 0.94));
  box-shadow: 0 18px 36px rgba(23, 33, 43, 0.05);
}

#appShell .module-frame {
  min-height: calc(100vh - 210px);
  background: transparent;
}

@media (max-width: 1100px) {
  #appShell .content-shell {
    padding: 12px;
  }

  #appShell .table-shell table {
    min-width: 760px;
  }

  #appShell .workspace-modal {
    max-width: min(100vw - 20px, 1080px);
  }
}

/* Final dense UI pass for internal workspaces only. Keep header untouched,
   but make the operational screens feel closer to a compact business tool. */
#appShell .content-shell,
#appShell .view-section,
#appShell .dashboard-shell,
#appShell .workspace-shell,
#appShell .workspace-grid,
#appShell .workspace-grid--2,
#appShell .admin-grid,
#appShell .workspace-panel,
#appShell .workspace-card,
#appShell .workspace-list-item,
#appShell .workspace-form,
#appShell .table-shell {
  min-width: 0;
}

#appShell .content-shell {
  padding: 10px;
}

#appShell .view-section {
  margin-top: 10px;
}

#appShell .dashboard-shell,
#appShell .workspace-shell {
  gap: 14px;
}

#appShell .placeholder-card,
#appShell .workspace-panel,
#appShell .dashboard-chart-card,
#appShell .dashboard-alerts-card,
#appShell .dashboard-panel,
#appShell .workspace-metric,
#appShell .workspace-card,
#appShell .workspace-list-item {
  border-radius: 18px;
}

#appShell .workspace-panel,
#appShell .dashboard-chart-card,
#appShell .dashboard-alerts-card,
#appShell .dashboard-panel,
#appShell .placeholder-card {
  padding: 16px 18px;
}

#appShell .panel-heading {
  gap: 10px;
  margin-bottom: 12px;
}

#appShell .panel-heading h3,
#appShell .panel-heading h4 {
  font-size: 1rem;
}

#appShell .workspace-note,
#appShell .workspace-list-item__meta,
#appShell .workspace-table__sub,
#appShell .workspace-form label > span,
#appShell .workspace-form .form-label,
#appShell .compact-help {
  font-size: 0.76rem;
}

#appShell .workspace-metric {
  padding: 12px 14px;
}

#appShell .workspace-metric span,
#appShell .workspace-metric small {
  font-size: 0.76rem;
}

#appShell .workspace-metric strong,
#appShell .dashboard-kpi strong,
#appShell .dashboard-focus-card strong {
  font-size: 1.12rem;
}

#appShell .workspace-card,
#appShell .workspace-list-item {
  padding: 10px 12px;
}

#appShell .workspace-card__head strong {
  font-size: 0.9rem;
}

#appShell .workspace-card__meta,
#appShell .workspace-card__note,
#appShell .workspace-empty,
#appShell .workspace-empty--tight {
  font-size: 0.8rem;
}

#appShell .workspace-mode-tab,
#appShell .workspace-command-chip,
#appShell .workspace-tag,
#appShell .dashboard-period {
  padding: 7px 11px;
  font-size: 0.76rem;
}

#appShell .workspace-command-bar {
  gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
}

#appShell .workspace-form-grid {
  gap: 10px;
}

#appShell .workspace-form .form-control,
#appShell .workspace-form .form-select,
#appShell .workspace-form textarea {
  min-height: 36px;
  font-size: 0.82rem;
  padding: 0.42rem 0.65rem;
}

#appShell .workspace-form textarea {
  min-height: 110px;
}

#appShell .workspace-form__actions .btn,
#appShell .workspace-command-bar .btn,
#appShell .panel-heading .btn,
#appShell .workspace-list-item .btn,
#appShell .workspace-card .btn {
  min-height: 34px;
  padding: 0.38rem 0.7rem;
  font-size: 0.76rem;
}

#appShell .table-shell {
  max-width: 100%;
}

#appShell .workspace-table th,
#appShell .workspace-table td,
#appShell .table-shell th,
#appShell .table-shell td {
  font-size: 0.78rem;
}

#appShell .workspace-modal {
  max-width: min(980px, calc(100vw - 36px));
}

@media (max-width: 1100px) {
  #appShell .content-shell {
    padding: 8px;
  }

  #appShell .workspace-panel,
  #appShell .dashboard-chart-card,
  #appShell .dashboard-alerts-card,
  #appShell .dashboard-panel,
  #appShell .placeholder-card {
    padding: 14px;
  }
}

#appShell [data-mode-section].workspace-panel--muted {
  display: none;
}

#appShell [data-mode-section].workspace-panel--active {
  display: block;
}

#appShell .workspace-stage-strip {
  gap: 10px;
}

#appShell .workspace-stage-card {
  min-width: 0;
  padding: 12px 14px;
}

#appShell .workspace-stage-card strong {
  font-size: 1rem;
}

#appShell .workspace-toolbar {
  gap: 10px;
  padding: 12px 14px;
}

#appShell .workspace-toolbar__group {
  gap: 8px;
}

#appShell .workspace-toolbar .form-control,
#appShell .workspace-toolbar .form-select {
  min-height: 34px;
  font-size: 0.8rem;
}

#appShell .workspace-list-item {
  gap: 10px;
}

#appShell .workspace-list-item strong,
#appShell .workspace-table strong {
  font-size: 0.84rem;
}

#appShell .workspace-shell {
  gap: 12px;
}

#appShell .workspace-grid {
  gap: 12px;
}

#appShell .workspace-panel {
  padding: 14px 15px;
  border-radius: 18px;
}

#appShell .workspace-metrics {
  gap: 10px;
}

#appShell .workspace-metric {
  padding: 12px 13px;
  border-radius: 16px;
}

#appShell .workspace-metric span,
#appShell .workspace-metric small {
  font-size: 0.74rem;
}

#appShell .workspace-metric strong {
  font-size: 1rem;
}

#appShell .workspace-list-item {
  padding: 10px 11px;
  border-radius: 14px;
}

#appShell .workspace-card,
#appShell .workspace-sprint-card {
  padding: 10px 11px;
  border-radius: 14px;
}

#appShell .workspace-lane {
  padding: 10px;
  border-radius: 16px;
}

#appShell .workspace-stage-card {
  padding: 10px 11px;
  border-radius: 14px;
}

#appShell .workspace-card__head strong {
  font-size: 0.83rem;
}

#appShell .workspace-toolbar {
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
}

#appShell .workspace-toolbar .form-control,
#appShell .workspace-toolbar .form-select {
  min-height: 32px;
  font-size: 0.78rem;
}

#appShell .workspace-toolbar .btn,
#appShell .workspace-panel .btn,
#appShell .table-shell .btn {
  min-height: 32px;
  font-size: 0.74rem;
}

#appShell .workspace-table th,
#appShell .workspace-table td,
#appShell .table-shell th,
#appShell .table-shell td {
  padding: 0.42rem 0.48rem;
  font-size: 0.76rem;
}

#appShell .table-shell thead th {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

#appShell .workspace-board--crm {
  grid-template-columns: repeat(3, minmax(240px, 1fr));
}

#appShell .workspace-board--tasks {
  grid-template-columns: repeat(5, minmax(210px, 1fr));
}

#appShell .admin-grid,
#appShell .dashboard-grid,
#appShell .content-grid {
  min-width: 0;
}

#appShell .admin-grid > *,
#appShell .dashboard-grid > *,
#appShell .content-grid > * {
  min-width: 0;
}

#appShell .dashboard-shell {
  gap: 14px;
}

#appShell .dashboard-focus-strip,
#appShell .dashboard-kpis,
#appShell .dashboard-panels {
  gap: 12px;
}

#appShell .dashboard-focus-card,
#appShell .dashboard-kpi,
#appShell .dashboard-panel,
#appShell .dashboard-chart-card,
#appShell .dashboard-alerts-card,
#appShell .dashboard-module-card {
  padding: 14px 15px;
  border-radius: 18px;
}

#appShell .dashboard-focus-card strong,
#appShell .dashboard-kpi strong {
  font-size: 1rem;
}

#appShell .dashboard-focus-card span,
#appShell .dashboard-focus-card small,
#appShell .dashboard-kpi span,
#appShell .dashboard-kpi small,
#appShell .dashboard-panel .compact-help,
#appShell .dashboard-alert__meta,
#appShell .dashboard-mini span {
  font-size: 0.74rem;
}

#appShell .dashboard-panel h3,
#appShell .dashboard-chart-card h3,
#appShell .dashboard-alerts-card h3 {
  font-size: 0.92rem;
}

#appShell .dashboard-chart {
  min-height: 280px;
}

#appShell .dashboard-tooltip {
  font-size: 0.72rem;
  padding: 8px 10px;
  border-radius: 12px;
}

#appShell .workspace-empty,
#appShell .workspace-empty--tight {
  padding: 12px 13px;
  border-radius: 14px;
  font-size: 0.76rem;
}

#appShell .workspace-table th,
#appShell .workspace-table td,
#appShell .table-shell th,
#appShell .table-shell td {
  overflow-wrap: anywhere;
  vertical-align: top;
}

#appShell .table-shell {
  overflow: auto;
  scrollbar-width: thin;
}

#appShell .admin-grid .workspace-table td,
#appShell .admin-grid .workspace-table th {
  font-size: 0.74rem;
}

#appShell .admin-grid .workspace-panel,
#appShell .dashboard-grid .workspace-panel {
  min-width: 0;
}

#appShell .workspace-note,
#appShell .workspace-table__sub {
  font-size: 0.72rem;
}

#appShell .workspace-card__meta,
#appShell .workspace-list-item__meta {
  font-size: 0.72rem;
}

/* Keep the original platform shell look, but force the workspace to stay wide
   and stable for embedded modules. */
#appShell .shell-header {
  padding: 12px 18px;
}

#appShell .brand-block__logo {
  width: 56px;
  height: 56px;
}

#appShell .top-nav-item,
#appShell .top-nav button {
  min-height: 52px;
  min-width: 86px;
  padding: 10px 12px;
}

#appShell #profileCard.profile-card {
  flex: 0 0 312px;
  width: 312px;
  min-width: 312px;
  margin: 0 0 0 auto;
}

#appShell .shell-actions {
  flex-wrap: nowrap;
}

#appShell .shell-actions > .btn {
  flex: 0 0 auto;
}

#appShell .content-shell,
body.platform-wide #appShell .content-shell {
  width: min(1920px, calc(100vw - 18px));
  margin: 0 auto;
}

#appShell .workspace-main,
#appShell .view-shell,
#appShell #embedView,
#appShell .module-frame-wrap,
#appShell .module-frame {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: block;
}

#appShell .module-frame-wrap {
  min-height: calc(100vh - 210px);
  overflow: hidden;
}

#appShell .module-frame {
  min-height: calc(100vh - 210px);
  border: 0;
}
