:root {
  color-scheme: light;
  --navy: #10172f;
  --pink: #b83256;
  --paper: #f7f1e9;
  --violet: #70549f;
  --ink: #171419;
  --muted: #655d67;
  --line: rgba(16, 23, 47, 0.14);
  --card: rgba(255, 252, 247, 0.9);
  --green: #267767;
  --gold: #b98731;
  --ivory: #fffaf2;
  --charcoal: #11131a;
  --shadow: 0 24px 80px rgba(17, 19, 26, 0.12);
  font-family:
    Manrope, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(16, 23, 47, 0.06), transparent 38%),
    linear-gradient(180deg, rgba(185, 135, 49, 0.12), transparent 18rem),
    var(--paper);
  color: var(--ink);
}

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

button,
.button {
  align-items: center;
  background: linear-gradient(135deg, #171f3f, #0f1428);
  border: 1px solid transparent;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 760;
  gap: 0.5rem;
  justify-content: center;
  line-height: 1;
  min-height: 44px;
  padding: 0.8rem 1rem;
  box-shadow: 0 14px 34px rgba(16, 23, 47, 0.16);
}

button.secondary,
.button.secondary {
  background: rgba(255, 250, 242, 0.86);
  border-color: var(--line);
  color: var(--navy);
  box-shadow: none;
}

button.pink,
.button.pink {
  background: linear-gradient(135deg, #c43a62, #8f2745);
}

button.compact,
.button.compact {
  min-height: 34px;
  padding: 0.55rem 0.72rem;
}

button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.58;
}

.shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  backdrop-filter: blur(18px);
  background: rgba(255, 250, 242, 0.86);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  min-height: 78px;
  padding: 0.9rem clamp(1rem, 4vw, 3rem);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  align-items: center;
  display: inline-flex;
  font-size: 1.2rem;
  font-weight: 850;
  gap: 0.6rem;
  white-space: nowrap;
}

.brand img {
  height: 36px;
  width: 36px;
}

.brand b {
  color: var(--navy);
}

.brand strong {
  color: var(--pink);
}

.nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-end;
}

.nav a {
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 720;
  padding: 0.65rem 0.75rem;
}

.nav a.active {
  background: rgba(16, 23, 47, 0.08);
  color: var(--navy);
}

#profile-nav {
  display: inline-flex;
  margin-left: 0.25rem;
}

.profile-menu {
  position: relative;
}

.profile-menu > summary {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  gap: 0.55rem;
  list-style: none;
  min-height: 44px;
  padding: 0.25rem 0.65rem 0.25rem 0.3rem;
}

.profile-menu > summary::-webkit-details-marker,
.admin-user-card > summary::-webkit-details-marker,
.audit-row > summary::-webkit-details-marker {
  display: none;
}

