:root {
  --ink: #0d0d0d;
  --muted: #5d5d5d;
  --faint: #8f8f8f;
  --canvas: #ffffff;
  --sidebar-surface: #f9f9f9;
  --surface: #ffffff;
  --surface-muted: #f7f7f7;
  --surface-hover: #f1f1f1;
  --line: #ececec;
  --line-strong: #d9d9d9;
  --brand: #0d0d0d;
  --brand-deep: #000000;
  --brand-soft: #ececec;
  --success: #0f7b5f;
  --success-soft: #e7f5f0;
  --warning: #8a5a12;
  --warning-soft: #fff4dc;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --info: #315f9b;
  --info-soft: #edf4ff;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.14);
  --shadow-small: 0 1px 2px rgba(0, 0, 0, 0.04);
  --radius: 8px;
  --radius-small: 6px;
  --sidebar: 260px;
  color: var(--ink);
  background: var(--canvas);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "WenQuanYi Zen Hei", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
}

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

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

button {
  color: inherit;
}

a {
  color: inherit;
}

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

.hidden {
  display: none !important;
}

.clipboard-fallback {
  position: fixed;
  inset: -1000px auto auto -1000px;
}

.mobile-only {
  display: none !important;
}

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

.danger-text {
  color: var(--danger);
}

.text-right {
  text-align: right;
}

.spacer-14 {
  height: 16px;
}

.loading-panel {
  height: 300px;
  margin-top: 16px;
}

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

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  font-weight: 650;
  line-height: 1.2;
}

.brand small {
  margin-top: 2px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.2;
  text-transform: uppercase;
}

.brand-large .brand-mark {
  width: 38px;
  height: 38px;
  font-size: 18px;
}

.brand-large strong {
  font-size: 17px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.auth-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 104px 24px 48px;
  background: #ffffff;
}

.auth-story {
  position: absolute;
  top: 24px;
  right: 28px;
  left: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.story-status {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #ffffff;
  padding: 7px 10px;
  font-size: 11px;
}

.story-status strong {
  color: var(--ink);
  font-weight: 600;
}

.status-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.auth-card {
  width: min(400px, 100%);
}

.auth-heading {
  text-align: center;
}

.auth-heading h2 {
  margin: 0;
  font-size: 30px;
  font-weight: 650;
  line-height: 1.2;
}

.auth-heading > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin: 30px 0 24px;
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 3px;
}

