:root {
  color-scheme: dark;
  --root: #020304;
  --panel: rgba(7, 8, 11, 0.72);
  --panel-solid: #07080b;
  --panel-soft: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.18);
  --line-soft: rgba(255, 255, 255, 0.09);
  --line-bright: rgba(255, 255, 255, 0.38);
  --text: rgba(255, 255, 255, 0.92);
  --soft: rgba(255, 255, 255, 0.72);
  --muted: rgba(255, 255, 255, 0.48);
  --green: #28c840;
  --yellow: #ffbd2e;
  --red: #ff5f57;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 79% 22%, rgba(255, 255, 255, 0.19), rgba(255, 255, 255, 0.05) 17%, transparent 48%),
    radial-gradient(circle at 42% 82%, rgba(255, 255, 255, 0.09), transparent 38%),
    #020304;
}

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

button {
  cursor: pointer;
}

.hidden,
.hidden-file {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-window {
  width: min(430px, 100%);
  padding: 22px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 78% 12%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08) 26%, transparent 62%),
    rgba(7, 8, 11, 0.82);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.login-brand {
  height: 112px;
  display: grid;
  place-items: center;
  margin-top: 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  font-size: 28px;
  font-weight: 900;
}

.login-window h1 {
  margin: 18px 0 8px;
  text-align: center;
  font-size: 24px;
}

.login-window p {
  margin: 0 0 18px;
  color: var(--soft);
  text-align: center;
}

.login-form {
  display: grid;
  gap: 12px;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--soft);
  font-size: 13px;
}

input,
select,
textarea,
.qt-select {
  width: 100%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 13px;
  outline: none;
}

input,
select,
.qt-select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 108px;
  padding: 11px 12px;
  line-height: 1.62;
}

input:hover,
select:hover,
textarea:hover,
.qt-select:hover {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.3);
}

input:focus,
select:focus,
textarea:focus,
.qt-select:focus {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.48);
}

.form-message {
  min-height: 20px;
  color: #ffb3b3;
  font-size: 13px;
}

.workbench {
  min-height: 100vh;
  display: flex;
  gap: 34px;
  padding: 14px 24px 14px 4px;
}

.sidebar,
.main-panel {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at 74% 9%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.055) 28%, transparent 62%),
    rgba(3, 4, 6, 0.82);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.sidebar {
  position: relative;
  width: 230px;
  min-width: 230px;
  min-height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
  padding: 18px;
  border-radius: 26px;
  transition: width 0.18s ease, min-width 0.18s ease;
}

.sidebar.collapsed {
  width: 74px;
  min-width: 74px;
  padding-left: 13px;
  padding-right: 13px;
}

.window-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
}

.dot.red {
  background: var(--red);
}

.dot.yellow {
  background: var(--yellow);
}

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

.brand-box {
  height: 130px;
  display: grid;
  place-items: center;
  margin-top: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 23px;
  font-weight: 900;
}

.brand-name {
  margin: 12px 0 12px;
  text-align: center;
  font-weight: 860;
}

.collapse-button {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.nav-item,
.qt-button,
.run-button {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.88);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.055));
  font-weight: 760;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 14px;
  text-align: left;
}

.nav-item:hover,
.qt-button:hover,
.run-button:hover {
  background:
    radial-gradient(circle at 54% 24%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.12) 40%, rgba(255, 255, 255, 0.07));
  border-color: rgba(255, 255, 255, 0.42);
}

.nav-item.active {
  border-color: rgba(255, 255, 255, 0.42);
  background:
    radial-gradient(circle at 62% 20%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.16) 38%, rgba(255, 255, 255, 0.07));
}

.nav-item.disabled {
  opacity: 0.52;
  cursor: default;
}

.nav-icon {
  width: 18px;
  text-align: center;
  flex: 0 0 auto;
}

.usage-box {
  margin-top: auto;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.045);
}

.usage-title {
  color: var(--muted);
  font-size: 12px;
}

.usage-name {
  margin: 5px 0 10px;
  font-weight: 800;
  word-break: break-all;
}

.sidebar.collapsed .brand-box,
.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-item span:last-child,
.sidebar.collapsed .usage-box {
  display: none;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0;
}

.main-panel {
  flex: 1;
  min-width: 0;
  border-radius: 0;
  border: none;
  background:
    radial-gradient(circle at 80% 11%, rgba(255, 255, 255, 0.12), transparent 34%),
    rgba(3, 4, 6, 0.3);
  box-shadow: none;
  padding: 20px 2px 14px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.page-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 18px 8px 0;
}

.page-kicker {
  color: rgba(255, 255, 255, 0.46);
  font-size: 12px;
  font-weight: 800;
}

.page-header h2 {
  margin: 2px 0 5px;
  font-size: 30px;
  line-height: 1.1;
}

.page-header p {
  display: none;
  margin: 0;
  color: var(--soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.server-pill {
  min-height: 38px;
  display: flex;
  align-items: center;
  max-width: 360px;
  padding: 0 14px;
  border-radius: 13px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 13px;
}

.main-stage {
  min-height: 620px;
  padding: 40px 22px 20px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.23);
  background:
    radial-gradient(circle at 88% 8%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.07) 26%, transparent 61%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.12));
}