.profile-avatar {
  align-items: center;
  background: linear-gradient(135deg, var(--navy), var(--violet));
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.85rem;
  font-weight: 850;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.profile-avatar.vip {
  background: linear-gradient(135deg, #8a5a0a, #d7a83e);
  box-shadow: 0 0 0 3px rgba(185, 135, 49, 0.15);
}

.profile-menu-label {
  display: grid;
  line-height: 1.15;
  max-width: 180px;
}

.profile-menu-label strong,
.profile-menu-label small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu-label small {
  color: var(--muted);
  font-size: 0.7rem;
}

.profile-menu-popover {
  background: var(--ivory);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: grid;
  min-width: 220px;
  padding: 0.45rem;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 20;
}

.profile-menu-popover a,
.profile-menu-logout {
  background: transparent;
  border: 0;
  border-radius: 7px;
  box-shadow: none;
  color: var(--navy);
  display: flex;
  font-size: 0.88rem;
  justify-content: flex-start;
  min-height: 40px;
  padding: 0.7rem;
  width: 100%;
}

.profile-menu-popover a:hover,
.profile-menu-logout:hover {
  background: rgba(16, 23, 47, 0.07);
}

.page {
  padding: clamp(1rem, 3vw, 2.2rem);
}

.section {
  margin: 0 auto;
  max-width: 1180px;
  padding: clamp(2rem, 6vw, 5rem) 0;
}

.hero {
  align-items: center;
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: minmax(0, 1.02fr) minmax(320px, 0.98fr);
  min-height: calc(100vh - 96px);
  padding-bottom: 3rem;
}

.hero::before {
  background: linear-gradient(90deg, var(--gold), transparent);
  content: "";
  display: block;
  grid-column: 1 / -1;
  height: 1px;
  opacity: 0.55;
}

.eyebrow {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 860;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  color: var(--navy);
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: clamp(3.4rem, 8vw, 6.8rem);
  line-height: 0.94;
}

h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.03;
}

h3 {
  font-size: 1.1rem;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.lead {
  color: #3c3542;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  max-width: 64ch;
}

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

.mockup {
  background:
    linear-gradient(145deg, rgba(255, 252, 247, 0.96), rgba(243, 232, 219, 0.74)),
    var(--ivory);
  border: 1px solid rgba(185, 135, 49, 0.22);
  border-radius: 8px;
  box-shadow: 0 34px 90px rgba(17, 19, 26, 0.2);
  overflow: hidden;
  padding: 1rem;
}

.mockup-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding-bottom: 0.85rem;
}

.mockup-grid {
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(14, 1fr);
  margin-top: 1rem;
}

.cell {
  align-items: center;
  aspect-ratio: 1;
  background: var(--cell);
  color: rgba(255, 255, 255, 0.88);
  display: grid;
  font-size: clamp(0.55rem, 1vw, 0.85rem);
  font-weight: 850;
  justify-items: center;
  min-width: 0;
}

.stats {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 1rem;
}

.stats-inline {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 1rem 0;
}

.stat,
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat {
  padding: 0.9rem;
}

.stat b {
  color: var(--navy);
  display: block;
  font-size: 1.4rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

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

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

.card {
  padding: 1.35rem;
}

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

.card img {
  border-radius: 8px;
  display: block;
  max-width: 100%;
}

.badge {
  background: rgba(185, 135, 49, 0.12);
  border: 1px solid rgba(185, 135, 49, 0.25);
  border-radius: 999px;
  color: #745014;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 820;
  padding: 0.32rem 0.6rem;
}

.badge.warning {
  background: rgba(196, 58, 98, 0.1);
  border-color: rgba(196, 58, 98, 0.25);
  color: #8b2440;
}

#web-save-status {
  line-height: 1.25;
  max-width: 100%;
  white-space: normal;
}

.list {
  display: grid;
  gap: 0.75rem;
  margin: 1.25rem 0 0;
}

.compact-list {
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.sync-actions {
  background: rgba(255, 250, 242, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 1rem 0;
  padding: 0.95rem;
}

.sync-actions p {
  color: var(--muted);
  margin: 0.35rem 0 0;
}

.sync-actions-total {
  font-weight: 800;
}

.sync-actions-breakdown {
  font-size: 0.9rem;
}

.sync-deletion-note {
  color: var(--muted);
  font-weight: 800;
  margin: 0.75rem 0 0;
}

.sync-authority-note {
  background: rgba(38, 119, 103, 0.08);
  border: 1px solid rgba(38, 119, 103, 0.22);
  border-radius: 8px;
  color: #235d55;
  font-weight: 800;
  margin: 0.75rem 0 0;
  padding: 0.8rem 0.9rem;
}

.sync-action-row {
  align-items: center;
}

.sync-next-action {
  color: var(--muted);
  font-weight: 800;
}

.project-sync-hint {
  color: var(--muted);
  font-weight: 800;
}

.library-actions,
.web-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}

.library-search {
  margin-top: 1rem;
}

.library-limit-note {
  color: var(--muted);
  font-weight: 800;
  margin: 0.75rem 0 0;
}

.thread-filter {
  align-items: stretch;
}

.thread-filter-button.active {
  border-color: rgba(196, 58, 98, 0.45);
  box-shadow: inset 0 0 0 1px rgba(196, 58, 98, 0.18);
}

.swatch {
  background: var(--cell);
  border: 1px solid rgba(16, 23, 47, 0.18);
  border-radius: 999px;
  display: inline-block;
  height: 0.9rem;
  width: 0.9rem;
}

.split-band {
  align-items: start;
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
}

.row {
  align-items: start;
  background: rgba(255, 250, 242, 0.76);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  min-width: 0;
  padding: 1rem;
}

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

.row.flat {
  background: transparent;
  border: 0;
  padding: 0;
}

.row-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  min-width: 0;
}

.row-actions .button,
.row-actions button {
  min-height: 34px;
  padding: 0.55rem 0.7rem;
}

.project-main {
  display: grid;
  gap: 0.35rem;
  min-width: min(100%, 280px);
}

.project-actions {
  max-width: 520px;
}

.project-history-panel {
  border-top: 1px solid var(--line);
  flex: 1 0 100%;
  padding-top: 0.9rem;
}

.project-history-panel[hidden] {
  display: none;
}

.revision-history-header {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.7rem;
}

.revision-history-header small,
.revision-history-item small {
  color: var(--muted);
}

.revision-history-list {
  display: grid;
  gap: 0.55rem;
}

.revision-pair-controls {
  align-items: end;
  background: rgba(40, 104, 93, 0.06);
  border: 1px solid rgba(40, 104, 93, 0.22);
  border-radius: 14px;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(2, minmax(160px, 1fr)) auto;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
}

.revision-pair-controls label {
  display: grid;
  gap: 0.35rem;
}

.revision-pair-controls select {
  min-width: 0;
  width: 100%;
}

.revision-pair-result {
  grid-column: 1 / -1;
}

.revision-pair-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
}