.segment {
  height: 40px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.segment:hover {
  color: var(--ink);
}

.segment.active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

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

.auth-footnote {
  margin: 24px 0 0;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  background: #ffffff;
  padding: 10px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  min-height: 104px;
  resize: vertical;
  line-height: 1.55;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #b8b8b8;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

input::placeholder,
textarea::placeholder {
  color: #a3a3a3;
}

.auth-form input {
  min-height: 52px;
  font-size: 14px;
}

.input-action {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid .span-two {
  grid-column: 1 / -1;
}

.toggle-field {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 11px 12px;
  cursor: pointer;
}

.toggle-field:hover {
  border-color: var(--line-strong);
}

.toggle-field input {
  width: 18px;
  min-height: 18px;
  flex: 0 0 auto;
  accent-color: var(--ink);
}

.toggle-field span,
.toggle-field strong,
.toggle-field small {
  display: block;
}

.toggle-field strong {
  font-size: 12px;
}

.toggle-field small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.45;
}

.form-message {
  min-height: 20px;
  margin: 13px 0 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.button.primary {
  color: #ffffff;
  background: var(--ink);
}

.button.primary:hover {
  background: #2b2b2b;
}

.button.secondary {
  border-color: var(--line-strong);
  background: #ffffff;
}

.button.secondary:hover,
.button.quiet:hover {
  background: var(--surface-hover);
}

.button.quiet {
  border-color: var(--line);
  color: var(--muted);
  background: #ffffff;
}

.button.danger {
  border-color: #ffd6d1;
  color: var(--danger);
  background: var(--danger-soft);
}

.button.full {
  width: 100%;
  min-height: 52px;
  justify-content: space-between;
  padding-inline: 17px;
  font-size: 14px;
}

.button.compact {
  min-height: 44px;
  white-space: nowrap;
}

.button.tiny {
  min-height: 32px;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 11px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
}

.icon-button:hover {
  background: var(--surface-hover);
}

.app-shell {
  min-height: 100vh;
  background: var(--canvas);
}

.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  background: var(--sidebar-surface);
  padding: 14px 12px 12px;
}

.sidebar-head {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 10px;
}

.sidebar-head .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-size: 14px;
}

.main-nav {
  display: grid;
  min-height: 0;
  gap: 2px;
  overflow-y: auto;
  padding: 4px 0 12px;
  scrollbar-width: thin;
}

.nav-group {
  display: grid;
  gap: 2px;
  margin-top: 4px;
}

.nav-group-toggle {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 8px;
  color: #666666;
  background: transparent;
  padding: 7px 10px 7px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.nav-group-toggle:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.nav-group-label {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.nav-group-icon {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  color: currentColor;
  font-size: 14px;
  font-weight: 600;
}

.nav-group-chevron {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  font-size: 15px;
  transition: transform 0.16s ease;
}

.nav-group-toggle[aria-expanded="true"] .nav-group-chevron {
  transform: rotate(180deg);
}

.nav-group-items {
  display: grid;
  gap: 2px;
}

.nav-group-items[hidden] {
  display: none;
}

.nav-item {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  color: #444444;
  background: transparent;
  padding: 7px 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

.nav-item:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.nav-item.active {
  color: var(--ink);
  background: #e9e9e9;
  font-weight: 600;
}

.nav-icon {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  color: currentColor;
  font-size: 16px;
}

.nav-item.active .nav-icon {
  background: #ffffff;
}

.nav-subitem {
  min-height: 36px;
  padding-left: 20px;
}

.nav-subitem .nav-icon {
  width: 22px;
  height: 22px;
  font-size: 14px;
}

.sidebar-foot {
  display: grid;
  gap: 4px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.connection-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.connection-card small,
.connection-card strong {
  display: block;
}

.connection-card small {
  color: var(--faint);
  font-size: 10px;
}

.connection-card strong {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
}

.health-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--warning);
}

.health-dot.good {
  background: var(--success);
}

.health-dot.bad {
  background: var(--danger);
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar);
  background: var(--canvas);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 10px 28px;
  backdrop-filter: blur(14px);
}

.topbar-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.topbar-title > div {
  min-width: 0;
}

.topbar h1 {
  max-width: 38vw;
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .eyebrow {
  display: none;
}

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

.topbar-refresh {
  border: 1px solid var(--line);
  font-size: 17px;
}

.download-client-button {
  min-width: 132px;
  min-height: 46px;
  justify-content: flex-start;
  padding: 6px 12px;
  text-align: left;
  white-space: nowrap;
}

.download-client-icon {
  font-size: 16px;
  line-height: 1;
}

.download-client-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.download-client-title {
  font-size: 12px;
  line-height: 1.15;
}

.download-client-meta {
  max-width: 112px;
  overflow: hidden;
  color: #b8b8b8;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.15;
  text-overflow: ellipsis;
}

.account-chip {
  display: flex;
  max-width: 220px;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 4px 6px;
  cursor: pointer;
  text-align: left;
}

.account-chip:hover {
  background: var(--surface-hover);
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #6e5b4b;
  font-size: 13px;
  font-weight: 650;
}

.account-copy {
  min-width: 0;
}

.account-copy strong,
.account-copy small {
  display: block;
  max-width: 155px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  font-size: 12px;
  font-weight: 600;
}

.account-copy small {
  margin-top: 2px;
  color: var(--faint);
  font-size: 10px;
}

.page-content {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 34px 32px 72px;
  outline: none;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  line-height: 1.3;
}

.page-head p {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

.stat-card {
  min-height: 126px;
  padding: 16px;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.stat-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface-muted);
  font-size: 15px;
}

.stat-value {
  margin-top: 17px;
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
}

.stat-foot {
  margin-top: 10px;
  color: var(--faint);
  font-size: 10px;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 12px;
  margin-top: 12px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 13px 16px;
}

.panel-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--faint);
  font-size: 10px;
}

.panel-body {
  padding: 14px 16px;
}

.panel-body.flush {
  padding: 0;
}

.status-list,
.activity-list,
.card-list {
  display: grid;
  gap: 0;
}

.status-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 11px 0;
}

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

