:root {
  --brand-950: #031a3d;
  --brand-900: #062858;
  --brand-800: #073b7e;
  --brand-700: #075cd9;
  --brand-600: #0877ee;
  --brand-500: #09a8f2;
  --cyan-500: #09cad9;
  --cyan-100: #dffbff;
  --ink-950: #061a38;
  --ink-800: #183250;
  --ink-600: #526a85;
  --ink-500: #71849a;
  --line: #dce7f1;
  --line-strong: #c9d8e8;
  --surface: #ffffff;
  --surface-soft: #f5f9fd;
  --surface-blue: #edf6ff;
  --success: #049b78;
  --success-soft: #e6f8f3;
  --warning: #c87500;
  --warning-soft: #fff5df;
  --danger: #c83f4d;
  --danger-soft: #fff0f1;
  --shadow-sm: 0 8px 24px rgba(17, 55, 92, 0.07);
  --shadow-lg: 0 22px 70px rgba(6, 37, 77, 0.16);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --sidebar-width: 264px;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC",
    system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink-950);
  background: var(--surface-soft);
}

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

html {
  min-width: 320px;
  min-height: 100%;
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink-950);
  background: #f1f6fb;
  -webkit-font-smoothing: antialiased;
}

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

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

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

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

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

img {
  display: block;
  max-width: 100%;
}

button {
  border: 0;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(9, 202, 217, 0.55);
  outline-offset: 2px;
}

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

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand-700);
  transform: translateY(-150%);
}

.skip-link:focus {
  color: #fff;
  transform: translateY(0);
}

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

.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow-y: auto;
  color: #fff;
  background:
    radial-gradient(circle at 20% 5%, rgba(9, 202, 217, 0.2), transparent 24%),
    linear-gradient(180deg, var(--brand-950), #05285c 62%, #063c82);
  box-shadow: 14px 0 38px rgba(4, 26, 61, 0.12);
}

