:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --text: #172033;
  --muted: #64748b;
  --line: #dce3ef;
  --line-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #e8f0ff;
  --success-bg: #eafaf2;
  --success-border: #9ee7c2;
  --danger: #ef4444;
  --shadow: 0 18px 50px rgba(38, 53, 84, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body.auth-loading .login-view,
body.authenticated .login-view {
  display: none;
}

body:not(.authenticated):not(.auth-loading) .portal-app {
  display: none;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(520px, 1.05fr);
  min-height: 100vh;
}

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

.portal-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100vh;
  padding: 20px 16px;
  color: #ffffff;
  background: #111827;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.portal-brand span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #111827;
  background: #ffffff;
  font-weight: 900;
}

.portal-brand strong,
.portal-user strong {
  display: block;
}

.portal-brand small,
.portal-user small {
  color: rgba(255, 255, 255, 0.64);
}

.portal-nav {
  display: grid;
  gap: 8px;
}

.portal-nav button {
  border: 0;
  border-radius: 8px;
  padding: 11px 12px;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  text-align: left;
  text-decoration: none;
  font-weight: 800;
}

.portal-nav button:hover,
.portal-nav button.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.portal-view {
  min-width: 0;
}

.order-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  padding: 20px;
  gap: 14px;
  background: #f8fafc;
}

.order-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: #ffffff;
}

.order-view-header h1 {
  margin: 0;
  font-size: 22px;
}

.order-frame-wrap {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.order-frame-wrap iframe {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 112px);
  border: 0;
  background: #ffffff;
}

.order-frame-tip {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 0;
  max-width: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.order-frame-tip p {
  margin: 6px 0 0;
  line-height: 1.5;
}

.portal-user {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.portal-user .ghost-button {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

.portal-user .ghost-button:hover {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.14);
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, #e8f0ff, transparent 30%), var(--bg);
}

.login-panel {
  display: grid;
  gap: 22px;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin-bottom: 8px;
}

.login-panel p {
  margin: 0;
  color: var(--muted);
}

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

.login-message {
  min-height: 20px;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 700;
}

.results-pane,
.workspace {
  padding: 24px;
}

.results-pane {
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.workspace {
  display: grid;
  gap: 18px;
  align-content: start;
}

.pane-header,
.topbar,
.panel-title,
.library-toolbar,
.batch-row,
.result-actions,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pane-header,
.library-toolbar,
.panel-title {
  justify-content: space-between;
}

.task-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.task-controls select {
  width: 180px;
}

.task-dir-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

.notice {
  margin: 18px 0;
  padding: 12px 14px;
  border: 1px solid var(--success-border);
  border-radius: 8px;
  color: #136f43;
  background: var(--success-bg);
  font-size: 14px;
}

.topbar {
  justify-content: space-between;
}

.tabs {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.usage-summary {
  margin-left: auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #0f766e;
  background: #ecfdf5;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.tab-button {
  min-width: 112px;
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.tab-button.active {
  color: #ffffff;
  background: var(--primary);
}

.doc-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: var(--panel-soft);
  outline: none;
}

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

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

.drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
  min-height: 170px;
  padding: 28px;
  border: 2px dashed var(--line-strong);
  border-radius: 8px;
  background: #fbfdff;
  text-align: center;
  cursor: pointer;
}

.drop-zone.dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.drop-copy {
  display: grid;
  place-items: center;
  gap: 8px;
}

.drop-copy span,
.empty-state p,
.prompt-text,
.prompt-model {
  color: var(--muted);
}

.preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 18px;
}

.preview-strip:empty {
  display: none;
}

.preview-strip:not(:empty) {
  min-height: 174px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.preview-card {
  position: relative;
  width: 144px;
  height: 144px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  cursor: grab;
}

.preview-card:active {
  cursor: grabbing;
}

.preview-card.dragging {
  opacity: 0.55;
}

.preview-card.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.preview-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

.preview-card button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--danger);
}

.prompt-label {
  margin-top: 16px;
}

.batch-row {
  margin-top: 14px;
  flex-wrap: wrap;
}

.batch-row label:first-child {
  width: 120px;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.checkline input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.primary-button,
.soft-button,
.ghost-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  min-height: 44px;
  padding: 11px 18px;
  color: #ffffff;
  background: var(--primary);
}

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

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.primary-button.small {
  min-height: 38px;
  padding: 8px 13px;
}

.soft-button {
  padding: 9px 13px;
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #bcd1ff;
}

.soft-button.small,
.ghost-button.small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.ghost-button {
  padding: 8px 11px;
  color: var(--muted);
  background: #ffffff;
  border-color: var(--line);
}

.ghost-button.danger-action {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff7f7;
}

.icon-button {
  width: 38px;
  height: 38px;
  color: var(--primary);
  background: var(--primary-soft);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 300px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fbfdff;
  text-align: center;
}

.empty-state span {
  font-weight: 900;
}

.result-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.result-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: var(--panel-soft);
  cursor: zoom-in;
}