.revision-pair-summary span {
  color: var(--muted);
}

.revision-history-item {
  align-items: center;
  background: rgba(26, 33, 89, 0.035);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  padding: 0.75rem;
}

.revision-history-item > div {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.revision-history-item .revision-compare {
  color: #28685d;
  font-weight: 700;
}

.revision-history-item .revision-checkpoint-label {
  color: #9a3152;
  font-weight: 800;
}

.revision-history-actions {
  align-items: center;
  display: flex !important;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.project-progress {
  background: rgba(26, 33, 89, 0.08);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  width: min(340px, 100%);
}

.project-progress span {
  background: linear-gradient(90deg, #c43a62, #b98731);
  display: block;
  height: 100%;
}

#web-save-status.error {
  border-color: rgba(167, 29, 58, 0.35);
  color: #a71d3a;
}

.route-head {
  display: grid;
  gap: 0.75rem;
  margin: 0 auto 1.5rem;
  max-width: 1180px;
}

.kb-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
}

.admin-menu {
  align-items: center;
  background: rgba(255, 250, 242, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0.45rem;
  position: sticky;
  top: 92px;
  z-index: 5;
}

.admin-menu a {
  border-radius: 8px;
  color: var(--navy);
  font-size: 0.9rem;
  font-weight: 760;
  padding: 0.65rem 0.8rem;
}

.admin-menu a:hover {
  background: rgba(185, 135, 49, 0.12);
}

.admin-menu a.active {
  background: var(--navy);
  color: #fff;
}

#admin-overview,
#admin-profile,
#admin-groups,
#admin-users,
#admin-release,
#admin-audit {
  scroll-margin-top: 170px;
}

.group-guide {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-top: 1rem;
}

.group-guide-item {
  background: rgba(16, 23, 47, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0.25rem;
  padding: 0.8rem;
}

.group-guide-item small {
  color: var(--muted);
  line-height: 1.35;
}

.group-plan-card {
  align-content: start;
  display: grid;
  gap: 0.8rem;
}

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

.capability-grid span {
  background: rgba(255, 250, 242, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  padding: 0.55rem;
}

.benefit-list {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding-left: 1.1rem;
}

.benefit-list li {
  color: var(--muted);
}

.access-summary-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 1rem 0;
}

.access-summary-card {
  background: rgba(16, 23, 47, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: none;
  color: inherit;
  cursor: pointer;
  display: grid;
  gap: 0.35rem;
  justify-items: start;
  min-height: auto;
  padding: 0.9rem;
  text-align: left;
}

.access-summary-card:hover {
  border-color: rgba(185, 135, 49, 0.46);
  box-shadow: 0 12px 30px rgba(16, 23, 47, 0.08);
  transform: translateY(-1px);
}

.access-summary-card strong {
  color: var(--navy);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1;
}

.access-summary-card small {
  color: var(--muted);
}

.access-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: -0.2rem 0 1rem;
}

.badge.danger {
  background: rgba(196, 58, 98, 0.12);
  border-color: rgba(196, 58, 98, 0.36);
  color: #8f2745;
}

.group-vip,
.group-badge.group-vip {
  background: linear-gradient(135deg, rgba(185, 135, 49, 0.18), rgba(112, 84, 159, 0.12));
  border-color: rgba(185, 135, 49, 0.42);
}

.vip-crown {
  color: var(--gold);
}

.admin-search {
  margin: 1rem 0 0.6rem;
}

.admin-filter-bar {
  align-items: end;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  margin-top: 1rem;
}

.admin-filter-bar label {
  color: var(--muted);
  display: grid;
  font-size: 0.85rem;
  font-weight: 720;
  gap: 0.35rem;
}

.admin-filter-bar select {
  background: rgba(255, 250, 242, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  padding: 0.65rem 0.75rem;
}

.audit-filter-bar {
  grid-template-columns: minmax(180px, 280px) auto;
  justify-content: start;
}

.filter-count {
  color: var(--muted);
  font-size: 0.88rem;
  margin: -0.25rem 0 0.65rem;
}

.admin-user-list {
  gap: 0.75rem;
}

.admin-user-card,
.audit-row {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.admin-user-card > summary,
.audit-row > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 0.8rem;
  justify-content: space-between;
  padding: 0.85rem;
}

.admin-user-card[open] > summary,
.audit-row[open] > summary {
  background: rgba(185, 135, 49, 0.08);
  border-bottom: 1px solid var(--line);
}

.admin-user-summary {
  display: grid;
  flex: 1;
  gap: 0.2rem;
  min-width: 0;
}

.admin-user-summary small {
  color: var(--muted);
}

.access-health-badge {
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.35rem 0.62rem;
  white-space: nowrap;
}

.access-health-badge.access-active,
.access-health-badge.access-permanent {
  background: rgba(51, 132, 83, 0.12);
  color: #2f7d51;
}

.access-health-badge.access-expiring {
  background: rgba(185, 135, 49, 0.16);
  color: #8a641f;
}

.access-health-badge.access-expired {
  background: rgba(196, 58, 98, 0.14);
  color: var(--pink);
}

.admin-user-edit {
  margin: 0;
  padding: 1rem;
}

.access-health-panel {
  align-items: start;
  background: rgba(16, 23, 47, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem;
}

.access-health-panel strong,
.access-health-panel small {
  display: block;
}

.access-health-panel small,
.access-health-panel p {
  color: var(--muted);
}

.access-health-panel p {
  margin: 0;
}

.access-health-panel.access-expiring {
  background: rgba(185, 135, 49, 0.1);
  border-color: rgba(185, 135, 49, 0.34);
}

.access-health-panel.access-expired {
  background: rgba(196, 58, 98, 0.08);
  border-color: rgba(196, 58, 98, 0.24);
}

.user-facts {
  background: rgba(16, 23, 47, 0.04);
  border-radius: 8px;
  display: grid;
  gap: 0.55rem 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0.85rem;
}

.user-facts span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.audit-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 250, 242, 0.72));
}

.audit-terminal-shell > summary::-webkit-details-marker {
  display: none;
}

.audit-terminal-summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  list-style: none;
}