.status-label {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.status-label > span:first-child {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  color: #454545;
  background: var(--surface-muted);
}

.status-label > div {
  min-width: 0;
}

.status-label strong,
.status-label small {
  display: block;
}

.status-label strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-label small {
  max-width: 480px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--faint);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-muted);
  padding: 4px 9px;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.success,
.badge.completed,
.badge.done,
.badge.passed,
.badge.succeeded,
.badge.finalized,
.badge.online,
.badge.connected,
.badge.active {
  color: var(--success);
  background: var(--success-soft);
}

.badge.running,
.badge.dispatched,
.badge.sent,
.badge.acknowledged {
  color: var(--info);
  background: var(--info-soft);
}

.badge.queued,
.badge.pending,
.badge.retrying,
.badge.insufficient_data,
.badge.waiting_login,
.badge.waiting_user {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge.failed,
.badge.rejected,
.badge.cancelled,
.badge.timed_out,
.badge.offline,
.badge.unavailable,
.badge.expired,
.badge.revoked {
  color: var(--danger);
  background: var(--danger-soft);
}

.toolbar {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar > select {
  width: auto;
  min-width: 160px;
}

.download-choice-list {
  display: grid;
  gap: 8px;
}

.download-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.download-choice.recommended {
  border-color: var(--accent);
  background: #f5f9ff;
}

.download-choice > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.download-choice small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monitor-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.7fr) minmax(140px, 0.45fr) auto auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.monitor-filters select,
.monitor-filters input {
  min-height: 40px;
}

.feedback-filters {
  display: grid;
  grid-template-columns: minmax(260px, 420px) auto auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.feedback-filters input {
  min-height: 40px;
}

.feedback-table {
  min-width: 900px;
}

.feedback-preview {
  display: -webkit-box;
  max-width: 420px;
  overflow: hidden;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

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

.feedback-detail-content {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.feedback-detail-content > :first-child {
  margin-top: 0;
}

.feedback-detail-content > :last-child {
  margin-bottom: 0;
}

.feedback-detail-content blockquote {
  margin: 10px 0;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
  padding-left: 12px;
}

.feedback-detail-image {
  display: block;
  width: auto;
  max-width: min(100%, 760px);
  max-height: 560px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: contain;
}

.search-box {
  position: relative;
  width: min(340px, 100%);
}

.search-box input {
  min-height: 40px;
  padding-left: 34px;
}

.search-box::before {
  position: absolute;
  z-index: 1;
  top: 10px;
  left: 12px;
  color: var(--faint);
  content: "⌕";
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

th {
  color: var(--faint);
  background: var(--surface-muted);
  font-size: 9px;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
}

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

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

tbody tr:hover {
  background: #fafafa;
}

.table-primary {
  display: block;
  max-width: 360px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-secondary {
  display: block;
  max-width: 360px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--faint);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.action-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #ffffff;
  padding: 5px 9px;
  cursor: pointer;
  font-size: 10px;
}

.action-button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.action-button.danger {
  color: var(--danger);
}

.monitor-table {
  min-width: 1040px;
}

.monitor-progress strong,
.monitor-progress small {
  display: block;
  white-space: nowrap;
}

.monitor-progress strong {
  font-size: 12px;
}

.monitor-progress small {
  margin-top: 3px;
  color: var(--faint);
  font-size: 9px;
}

.monitor-pager,
.modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.monitor-pager {
  border-top: 1px solid var(--line);
  padding: 12px 2px 0;
  color: var(--faint);
  font-size: 10px;
}

.modal-toolbar {
  min-height: 38px;
}

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

.monitor-json {
  max-height: 360px;
  margin: 10px 0 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-muted);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.match-value {
  font-size: 15px;
  font-weight: 700;
}

.condition-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.condition-counts span,
.condition-list span {
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 9px;
}

.condition-counts .met,
.condition-group.met .condition-list span {
  color: var(--success);
  background: var(--success-soft);
}

.condition-counts .unmet,
.condition-group.unmet .condition-list span {
  color: var(--danger);
  background: var(--danger-soft);
}

.condition-counts .pending,
.condition-group.pending .condition-list span {
  color: var(--warning);
  background: var(--warning-soft);
}

.candidate-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.candidate-summary > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  padding: 12px;
}

.candidate-summary small,
.candidate-summary strong {
  display: block;
}

.candidate-summary small {
  color: var(--faint);
  font-size: 9px;
}

.candidate-summary strong {
  margin-top: 5px;
  font-size: 17px;
}

.candidate-summary .badge {
  margin-top: 7px;
}

.condition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.condition-group {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px;
}

.condition-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.condition-heading h4 {
  margin: 0;
  font-size: 11px;
}

.condition-heading span {
  color: var(--faint);
  font-size: 9px;
}

.condition-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.monitor-record-list {
  display: grid;
  gap: 7px;
}

.monitor-record-list details {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.monitor-record-list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  font-size: 10px;
}

.monitor-record-list summary span {
  color: var(--faint);
}

.monitor-table-detail summary {
  color: var(--info);
  cursor: pointer;
  font-size: 10px;
}

.monitor-table-detail .monitor-json {
  width: min(380px, 70vw);
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.resource-card {
  display: flex;
  min-height: 172px;
  min-width: 0;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.resource-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.resource-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.resource-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-muted);
  font-size: 14px;
  font-weight: 650;
}

.resource-card h3 {
  margin: 14px 0 5px;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 600;
}

.resource-card p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.resource-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 15px;
}

.resource-card-foot small {
  min-width: 0;
  overflow: hidden;
  color: var(--faint);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-stack {
  display: grid;
  gap: 12px;
}

.detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.detail-card h4 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
}

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

.detail-meta div {
  min-width: 0;
  border-radius: 6px;
  background: var(--surface-muted);
  padding: 10px;
}

.detail-meta small,
.detail-meta strong {
  display: block;
}

.detail-meta small {
  color: var(--faint);
  font-size: 9px;
}

.detail-meta strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 10px;
  font-weight: 600;
}

.panel-header-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-header-inline h4 {
  margin: 0;
}

.assignment-list {
  display: grid;
  gap: 0;
}

.assignment-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) minmax(130px, 190px);
  min-height: 56px;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--line);
  padding: 8px 2px;
  cursor: pointer;
}

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