.sidebar-brand {
  display: flex;
  min-height: 88px;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand:hover {
  color: #fff;
}

.brand-logo {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  overflow: hidden;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-brand > span:last-child {
  display: grid;
  gap: 3px;
}

.sidebar-brand strong {
  font-size: 18px;
  letter-spacing: 0.08em;
}

.sidebar-brand small {
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  display: grid;
  gap: 5px;
  padding: 24px 14px;
}

.sidebar-nav p {
  margin: 18px 12px 7px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.sidebar-nav p:first-child {
  margin-top: 0;
}

.sidebar-nav a {
  position: relative;
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 13px;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 600;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.sidebar-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

.sidebar-nav a.active {
  color: #fff;
  border-color: rgba(103, 226, 255, 0.25);
  background: linear-gradient(110deg, rgba(7, 92, 217, 0.85), rgba(9, 202, 217, 0.25));
  box-shadow: inset 3px 0 0 #36e7f2;
}

.nav-mark {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.62);
  background: rgba(255, 255, 255, 0.08);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.sidebar-nav a.active .nav-mark {
  color: var(--brand-900);
  background: #bffaff;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 24px 22px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.sidebar-footer strong {
  font-size: 12px;
}

.sidebar-footer small {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  text-overflow: ellipsis;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  background: #37e5be;
  box-shadow: 0 0 0 5px rgba(55, 229, 190, 0.12);
}

.admin-stage {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: 80px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px clamp(20px, 3vw, 44px);
  border-bottom: 1px solid rgba(201, 216, 232, 0.78);
  background: rgba(255, 255, 255, 0.91);
  box-shadow: 0 5px 20px rgba(17, 55, 92, 0.04);
  backdrop-filter: blur(18px);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-title p,
.topbar-title h1 {
  margin: 0;
}

.topbar-title p {
  margin-bottom: 2px;
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topbar-title h1 {
  font-size: 18px;
  letter-spacing: -0.02em;
}

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

.topbar-site-link {
  padding: 7px 12px;
  border: 1px solid #cfe0f2;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #f6fbff;
}

.operator {
  display: flex;
  align-items: center;
  gap: 9px;
}

.operator-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-700), var(--cyan-500));
  box-shadow: 0 6px 16px rgba(7, 92, 217, 0.2);
  font-size: 13px;
  font-weight: 800;
}

.operator > span:last-child {
  display: grid;
  gap: 1px;
}

.operator strong {
  font-size: 12px;
}

.operator small {
  color: var(--ink-500);
  font-size: 10px;
}

.icon-button,
.link-button {
  cursor: pointer;
  color: var(--ink-600);
  background: transparent;
}

.link-button {
  padding: 7px 4px;
  font-size: 12px;
  font-weight: 700;
}

.link-button:hover {
  color: var(--brand-700);
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.mobile-menu-button {
  display: none;
}

.main-content {
  width: min(100%, 1540px);
  flex: 1;
  padding: 34px clamp(20px, 3vw, 44px) 44px;
  margin: 0 auto;
}

.admin-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px clamp(20px, 3vw, 44px);
  border-top: 1px solid var(--line);
  color: var(--ink-500);
  background: rgba(255, 255, 255, 0.62);
  font-size: 11px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 26px;
  margin-bottom: 24px;
}

.page-heading.compact {
  align-items: flex-start;
  margin-bottom: 20px;
}

.page-heading h2,
.page-heading p {
  margin: 0;
}

.page-heading h2 {
  max-width: 900px;
  margin-top: 7px;
  font-size: clamp(23px, 2vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.page-heading p {
  margin-top: 8px;
  color: var(--ink-600);
  font-size: 13px;
  line-height: 1.7;
}

.eyebrow {
  color: var(--brand-700);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.heading-actions,
.result-actions,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    border-color 150ms ease,
    background 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button-primary {
  color: #fff;
  border-color: var(--brand-700);
  background: linear-gradient(135deg, var(--brand-700), #0783e7);
  box-shadow: 0 8px 20px rgba(7, 92, 217, 0.2);
}

.button-primary:hover:not(:disabled) {
  color: #fff;
  box-shadow: 0 11px 28px rgba(7, 92, 217, 0.27);
}

.button-secondary {
  color: var(--brand-700);
  border-color: #c9dcf1;
  background: #fff;
}

.button-secondary:hover:not(:disabled) {
  color: var(--brand-700);
  border-color: #94bde7;
  background: #f5faff;
}

.button-quiet {
  color: var(--ink-600);
  border-color: var(--line);
  background: #f8fbfd;
}

.button-quiet:hover:not(:disabled) {
  color: var(--brand-700);
  border-color: #b8d2ec;
}

.button-block {
  width: 100%;
}

.button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
  box-shadow: none;
}

.button.loading .button-spinner {
  display: block;
}

.button.loading > span {
  opacity: 0.72;
}

.button-spinner {
  display: none;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 650ms linear infinite;
}

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

.panel {
  border: 1px solid rgba(201, 216, 232, 0.9);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-heading {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 20px;
  border-bottom: 1px solid #edf2f7;
}

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

.panel-heading h2,
.panel-heading h3,
.panel-heading p {
  margin: 0;
}

.panel-heading h2,
.panel-heading h3 {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.panel-heading > div:has(.eyebrow) {
  display: grid;
  gap: 3px;
}

.panel-heading small,
.panel-count {
  color: var(--ink-500);
  font-size: 11px;
}

.panel-count strong {
  color: var(--brand-700);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 20px 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 100% 100%, rgba(9, 202, 217, 0.12), transparent 44%),
    #fff;
  box-shadow: var(--shadow-sm);
}

.metric-card::after {
  position: absolute;
  right: -25px;
  bottom: -42px;
  width: 120px;
  height: 120px;
  content: "";
  border: 16px solid rgba(7, 92, 217, 0.045);
  border-radius: 50%;
}

.metric-card p,
.metric-card strong,
.metric-card small {
  position: relative;
  z-index: 1;
  display: block;
  margin: 0;
}

.metric-card p {
  color: var(--ink-600);
  font-size: 12px;
}

.metric-card > strong {
  margin: 8px 0 4px;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.metric-card small {
  color: var(--ink-500);
  font-size: 10px;
}

.metric-index {
  position: absolute;
  top: 17px;
  right: 18px;
  color: #d6e8fb;
  font-size: 19px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(290px, 0.7fr);
  gap: 16px;
}

.quick-list {
  display: grid;
  padding: 8px 16px;
}

.quick-list a {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 14px 4px;
  border-bottom: 1px solid #edf2f7;
  color: var(--ink-950);
}

.quick-list a:last-child {
  border-bottom: 0;
}

.quick-list a:hover strong,
.quick-list a:hover > b {
  color: var(--brand-700);
}

.quick-list a > span:nth-child(2) {
  display: grid;
  gap: 3px;
}

.quick-list strong {
  font-size: 12px;
}

.quick-list small {
  color: var(--ink-500);
  font-size: 10px;
}

.quick-list b {
  color: var(--ink-500);
}

.quick-number,
.step-label {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 9px;
  color: var(--brand-700);
  background: var(--surface-blue);
  font-size: 9px;
  font-weight: 800;
}

.system-health {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  margin: 0 16px 16px;
  border: 1px solid #ccece5;
  border-radius: 12px;
  background: var(--success-soft);
}

.system-health > div {
  display: grid;
  gap: 2px;
}

.system-health strong {
  color: #047a61;
  font-size: 11px;
}

.system-health small {
  color: #4d8276;
  font-size: 9px;
}

.system-health .status-dot {
  border-color: #fff;
}

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

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

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--ink-500);
  background: #fbfdff;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

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

tbody tr:not(.skeleton-row):hover {
  background: #f8fbff;
}

td strong {
  display: block;
  font-size: 12px;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--ink-500);
  font-size: 9px;
}

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

.table-link {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 750;
}

.skeleton-row td {
  height: 120px;
  color: var(--ink-500);
  text-align: center;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 7px;
  text-align: center;
}

.empty-state strong {
  font-size: 16px;
}

.empty-state p {
  margin: 0 0 7px;
  color: var(--ink-500);
  font-size: 11px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge::before {
  width: 5px;
  height: 5px;
  content: "";
  border-radius: 50%;
  background: currentColor;
}

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

.status-draft,
.status-warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-failed,
.status-error,
.status-archived {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-processing,
.status-validating {
  color: var(--brand-700);
  background: var(--surface-blue);
}

.filter-panel {
  padding: 16px;
  margin-bottom: 14px;
}

.filter-form {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) minmax(160px, 0.6fr) auto auto;
  align-items: end;
  gap: 12px;
}

.audit-filter {
  grid-template-columns: minmax(200px, 1.2fr) repeat(3, minmax(140px, 0.6fr)) auto auto;
}

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.field > span:first-child,
.generated-link > label {
  color: var(--ink-800);
  font-size: 11px;
  font-weight: 750;
}

.field input,
.field select,
.field textarea,
.generated-link input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  background: #fff;
  font-size: 12px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #a8c4e0;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.generated-link input:focus {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(7, 92, 217, 0.1);
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(200, 63, 77, 0.08);
}

.field-hint,
.field-error {
  min-height: 12px;
  color: var(--ink-500);
  font-size: 9px;
  line-height: 1.4;
}

.field-error {
  color: var(--danger);
}

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

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

.form-stack {
  display: grid;
  gap: 17px;
}

.form-section + .form-section {
  margin-top: 16px;
}

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
  color: var(--ink-600);
  font-size: 11px;
  line-height: 1.5;
}

.check-field input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  accent-color: var(--brand-700);
}

.password-field,
.select-action {
  position: relative;
  display: flex;
  gap: 8px;
}

.password-field input,
.select-action select {
  flex: 1;
}

.password-field button {
  position: absolute;
  top: 50%;
  right: 8px;
  padding: 6px;
  cursor: pointer;
  color: var(--brand-700);
  background: transparent;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 750;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  align-items: start;
  gap: 16px;
}

.editor-aside {
  position: sticky;
  top: 98px;
  padding: 22px;
}

.editor-aside h3 {
  margin: 7px 0 16px;
  font-size: 17px;
}

.check-list {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 20px;
  color: var(--ink-600);
  font-size: 11px;
  line-height: 1.5;
}

.check-list li::before {
  position: absolute;
  top: 4px;
  left: 0;
  display: grid;
  width: 13px;
  height: 13px;
  content: "✓";
  place-items: center;
  border-radius: 50%;
  color: var(--success);
  background: var(--success-soft);
  font-size: 8px;
  font-weight: 900;
}

.aside-actions {
  display: grid;
  gap: 9px;
  margin-top: 24px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 15px;
  color: var(--ink-500);
  font-size: 10px;
}

.breadcrumb a {
  color: var(--ink-500);
}

.breadcrumb a:hover {
  color: var(--brand-700);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-500);
  font-size: 10px;
}

.pagination > div {
  display: flex;
  gap: 7px;
}

.notice {
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.55;
}

.notice-error {
  color: #a72535;
  border-color: #f2c8cd;
  background: var(--danger-soft);
}

.notice-success {
  color: #05745d;
  border-color: #bee7dc;
  background: var(--success-soft);
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0;
  margin: 0 0 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  list-style: none;
  box-shadow: var(--shadow-sm);
}

.stepper li {
  position: relative;
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--ink-500);
  font-size: 11px;
}

.stepper li + li::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 1px;
  height: 24px;
  content: "";
  background: var(--line);
  transform: translateY(-50%);
}

.stepper li span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: #edf2f7;
  font-size: 9px;
  font-weight: 800;
}