.result-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px;
}

.result-card small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-card .saved-path {
  flex-basis: 100%;
  color: #0f766e;
}

.result-card .result-provider {
  display: block;
  margin-top: 6px;
  color: #7f1d1d;
}

.result-card.loading {
  position: relative;
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.result-card.loading .cancel-result {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 7px 10px;
  font-size: 12px;
}

.result-card.error {
  padding: 16px;
  color: #991b1b;
  background: #fff1f2;
  border-color: #fecdd3;
}

.result-card.error p {
  margin: 10px 0 14px;
  line-height: 1.55;
}

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

.result-error-actions button {
  flex: 1;
}

.result-card.error .retry-result {
  width: 100%;
  background: #ffffff;
}

.library-panel {
  box-shadow: none;
}

.toolbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar-actions input {
  width: min(230px, 100%);
}

.toolbar-actions select {
  width: 140px;
}

.prompt-editor {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 10px;
  margin: 14px 0;
}

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

.prompt-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  min-height: 120px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  user-select: none;
}

.prompt-item.dragging {
  opacity: 0.55;
}

.prompt-item.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.prompt-check {
  width: 16px;
  height: 16px;
  margin-top: 4px;
}

.prompt-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.prompt-category {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 800;
}

.prompt-text {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 8px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.5;
}

.prompt-actions {
  display: grid;
  gap: 8px;
  align-content: start;
}

.collections-block {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.collections-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.collection-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.collection-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
  aspect-ratio: 1;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.collection-item > div:first-child {
  min-height: 0;
  overflow: hidden;
}

.collection-item .prompt-actions {
  grid-template-columns: 1fr auto;
  margin-top: auto;
}

.collection-text,
.image-preview-prompt {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.collection-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

.collection-list > .empty-state {
  grid-column: 1 / -1;
}

.prompt-select-all {
  min-height: 38px;
  padding: 0 4px;
}

.empty-state.compact {
  min-height: 120px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 15px;
  border-radius: 8px;
  color: #ffffff;
  background: #172033;
  box-shadow: var(--shadow);
  z-index: 20;
}

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

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

.modal-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.26);
}

.image-preview-panel {
  position: relative;
  width: min(980px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.26);
}

.image-preview-panel img {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.image-preview-prompt {
  margin-top: 12px;
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.update-log-panel {
  width: min(620px, calc(100vw - 32px));
}

.update-log-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}

.update-log-list {
  margin: 18px 0 0;
  padding-left: 22px;
}

.update-log-list li {
  margin-bottom: 14px;
}

.update-log-list li strong,
.update-log-list li span {
  display: block;
}

.update-log-list li span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.6;
}

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

