:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #17201d;
  background: #f4f7f6;
  font-synthesis: none;
  letter-spacing: 0;
  --ink: #17201d;
  --muted: #66736e;
  --soft: #f4f7f6;
  --panel: #ffffff;
  --line: #d8e0dd;
  --line-strong: #c5d0cc;
  --green: #087b65;
  --green-dark: #05624f;
  --green-soft: #e8f4f0;
  --blue: #2168a6;
  --blue-soft: #e9f2fa;
  --amber: #936116;
  --amber-soft: #fbf0d8;
  --red: #b23c3c;
  --red-soft: #fbeaea;
  --shadow: 0 18px 55px rgba(28, 45, 39, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--soft);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--soft);
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  height: 38px;
  padding: 0 10px;
}

textarea {
  min-height: 92px;
  padding: 9px 10px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(8, 123, 101, 0.28);
  outline-offset: 1px;
}

a {
  color: inherit;
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

[hidden] {
  display: none !important;
}

.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;
}

.boot-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd6d2;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.auth-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(36, 56, 48, 0.12);
}

.auth-brand {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 17px 22px;
  border-bottom: 1px solid var(--line);
}

.auth-brand div,
.brand-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.auth-brand strong,
.brand-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-brand span:last-child,
.brand-copy small {
  color: var(--muted);
  font-size: 12px;
}

.auth-form {
  display: grid;
  gap: 15px;
  padding: 28px 28px 30px;
}

.auth-heading h1 {
  margin: 0;
  font-size: 23px;
}

.auth-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

label {
  min-width: 0;
  display: grid;
  gap: 6px;
  color: #4d5a55;
  font-size: 13px;
}

label > small {
  color: var(--muted);
  line-height: 1.45;
}