.stepper li.active {
  color: var(--brand-700);
  background: var(--surface-blue);
}

.stepper li.active span,
.stepper li.complete span {
  color: #fff;
  background: var(--brand-700);
}

.stepper li.complete {
  color: var(--success);
}

.report-builder {
  max-width: 1180px;
  margin: 0 auto;
}

.builder-step {
  overflow: hidden;
}

.step-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid #edf2f7;
  background: #fbfdff;
}

.step-actions.split {
  justify-content: space-between;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 22px;
}

.upload-zone {
  position: relative;
  display: grid;
  min-height: 210px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  cursor: pointer;
  border: 1px dashed #a9c7e6;
  border-radius: 14px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(9, 202, 217, 0.09), transparent 35%),
    #fafdff;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--brand-600);
  background-color: #f1f8ff;
  transform: translateY(-1px);
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-zone:focus-within {
  outline: 3px solid rgba(9, 202, 217, 0.45);
  outline-offset: 2px;
}

.upload-zone strong {
  font-size: 13px;
}

.upload-zone small {
  color: var(--ink-500);
  font-size: 10px;
}

.upload-type {
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--brand-700);
  background: var(--surface-blue);
  font-size: 9px;
  font-weight: 800;
}

.upload-zone-required .upload-type {
  color: #00859c;
  background: var(--cyan-100);
}

