:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #122033;
  --muted: #5d6b7c;
  --line: #e2e6ec;
  --line-strong: #cfd6df;
  --brand: #1c3d66;
  --brand-hover: #163454;
  --brand-soft: #e8eef5;
  --danger: #8f2d2d;
  --warn: #8a5a12;
  --ok: #1d6b45;
  --radius: 4px;
  --control-h: 2rem;
  --sidebar: 13.75rem;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 1px 2px rgba(18, 32, 51, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.45;
}

a {
  color: var(--brand);
}

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

h1,
h2,
h3,
legend {
  font-family: var(--font);
}

.app-shell {
  min-height: 100vh;
}

.has-sidebar .app-shell {
  display: flex;
  align-items: stretch;
}

.app-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1;
  width: 100%;
  padding: 0.85rem 1rem 1.25rem;
}

.site-footer {
  padding: 0.45rem 1rem 0.7rem;
  color: var(--muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  flex: 0 0 var(--sidebar);
  width: var(--sidebar);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.75rem 0.65rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 4px;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-name {
  font-size: 0.8125rem;
  font-weight: 700;
}

.brand-product {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
}

.site-nav {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.4rem;
  overflow: visible;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2rem;
  padding: 0.3rem 0.55rem;
  border-left: 2px solid transparent;
  border-radius: 4px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8125rem;
}

.nav-link:hover {
  background: #f6f8fb;
}

.nav-link.is-active {
  background: var(--brand-soft);
  border-left-color: var(--brand);
  color: var(--brand);
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-top: 0.2rem;
}

.nav-group-label {
  margin: 0.15rem 0 0;
  padding: 0.25rem 0.55rem 0.05rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.nav-group.is-current .nav-group-label {
  color: var(--brand);
}

.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.nav-sub .nav-link {
  padding-left: 1.05rem;
}

.nav-text {
  min-width: 0;
}

.nav-count {
  margin-left: auto;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-foot {
  margin-top: auto;
  padding: 0.65rem 0.75rem 0.75rem;
  border-top: 1px solid var(--line);
}

.user-label {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.3;
}

.user-label span {
  display: block;
  color: var(--muted);
  font-weight: 500;
}

.nav-logout,
.nav-restart,
.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--brand);
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  text-decoration: none;
}

.nav-logout:hover,
.nav-restart:hover,
.linkish:hover {
  text-decoration: underline;
}

.nav-restart {
  display: block;
  margin-bottom: 0.35rem;
  text-align: left;
}

.mobile-bar,
.nav-scrim {
  display: none;
}

.nav-toggle {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.nav-toggle-bars {
  width: 0.9rem;
  height: 1px;
  background: var(--ink);
  box-shadow: 0 -4px 0 var(--ink), 0 4px 0 var(--ink);
}

.is-guest .app-shell {
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem;
}

.is-guest .app-body {
  width: min(100%, 23rem);
}

.is-guest .site-main {
  padding: 0;
}

h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--ink);
}

h2 {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink);
}

h3 {
  margin: 0.55rem 0 0.3rem;
  font-size: 0.84rem;
  font-weight: 650;
}

.page-head h1,
.panel h2,
.field-group legend,
.label-line,
.check-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

p {
  margin: 0.25rem 0;
}

.lede,
.help,
.muted,
.sub {
  color: var(--muted);
}

.lede {
  margin: 0.15rem 0 0;
  font-size: 0.8125rem;
  max-width: 46rem;
}

.help,
.sub,
.muted {
  font-size: 0.75rem;
  font-weight: 500;
}

.sub,
.muted {
  display: block;
}

h1 .sub {
  display: inline;
  margin-left: 0.25rem;
  font-size: 0.8rem;
}

.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.site-nav .tip {
  display: block;
}

.info-tip {
  width: 0.95rem;
  height: 0.95rem;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  flex: 0 0 auto;
}

.info-tip:hover,
.info-tip:focus-visible {
  border-color: var(--brand);
  color: var(--brand);
}

.tip-bubble {
  position: absolute;
  z-index: 40;
  left: calc(100% + 0.5rem);
  top: 0;
  width: max-content;
  max-width: 16rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(18, 32, 51, 0.12);
  font-size: 0.75rem;
  font-weight: 450;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

html:not([data-js="ready"]) .tip:hover .tip-bubble,
html:not([data-js="ready"]) .tip:focus-within .tip-bubble {
  opacity: 1;
  visibility: visible;
  transition: opacity 0s linear 0.5s, visibility 0s linear 0.5s;
}

html[data-js="ready"] .tip-bubble {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  box-shadow: none !important;
  white-space: nowrap !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.nav-tooltip {
  position: fixed;
  z-index: 80;
  left: 0;
  top: 0;
  box-sizing: border-box;
  width: max-content;
  max-width: 260px;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(18, 32, 51, 0.12);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 450;
  font-style: normal;
  line-height: 1.4;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  white-space: normal;
  pointer-events: none;
  visibility: hidden;
}

.nav-tooltip.is-on {
  visibility: visible;
}

.hover-tip {
  position: fixed;
  z-index: 80;
  left: 0;
  top: 0;
  max-width: min(17.5rem, calc(100vw - 1rem));
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(18, 32, 51, 0.12);
  font-size: 0.75rem;
  font-weight: 450;
  line-height: 1.4;
  pointer-events: none;
  visibility: hidden;
}

.hover-tip.is-on {
  visibility: visible;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 0.65rem;
}

.messages li {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 0.35rem;
}

.messages .success {
  border-color: #c5dfd0;
  background: #f4faf6;
}

.messages .error {
  border-color: #e4c8c8;
  background: #fdf6f6;
}

.messages .warning {
  border-color: #ead9b5;
  background: #fdf9f1;
}

code {
  font-size: 0.85em;
  background: var(--brand-soft);
  padding: 0.05em 0.3em;
  border-radius: 3px;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

@media (min-width: 1280px) {
  :root {
    --sidebar: 15.25rem;
  }

  .site-main {
    padding: 1rem 1.25rem 1.5rem;
  }
}

@media (max-width: 760px) {
  .has-sidebar .app-shell {
    flex-direction: column;
  }

  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    position: sticky;
    top: 0;
    z-index: 25;
    height: 2.75rem;
    padding: 0 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }

  .mobile-title {
    font-size: 0.8125rem;
    font-weight: 700;
  }

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-105%);
    transition: transform 0.16s ease;
    box-shadow: none;
  }

  body.nav-open .sidebar {
    transform: none;
    box-shadow: 0 8px 28px rgba(18, 32, 51, 0.16);
  }

  .nav-scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 25;
    border: 0;
    padding: 0;
    background: rgba(18, 32, 51, 0.28);
    cursor: pointer;
  }

  body.nav-open .nav-scrim {
    display: block;
  }

  .site-main {
    padding: 0.75rem 0.75rem 1rem;
  }
}