.audit-terminal-summary span:first-child {
  display: grid;
  gap: 0.2rem;
}

.audit-terminal-summary strong {
  color: var(--navy);
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
}

.audit-terminal-summary small {
  color: var(--muted);
}

.audit-terminal-window {
  background: #10172f;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 22px 60px rgba(16, 23, 47, 0.24);
  margin-top: 1rem;
  overflow: hidden;
}

.audit-terminal-titlebar {
  align-items: center;
  background: linear-gradient(180deg, #202842, #151d35);
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
}

.audit-terminal-titlebar strong {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  margin-left: 0.25rem;
}

.audit-terminal-titlebar small {
  color: rgba(255, 255, 255, 0.56);
  margin-left: auto;
}

.terminal-dot {
  border-radius: 999px;
  display: inline-block;
  height: 0.72rem;
  width: 0.72rem;
}

.terminal-dot.red {
  background: #ff6b7d;
}

.terminal-dot.yellow {
  background: #ffd166;
}

.terminal-dot.green {
  background: #52d273;
}

.audit-terminal-controls {
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.9rem;
}

.audit-terminal-controls .admin-filter-bar label,
.audit-terminal-controls .admin-search,
.audit-terminal-controls .filter-count {
  color: rgba(255, 255, 255, 0.68);
}

.audit-terminal-controls input,
.audit-terminal-controls select {
  background: rgba(255, 255, 255, 0.92);
}

.audit-terminal-body {
  max-height: 620px;
  overflow: auto;
  padding: 0.9rem;
}

.audit-terminal-body .audit-list {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  gap: 0;
  overflow: hidden;
}

.audit-terminal-body .audit-row {
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  color: rgba(255, 255, 255, 0.84);
}

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

.audit-terminal-body .audit-row > summary {
  align-items: center;
  color: rgba(255, 255, 255, 0.86);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  min-height: 54px;
  padding: 0.72rem 0.85rem;
}

.audit-terminal-body .audit-row > summary:hover {
  background: rgba(255, 255, 255, 0.05);
}

.audit-terminal-body .audit-row[open] > summary {
  background: rgba(185, 135, 49, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.audit-terminal-body .audit-line-main {
  align-items: center;
  display: flex;
  gap: 0.7rem;
  min-width: 0;
}

.audit-terminal-body .audit-line-main > span:last-child {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.audit-terminal-body .audit-terminal-prompt {
  background: rgba(82, 210, 115, 0.12);
  border: 1px solid rgba(82, 210, 115, 0.3);
  border-radius: 999px;
  color: #7ff0a0;
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 860;
  letter-spacing: 0;
  padding: 0.22rem 0.45rem;
  text-transform: uppercase;
}

.audit-terminal-body .audit-row strong {
  color: rgba(255, 255, 255, 0.94);
  overflow-wrap: anywhere;
}

.audit-terminal-body .audit-row small {
  color: rgba(255, 255, 255, 0.58);
}

.audit-terminal-body .audit-details {
  background: rgba(4, 8, 20, 0.72);
  color: rgba(255, 255, 255, 0.72);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.audit-terminal-body .audit-details code {
  color: #ffd166;
}

.audit-terminal-body .audit-details pre {
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
}

.audit-list {
  display: grid;
  gap: 0.6rem;
}

.audit-row > summary span {
  display: grid;
  gap: 0.2rem;
}

.audit-row > summary span:last-child {
  text-align: right;
}

.audit-row-meta {
  align-items: end;
  justify-items: end;
}

.audit-kind-badge {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.72rem;
  font-weight: 820;
  padding: 0.25rem 0.5rem;
  width: max-content;
}

.audit-kind-access {
  background: rgba(185, 135, 49, 0.14);
  border-color: rgba(185, 135, 49, 0.28);
  color: #ffd166;
}

.audit-kind-admin {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.78);
}

.audit-kind-auth {
  background: rgba(51, 132, 83, 0.16);
  color: #7ff0a0;
}

.audit-kind-project,
.audit-kind-release {
  background: rgba(112, 84, 159, 0.18);
  color: #d3c7ff;
}

.audit-details {
  padding: 0.8rem 1rem 1rem;
}

.audit-details p {
  margin: 0.35rem 0;
}

.audit-access-summary {
  background: rgba(185, 135, 49, 0.1);
  border: 1px solid rgba(185, 135, 49, 0.24);
  border-radius: 10px;
  margin: 0.65rem 0;
  padding: 0.8rem;
}

.audit-access-summary ul {
  margin: 0.45rem 0 0;
  padding-left: 1.1rem;
}

.audit-access-summary li {
  margin: 0.25rem 0;
}

.audit-details pre {
  background: var(--charcoal);
  border-radius: 8px;
  color: #fff;
  max-height: 260px;
  overflow: auto;
  padding: 0.8rem;
  white-space: pre-wrap;
}

.search {
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  min-height: 46px;
  padding: 0.8rem 1rem;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus,
.search:focus {
  border-color: rgba(185, 135, 49, 0.62);
  box-shadow: 0 0 0 3px rgba(185, 135, 49, 0.14);
  outline: 0;
}

.admin-form {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1rem;
}

.admin-form label,
.admin-login label,
.card label {
  color: var(--navy);
  display: grid;
  font-size: 0.86rem;
  font-weight: 780;
  gap: 0.4rem;
}

.admin-form input,
.admin-form select,
.admin-form textarea,
.admin-login input,
.card input,
.card select,
.card textarea {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  min-height: 44px;
  padding: 0.72rem 0.82rem;
  width: 100%;
}

.compact-input {
  min-height: 38px;
  max-width: 100%;
  min-width: min(180px, 100%);
  padding: 0.55rem 0.7rem;
}

.admin-form textarea {
  resize: vertical;
}

.admin-form .wide {
  grid-column: 1 / -1;
}

.access-expiry-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.access-role-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.access-expiry-presets .compact,
.access-role-presets .compact {
  border-radius: 999px;
  min-height: 34px;
  padding: 0.42rem 0.7rem;
}

.admin-form .check {
  align-items: center;
  display: flex;
  gap: 0.6rem;
}

.admin-form .check input {
  min-height: 0;
  width: auto;
}

.form-status {
  align-self: center;
  margin: 0;
}

.form-status.error {
  color: #a71d3a;
}

.form-notice {
  background: #f7fff9;
  border: 1px solid #86c99a;
  border-radius: 12px;
  color: #235d34;
  margin-bottom: 1rem;
  padding: 1rem 1.15rem;
}

.form-notice.error {
  background: #fff6f7;
  border-color: #dc9baa;
  color: #8b243d;
}

.narrow-card {
  margin-inline: auto;
  max-width: 560px;
}

.web-app {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) 280px;
}

.chart {
  background: var(--ivory);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(var(--cols), minmax(18px, 1fr));
  overflow: hidden;
  padding: 0.35rem;
}

.chart-cell {
  align-items: center;
  aspect-ratio: 1;
  background: var(--cell);
  color: #fff;
  cursor: pointer;
  display: grid;
  font-size: 0.72rem;
  font-weight: 850;
  justify-items: center;
}

.chart-cell.done {
  box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.6);
  color: var(--navy);
}

.chart-cell.muted {
  filter: grayscale(0.6);
  opacity: 0.28;
}

.footer {
  border-top: 1px solid var(--line);
  margin: 3rem auto 0;
  max-width: 1180px;
  padding: 2rem 0;
}

@media (max-width: 900px) {
  .hero,
  .kb-layout,
  .split-band,
  .web-app,
  .grid.cols-2,
  .grid.cols-3,
  .stats-inline {
    grid-template-columns: 1fr;
  }

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

  .admin-filter-bar {
    grid-template-columns: 1fr;
  }

  .audit-terminal-titlebar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .audit-terminal-titlebar small {
    margin-left: 0;
    width: 100%;
  }

  .user-facts {
    grid-template-columns: 1fr;
  }

  .revision-pair-controls {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  h1 {
    font-size: 2.65rem;
    line-height: 1;
    overflow-wrap: anywhere;
  }

  .route-head,
  .card,
  .stat {
    min-width: 0;
  }

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

  .nav {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .profile-menu-label {
    display: none;
  }

  .profile-menu > summary {
    padding-right: 0.3rem;
  }

  .admin-user-card > summary,
  .audit-row > summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .audit-row > summary span:last-child {
    text-align: left;
    width: 100%;
  }

  .audit-terminal-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .audit-row-meta {
    align-items: start;
    justify-items: start;
  }
}
