:root {
  --ink: #111827;
  --ink-2: #374151;
  --ink-3: #6b7280;
  --faint: #9ca3af;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --bg: #ffffff;
  --paper: #fafafa;
  --zebra: #f7f8fa;
  --hover: #f1f3f5;
  --blue: #1a73e8;
  --blue-dark: #1557b0;
  --blue-tint: #e8f0fe;
  --green: #188038;
  --green-tint: #dcfce7;
  --amber: #b06000;
  --amber-tint: #fef3c7;
  --red: #b91c1c;
  --red-tint: #fee2e2;
  --purple: #6941c6;
  --purple-tint: #ede9fe;
  --radius: 10px;
  --radius-small: 6px;
  --shadow-card: 0 1px 2px rgba(17, 24, 39, .05), 0 1px 3px rgba(17, 24, 39, .04);
  --font-ui: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink-2);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.65;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-width: 0; background: var(--bg); }

body { min-height: 100vh; overflow-x: hidden; }

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

button, select { min-height: 44px; }

button { touch-action: manipulation; }

.nav {
  position: sticky;
  z-index: 10;
  top: 0;
  height: 58px;
  border-bottom: 1px solid rgba(229, 231, 235, .9);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
}

.nav__inner {
  width: min(1180px, 100%);
  height: 100%;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav__brand { margin-right: auto; color: var(--ink); font-weight: 700; text-decoration: none; }

.shell { width: min(1180px, 100%); margin: 0 auto; padding: 36px 40px 72px; }

.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.login-panel { width: min(520px, 100%); margin: 7vh auto 0; padding: 28px; }

.section-title { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }

.section-title h1 { margin: 0; color: var(--ink); font-size: clamp(24px, 4vw, 32px); line-height: 1.28; }

.section-title p { margin: 8px 0 0; color: var(--ink-3); }

.section-index, .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.section-index, .pill--blue { color: var(--blue-dark); background: var(--blue-tint); }
.pill--green { color: var(--green); background: var(--green-tint); }
.pill--amber { color: var(--amber); background: var(--amber-tint); }
.pill--red { color: var(--red); background: var(--red-tint); }
.pill--purple { color: var(--purple); background: var(--purple-tint); }
.pill--neutral { color: var(--ink-2); background: var(--hover); }

form { margin-top: 24px; }

label { display: block; margin: 0 0 7px; color: var(--ink); font-size: 13px; font-weight: 700; }

input, select, textarea {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-small);
  color: var(--ink);
  background: #fff;
  outline: none;
}

input, select { padding: 10px 12px; }

textarea { min-height: 132px; padding: 12px; resize: vertical; line-height: 1.65; }

input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }

form .button { width: 100%; margin-top: 16px; }

.button {
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 8px 16px;
  color: var(--ink-2);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s, color .15s, background-color .15s, transform .15s;
}

