/* ==========================================================================
   Level 10 SEO Performance Service
   Visual language: Level 10s OTT app — quiet light-gray administrative UI.
   White top bar, blue primary, Inter, soft borders, 8px cards.
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/static/fonts/inter-latin.woff2') format('woff2');
}

:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --ink: #1b2a4a;
  --muted: #6b7d93;
  --muted-bg: #edf2f7;
  --border: #dce5ee;
  --border-strong: #aec0d3;
  --primary: #2e5fa3;
  --primary-hover: #264f88;
  --primary-soft: #eaf2fb;
  --green: #2f7d4a;
  --green-soft: #e8f5ed;
  --amber: #a16207;
  --amber-soft: #fdf3e2;
  --red: #b91c1c;
  --red-strong: #e63946;
  --red-soft: #fdecee;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-xs: 5px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
p,
ol,
ul,
dl,
dd {
  margin: 0;
}

ol,
ul {
  padding: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img,
svg {
  vertical-align: middle;
}

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

button {
  cursor: pointer;
}

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

::selection {
  background: #cfe0f2;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Shell, top bar and navigation
   -------------------------------------------------------------------------- */

.shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: 1400px;
  min-height: 64px;
  margin: 0 auto;
  padding: 0 1rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-wordmark {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 0.9rem;
  border-radius: 2px;
  background: #173c8f;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}

.brand-sep {
  margin: 0 0.3rem;
  font-weight: 400;
  opacity: 0.55;
}

.brand-suffix {
  font-weight: 600;
}

.client-identity {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.client-identity strong {
  color: var(--ink);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.2px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--muted-bg);
  color: var(--ink);
  text-decoration: none;
}

.nav-item.is-active {
  color: var(--primary);
  background: transparent;
}

.nav-divider {
  width: 1px;
  height: 20px;
  margin: 0 6px;
  background: var(--border);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
}

.icon-btn:hover {
  background: var(--muted-bg);
  color: var(--ink);
  text-decoration: none;
}

.icon-btn.is-open {
  background: var(--muted-bg);
  color: var(--ink);
}

.menu-toggle {
  display: none;
}

.logout-form {
  display: flex;
}

.mobile-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding: 0.5rem 1rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 14px 30px rgba(27, 42, 74, 0.1);
}

.mobile-menu[hidden] {
  display: none;
}