.enterprise-upload-summary {
  cursor: default;
}

.enterprise-upload-summary:hover {
  border-color: #a9c7e6;
  background-color: #fafdff;
  transform: none;
}

.enterprise-upload-summary small {
  max-width: 420px;
  line-height: 1.7;
}

.file-selection {
  max-width: 100%;
  overflow: hidden;
  padding: 6px 9px;
  margin-top: 5px;
  border-radius: 7px;
  color: var(--ink-600);
  background: #edf3f8;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-zone.has-file .file-selection {
  color: var(--success);
  background: var(--success-soft);
}

.upload-guidance {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 15px 22px;
  margin: 0 22px 22px;
  border: 1px solid #dce9f5;
  border-radius: 12px;
  background: #f7fbff;
}

.upload-guidance div {
  display: grid;
  gap: 3px;
}

.upload-guidance strong,
.upload-guidance a {
  font-size: 10px;
}

.upload-guidance span {
  color: var(--ink-500);
  font-size: 9px;
  line-height: 1.5;
}

.template-links {
  display: grid;
  gap: 6px;
}

.template-links a {
  white-space: nowrap;
}

.validation-progress {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 26px 22px;
}

.validation-progress > span {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 4px solid #dceafa;
  border-top-color: var(--brand-700);
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

.validation-progress p {
  display: grid;
  gap: 4px;
  margin: 0;
}

.validation-progress strong {
  font-size: 13px;
}

.validation-progress small {
  color: var(--ink-500);
  font-size: 10px;
}

.validation-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 22px 22px 10px;
}

.validation-summary article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfdff;
}

.validation-summary span,
.validation-summary strong {
  display: block;
}

.validation-summary span {
  color: var(--ink-500);
  font-size: 9px;
}

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

.validation-issues {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 22px 24px;
}

.validation-issues h4,
.validation-issues p {
  margin: 0;
}

.validation-issues h4 {
  font-size: 13px;
}

.validation-issues p {
  margin-top: 5px;
  color: var(--ink-500);
  font-size: 9px;
  line-height: 1.6;
}

.validation-issues ul {
  display: grid;
  gap: 7px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.validation-issues li {
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--ink-600);
  background: #f4f7fa;
  font-size: 10px;
  line-height: 1.45;
}

.validation-issues li.error {
  color: var(--danger);
  background: var(--danger-soft);
}

.validation-issues li.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.validation-issues li.success {
  color: var(--success);
  background: var(--success-soft);
}