.brand-mark {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  border-left: 4px solid #0f8b73;
  border-right: 3px solid #df5060;
  background: #17201d;
  color: #fff;
  font-size: 19px;
  font-weight: 800;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.header-main {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 30px;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-copy strong {
  font-size: 18px;
}

.account-menu {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}

.role-label {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 4px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 700;
}

.text-button,
.link-button {
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
}

.text-button {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.text-button.muted {
  color: var(--muted);
  font-weight: 500;
}

.link-button {
  color: var(--green);
  font-weight: 700;
}

.main-nav {
  height: 50px;
  display: flex;
  align-items: stretch;
  gap: 28px;
  overflow-x: auto;
  padding: 0 30px;
  border-top: 1px solid #edf0ef;
  scrollbar-width: none;
}

.main-nav::-webkit-scrollbar {
  display: none;
}

.main-nav button {
  position: relative;
  flex: 0 0 auto;
  border: 0;
  padding: 0;
  color: #5f6c67;
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}

.main-nav button::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: transparent;
}

.main-nav button:hover,
.main-nav button.active {
  color: var(--green);
}

.main-nav button.active::after {
  background: var(--green);
}

.page-shell {
  width: min(1640px, 100%);
  margin: 0 auto;
  padding: 30px clamp(18px, 4vw, 76px) 70px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-heading {
  min-height: 66px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.page-heading h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.page-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.heading-with-filter {
  align-items: center;
}

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 0 13px;
  color: #293530;
  background: #fff;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  border-color: #9eada7;
  background: #f9fbfa;
}

.button.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.button.primary:hover {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.button.danger {
  border-color: #e4bcbc;
  color: var(--red);
}

.button.small {
  min-height: 31px;
  padding: 0 9px;
  font-size: 12px;
}

.button.wide {
  width: 100%;
}

.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.date-filter {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  overflow: hidden;
  background: #fff;
}

.preset-group button {
  height: 36px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 11px;
  color: #52605a;
  background: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.preset-group button:last-child {
  border-right: 0;
}

.preset-group button.active {
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 700;
}

.custom-dates {
  display: flex;
  align-items: center;
  gap: 7px;
}

.custom-dates input {
  width: 138px;
}

.custom-dates span {
  color: var(--muted);
  font-size: 12px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  border: 1px solid var(--line);
  background: #fff;
}

.metric {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 9px;
  padding: 15px 18px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  overflow: hidden;
  color: #17201d;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-banner {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 14px;
  padding: 8px 12px;
  border-left: 3px solid var(--green);
  background: var(--green-soft);
}

.scope-banner div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.scope-banner span {
  color: var(--muted);
  font-size: 12px;
}

.section-block {
  margin-top: 28px;
}

.section-heading {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 17px;
}

.table-frame {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: #fff;
}

.data-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table th {
  height: 42px;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
  color: #63716b;
  background: #edf2f0;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.data-table td {
  height: 50px;
  padding: 8px 13px;
  border-bottom: 1px solid #e7ecea;
  color: #27322e;
  font-size: 12px;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #f8fbfa;
}

.data-table tbody tr.clickable-row {
  cursor: pointer;
}

.jobs-table th:first-child,
.jobs-table td:first-child {
  min-width: 152px;
  white-space: nowrap;
}

.jobs-table td:nth-child(2) {
  min-width: 130px;
}

.job-id-button {
  border: 0;
  padding: 0;
  color: var(--green);
  background: transparent;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 750;
}

.cell-main {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-subline {
  display: block;
  max-width: 220px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--muted);
  background: #edf1ef;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.status-badge.success,
.status-badge.active {
  color: var(--green-dark);
  background: var(--green-soft);
}

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

.status-badge.failed,
.status-badge.disabled {
  color: var(--red);
  background: var(--red-soft);
}

.status-badge.queued {
  color: #56645f;
  background: #edf1ef;
}

.status-badge.cancelled {
  color: #675870;
  background: #f0ebf3;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-action {
  border: 0;
  padding: 0;
  color: var(--green);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
}

.empty-state,
.empty-detail {
  min-height: 190px;
  display: grid;
  place-items: center;
  padding: 28px;
  color: #7b8782;
  text-align: center;
  font-size: 13px;
}

.filter-bar {
  min-height: 60px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #f8faf9;
}

.filter-bar .search-field {
  flex: 1 1 240px;
  max-width: 360px;
}

.filter-bar .status-field {
  width: 142px;
}

.field-inline {
  display: block;
}

.pagination {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.pagination > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-layout {
  display: grid;
  gap: 28px;
}

.settings-section,
.settings-form {
  max-width: 860px;
  padding: 20px 0 25px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}

.settings-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.key-empty {
  min-height: 110px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
}

.key-empty p {
  margin: 0;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 7px 0 20px;
}

.info-grid > div {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
}

.info-grid dt {
  color: var(--muted);
  font-size: 11px;
}

.info-grid dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.copy-field,
.password-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-field {
  width: min(720px, 100%);
  min-height: 46px;
  padding: 6px 7px 6px 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8faf9;
}

.copy-field code {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: #33413b;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 800px);
  gap: 38px;
}

.docs-nav {
  position: sticky;
  top: 142px;
  align-self: start;
  display: grid;
  border-left: 1px solid var(--line-strong);
}

.docs-nav a {
  padding: 9px 13px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.docs-nav a:hover {
  color: var(--green);
}

.docs-content {
  min-width: 0;
}

.docs-content section {
  padding: 0 0 30px;
  scroll-margin-top: 145px;
}

.docs-content h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.docs-content p {
  color: #50605a;
  font-size: 13px;
  line-height: 1.7;
}

.docs-content pre {
  max-width: 100%;
  overflow: auto;
  margin: 12px 0 0;
  padding: 16px;
  border: 1px solid #303a36;
  border-radius: 5px;
  color: #e6eee9;
  background: #1f2824;
  font-size: 12px;
  line-height: 1.7;
}

.endpoint-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 10px 0;
}

.method {
  min-width: 43px;
  display: inline-flex;
  justify-content: center;
  border-radius: 4px;
  padding: 4px 6px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.method.get { background: var(--blue); }
.method.post { background: var(--green); }

.admin-users-layout {
  display: grid;
  grid-template-columns: minmax(680px, 1.4fr) minmax(320px, 0.8fr);
  border: 1px solid var(--line);
  background: #fff;
}

.user-list-pane {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.filter-bar.compact {
  border: 0;
  border-bottom: 1px solid var(--line);
}

.filter-bar.compact input {
  flex: 1 1 230px;
}

.filter-bar.compact select {
  width: 125px;
}

.user-list-pane .table-frame {
  border: 0;
}

.users-table {
  min-width: 720px;
}

.user-detail-pane {
  min-width: 0;
  background: #fbfcfc;
}

.user-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.user-detail-head h2 {
  margin: 7px 0 0;
  font-size: 20px;
}

.user-detail-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.user-info-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 22px 22px;
}

.settings-form {
  display: grid;
  gap: 18px;
}

.settings-form.narrow {
  max-width: 560px;
}

.connection-result {
  padding: 10px 12px;
  border-left: 3px solid var(--green);
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 12px;
}

.connection-result.error {
  border-left-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}

.form-message {
  min-height: 18px;
  color: var(--green-dark);
  font-size: 12px;
  line-height: 1.5;
}

.form-message.error {
  color: var(--red);
}

.dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(20, 29, 26, 0.48);
}

.large-dialog {
  width: min(980px, calc(100vw - 28px));
}

.asset-dialog {
  width: min(1180px, calc(100vw - 24px));
  height: min(860px, calc(100dvh - 24px));
  overflow: hidden;
  background: #121916;
}

.asset-dialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog-head {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-head.dark {
  border-bottom-color: #313a36;
  color: #fff;
  background: #1b2420;
}

.dialog-head h2 {
  max-width: min(720px, 72vw);
  margin: 2px 0 0;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-eyebrow {
  color: var(--muted);
  font-size: 10px;
}

.dialog-head.dark .dialog-eyebrow {
  color: #aebbb6;
}

.icon-button {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: #59655f;
  background: #eef2f0;
  font-size: 20px;
  line-height: 1;
}

.icon-button.dark {
  color: #eaf0ed;
  background: #33403a;
}

.dialog-body {
  padding: 20px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: #fafbfb;
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

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

.task-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line);
}

.task-detail-item {
  min-width: 0;
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 11px 13px;
  background: #fff;
}

.task-detail-item span {
  color: var(--muted);
  font-size: 10px;
}

.task-detail-item strong {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.prompt-block,
.error-block {
  margin-top: 18px;
}

.prompt-block h3,
.error-block h3,
.assets-block h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.prompt-block p,
.error-block p {
  margin: 0;
  padding: 12px;
  border-left: 3px solid var(--line-strong);
  color: #36443e;
  background: #f7f9f8;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.error-block p {
  border-left-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}

.assets-block {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.asset-item {
  min-width: 0;
  display: grid;
  gap: 7px;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

button.asset-item {
  cursor: zoom-in;
}

.asset-media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #84918b;
  background: #edf1ef;
  font-size: 11px;
}

.asset-item:hover .asset-media {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(8, 123, 101, 0.12);
}

.asset-media img,
.asset-media video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.asset-media audio {
  width: calc(100% - 14px);
}

.asset-caption {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.asset-caption strong,
.asset-caption span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-caption strong { font-size: 11px; }
.asset-caption span { color: var(--muted); font-size: 10px; }

.asset-dialog-body {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 14px;
  background: #121916;
}

.asset-dialog-body img,
.asset-dialog-body video {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
}

.asset-dialog-body audio {
  width: min(720px, 90vw);
}

.secret-dialog {
  width: min(720px, calc(100vw - 28px));
}

.secret-dialog p {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 12px;
}

.secret-value {
  width: 100%;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  max-width: min(380px, calc(100vw - 36px));
  padding: 11px 14px;
  border-radius: 5px;
  color: #fff;
  background: #26332e;
  box-shadow: 0 10px 32px rgba(27, 39, 34, 0.25);
  font-size: 12px;
  line-height: 1.5;
}

.toast.error {
  background: #a53737;
}

@media (max-width: 1180px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .metric:nth-child(3) {
    border-right: 0;
  }

  .metric:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

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

  .user-list-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 820px) {
  .header-main {
    padding: 8px 16px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .brand-copy small,
  .role-label {
    display: none;
  }

  .account-menu {
    gap: 11px;
  }

  .text-button {
    max-width: 108px;
  }

  .main-nav {
    gap: 22px;
    padding: 0 16px;
  }

  .page-shell {
    padding: 22px 14px 54px;
  }

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

  .page-heading h1 {
    font-size: 22px;
  }

  .docs-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .docs-nav {
    position: static;
    display: flex;
    overflow-x: auto;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .docs-nav a {
    flex: 0 0 auto;
  }

  .user-detail-head {
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .header-main {
    min-height: 56px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-copy small,
  #currentRole {
    display: none;
  }

  .main-nav {
    height: 46px;
  }

  .page-heading {
    min-height: 54px;
    margin-bottom: 12px;
  }

  .date-filter {
    width: 100%;
  }

  .preset-group {
    max-width: 100%;
  }

  .preset-group button {
    padding: 0 9px;
  }

  .custom-dates {
    width: 100%;
  }

  .custom-dates input {
    min-width: 0;
    flex: 1;
    width: auto;
  }

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

  .metric {
    min-height: 82px;
    padding: 12px;
  }

  .metric:nth-child(2n) {
    border-right: 0;
  }

  .metric:nth-child(-n + 4) {
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(3) {
    border-right: 1px solid var(--line);
  }

  .metric strong {
    font-size: 20px;
  }

  .filter-bar .date-filter,
  .filter-bar .search-field,
  .filter-bar .status-field {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
  }

  .scope-banner,
  .pagination {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .info-grid,
  .user-info-grid,
  .task-detail-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .full {
    grid-column: auto;
  }

  .copy-field {
    align-items: stretch;
    flex-direction: column;
  }

  .copy-field code {
    width: 100%;
    padding: 4px 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .dialog {
    max-height: calc(100dvh - 16px);
  }

  .dialog-body {
    padding: 16px;
  }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spinner { animation: none; }
}