.assignment-row input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--ink);
}

.assignment-row select {
  min-height: 36px;
  padding-block: 6px;
}

.assignment-copy {
  min-width: 0;
}

.assignment-copy strong,
.assignment-copy small {
  display: block;
  overflow-wrap: anywhere;
}

.assignment-copy strong {
  font-size: 12px;
}

.assignment-copy small {
  margin-top: 3px;
  color: var(--faint);
  font-size: 9px;
}

.organization-tree {
  width: 100%;
  overflow-x: auto;
}

.organization-tree-node {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, auto) minmax(230px, auto);
  min-width: 760px;
  min-height: 64px;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 10px 2px 10px calc(4px + var(--tree-depth) * 28px);
}

.organization-tree-node:last-child {
  border-bottom: 0;
}

.organization-tree-node:hover {
  background: var(--surface-hover);
}

.organization-tree-node.root {
  background: #f4f8f5;
}

.organization-tree-identity,
.organization-tree-title,
.organization-tree-metrics {
  display: flex;
  align-items: center;
}

.organization-tree-identity {
  min-width: 0;
  gap: 9px;
}

.organization-tree-connector {
  width: 14px;
  flex: 0 0 14px;
  color: var(--line-strong);
  font-size: 16px;
  line-height: 1;
}

.organization-tree-icon {
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #ffffff;
  font-size: 12px;
}

.organization-tree-node.root .organization-tree-icon {
  color: #237a49;
  border-color: #b9d8c6;
}

.organization-tree-title {
  min-width: 0;
  flex-wrap: wrap;
  gap: 7px;
}

.organization-tree-title strong,
.organization-tree-identity small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.organization-tree-title strong {
  max-width: 300px;
  font-size: 12px;
}

.organization-tree-identity small {
  max-width: 320px;
  margin-top: 3px;
  color: var(--faint);
  font-size: 9px;
}

.organization-tree-metrics {
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.permission-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 10px;
}

.permission-code {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: var(--surface-muted);
  padding: 3px 6px;
  font-size: 10px;
  overflow-wrap: anywhere;
}

.model-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

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

.model-form {
  max-width: 920px;
}

.runtime-error {
  margin: 12px 0 0;
  border-left: 3px solid var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
  padding: 9px 11px;
  font-size: 10px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.credential-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.credential-field label {
  min-width: 0;
}

.credential-value {
  min-height: 74px;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  padding: 40px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  margin: 0 auto 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-muted);
  font-size: 19px;
}