.stage-title {
  display: none;
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 17px;
  font-weight: 900;
}

.toolbar,
.table-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar {
  grid-area: toolbar;
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 10px;
  margin: 10px 0 0;
}

.toolbar-spacer {
  flex: 1;
  min-width: 20px;
}

.qt-button {
  padding: 0 16px;
}

.qt-button.compact {
  min-height: 36px;
  border-radius: 11px;
  padding: 0 12px;
  font-size: 13px;
}

.qt-button.primary {
  width: 100%;
}

.qt-button.ghost {
  background: transparent;
}

.qt-button.danger {
  color: #ffe7e7;
  background: rgba(210, 72, 72, 0.16);
  border-color: rgba(255, 150, 150, 0.3);
}

.qt-button.tall {
  min-height: 84px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(540px, 1fr) 408px;
  grid-template-rows: 307px 44px 390px 44px;
  grid-template-areas:
    "table table"
    "toolbar toolbar"
    "previews actions"
    "extras extras";
  gap: 10px;
  align-items: start;
}

.table-panel {
  grid-area: table;
  min-width: 0;
}

.table-wrap {
  min-height: 307px;
  max-height: 307px;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.19);
  background: rgba(0, 0, 0, 0.25);
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th {
  height: 44px;
  padding: 0 10px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.13);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 13px;
  text-align: left;
}

td {
  height: 41px;
  padding: 5px 10px;
  color: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

tr.selected td {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.07);
}

.status-col {
  width: 34px;
  text-align: center;
}

.index-col {
  width: 58px;
}

.select-col {
  width: 160px;
}

.action-col {
  width: 146px;
}

.row-select {
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 12px;
}

.row-action {
  width: 136px;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 9px;
  font-size: 12px;
}

.status-dot {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.055);
}

.status-dot.running {
  background: var(--yellow);
}

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

.status-dot.failed {
  background: var(--red);
}

.table-actions {
  grid-area: extras;
  min-height: 44px;
  margin-top: 0;
  justify-content: flex-end;
}

#taskSummary {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.preview-strip {
  grid-area: previews;
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 10px;
  height: 390px;
  min-width: 0;
}

.preview-card {
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 390px;
  margin: 0;
  display: grid;
  grid-template-rows: 42px 338px;
  gap: 10px;
}

.preview-card figcaption {
  height: 42px;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
  font-weight: 780;
}

.image-frame {
  position: relative;
  width: 100%;
  height: 338px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at 72% 18%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08) 24%, rgba(0, 0, 0, 0.52) 70%),
    rgba(0, 0, 0, 0.42);
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-frame img[src] + span {
  display: none;
}

.image-frame span {
  color: rgba(255, 255, 255, 0.48);
  font-size: 13px;
  text-align: center;
  padding: 0 18px;
}

.action-stack {
  grid-area: actions;
  height: 390px;
  display: grid;
  grid-template-rows: 112px 84px 84px 84px;
  gap: 10px;
}

.run-button {
  font-size: 24px;
  font-weight: 900;
  border-radius: 28px;
  background:
    radial-gradient(circle at 74% 22%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.15) 40%, rgba(255, 255, 255, 0.06));
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(8px);
}

.qt-dialog {
  width: min(720px, calc(100vw - 48px));
  max-height: calc(100vh - 70px);
  overflow: auto;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    radial-gradient(circle at 80% 8%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.07) 32%, transparent 62%),
    rgba(8, 9, 12, 0.96);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62);
}

.dialog-header {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.dialog-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
}

.dialog-close {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-size: 20px;
  line-height: 1;
}

.settings-dialog {
  width: min(760px, calc(100vw - 48px));
}

.settings-tabs {
  display: flex;
  gap: 10px;
  padding: 16px 18px 0;
}

.settings-tabs .active {
  border-color: rgba(255, 255, 255, 0.46);
  background:
    radial-gradient(circle at 62% 20%, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.13) 42%, rgba(255, 255, 255, 0.06));
}

.dialog-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.setting-note {
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 14px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.log-dialog textarea {
  width: calc(100% - 36px);
  min-height: 420px;
  margin: 18px;
  resize: vertical;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(0, 0, 0, 0.34);
  border-radius: 14px;
}

@media (max-width: 1720px) {
  .workspace-grid {
    grid-template-columns: minmax(540px, 1fr) 408px;
  }
}

@media (max-width: 860px) {
  .workbench {
    padding: 8px;
  }

  .sidebar {
    width: 74px;
    min-width: 74px;
    padding-left: 13px;
    padding-right: 13px;
  }

  .brand-box,
  .brand-name,
  .nav-item span:last-child,
  .usage-box {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .page-header,
  .toolbar,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .preview-strip,
  .action-stack,
  .toolbar,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .workspace-grid {
    grid-template-rows: auto auto auto auto auto;
    grid-template-areas:
      "table"
      "toolbar"
      "previews"
      "actions"
      "extras";
  }

  .action-stack {
    height: auto;
  }

  .preview-strip,
  .preview-card {
    height: auto;
  }
}