.mobile-menu a {
  display: block;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.mobile-menu a:hover {
  background: var(--muted-bg);
  color: var(--ink);
  text-decoration: none;
}

.mobile-menu a.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.mobile-menu-meta {
  display: block;
  margin-top: 0.35rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.5rem 1rem 2rem;
  color: var(--muted);
  font-size: 11.5px;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 1rem;
  z-index: 100;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
}

.skip-link:focus {
  top: 0.75rem;
}

/* --------------------------------------------------------------------------
   Page titles and breadcrumbs
   -------------------------------------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-head h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.page-head-lg h1 {
  font-size: 1.875rem;
  letter-spacing: -0.025em;
}

.sub {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.sub a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sub a:hover {
  color: var(--primary);
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.1rem;
  margin-bottom: 0.6rem;
  color: var(--muted);
  font-size: 12px;
}

.crumbs a {
  color: var(--muted);
}

.crumbs a:hover {
  color: var(--primary);
}

.crumbs span {
  color: var(--muted);
  margin: 0 0.2rem;
}

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

.identity-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 18px;
  font-weight: 600;
}

.identity-mark .icon {
  width: 22px;
  height: 22px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 36px;
  padding: 0.48rem 0.78rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--muted-bg);
  border-color: var(--border-strong);
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--muted-bg);
  color: var(--ink);
}

.btn-danger {
  background: var(--red-strong);
  border-color: var(--red-strong);
  color: #ffffff;
}

.btn-danger:hover {
  background: #c92f3b;
  border-color: #c92f3b;
  color: #ffffff;
}

.btn-sm {
  min-height: 28px;
  padding: 0.32rem 0.6rem;
  border-radius: var(--radius-xs);
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.btn[disabled],
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

/* --------------------------------------------------------------------------
   Cards, grids, metrics
   -------------------------------------------------------------------------- */

.card {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.card:last-child {
  margin-bottom: 0;
}

.card-flush {
  padding: 0;
  overflow-x: auto;
}

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

.card-head h2 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.card-flush .card-head {
  margin: 0;
  padding: 1.25rem 1.5rem 0.75rem;
}

.card-link {
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.card-note {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.section-note {
  margin-bottom: 0.85rem;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

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

.grid > .card {
  margin-bottom: 0;
}

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

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

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

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat-value {
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-unit {
  margin-left: 0.25rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.stat-value-sm {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.stat-foot {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.prose {
  white-space: pre-line;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */

.badge {
  display: inline-block;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--muted-bg);
  color: #4a5c72;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  vertical-align: middle;
  white-space: nowrap;
}

.badge::first-letter {
  text-transform: uppercase;
}

.badge-gray {
  background: var(--muted-bg);
  color: #4a5c72;
}

.badge-green {
  background: var(--green-soft);
  color: var(--green);
}

.badge-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-red {
  background: var(--red-soft);
  color: var(--red);
}

.badge-blue {
  background: var(--primary-soft);
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Notices and alerts
   -------------------------------------------------------------------------- */

.notice,
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin-bottom: 1.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid #cfe0f2;
  border-radius: var(--radius);
  background: #eef4fb;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.55;
}

.notice .icon,
.alert .icon {
  margin-top: 0.15rem;
  color: var(--primary);
}

.notice strong,
.alert strong {
  font-weight: 600;
}

.notice-quiet {
  background: var(--bg);
  border-color: var(--border);
}

.notice-quiet .icon {
  color: var(--muted);
}

.alert-error {
  background: #fdf2f3;
  border-color: #f3c7cb;
  color: #8f1d24;
}

.alert-error .icon {
  color: var(--red);
}

.alert-success {
  background: var(--green-soft);
  border-color: #c6e5d1;
  color: #235f39;
}

.alert-success .icon {
  color: var(--green);
}

.error-list {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  font-size: 13px;
}

.error-list li + li {
  margin-top: 0.2rem;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink);
  font-size: 0.875rem;
}

.table th {
  padding: 0.74rem 1rem;
  background: #f3f6fa;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: left;
  vertical-align: bottom;
  white-space: nowrap;
}

.table td {
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: #fafcfe;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table .mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

.table .actions-cell {
  text-align: right;
  white-space: nowrap;
}

.table .nowrap {
  white-space: nowrap;
}

.row-title {
  display: block;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
}

a.row-title:hover {
  color: var(--primary);
  text-decoration: none;
}

.row-sub {
  display: block;
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

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

.nowrap {
  white-space: nowrap;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.link {
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
}

.link-danger {
  padding: 0;
  border: 0;
  background: none;
  color: var(--red);
  font-size: 12px;
  font-weight: 500;
}

.link-danger:hover {
  text-decoration: underline;
}

.actions-cell {
  text-align: right;
  white-space: nowrap;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.pager-info {
  color: var(--muted);
  font-size: 12px;
}

.detail-pop summary {
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  list-style: none;
}

.detail-pop summary::-webkit-details-marker {
  display: none;
}

.detail-pop pre {
  max-width: 380px;
  max-height: 260px;
  margin: 0.5rem 0 0;
  padding: 0.75rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  text-align: left;
  white-space: pre-wrap;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.field-label {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 600;
}

.field input,
.field select,
.field textarea,
.filter-bar input,
.filter-bar select {
  width: 100%;
  min-height: 36px;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.875rem;
  line-height: 1.4;
}

.field textarea {
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder,
.filter-bar input::placeholder {
  color: #9aa9ba;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.filter-bar input:focus,
.filter-bar select:focus {
  outline: none;
  border-color: #8aadd3;
  box-shadow: 0 0 0 3px rgba(46, 95, 163, 0.1);
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.req {
  color: var(--red);
}

.field-narrow {
  max-width: 110px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.checkbox input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

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

.fieldset {
  margin: 1.25rem 0 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.fieldset legend {
  padding: 0 0.35rem;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-card {
  max-width: 860px;
  padding: 1.5rem;
}

.form-narrow {
  max-width: 480px;
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-section:last-of-type {
  margin-bottom: 0;
}

.form-section h2 {
  margin-bottom: 0.9rem;
  font-size: 1rem;
  font-weight: 600;
}

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

.form-grid .field:has(textarea) {
  grid-column: 1 / -1;
}

.form-section > .field {
  margin-top: 1rem;
}

.form-card > .field + .field,
.form-card > .field + .checkbox,
.form-card > .checkbox + .field {
  margin-top: 1rem;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.filter-bar input,
.filter-bar select {
  width: auto;
  min-height: 36px;
}

.filter-bar select {
  min-width: 150px;
}

.search-field {
  position: relative;
  flex: 1 1 240px;
  min-width: 200px;
}

.search-field input {
  padding-left: 2.1rem;
}

.search-field .icon {
  position: absolute;
  top: 50%;
  left: 0.7rem;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.inline-form .field {
  flex: 1;
}

.location-form {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.location-form h3 {
  margin-bottom: 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.location-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr 90px auto auto;
  align-items: end;
  gap: 0.75rem;
}

/* --------------------------------------------------------------------------
   Dashboard pieces
   -------------------------------------------------------------------------- */

.steps {
  list-style: none;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.step:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.step:first-child {
  padding-top: 0;
}

.step-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.step strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
}

.step p {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.step.is-done .step-dot {
  border-color: #c6e5d1;
  background: var(--green-soft);
  color: var(--green);
}

.step.is-next .step-dot {
  border-color: #cfe0f2;
  background: var(--primary-soft);
  color: var(--primary);
}

.checklist {
  list-style: none;
}

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}

.checklist li:last-child {
  border-bottom: 0;
}

.check {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 0.1rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: transparent;
  font-size: 11px;
  font-weight: 700;
}

.checklist li.is-done .check {
  border-color: #c6e5d1;
  background: var(--green-soft);
  color: var(--green);
}

.checklist a,
.checklist span {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
}

.checklist a:hover {
  color: var(--primary);
}

.checklist p {
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.card-actions {
  margin-top: 1rem;
}

.source-list {
  display: flex;
  flex-direction: column;
}

.source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.source-row:first-child {
  padding-top: 0;
}

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

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

.source-name {
  display: block;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
}

.source-note {
  display: block;
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.activity {
  list-style: none;
}

.activity li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.activity li:first-child {
  padding-top: 0;
}

.activity li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.activity-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 0.4rem;
  border-radius: 50%;
  background: var(--primary);
}

.activity-title {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.activity-title a {
  color: var(--ink);
  font-weight: 500;
}

.activity-title a:hover {
  color: var(--primary);
}

.activity-meta {
  display: block;
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 11.5px;
}

.member-list {
  list-style: none;
}

.member-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.member-list li:first-child {
  padding-top: 0;
}

.member-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.member-main {
  min-width: 0;
  flex: 1;
}

.member-name {
  display: block;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
}

.member-email {
  display: block;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.detail-list {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 0.6rem 0.75rem;
  margin-bottom: 1.25rem;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.detail-list dd {
  color: var(--ink);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.scope-note {
  margin-top: 1.5rem;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: #f4f8fc;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.scope-note strong {
  color: var(--ink);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Empty states and errors
   -------------------------------------------------------------------------- */

.empty {
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-sm {
  padding: 1.5rem;
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 0.75rem;
  border-radius: 50%;
  background: var(--muted-bg);
  color: var(--muted);
}

.empty-icon .icon {
  width: 22px;
  height: 22px;
}

.empty h2 {
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.empty p {
  max-width: 480px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.empty .btn {
  margin-top: 1rem;
}

.empty-sm .btn {
  margin-top: 0.75rem;
}

.error-page {
  max-width: 560px;
  margin: 2rem auto;
  padding: 2.5rem 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.error-code {
  color: var(--primary);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.error-page h1,
.error-standalone h1 {
  margin-top: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.error-page p,
.error-standalone p {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.error-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: var(--bg);
}

.error-standalone {
  width: 100%;
  max-width: 448px;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 25px 50px rgba(27, 42, 74, 0.16);
  text-align: center;
}

.error-standalone .brand {
  margin-bottom: 1rem;
}

.error-standalone .btn {
  margin-top: 1.25rem;
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */

.auth-body {
  background: var(--bg);
}

.login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.login-card {
  width: 100%;
  max-width: 448px;
  padding-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 25px 50px rgba(27, 42, 74, 0.16);
}

.login-card-header {
  padding: 2rem 2rem 1.25rem;
  text-align: center;
}

.login-card-header .brand {
  justify-content: center;
  margin-bottom: 1.25rem;
}

.login-card-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-card-header p {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1rem 2rem 0.5rem;
}

.btn-login {
  width: 100%;
  min-height: 44px;
  margin-top: 0.25rem;
  font-size: 1rem;
}

.login-note {
  padding: 0.75rem 2rem 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.login-card .alert {
  margin: 0 2rem 1rem;
}

.login-foot {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (min-width: 640px) {
  .topbar-inner,
  .page,
  .footer {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .topbar-inner,
  .page,
  .footer {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (max-width: 1020px) {
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }

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

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

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

  .head-actions {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .client-identity {
    display: none;
  }
}

@media (max-width: 720px) {
  .nav,
  .client-identity,
  .nav-divider {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .topbar-inner {
    padding: 0 1rem;
  }

  .page {
    padding: 1.25rem 1rem;
  }

  .footer {
    padding: 0.5rem 1rem 1.5rem;
  }

  .page-head {
    margin-bottom: 1.25rem;
  }

  .page-head > .btn {
    width: 100%;
  }

  .page-head-lg h1 {
    font-size: 1.6rem;
  }

  .page-head h1 {
    font-size: 1.35rem;
  }

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

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

  .location-grid .field-narrow {
    max-width: none;
  }

  .inline-form {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.2rem;
  }

  .detail-list dd {
    margin-bottom: 0.55rem;
  }

  .card {
    padding: 1.25rem;
    overflow-x: auto;
  }

  .card-flush {
    padding: 0;
  }

  .card-flush .card-head {
    padding: 1rem 1.25rem 0.65rem;
  }

  .table {
    min-width: 560px;
  }

  .table-compact {
    min-width: 0;
  }

  .table-compact .col-optional {
    display: none;
  }

  .table-compact .nowrap {
    white-space: normal;
  }

  .table-compact td {
    overflow-wrap: anywhere;
  }

  .table th,
  .table td {
    padding: 0.7rem 0.65rem;
  }

  .table th:first-child,
  .table td:first-child {
    padding-left: 1.25rem;
  }

  .table th:last-child,
  .table td:last-child {
    padding-right: 1.25rem;
  }

  .form-card {
    padding: 1.25rem;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .btn {
    flex: 1;
  }

  .filter-bar .search-field {
    flex-basis: 100%;
  }

  .filter-bar select {
    flex: 1;
    min-width: 0;
  }

  .login-card-header,
  .login-form {
    padding-left: 1.4rem;
    padding-right: 1.4rem;
  }

  .login-card .alert {
    margin-left: 1.4rem;
    margin-right: 1.4rem;
  }
}

@media (max-width: 420px) {
  .topbar-inner {
    padding: 0 0.75rem;
  }

  .brand-wordmark {
    height: 36px;
    padding: 0 0.65rem;
    font-size: 13px;
  }

  .topbar-right {
    gap: 0;
  }

  .card {
    padding: 1rem;
  }

  .card-flush {
    padding: 0;
  }

  .table th:first-child,
  .table td:first-child {
    padding-left: 1rem;
  }

  .table th:last-child,
  .table td:last-child {
    padding-right: 1rem;
  }

  .login {
    padding: 1rem;
  }

  .login-card-header {
    padding: 1.5rem 1.25rem 1rem;
  }

  .login-form {
    padding: 1rem 1.25rem 0.5rem;
  }

  .login-card .alert {
    margin-left: 1.25rem;
    margin-right: 1.25rem;
  }

  .login-note {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .member-list li {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .topbar,
  .footer,
  .btn,
  .filter-bar,
  .pager,
  .head-actions,
  .actions-cell,
  .skip-link {
    display: none !important;
  }

  body,
  .shell,
  .page {
    background: #ffffff !important;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .card,
  .stat {
    break-inside: avoid;
    box-shadow: none;
  }
}
