:root {
  --ink: #111111;
  --paper: #ffffff;
  --canvas: #f2f2f0;
  --muted: #737373;
  --line: #ddddda;
  --success: #217a4a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.demo-bar {
  min-height: 38px;
  padding: 0.55rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  color: white;
  background: var(--ink);
  font-size: 0.82rem;
}

.demo-bar strong {
  padding-right: 0.7rem;
  border-right: 1px solid #555;
}

.shell {
  min-height: calc(100vh - 38px);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  min-height: calc(100vh - 38px);
  padding: 1.6rem 1rem;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
}

.panel-brand {
  padding: 0 0.8rem 1.7rem;
  border-bottom: 1px solid var(--line);
}

.panel-brand img {
  display: block;
  width: 128px;
  height: auto;
}

.panel-brand span {
  display: block;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.15em;
}

.sidebar nav {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.35rem;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  padding: 0 0.85rem;
  border: 0;
  background: transparent;
  color: #525252;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.is-active {
  color: white;
  background: var(--ink);
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-top: 1px solid var(--line);
}

.sidebar-footer strong,
.sidebar-footer small {
  display: block;
}

.sidebar-footer small {
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.avatar,
.activity-list > li > span {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: white;
  background: var(--ink);
  font-weight: 850;
}

.workspace {
  min-width: 0;
  padding: clamp(1.5rem, 4vw, 3.5rem);
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.workspace-header p,
.kicker {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.14em;
}

.workspace-header h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3.3rem);
  letter-spacing: -0.055em;
}

.environment {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.environment i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d89d18;
}

