:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --ink: #18202f;
  --muted: #677085;
  --line: #dbe2ec;
  --blue: #2563eb;
  --green: #0f9f6e;
  --amber: #b86b00;
  --red: #d0483e;
  --shadow: 0 16px 42px rgba(24, 32, 47, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

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

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  background: #101828;
  color: #f8fafc;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f2b84b;
  color: #101828;
  font-weight: 800;
}

.brand span {
  display: block;
  color: #a9b4c7;
  font-size: 13px;
  margin-top: 3px;
}

.tool-list {
  display: grid;
  gap: 10px;
}

.tool-btn {
  width: 100%;
  min-height: 78px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #f8fafc;
  text-align: left;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
}

.tool-btn:hover,
.tool-btn.active {
  background: #ffffff;
  color: #111827;
}

.tool-btn span {
  display: block;
  color: inherit;
  opacity: 0.7;
  font-size: 12px;
  margin-bottom: 5px;
}

.main {
  padding: 28px;
  min-width: 0;
}

.topbar {
  min-height: 108px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.top-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

.muted {
  color: var(--muted);
  line-height: 1.7;
  max-width: 760px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.auth-trigger,
.user-menu .ghost {
  padding: 0 13px;
}

.user-menu {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.user-menu span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 14px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--amber);
}

.dot.ok {
  background: var(--green);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

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

.form-panel {
  padding: 20px;
  display: grid;
  gap: 16px;
}

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

.field label {
  font-size: 14px;
  font-weight: 700;
}

.required {
  color: var(--red);
}

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

textarea {
  min-height: 118px;
  resize: vertical;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.primary {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.ghost {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.result-panel {
  min-height: 560px;
  padding: 20px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.run-meta {
  margin: 18px 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.result-box {
  min-height: 360px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: 18px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  line-height: 1.7;
  overflow: auto;
}

.modal[hidden] {
  display: none;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.46);
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
  padding: 20px;
}

.auth-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 18px 0;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 8px;
}

.auth-tab {
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
  color: var(--muted);
}

.auth-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 6px rgba(24, 32, 47, 0.08);
}

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

.auth-form .field span {
  font-size: 14px;
  font-weight: 700;
}

.auth-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff1f0;
  color: var(--red);
  font-size: 13px;
}

@media (max-width: 920px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

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

  .topbar {
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }
}