.button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue-dark); transform: translateY(-1px); }
.button:focus-visible { outline: 3px solid var(--blue-tint); outline-offset: 2px; }
.button:disabled { color: var(--faint); background: var(--zebra); cursor: not-allowed; }
.button--primary { border-color: var(--blue); color: #fff; background: var(--blue); }
.button--primary:hover:not(:disabled) { color: #fff; background: var(--blue-dark); }
.button--quiet { min-height: 36px; padding: 5px 12px; }
.button--small { min-height: 34px; padding: 4px 10px; font-size: 12px; }

.feedback { min-height: 1.65em; margin: 12px 0 0; color: var(--red); font-size: 13px; }
.feedback[data-tone="success"] { color: var(--green); }
.feedback[data-tone="neutral"] { color: var(--ink-3); }

.hero {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 28px;
  align-items: stretch;
  padding: 32px 0 36px;
  background: linear-gradient(180deg, var(--blue-tint), transparent 78%);
}

.eyebrow { margin: 0 0 8px; color: var(--blue-dark); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.hero h1 { margin: 0; color: var(--ink); font-size: clamp(32px, 4.6vw, 50px); line-height: 1.18; letter-spacing: -.02em; }
.hero__intro { max-width: 700px; margin: 18px 0 0; color: var(--ink-2); font-size: 17px; line-height: 1.75; }
.hero__meta { padding: 22px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.meta-label, .meta-note { color: var(--ink-3); font-size: 12px; }
.hero__meta strong { overflow-wrap: anywhere; color: var(--ink); font-size: 19px; line-height: 1.4; }

.workspace-grid { display: grid; grid-template-columns: minmax(260px, .72fr) minmax(0, 1.7fr); gap: 28px; align-items: start; }
.control-column, .main-column { min-width: 0; display: grid; gap: 20px; }
.control-card, .composer { padding: 20px; }
.control-card select + .inline-actions { margin-top: 18px; }

.subhead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink);
  font-size: 19px;
  line-height: 1.35;
}

.subhead::before { content: ""; width: 4px; height: 16px; flex: 0 0 auto; border-radius: 2px; background: var(--blue); }
.inline-actions { display: flex; align-items: center; gap: 10px; }
.inline-actions .grow { flex: 1; margin: 0; }
.hint { margin: 9px 0 0; color: var(--ink-3); font-size: 13px; line-height: 1.6; }

.check-list { display: grid; gap: 9px; }
.check-row { display: flex; gap: 9px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-row input { width: 18px; height: 18px; margin: 3px 0 0; }
.check-row label { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.approval-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.approval-item:last-child { border-bottom: 0; }
.approval-operation { margin: 0; padding: 10px; border-radius: var(--radius-small); background: var(--paper); color: var(--ink-2); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.approval-actions { display: flex; gap: 8px; margin-top: 10px; }

.composer__footer { display: flex; align-items: flex-end; gap: 18px; margin-top: 12px; }
.composer__footer .hint { flex: 1; }
.composer__footer .button { flex: 0 0 auto; }

.section-heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 4px 0 12px; }
.section-heading-row h2 { margin: 0; color: var(--ink); font-size: clamp(23px, 2.8vw, 32px); line-height: 1.28; }
.run-list { display: grid; gap: 14px; }
.run-card { padding: 20px; }
.run-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.run-card__head .pill { flex: 0 0 auto; align-self: flex-start; }
.run-card__task { margin: 0; min-width: 0; color: var(--ink); font-weight: 700; overflow-wrap: anywhere; white-space: pre-wrap; }
.run-card__meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; color: var(--ink-3); font-size: 12px; }
.run-card__result { margin-top: 14px; padding: 13px; border-radius: var(--radius-small); background: var(--paper); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.run-card__actions { margin-top: 14px; }
.unknown-note { margin: 12px 0 0; color: var(--amber); font-size: 13px; font-weight: 700; }
.empty-state { padding: 28px; text-align: center; }
.empty-state strong { color: var(--ink); }
.empty-state p { margin: 6px 0 0; color: var(--ink-3); }

[hidden] { display: none !important; }

@media (max-width: 980px) {
  .nav__inner, .shell { padding-left: 24px; padding-right: 24px; }
  .hero, .workspace-grid { grid-template-columns: 1fr; gap: 20px; }
  .hero__meta { min-height: 126px; }
}

@media (max-width: 600px) {
  .nav__inner, .shell { padding-left: 16px; padding-right: 16px; }
  .shell { padding-top: 20px; padding-bottom: 48px; }
  .nav__brand { font-size: 15px; }
  .hero { padding-top: 24px; }
  .login-panel, .control-card, .composer, .run-card { padding: 16px; }
  .composer__footer, .run-card__head { align-items: stretch; flex-direction: column; }
  .composer__footer .button, .section-heading-row .button { width: 100%; }
  .section-heading-row { align-items: stretch; flex-direction: column; }
  .inline-actions { align-items: flex-end; }
}