.empty-state h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.empty-state p {
  max-width: 360px;
  margin: 8px auto 17px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.skeleton {
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(90deg, #eeeeee 25%, #f8f8f8 50%, #eeeeee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.modal-layer {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(0, 0, 0, 0.46);
  cursor: default;
}

.modal {
  position: relative;
  width: min(560px, 100%);
  max-height: min(780px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.modal.wide {
  width: min(840px, 100%);
}

.modal-header {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 17px 20px;
  backdrop-filter: blur(12px);
}

.modal-header h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
}

.modal-body {
  padding: 20px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.confirm-copy {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.confirm-name {
  color: var(--ink);
  font-weight: 650;
}

.toast-region {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(360px, calc(100% - 40px));
  gap: 8px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  animation: toast-in 0.2s ease-out;
}

.toast-mark {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--success);
  background: var(--success-soft);
  font-size: 11px;
}

.toast.error .toast-mark {
  color: var(--danger);
  background: var(--danger-soft);
}

.toast strong,
.toast small {
  display: block;
}

.toast strong {
  font-size: 11px;
}

.toast small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

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

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

@media (max-width: 860px) {
  .mobile-only {
    display: grid !important;
  }

  .auth-shell {
    padding-top: 98px;
  }

  .auth-story {
    top: 20px;
    right: 20px;
    left: 20px;
  }

  .sidebar {
    width: min(280px, 86vw);
    transform: translateX(-102%);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .monitor-filters {
    grid-template-columns: 1fr 1fr;
  }

  .monitor-filters .search-box {
    grid-column: 1 / -1;
  }

  .feedback-filters,
  .feedback-detail-meta {
    grid-template-columns: 1fr;
  }

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

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

  .sidebar-backdrop {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(0, 0, 0, 0.35);
  }

  .workspace {
    margin-left: 0;
  }

  .topbar {
    padding-inline: 18px;
  }

  .page-content {
    padding-inline: 20px;
  }

  .panel-grid,
  .model-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .auth-shell {
    align-items: start;
    padding: 118px 20px 36px;
  }

  .auth-story {
    top: 18px;
    right: 16px;
    left: 16px;
  }

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

  .story-status span:nth-child(2) {
    display: none;
  }

  .auth-heading h2 {
    font-size: 26px;
  }

  .input-action {
    grid-template-columns: 1fr;
  }

  .topbar {
    min-height: 64px;
    padding: 8px 10px;
  }

  .topbar-title {
    flex: 1 1 auto;
    overflow: hidden;
  }

  .topbar h1 {
    max-width: 22vw;
    font-size: 15px;
  }

  #refresh-button { display: none; }

  .download-client-button {
    min-width: 108px;
    min-height: 42px;
    padding: 6px 9px;
  }

  .download-client-icon {
    display: none;
  }

  .download-client-title {
    font-size: 11px;
  }

  .download-client-meta {
    max-width: 96px;
    font-size: 8px;
  }

  .account-chip {
    padding: 3px;
  }

  .account-copy {
    display: none;
  }

  .page-content {
    padding: 24px 14px 56px;
  }

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

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

  .page-actions .button {
    flex: 1 1 auto;
  }

  .stat-grid,
  .resource-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: 112px;
  }

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

  .toolbar > select,
  .search-box {
    width: 100%;
  }

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

  .form-grid .span-two {
    grid-column: auto;
  }

  .detail-meta {
    grid-template-columns: 1fr;
  }

  .assignment-row {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .assignment-row select {
    grid-column: 2;
  }

  .organization-tree-node {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    gap: 8px;
    padding-left: calc(2px + var(--tree-depth) * 18px);
  }

  .organization-tree-metrics,
  .organization-tree-node > .row-actions {
    justify-content: flex-start;
    margin-left: 51px;
  }

  .organization-tree-metrics {
    flex-wrap: wrap;
    gap: 8px;
  }

  .permission-summary {
    justify-content: flex-start;
  }

  .model-status-grid {
    grid-template-columns: 1fr;
  }

  .credential-field {
    grid-template-columns: 1fr;
  }

  .modal-layer {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 12px 12px 0 0;
  }

  .modal-actions .button {
    flex: 1 1 auto;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
  }
}

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