.publish-recovery {
  display: grid;
  gap: 5px;
  margin: 0 22px 20px;
}

.publish-recovery strong,
.publish-recovery span,
.publish-recovery a {
  display: block;
}

.publish-recovery a {
  width: fit-content;
  margin-top: 3px;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.result-step {
  padding: 48px clamp(22px, 7vw, 90px);
  text-align: center;
}

.result-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--success), #23d2b0);
  box-shadow: 0 12px 28px rgba(4, 155, 120, 0.23);
  font-size: 24px;
  font-weight: 900;
}

.result-step h3 {
  margin: 8px 0 6px;
  font-size: 24px;
}

.result-step > p {
  margin: 0;
  color: var(--ink-600);
  font-size: 12px;
}

.generated-link {
  display: grid;
  max-width: 720px;
  gap: 7px;
  margin: 28px auto 18px;
  text-align: left;
}

.generated-link > span {
  display: flex;
  gap: 8px;
}

.generated-link input {
  flex: 1;
  color: var(--brand-700);
  background: #f6faff;
}

.result-actions {
  justify-content: center;
}

.detail-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding: 26px;
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid rgba(67, 156, 239, 0.4);
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    radial-gradient(circle at 85% 10%, rgba(56, 229, 242, 0.26), transparent 32%),
    linear-gradient(125deg, #06275a, #075cd9 64%, #099bd5);
  box-shadow: 0 18px 45px rgba(7, 68, 142, 0.18);
}

.detail-hero .eyebrow {
  color: #73f0fa;
}

.detail-title-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-title-line h2 {
  margin: 7px 0;
  font-size: clamp(22px, 2.4vw, 34px);
  letter-spacing: -0.04em;
}

.detail-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
}

.detail-hero p b {
  margin: 0 6px;
}

.detail-hero code {
  color: #fff;
  font-family: inherit;
}

.detail-hero .button-secondary {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.detail-hero .button-primary {
  color: var(--brand-900);
  border-color: #b8fbff;
  background: #b8fbff;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.detail-meta-grid article {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

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

.detail-meta-grid span,
.detail-meta-grid small {
  color: var(--ink-500);
  font-size: 9px;
}

.detail-meta-grid strong {
  margin: 6px 0 4px;
  overflow: hidden;
  font-size: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-panel {
  margin-bottom: 14px;
  overflow: hidden;
}

.preview-origin {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--brand-700);
  background: var(--surface-blue);
  font-size: 9px;
  font-weight: 750;
}

.browser-preview {
  margin: 18px;
  overflow: hidden;
  border: 1px solid #cfddea;
  border-radius: 13px;
  background: #edf3f8;
}

.browser-bar {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid #d6e1eb;
  background: #f8fafc;
}

.browser-bar i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c3d0dc;
}

.browser-bar i:first-child { background: #f0858f; }
.browser-bar i:nth-child(2) { background: #f2c36a; }
.browser-bar i:nth-child(3) { background: #65cfac; }

.browser-bar span {
  min-width: 0;
  overflow: hidden;
  padding: 5px 10px;
  margin-left: 7px;
  border-radius: 7px;
  color: var(--ink-500);
  background: #fff;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-placeholder {
  display: grid;
  min-height: 330px;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--ink-600);
  background:
    radial-gradient(circle at 50% 50%, rgba(9, 202, 217, 0.13), transparent 28%),
    #f7fbff;
}

.preview-placeholder img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  filter: saturate(0.8);
  opacity: 0.62;
}

.preview-placeholder strong {
  margin-top: 5px;
  font-size: 14px;
}

.preview-placeholder p {
  margin: 0;
  color: var(--ink-500);
  font-size: 10px;
}

.browser-preview iframe {
  width: 100%;
  height: min(62vh, 680px);
  border: 0;
  background: #fff;
}

.detail-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.55fr);
  gap: 14px;
  margin-bottom: 14px;
}

.report-facts dl {
  display: grid;
  gap: 0;
  padding: 8px 20px 16px;
  margin: 0;
}

.report-facts dl div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #edf2f7;
}

.report-facts dl div:last-child {
  border-bottom: 0;
}

.report-facts dt,
.report-facts dd {
  margin: 0;
  font-size: 10px;
  line-height: 1.5;
}

.report-facts dt {
  color: var(--ink-500);
}

.report-facts dd {
  overflow-wrap: anywhere;
  color: var(--ink-800);
  font-weight: 650;
}

