@font-face {
  font-family: "MingShi Brand Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/source-han-serif-brand-regular.woff2") format("woff2");
}

@font-face {
  font-family: "MingShi Brand Serif";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/source-han-serif-brand-bold.woff2") format("woff2");
}

:root {
  --bg: #ffffff;
  --surface: #f4f4f1;
  --surface-strong: #ecece7;
  --fg: #111111;
  --muted: #747474;
  --border: #d8d8d2;
  --accent: #b85a1c;
  --accent-soft: #f5e9df;
  --link: #5665ed;
  --link-soft: #e9ebff;
  --success: #187557;
  --success-soft: #e1f2eb;
  --danger: #a63b32;
  --danger-soft: #f7e6e3;
  --warning: #9c6816;
  --warning-soft: #f7efd9;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-brand: "MingShi Brand Serif", "Source Han Serif SC", "Source Han Serif CN", "Noto Serif CJK SC", "Songti SC", STSong, serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --shadow: 6px 6px 0 var(--border);
  --radius: 9px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.is-busy {
  cursor: progress;
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  margin: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.12;
  letter-spacing: -.04em;
}

[hidden] {
  display: none !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

.wrap {
  width: min(1184px, calc(100% - 40px));
  margin-inline: auto;
}

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

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

.small {
  font-size: 12px;
}

.eyebrow {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-brand);
  font-weight: 800;
  letter-spacing: -.04em;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--fg);
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  box-shadow: 3px 3px 0 var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
}

.brand-mark.brand-mark-image {
  width: 24px;
  height: 24px;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.brand-mark.brand-mark-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-domain {
  color: var(--muted);
  font-weight: 500;
}

.btn {
  min-height: 42px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.btn:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 3px 3px 0 var(--fg);
}

.btn-primary:hover {
  background: #a94f17;
  box-shadow: 1px 1px 0 var(--fg);
}

.btn-link {
  border-color: var(--link);
  color: var(--link);
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-small {
  min-height: 34px;
  padding-inline: 12px;
  font-size: 11px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  font-size: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label,
.field-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.control {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--bg);
  color: var(--fg);
}

textarea.control {
  min-height: 96px;
  padding-block: 11px;
  resize: vertical;
}

.control::placeholder {
  color: #a1a1a1;
}

.control:focus {
  border-color: var(--link);
  box-shadow: 0 0 0 1px var(--link);
}

.control[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}

.field-error {
  min-height: 16px;
  color: var(--danger);
  font-size: 11px;
}

.window {
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.window-bar {
  min-height: 48px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
}

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

.window-path {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.window-status {
  color: var(--link);
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  flex: 0 0 auto;
  border: 1px solid var(--fg);
  background: var(--success);
}

.status-dot.pending {
  background: var(--warning);
}

.status-dot.error {
  background: var(--danger);
}

.badge {
  min-height: 25px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.success,
.badge.succeeded {
  border-color: #9ccab8;
  background: var(--success-soft);
  color: var(--success);
}

.badge.queued,
.badge.running,
.badge.warning {
  border-color: #ddc587;
  background: var(--warning-soft);
  color: var(--warning);
}

.badge.failed,
.badge.cancelled,
.badge.expired,
.badge.danger {
  border-color: #d9aaa5;
  background: var(--danger-soft);
  color: var(--danger);
}

.inline-status {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

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

.callout {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--link);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12px;
}

.callout.error {
  border-left-color: var(--danger);
}

.empty-state {
  padding: 48px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--fg);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: min(420px, calc(100% - 48px));
  padding: 13px 16px;
  border: 1px solid var(--fg);
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  box-shadow: 4px 4px 0 var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  box-shadow: 4px 4px 0 var(--danger);
}

.loading-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: currentColor;
  animation: loading-pulse 1.1s ease-in-out infinite alternate;
}

.visually-hidden {
  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;
}

@keyframes loading-pulse {
  from { opacity: .25; transform: scale(.78); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 600px) {
  .wrap {
    width: min(100% - 28px, 1184px);
  }

  .brand-domain {
    display: none;
  }

  .window {
    box-shadow: 4px 4px 0 var(--border);
  }

  .window-path,
  .window-status .optional {
    display: none;
  }

  .toast {
    right: 14px;
    bottom: 14px;
    max-width: calc(100% - 28px);
  }
}

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