.sidebar-toggle {
  display: none;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.view-heading {
  margin-top: clamp(2.5rem, 6vw, 5rem);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.view-heading h2,
.placeholder-view h2,
.user-dialog h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.06em;
}

.primary-action,
.quiet-action,
.close-dialog,
.sidebar-toggle {
  border: 1px solid var(--ink);
  background: var(--paper);
  cursor: pointer;
}

.primary-action {
  min-height: 46px;
  padding: 0.75rem 1.1rem;
  color: white;
  background: var(--ink);
  font-weight: 800;
}

.metric-grid {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.metric {
  min-height: 190px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

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

.metric span {
  font-weight: 750;
}

.metric strong {
  margin: auto 0 0.5rem;
  font-size: clamp(3rem, 7vw, 5.8rem);
  line-height: 0.85;
  letter-spacing: -0.08em;
}

.metric small {
  font-size: 0.78rem;
}

.content-grid {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 1.5rem;
}

.panel-card {
  padding: 1.5rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.card-heading h3 {
  margin: 0;
  font-size: 1.35rem;
}

.quiet-action {
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 750;
}

.module-row {
  margin-top: 1.25rem;
  padding: 1rem 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.module-letter {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  font-weight: 900;
}

.module-letter.dark {
  color: white;
  background: var(--ink);
}

.module-row strong,
.module-row small {
  display: block;
}

.module-row small {
  margin-top: 0.2rem;
  color: var(--muted);
}

.module-row em {
  color: var(--success);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 800;
}

.activity-list {
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
}

.activity-list li {
  padding: 1rem 0;
  display: flex;
  gap: 0.8rem;
  border-top: 1px solid var(--line);
}

.activity-list > li > span {
  width: 34px;
  height: 34px;
  font-size: 0.78rem;
}

.activity-list p,
.activity-list small {
  margin: 0;
}

.activity-list small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
}

.placeholder-view {
  margin-top: clamp(3rem, 8vw, 7rem);
  padding: clamp(2rem, 5vw, 5rem);
  border: 1px solid var(--line);
  background: var(--paper);
}

.placeholder-view > p:last-child {
  max-width: 660px;
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.toolbar {
  margin-top: 2rem;
  padding: 1rem;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--paper);
}

.toolbar label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.toolbar .search-field {
  flex: 1;
}

.toolbar input,
.toolbar select {
  min-height: 44px;
  padding: 0.65rem 0.75rem;
  border: 1px solid #bdbdb8;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.95rem;
}

.table-card {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--paper);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  font-size: 0.88rem;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 0.2rem;
  color: var(--muted);
}

.row-action {
  border: 0;
  background: transparent;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 0.25rem;
  cursor: pointer;
}

.status {
  display: inline-flex;
  padding: 0.35rem 0.55rem;
  border: 1px solid currentColor;
  font-size: 0.72rem;
  font-weight: 850;
}

.status.active {
  color: var(--success);
}

.status.pending {
  color: #8a6413;
}

.empty-search {
  margin: 0;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.info-strip {
  margin-top: 1.25rem;
  padding: 1rem 1.2rem;
  display: flex;
  gap: 0.8rem 1.5rem;
  border-left: 4px solid var(--ink);
  background: #e7e7e3;
  font-size: 0.85rem;
}

.info-strip span {
  color: var(--muted);
}

.secondary-link {
  min-height: 46px;
  padding: 0.75rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: var(--paper);
  font-weight: 800;
  text-decoration: none;
}

.site-management-grid {
  margin-top: 2rem;
}

.content-row,
.person-row {
  padding: 1rem 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  border-top: 1px solid var(--line);
}

.content-row:first-of-type,
.person-row:first-of-type {
  margin-top: 1rem;
}

.content-index {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.content-row strong,
.content-row small,
.person-row strong,
.person-row small {
  display: block;
}

.content-row small,
.person-row small {
  margin-top: 0.2rem;
  color: var(--muted);
}

.page-list {
  margin-top: 1rem;
  display: grid;
}

.page-list button {
  min-height: 58px;
  padding: 0.8rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.page-list span {
  font-weight: 800;
}

.page-list em {
  color: var(--muted);
  font-size: 0.75rem;
  font-style: normal;
}

.compact-metrics {
  margin-top: 2rem;
}

.compact-metrics .metric {
  min-height: 165px;
}

.compact-metrics .metric strong {
  font-size: clamp(2.8rem, 5vw, 4.4rem);
}

.light-avatar {
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--line);
}

.boundary-card {
  color: white;
  background: var(--ink);
  border-color: var(--ink);
}

.boundary-card .kicker,
.boundary-card p {
  color: #bdbdbd;
}

.boundary-card h3 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  letter-spacing: -0.05em;
}

.boundary-card p:last-child {
  line-height: 1.7;
}

.role-grid {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.role-card {
  min-height: 270px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.role-card > span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
}

.role-card h3 {
  margin: auto 0 0;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  letter-spacing: -0.05em;
}

.role-card p {
  color: var(--muted);
}

.role-card strong {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.future-role {
  color: white;
  background: var(--ink);
}

.future-role p,
.future-role > span {
  color: #bdbdbd;
}

.audit-card {
  margin-top: 2rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.audit-row {
  padding: 1.1rem;
  display: grid;
  grid-template-columns: 64px 38px minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
  border-bottom: 1px solid var(--line);
}

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

.audit-row time,
.audit-row small {
  color: var(--muted);
  font-size: 0.78rem;
}

.audit-row > span {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: var(--ink);
  font-weight: 850;
}

.audit-row p,
.audit-row small {
  margin: 0;
}

.audit-row small {
  display: block;
  margin-top: 0.2rem;
}

.user-dialog {
  width: min(540px, calc(100vw - 2rem));
  padding: 0;
  border: 0;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.28);
}

.user-dialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

.user-dialog form {
  padding: 2rem;
}

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

.close-dialog {
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
}

.user-dialog label {
  margin-top: 1rem;
  display: grid;
  gap: 0.45rem;
  font-size: 0.84rem;
  font-weight: 800;
}

.user-dialog input,
.user-dialog select {
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 0.8rem;
  border: 1px solid #bdbdb8;
  background: var(--paper);
}

.dialog-note {
  margin: 1.3rem 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  max-width: 360px;
  padding: 0.9rem 1rem;
  color: white;
  background: var(--ink);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    display: none;
    position: fixed;
    inset: 38px auto 0 0;
    width: min(320px, 88vw);
    z-index: 20;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.18);
  }

  .sidebar.is-open {
    display: flex;
  }

  .sidebar-toggle {
    display: inline-flex;
    padding: 0.65rem 0.8rem;
    font-weight: 800;
  }

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

@media (max-width: 700px) {
  .demo-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }

  .demo-bar strong {
    padding: 0;
    border: 0;
  }

  .workspace-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .environment {
    width: 100%;
  }

  .view-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .toolbar,
  .info-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar select {
    width: 100%;
  }

  .metric {
    min-height: 155px;
  }

  .module-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .module-row em {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
}
