:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #111827;
  --muted: #64748b;
  --line: #d9e2ee;
  --line-strong: #c4d0df;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --primary-soft: #e6fffb;
  --primary-line: #9bd8d0;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --warn: #b54708;
  --warn-soft: #fff7e6;
  --ok: #027a48;
  --ok-soft: #ecfdf3;
  --unknown: #475467;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
  --shadow-soft: 0 2px 10px rgba(15, 23, 42, 0.05);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eef4fb 0, #f6f8fb 280px, var(--bg) 100%);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 28px;
  background: #0f263d;
  color: white;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 30px rgba(15, 23, 42, 0.14);
}

.topbar h1,
.topbar p,
.panel h2,
.panel p {
  margin: 0;
}

.topbar h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 4px;
  color: #bfd0e1;
  font-size: 13px;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill {
  min-height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.topbar-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.user-field {
  display: grid;
  grid-template-columns: auto minmax(140px, 220px);
  align-items: center;
  gap: 8px;
  color: #d6e4f0;
}

.user-field span {
  font-size: 12px;
  font-weight: 800;
}

.user-field input {
  min-height: 36px;
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.user-field input:focus {
  outline: 2px solid rgba(153, 213, 204, 0.7);
  outline-offset: 1px;
}

.button-link.inverse {
  min-height: 34px;
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.inverse-btn {
  min-height: 34px;
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.inverse-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

main {
  width: min(1480px, calc(100vw - 24px));
  margin: 18px auto 40px;
}

.login-panel {
  width: min(520px, calc(100vw - 32px));
  margin: 48px auto;
}

.login-box {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-box h2,
.login-box p {
  margin: 0;
}

.login-box p {
  color: var(--muted);
}

.login-box label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 16px;
  box-shadow: var(--shadow-soft);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 25px;
  line-height: 1;
}

.guide-panel {
  margin-bottom: 12px;
  border: 1px solid var(--primary-line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: linear-gradient(180deg, #f1fffd, #ffffff);
  box-shadow: var(--shadow-soft);
}

.guide-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.guide-head h2,
.guide-head p {
  margin: 0;
}

.guide-head h2 {
  font-size: 16px;
}

.guide-head p {
  margin-top: 3px;
  color: #475467;
  font-size: 12px;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.guide-format {
  display: grid;
  gap: 5px;
  min-width: min(520px, 42%);
}

.guide-format span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
}

.guide-format code {
  display: block;
  border: 1px solid #99d5cc;
  border-radius: 6px;
  padding: 6px 8px;
  background: #ffffff;
  color: #134e4a;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.guide-step {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: flex-start;
  min-width: 0;
  border: 1px solid #ccfbf1;
  border-radius: var(--radius);
  padding: 8px;
  background: #ffffff;
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.guide-step strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
}

.guide-step p {
  margin: 0;
  color: #475467;
  font-size: 11px;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.panel h2 {
  font-size: 17px;
}

.panel p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.two-col {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 22px;
}

.two-col > *,
.form-grid > *,
.metrics > * {
  min-width: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.wide {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  padding: 9px 10px;
  background: white;
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
  outline: none;
}

textarea {
  min-height: 118px;
  resize: vertical;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
}

.paste-panel textarea {
  min-height: 96px;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  border: 1px solid #b7c3d4;
  border-radius: var(--radius);
  padding: 0 12px;
  background: #ffffff;
  color: #182230;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  border-color: #7b8aa0;
  box-shadow: var(--shadow-soft);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.paste-panel .actions {
  margin-top: 10px;
}

.asset-panel {
  padding-bottom: 14px;
}

.asset-panel .panel-head {
  align-items: flex-start;
  margin: -16px -16px 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: #ffffff;
}

.asset-toolbar {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  width: min(980px, 100%);
}

.action-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.model-group {
  justify-content: flex-end;
}

.validate-group {
  background: #effcf9;
  border-color: #bfe8e2;
}

.filter-group {
  background: #f8fafc;
}

.danger-group {
  background: #fff7f6;
  border-color: #f6d5d1;
}

.danger {
  border-color: #f3afa7;
  background: var(--danger-soft);
  color: var(--danger);
}

.danger:hover {
  border-color: #f87171;
}

.batch-model-combobox {
  width: min(340px, 100%);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 216px;
}

.small-btn {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.batch-box {
  display: grid;
  gap: 12px;
}

.paste-preview {
  margin-top: 12px;
}

.preview-summary {
  margin-bottom: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.preview-table {
  display: grid;
  gap: 6px;
}

.preview-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.7fr 0.7fr 1.2fr 1fr 1fr 0.5fr;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  min-width: 0;
}

.preview-row span {
  overflow-wrap: anywhere;
  min-width: 0;
}

.preview-error {
  margin-top: 8px;
  border: 1px solid #fecdca;
  border-radius: 6px;
  padding: 8px;
  background: #fef3f2;
  color: var(--danger);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.asset-table-wrap {
  max-height: min(66vh, 760px);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 1360px;
}

.asset-table-wrap table th:nth-child(1),
.asset-table-wrap table td:nth-child(1) {
  width: 44px;
}

.asset-table-wrap table th:nth-child(2),
.asset-table-wrap table td:nth-child(2) {
  width: 10%;
}

.asset-table-wrap table th:nth-child(3),
.asset-table-wrap table td:nth-child(3) {
  width: 17%;
}

.asset-table-wrap table th:nth-child(4),
.asset-table-wrap table td:nth-child(4) {
  width: 18%;
}

.asset-table-wrap table th:nth-child(5),
.asset-table-wrap table td:nth-child(5) {
  width: 19%;
}

.asset-table-wrap table th:nth-child(6),
.asset-table-wrap table td:nth-child(6) {
  width: 70px;
}

.asset-table-wrap table th:nth-child(7),
.asset-table-wrap table td:nth-child(7) {
  width: 82px;
}

.asset-table-wrap table th:nth-child(8),
.asset-table-wrap table td:nth-child(8) {
  width: 84px;
}

.asset-table-wrap table th:nth-child(9),
.asset-table-wrap table td:nth-child(9) {
  width: 17%;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  overflow-wrap: anywhere;
}

th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f8fafc;
  color: #475467;
  font-size: 12px;
  text-transform: uppercase;
  box-shadow: 0 1px 0 var(--line);
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: #fbfdff;
}

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

.mono {
  font-family: "Cascadia Mono", Consolas, monospace;
}

.muted {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.badge.valid,
.badge.success {
  color: var(--ok);
  background: var(--ok-soft);
}

.badge.invalid,
.badge.failed,
.badge.quota_exceeded,
.badge.provider_error,
.badge.network_error {
  color: var(--danger);
  background: var(--danger-soft);
}

.badge.rate_limited,
.badge.running {
  color: var(--warn);
  background: var(--warn-soft);
}

.badge.unknown,
.badge.pending {
  color: var(--unknown);
  background: #f2f4f7;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result-list {
  display: grid;
  gap: 12px;
}

.job-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fcfcfd;
  box-shadow: var(--shadow-soft);
}

.job-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.job-card p,
.result-card p {
  margin: 6px 0 0;
}

.key-plain-card {
  border-color: #fdb022;
  background: #fffcf5;
}

.key-plain-value {
  overflow-wrap: anywhere;
  color: #7a2e0e;
  font-size: 13px;
}

.result-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.result-card-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.config-input {
  min-width: 0;
}

.config-select {
  min-width: 0;
}

.result-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.model-picker {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.model-picker .config-input {
  min-width: 0;
}

.model-status {
  position: relative;
  min-width: 0;
  padding-left: 9px;
  color: #52657a;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-status::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
}

.model-combobox {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.model-combobox:hover {
  border-color: #9aa8bc;
}

.model-combobox:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.model-search-input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  background: transparent;
  color: #0f172a;
  font: inherit;
  font-size: 13px;
  line-height: 1.25;
}

.model-search-input:focus {
  border-color: transparent;
  box-shadow: none;
  outline: none;
}

.model-search-input::placeholder {
  color: #94a3b8;
}

.model-menu-toggle {
  min-width: 34px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-left: 1px solid #e2e8f0;
  border-radius: 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0;
  background: #f8fafc;
  color: transparent;
  font-size: 0;
  box-shadow: none;
}

.model-menu-toggle:hover {
  border-color: #d5dee9;
  border-left-color: #d5dee9;
  background: #eef7f5;
  box-shadow: none;
}

.model-menu-toggle:focus {
  box-shadow: none;
  outline: none;
}

.model-menu-toggle::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 2px solid #475569;
  border-bottom: 2px solid #475569;
  transform: rotate(45deg);
}

.model-combobox:focus-within .model-menu-toggle {
  border-left-color: var(--primary-line);
  background: #f0fdfa;
}

.model-combobox:focus-within .model-menu-toggle::before {
  border-color: var(--primary);
}

.model-options {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 4px;
  background: #ffffff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.18);
}

.model-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 32px;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #1e293b;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
  overflow-wrap: anywhere;
}

.model-option:hover,
.model-option:focus {
  background: #e9f8f5;
  color: var(--primary-strong);
  outline: none;
}

.model-option.muted {
  color: var(--muted);
  font-weight: 600;
  cursor: default;
}

.result-grid div,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.result-grid div {
  padding: 9px;
}

.result-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.result-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 14px;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(2px);
}

.modal-panel {
  width: min(1040px, calc(100vw - 32px));
  max-height: min(86vh, 900px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: -18px -18px 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.modal-head h2,
.modal-head p {
  margin: 0;
}

.modal-head p {
  margin-top: 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.modal-close {
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: var(--radius);
  font-size: 22px;
  line-height: 1;
}

.modal-actions {
  justify-content: flex-start;
  margin-bottom: 14px;
}

.cc-import-modal-panel {
  width: min(880px, calc(100vw - 32px));
}

.cc-import-card {
  background: #ffffff;
}

.cc-import-link {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.cc-import-link span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.cc-import-link textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 10px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 12px;
  line-height: 1.45;
}

.cc-import-actions {
  align-items: flex-end;
  margin-top: 14px;
  margin-bottom: 0;
}

.cc-inline-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 150px;
}

.cc-app-select {
  display: grid;
  gap: 5px;
  min-width: 150px;
}

.cc-app-select.compact {
  min-width: 132px;
}

.cc-model-field {
  min-width: 0;
}

.cc-model-config-cell {
  display: grid;
  gap: 6px;
}

.cc-model-config-cell input {
  min-height: 32px;
  padding: 0 9px;
  font-size: 12px;
}

.warning-input {
  border-color: #f79009;
  background: #fffcf5;
}

.cc-app-select span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #0f263d;
  color: white;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22);
  z-index: 100;
}

.hidden {
  display: none;
}

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

@media (max-width: 980px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .topbar-tools {
    justify-content: flex-start;
    width: 100%;
  }

  .user-field {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .metrics,
  .two-col,
  .detail-grid,
  .result-grid,
  .guide-steps {
    grid-template-columns: 1fr;
  }

  main {
    width: min(100vw - 16px, 100%);
    margin-top: 12px;
  }

  .metric strong {
    font-size: 22px;
  }

  .guide-head {
    flex-direction: column;
  }

  .guide-format {
    min-width: 0;
    width: 100%;
  }

  .panel-head,
  .asset-panel .panel-head {
    position: static;
    flex-direction: column;
    margin: 0 0 12px;
    padding: 0;
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .asset-toolbar {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .action-group,
  .model-group,
  .validate-group,
  .filter-group,
  .danger-group {
    justify-content: flex-start;
    width: 100%;
  }

  .batch-model-combobox,
  .model-combobox,
  .config-select,
  .config-input {
    width: 100%;
    min-width: 0;
  }

  .asset-table-wrap {
    max-height: 62vh;
  }

  .preview-row {
    grid-template-columns: 1fr;
  }

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

  .wide {
    grid-column: span 1;
  }
}

@media (max-width: 560px) {
  body {
    background: var(--bg);
  }

  .topbar h1 {
    font-size: 19px;
  }

  .topbar-tools,
  .actions,
  .action-group {
    align-items: stretch;
  }

  button,
  .button-link,
  select {
    width: 100%;
  }

  .status-pill {
    width: auto;
  }

  .panel,
  .guide-panel {
    padding: 12px;
  }

  textarea {
    min-height: 118px;
  }

  .modal {
    align-items: stretch;
    padding: 10px;
  }

  .modal-panel {
    width: 100%;
    max-height: calc(100vh - 20px);
    padding: 14px;
  }

  .modal-head {
    margin: -14px -14px 12px;
    padding: 14px;
  }
}

/* Modern dashboard skin: shadcn-inspired neutral components for the existing app. */
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --primary-soft: #f0fdfa;
  --primary-line: #99f6e4;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --unknown: #475569;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-pop: 0 20px 50px rgba(15, 23, 42, 0.16);
  --radius: 8px;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.08), transparent 340px),
    linear-gradient(180deg, #ffffff 0, #f8fafc 240px, #f1f5f9 100%);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  min-height: 72px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.88);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  backdrop-filter: blur(18px);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.topbar h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 21px;
  font-weight: 760;
  line-height: 1.15;
}

.topbar h1::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(20, 184, 166, 0.42);
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.96), rgba(14, 165, 233, 0.84)),
    #0f766e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 10px 22px rgba(15, 118, 110, 0.2);
}

.topbar p {
  margin-top: 5px;
  color: #64748b;
  font-size: 13px;
}

.topbar-tools {
  gap: 8px;
}

.status-pill,
.badge {
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 720;
}

.status-pill {
  min-height: 32px;
  border-color: var(--line);
  background: #ffffff;
  color: #334155;
  box-shadow: var(--shadow-soft);
}

.button-link.inverse,
.inverse-btn {
  min-height: 32px;
  border-color: var(--line);
  background: #ffffff;
  color: #334155;
  box-shadow: var(--shadow-soft);
}

.button-link.inverse:hover,
.inverse-btn:hover {
  border-color: var(--line-strong);
  background: #f8fafc;
  color: #0f172a;
}

main {
  width: min(1504px, calc(100vw - 32px));
  margin: 18px auto 48px;
}

.login-panel {
  width: min(460px, calc(100vw - 32px));
  margin: 72px auto;
}

.login-box {
  gap: 16px;
  border-color: var(--line);
  border-radius: 8px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.login-box h2 {
  font-size: 24px;
  letter-spacing: 0;
}

.metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  position: relative;
  min-height: 92px;
  overflow: hidden;
  border-color: rgba(226, 232, 240, 0.9);
  border-radius: 8px;
  padding: 15px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.96)),
    #ffffff;
  box-shadow: var(--shadow-soft);
}

.metric::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(15, 118, 110, 0.1);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(240, 253, 250, 0.95), rgba(224, 242, 254, 0.85));
}

.metric span {
  color: #64748b;
  font-size: 12px;
  font-weight: 680;
}

.metric strong {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  color: #0f172a;
  font-size: 30px;
  font-weight: 760;
  letter-spacing: 0;
}

.guide-panel,
.panel {
  border-color: rgba(226, 232, 240, 0.94);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
}

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

.guide-head {
  margin-bottom: 12px;
}

.guide-head h2,
.panel h2 {
  color: #0f172a;
  font-size: 17px;
  font-weight: 760;
  letter-spacing: 0;
}

.guide-head p,
.panel p {
  color: #64748b;
  font-size: 13px;
}

.guide-format span {
  color: var(--primary);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.guide-format code {
  border-color: #ccfbf1;
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fffd;
  color: #115e59;
}

.guide-steps {
  gap: 10px;
}

.guide-step {
  min-height: 86px;
  border-color: #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.step-index {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: #0f172a;
  font-size: 12px;
}

.guide-step strong {
  color: #0f172a;
  font-size: 12px;
  font-weight: 760;
}

.guide-step p {
  color: #64748b;
}

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

.panel-head {
  gap: 16px;
  margin-bottom: 14px;
}

input,
select,
textarea {
  min-height: 38px;
  border-color: var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

textarea {
  min-height: 128px;
  padding: 12px;
  line-height: 1.5;
}

.paste-panel textarea {
  min-height: 116px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.16);
}

button,
.button-link {
  min-height: 36px;
  border-color: var(--line-strong);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
  font-weight: 720;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

button:hover,
.button-link:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

button:active,
.button-link:active {
  transform: translateY(1px);
}

button:disabled {
  box-shadow: none;
}

.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

.primary:hover {
  border-color: var(--primary-strong);
  background: var(--primary-strong);
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.2);
}

.danger {
  border-color: #fecaca;
  background: #fffafa;
  color: var(--danger);
}

.danger:hover {
  border-color: #fca5a5;
  background: var(--danger-soft);
}

.asset-panel {
  padding-bottom: 16px;
}

.asset-panel .panel-head {
  display: grid;
  grid-template-columns: 1fr;
  margin: -16px -16px 14px;
  padding: 16px;
  border-bottom-color: var(--line);
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.asset-toolbar {
  width: 100%;
  grid-template-columns: minmax(430px, 1.35fr) minmax(220px, auto) minmax(220px, auto) minmax(104px, auto);
  gap: 8px;
  justify-content: stretch;
}

.action-group {
  gap: 8px;
  padding: 5px;
  border-color: var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.asset-toolbar .action-group {
  min-height: 50px;
}

.asset-toolbar button,
.asset-toolbar select {
  width: auto;
  white-space: nowrap;
}

.asset-toolbar .model-group {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
}

.asset-toolbar .validate-group,
.asset-toolbar .filter-group,
.asset-toolbar .danger-group {
  justify-content: flex-start;
}

.validate-group {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.danger-group {
  border-color: #fecaca;
  background: #fffafa;
}

.batch-model-combobox {
  width: min(350px, 100%);
}

.table-wrap {
  border-color: var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.asset-table-wrap {
  max-height: min(68vh, 780px);
  scroll-padding-bottom: 312px;
}

.asset-table-wrap:focus-within {
  padding-bottom: 312px;
}

.asset-table-wrap:focus-within tbody tr:last-child td {
  border-bottom: 1px solid #edf2f7;
}

table {
  min-width: 1380px;
}

th,
td {
  padding: 11px 12px;
  border-bottom-color: #edf2f7;
  font-size: 13px;
}

th {
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: none;
}

tbody tr {
  background: #ffffff;
}

tbody tr:hover {
  background: #f8fafc;
}

td strong {
  color: #0f172a;
  font-weight: 760;
}

.row-actions {
  gap: 6px;
  min-width: 204px;
}

.small-btn {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 12px;
}

.badge.valid,
.badge.success {
  border-color: #bbf7d0;
  color: #047857;
  background: #ecfdf5;
}

.badge.invalid,
.badge.failed,
.badge.quota_exceeded,
.badge.provider_error,
.badge.network_error {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fef2f2;
}

.badge.rate_limited,
.badge.running {
  border-color: #fed7aa;
  color: #b45309;
  background: #fffbeb;
}

.badge.unknown,
.badge.pending,
.badge.finished {
  border-color: #e2e8f0;
  color: #475569;
  background: #f8fafc;
}

.model-combobox {
  min-height: 38px;
  border-color: var(--line);
  border-radius: 8px;
  box-shadow: none;
}

.model-combobox:hover {
  border-color: var(--line-strong);
}

.model-combobox:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.16);
}

.model-menu-toggle {
  background: #f8fafc;
}

.model-menu-toggle:hover {
  background: #f1f5f9;
}

.model-options {
  top: calc(100% + 8px);
  border-color: var(--line);
  border-radius: 8px;
  padding: 6px;
  box-shadow: var(--shadow-pop);
}

.model-option {
  min-height: 34px;
  border-radius: 7px;
  color: #334155;
  font-size: 12px;
}

.model-option:hover,
.model-option:focus {
  background: #f0fdfa;
  color: #0f766e;
}

.model-status {
  color: #64748b;
  font-size: 11px;
  font-weight: 640;
}

.paste-preview {
  margin-top: 14px;
}

.preview-summary {
  color: #0f172a;
}

.preview-row {
  border-color: var(--line);
  border-radius: 9px;
  padding: 9px 10px;
  background: #ffffff;
}

.preview-error {
  border-radius: 9px;
}

.detail-grid {
  gap: 12px;
}

.job-card,
.result-card {
  border-color: var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.job-card h3 {
  color: #0f172a;
}

.key-plain-card {
  border-color: #fde68a;
  background: #fffbeb;
}

.result-grid {
  gap: 10px;
}

.result-grid div,
.empty-state {
  border-color: var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.result-grid div {
  padding: 10px;
}

.empty-state {
  padding: 16px;
}

.modal {
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(6px);
}

.modal-panel {
  border-color: var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 28px 72px rgba(15, 23, 42, 0.26);
}

.modal-head {
  border-bottom-color: var(--line);
  border-radius: 8px 8px 0 0;
  background: #ffffff;
}

.modal-close {
  border-radius: 8px;
  color: #64748b;
}

.toast {
  right: 20px;
  bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #0f172a;
  box-shadow: 0 22px 46px rgba(15, 23, 42, 0.28);
}

@media (max-width: 980px) {
  .topbar {
    background: rgba(255, 255, 255, 0.94);
  }

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

  .asset-toolbar {
    grid-template-columns: 1fr;
  }

  .asset-toolbar .model-group {
    grid-template-columns: 1fr;
  }

  .asset-toolbar button,
  .asset-toolbar select {
    width: 100%;
  }

  .asset-toolbar .batch-model-combobox {
    width: 100%;
  }

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

@media (max-width: 560px) {
  main {
    width: min(100vw - 16px, 100%);
  }

  .metrics,
  .guide-steps {
    grid-template-columns: 1fr;
  }

  .topbar-tools,
  .user-field {
    width: 100%;
  }

  .topbar-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h1::before {
    width: 24px;
    height: 24px;
  }
}

/* UX refresh v3: enterprise console polish, search-first controls, clearer density. */
:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #0b1220;
  --muted: #667085;
  --line: #e5e7eb;
  --line-strong: #cbd5e1;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --primary-soft: #ecfdf5;
  --primary-line: #99f6e4;
  --danger: #c2410c;
  --danger-soft: #fff7ed;
  --warn: #a16207;
  --warn-soft: #fefce8;
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --unknown: #475569;
  --shadow: 0 18px 46px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-pop: 0 22px 60px rgba(15, 23, 42, 0.18);
}

body {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0, rgba(248, 250, 252, 0.96) 230px, var(--bg) 100%);
}

.topbar {
  min-height: 70px;
  padding-inline: max(24px, calc((100vw - 1504px) / 2 + 16px));
}

.topbar h1::before {
  background: linear-gradient(135deg, #111827 0%, #0f766e 62%, #0ea5e9 100%);
}

.topbar-tools {
  flex-wrap: nowrap;
}

main {
  display: grid;
  gap: 16px;
}

.metrics,
.guide-panel,
.panel {
  margin-bottom: 0;
}

.metric,
.guide-panel,
.panel,
.table-wrap,
.modal-panel,
.login-box {
  border-radius: 8px;
}

.metric {
  min-height: 86px;
  padding: 14px 15px;
}

.metric::after {
  opacity: 0.72;
}

.guide-panel {
  border-color: #dbeafe;
  background: linear-gradient(90deg, rgba(239, 246, 255, 0.88), rgba(240, 253, 250, 0.72) 52%, #ffffff 100%);
}

.guide-head {
  align-items: center;
}

.guide-head p,
.panel p {
  max-width: 900px;
}

.guide-format {
  min-width: min(560px, 44%);
}

.guide-steps {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.guide-step {
  min-height: 92px;
  border-color: rgba(203, 213, 225, 0.78);
}

.paste-panel,
.asset-panel {
  border-color: #d7dee8;
}

.panel-head {
  align-items: center;
}

.asset-panel .panel-head {
  gap: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.asset-toolbar {
  align-items: stretch;
}

.asset-toolbar .action-group {
  align-items: center;
  border-color: #dbe3ee;
}

.asset-toolbar .model-group {
  grid-template-columns: auto minmax(260px, 1fr) auto;
}

.asset-toolbar .filter-group {
  display: grid;
  grid-template-columns: minmax(128px, 1fr) auto;
}

.asset-toolbar .danger-group {
  justify-content: center;
}

button,
.button-link,
input,
select,
textarea {
  border-radius: 8px;
}

button:focus-visible,
.button-link:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.model-option:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.7);
  outline-offset: 2px;
}

textarea::placeholder,
input::placeholder {
  color: #98a2b3;
}

.paste-panel textarea {
  min-height: 132px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.preview-row {
  grid-template-columns: minmax(130px, 1.1fr) minmax(180px, 1.15fr) 0.7fr 0.65fr minmax(170px, 1.25fr) minmax(150px, 1fr) minmax(130px, 0.85fr) 60px;
}

.asset-table-wrap table th:nth-child(1),
.asset-table-wrap table td:nth-child(1) {
  width: 42px;
}

.asset-table-wrap table th:nth-child(2),
.asset-table-wrap table td:nth-child(2) {
  width: 9%;
}

.asset-table-wrap table th:nth-child(3),
.asset-table-wrap table td:nth-child(3) {
  width: 18%;
}

.asset-table-wrap table th:nth-child(4),
.asset-table-wrap table td:nth-child(4) {
  width: 13%;
}

.asset-table-wrap table th:nth-child(5),
.asset-table-wrap table td:nth-child(5) {
  width: 22%;
}

.asset-table-wrap table th:nth-child(6),
.asset-table-wrap table td:nth-child(6) {
  width: 96px;
}

.asset-table-wrap table th:nth-child(7),
.asset-table-wrap table td:nth-child(7) {
  width: 86px;
}

.asset-table-wrap table th:nth-child(8),
.asset-table-wrap table td:nth-child(8) {
  width: 104px;
}

.asset-table-wrap table th:nth-child(9),
.asset-table-wrap table td:nth-child(9) {
  width: 19%;
}

.row-actions {
  min-width: 242px;
}

.row-actions .small-btn {
  flex: 1 0 auto;
}

.model-combobox {
  overflow: visible;
  background: #ffffff;
}

.model-search-input {
  min-height: 36px;
}

.model-options {
  z-index: 120;
  max-height: min(44vh, 420px);
}

.model-option {
  justify-content: space-between;
  gap: 10px;
}

.model-option::after {
  content: "选择";
  color: #94a3b8;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
}

.model-option.muted::after {
  content: "";
}

.model-status {
  white-space: normal;
}

.cc-import-modal-panel {
  width: min(980px, calc(100vw - 32px));
}

.cc-import-card {
  border-color: #dbe3ee;
}

.cc-inline-controls {
  align-items: end;
  min-width: 180px;
}

.cc-app-select {
  min-width: 168px;
}

.cc-app-select span,
.cc-import-link span,
.result-grid span {
  color: #667085;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: none;
}

.cc-app-select select {
  min-height: 38px;
  font-weight: 720;
}

.cc-model-config-cell {
  position: relative;
  overflow: visible;
  background: #f8fafc;
}

.cc-model-combobox {
  margin-top: 2px;
}

.cc-model-options {
  min-width: 100%;
  width: 100%;
  max-width: 100%;
}

.cc-import-link textarea {
  min-height: 106px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f8fafc;
}

.result-card-head {
  align-items: center;
}

.result-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.modal {
  z-index: 100;
}

.modal-panel {
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.modal-panel > .result-list,
.modal-panel > #ccImportModalBody,
.modal-panel > #keyResultModalBody {
  min-height: 0;
  overflow: auto;
}

.modal-actions {
  position: static;
  bottom: auto;
  z-index: 2;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.toast {
  font-weight: 700;
}

@media (max-width: 1280px) {
  .asset-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .asset-toolbar .model-group {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .topbar {
    position: static;
  }

  .topbar-tools {
    flex-wrap: wrap;
  }

  .guide-head {
    align-items: stretch;
  }

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

  .asset-toolbar {
    grid-template-columns: 1fr;
  }

  .asset-toolbar .model-group,
  .asset-toolbar .filter-group {
    grid-template-columns: 1fr;
  }

  .preview-row,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .cc-inline-controls,
  .cc-app-select {
    width: 100%;
  }

  .result-card-head {
    align-items: stretch;
    flex-direction: column;
  }
}

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

  .topbar-tools {
    align-items: stretch;
  }

  .metrics,
  .guide-steps {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 78px;
  }

  button,
  .button-link,
  .button-link.inverse,
  .inverse-btn,
  input,
  select,
  .model-combobox,
  .model-search-input,
  .model-menu-toggle {
    min-height: 44px;
  }

  .cc-import-modal-panel,
  .modal-panel {
    width: 100%;
  }

  .cc-model-options {
    min-width: 100%;
  }
}