.danger-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 19px 22px;
  border-color: #f0dbc1;
  background: #fffdf8;
}

.danger-panel h3,
.danger-panel p {
  margin: 0;
}

.danger-panel h3 {
  margin: 5px 0;
  font-size: 14px;
}

.danger-panel p {
  color: var(--ink-600);
  font-size: 10px;
  line-height: 1.5;
}

.safe-note {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--success);
  background: var(--success-soft);
  font-size: 9px;
  font-weight: 750;
}

dialog {
  width: min(92vw, 520px);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  color: var(--ink-950);
  background: #fff;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(3, 21, 49, 0.62);
  backdrop-filter: blur(3px);
}

.confirm-dialog form {
  padding: 26px;
}

.confirm-dialog h2 {
  margin: 7px 0 8px;
  font-size: 20px;
}

.confirm-dialog p {
  margin: 0 0 18px;
  color: var(--ink-600);
  font-size: 11px;
  line-height: 1.6;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 23px;
}

.audit-dialog {
  width: min(94vw, 680px);
}

.audit-dialog .panel-heading {
  padding: 18px 22px;
}

.audit-dialog dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 12px 22px;
  margin: 0;
}

.audit-dialog dl div {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.audit-dialog dt,
.audit-dialog dd {
  margin: 0;
  font-size: 10px;
}

.audit-dialog dt {
  margin-bottom: 4px;
  color: var(--ink-500);
}

.audit-dialog dd {
  overflow-wrap: anywhere;
  font-weight: 650;
}

.audit-dialog .dialog-actions {
  padding: 0 22px 20px;
}

.error-state {
  display: grid;
  min-height: calc(100vh - 220px);
  place-items: center;
  align-content: center;
  text-align: center;
}

.error-code {
  color: #d9e8f7;
  font-size: clamp(70px, 12vw, 150px);
  font-weight: 900;
  line-height: 0.82;
}

.error-state h2 {
  margin: 12px 0 8px;
  font-size: 24px;
}

.error-state p {
  max-width: 500px;
  margin: 0;
  color: var(--ink-600);
  font-size: 11px;
  line-height: 1.65;
}

.error-state .request-id {
  margin-top: 10px;
}

.error-state .heading-actions {
  margin-top: 22px;
}

.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 10%, rgba(9, 202, 217, 0.16), transparent 28%),
    #edf5fb;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
}

.auth-story {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  overflow: hidden;
  padding: clamp(30px, 5vw, 70px);
  color: #fff;
  background:
    radial-gradient(circle at 80% 18%, rgba(16, 213, 230, 0.3), transparent 26%),
    radial-gradient(circle at 22% 80%, rgba(8, 119, 238, 0.5), transparent 35%),
    linear-gradient(135deg, var(--brand-950), #06377a 55%, #0674ce);
}

.auth-story::after {
  position: absolute;
  right: -170px;
  bottom: -190px;
  width: 520px;
  height: 520px;
  content: "";
  border: 80px solid rgba(255, 255, 255, 0.045);
  border-radius: 50%;
}

.auth-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 13px;
}

.auth-brand > span {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  padding: 5px;
  border-radius: 15px;
  background: #fff;
}

.auth-brand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-brand > div {
  display: grid;
  gap: 3px;
}

.auth-brand strong {
  font-size: 19px;
  letter-spacing: 0.08em;
}