.modal-prompt-text {
  margin-top: 14px;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.account-view {
  min-height: 100vh;
  padding: 22px;
  background: #f8fafc;
}

.account-header,
.account-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-header {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
}

.account-header h1,
.account-card h2 {
  margin: 0;
}

.account-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.account-card + .account-card {
  margin-top: 16px;
}

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

.account-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.account-message[data-type="success"] {
  color: #15803d;
}

.account-message[data-type="error"] {
  color: #b91c1c;
}

.sync-note {
  margin: 8px 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

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

.sync-toggle {
  min-height: 40px;
  align-self: end;
}

.sync-auth-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.sync-auth-actions input[type="file"] {
  min-width: 280px;
  max-width: 100%;
}

.sync-status-message {
  margin: 12px 0;
  color: var(--muted);
  line-height: 1.6;
}

.sync-status-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.ghost-link {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.ghost-link:hover {
  text-decoration: underline;
}

.sync-log-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.sync-log-item {
  display: grid;
  grid-template-columns: 90px 170px 1fr;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.sync-log-item strong {
  color: var(--primary);
  text-transform: uppercase;
  font-size: 12px;
}

.sync-log-item small {
  color: var(--muted);
}

.sync-log-item p {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 800;
}

.status-pill[data-status="ready"] {
  border-color: var(--success-border);
  color: #15803d;
  background: var(--success-bg);
}

.status-pill[data-status="error"] {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fef2f2;
}

.image-url-form {
  grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(110px, 0.7fr) minmax(90px, 0.5fr) minmax(160px, 0.9fr) auto;
}

.image-url-file-field input[type="file"] {
  width: 100%;
  min-height: 40px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
}

.image-url-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.image-url-actions button {
  white-space: nowrap;
}

.danger-button {
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 10px 14px;
  color: #b91c1c;
  background: #fff1f2;
  font-weight: 800;
}

.danger-button:hover:not(:disabled) {
  background: #ffe4e6;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.image-url-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.image-url-progress-row progress {
  width: min(720px, 100%);
  height: 12px;
}

.image-url-table {
  min-width: 760px;
}

.image-url-table th:nth-child(1) {
  width: 220px;
}

.image-url-table th:nth-child(2),
.image-url-table th:nth-child(3) {
  width: 100px;
}

.image-url-table td:last-child {
  max-width: 560px;
  overflow-wrap: anywhere;
}

.image-url-log {
  min-height: 120px;
  max-height: 320px;
  margin: 12px 0 0;
  overflow: auto;
  border: 1px solid #1f2937;
  border-radius: 6px;
  padding: 12px;
  color: #d1fae5;
  background: #111827;
  font: 12px/1.6 Consolas, "Microsoft YaHei", monospace;
  white-space: pre-wrap;
}

.account-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

.account-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1380px;
}

.usage-ranking-table {
  min-width: 1280px;
}

.usage-ranking-number {
  color: #0f766e;
  font-weight: 900;
}

.usage-ranking-cost {
  color: #b45309;
  font-weight: 900;
}

.usage-ranking-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.usage-ranking-summary > div {
  display: grid;
  gap: 4px;
  padding: 0 14px;
  border-right: 1px solid var(--line);
}

.usage-ranking-summary > div:last-child {
  border-right: 0;
}

.usage-ranking-summary span {
  color: var(--muted);
  font-size: 13px;
}

.usage-ranking-summary strong {
  color: #0f172a;
  font-size: 20px;
}

.usage-ranking-filter {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-top: 14px;
}

.usage-ranking-filter label {
  display: grid;
  gap: 6px;
  width: 180px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.usage-ranking-filter button {
  min-height: 40px;
}

.usage-ranking-filter span {
  margin-left: auto;
  padding-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.account-table th,
.account-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

.account-table th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 13px;
}

.account-inline-input {
  width: 100%;
  min-height: 36px;
}

.account-actions {
  display: flex;
  gap: 8px;
}

.account-badge {
  display: inline-block;
  margin-left: 8px;
  border-radius: 999px;
  padding: 2px 7px;
  color: #166534;
  background: #dcfce7;
  font-size: 12px;
  font-weight: 900;
}

@media (max-width: 1120px) {
  .portal-app {
    grid-template-columns: 1fr;
  }

  .portal-sidebar {
    position: static;
    height: auto;
  }

  .portal-nav {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .order-view {
    min-height: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .results-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .results-pane,
  .workspace {
    padding: 16px;
  }

  .pane-header,
  .library-toolbar,
  .panel-title,
  .order-view-header,
  .account-header,
  .account-card-title,
  .topbar,
  .batch-row {
    align-items: stretch;
    flex-direction: column;
  }

  .task-controls {
    margin-left: 0;
  }

  .task-controls select {
    width: 100%;
  }

  .result-actions,
  .toolbar-actions {
    justify-content: flex-start;
  }

  .form-grid,
  .modal-grid,
  .prompt-editor,
  .prompt-list,
  .collection-item,
  .account-form {
    grid-template-columns: 1fr;
  }

  .drop-zone {
    align-items: stretch;
    flex-direction: column;
  }

  .batch-row label:first-child {
    width: 100%;
  }

  .sync-log-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .status-pill {
    align-self: flex-start;
  }

  .image-url-actions {
    flex-wrap: wrap;
  }
}