.auth-brand small {
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.auth-copy {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: auto 0;
}

.auth-copy .eyebrow {
  color: #65edf5;
}

.auth-copy h1 {
  margin: 13px 0 18px;
  font-size: clamp(38px, 4.5vw, 66px);
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.auth-copy p {
  max-width: 590px;
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 14px;
  line-height: 1.9;
}

.auth-points {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.auth-points span {
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.06);
  font-size: 9px;
}

.auth-card {
  display: grid;
  width: min(100%, 470px);
  place-self: center;
  gap: 28px;
  padding: clamp(32px, 5vw, 60px);
}

.auth-card-heading p,
.auth-card-heading h2,
.auth-card-heading > span:last-child {
  display: block;
  margin: 0;
}

.auth-card-heading p {
  color: var(--brand-700);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.auth-card-heading h2 {
  margin: 9px 0 7px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.auth-card-heading > span:last-child {
  color: var(--ink-500);
  font-size: 11px;
}

.mobile-auth-logo {
  display: none;
}

.auth-help {
  margin: 2px 0 0;
  color: var(--ink-500);
  font-size: 9px;
  line-height: 1.55;
  text-align: center;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  border: 1px solid #bcd4ed;
  border-radius: 11px;
  color: var(--ink-800);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow-lg);
  font-size: 11px;
  line-height: 1.5;
  animation: toast-in 180ms ease both;
}

.toast.error {
  color: var(--danger);
  border-color: #f0c5ca;
}

.toast.success {
  color: var(--success);
  border-color: #bce6db;
}

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

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

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

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

  .audit-filter .field-search {
    grid-column: 1 / -1;
  }
}

@media (max-width: 920px) {
  :root {
    --sidebar-width: 248px;
  }

  .sidebar {
    transform: translateX(-105%);
    transition: transform 200ms ease;
  }

  body.sidebar-open {
    overflow: hidden;
  }

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

  .sidebar-backdrop {
    position: fixed;
    z-index: 35;
    inset: 0;
    background: rgba(3, 21, 49, 0.56);
    backdrop-filter: blur(2px);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block !important;
  }

  .admin-stage {
    margin-left: 0;
  }

  .mobile-menu-button {
    display: grid;
  }

  .topbar-site-link,
  .operator > span:last-child {
    display: none;
  }

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

  .editor-aside {
    position: static;
  }

  .auth-shell {
    grid-template-columns: minmax(0, 1fr) minmax(390px, 0.72fr);
  }
}

@media (max-width: 760px) {
  .main-content {
    padding-top: 24px;
  }

  .page-heading,
  .detail-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .heading-actions,
  .detail-hero .heading-actions {
    width: 100%;
  }

  .detail-hero .heading-actions .button {
    flex: 1;
  }

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

  .field-search {
    grid-column: 1 / -1;
  }

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

  .field-wide {
    grid-column: auto;
  }

  .upload-guidance {
    grid-template-columns: 1fr;
  }

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

  .validation-issues {
    grid-template-columns: 1fr;
  }

  .stepper li {
    gap: 5px;
  }

  .stepper li strong {
    font-size: 9px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-story {
    display: none;
  }

  .auth-card {
    min-height: 100vh;
  }

  .mobile-auth-logo {
    display: grid;
    width: 60px;
    height: 60px;
    place-items: center;
    padding: 5px;
    margin-bottom: 22px;
    border-radius: 17px;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }

  .mobile-auth-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 66px;
    padding: 10px 14px;
  }

  .topbar-title p {
    display: none;
  }

  .topbar-title h1 {
    font-size: 15px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .operator-avatar {
    width: 32px;
    height: 32px;
  }

  .main-content {
    padding: 20px 14px 34px;
  }

  .admin-footer {
    display: grid;
    padding: 16px 14px;
  }

  .page-heading h2 {
    font-size: 24px;
  }

  .metric-grid,
  .validation-summary,
  .detail-meta-grid {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .metric-card {
    padding: 16px;
  }

  .metric-card > strong {
    font-size: 25px;
  }

  .panel-heading {
    min-height: 62px;
    padding: 14px;
  }

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

  .filter-form .field-search,
  .audit-filter .field-search {
    grid-column: auto;
  }

  .form-grid,
  .upload-grid {
    padding: 16px;
  }

  .upload-zone {
    min-height: 180px;
  }

  .upload-guidance {
    margin: 0 16px 16px;
  }

  .stepper {
    grid-template-columns: repeat(4, 1fr);
  }

  .stepper li {
    display: grid;
    min-height: 66px;
    place-items: center;
    align-content: center;
  }

  .stepper li strong {
    font-size: 8px;
  }

  .step-actions,
  .step-actions.split {
    display: grid;
    grid-template-columns: 1fr;
    padding: 14px 16px;
  }

  .step-actions .button {
    width: 100%;
  }

  .generated-link > span {
    display: grid;
  }

  .detail-hero {
    padding: 20px;
  }

  .detail-title-line {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-hero .heading-actions {
    display: grid;
  }

  .browser-preview {
    margin: 12px;
  }

  .preview-placeholder {
    min-height: 240px;
  }

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

  .audit-dialog dl {
    grid-template-columns: 1fr;
  }

  .auth-card {
    width: 100%;
    padding: 28px 20px;
  }
}

@media (max-width: 390px) {
  .metric-grid,
  .validation-summary,
  .detail-meta-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions .link-button {
    display: none;
  }
}

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