:root {
  --bg: #07111f;
  --panel: rgba(7, 22, 39, 0.88);
  --panel-strong: rgba(10, 29, 50, 0.96);
  --line: rgba(188, 161, 93, 0.25);
  --text: #eef3f8;
  --muted: #9fb0c3;
  --accent: #d4a94f;
  --accent-strong: #f1c56b;
  --danger: #e27d7d;
  --ok: #88d0a7;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Yu Gothic UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

.background {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(212, 169, 79, 0.2), transparent 28%),
    radial-gradient(circle at bottom right, rgba(55, 88, 146, 0.35), transparent 33%),
    linear-gradient(160deg, #06101c 0%, #081a2d 55%, #04111f 100%);
  z-index: -1;
}

.shell {
  width: calc(100% - 24px);
  margin: 24px auto 40px;
}

.hidden {
  display: none !important;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(16px);
}

.login-panel {
  width: min(560px, 100%);
  margin: 80px auto;
  padding: 32px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-lockup-login {
  justify-content: center;
  margin-bottom: 18px;
}

.brand-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  flex: 0 0 auto;
  object-fit: cover;
}

.brand-icon-large {
  width: 84px;
  height: 84px;
  border-radius: 22px;
}

.brand-logo {
  display: block;
  width: auto;
  height: 42px;
  max-width: min(360px, 100%);
}

.brand-logo-large {
  height: 92px;
  max-width: min(520px, 100%);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 13px;
  color: var(--accent-strong);
}

h1, h2 {
  margin: 0 0 12px;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

.lead, .hint {
  color: var(--muted);
}

#orders-status {
  min-height: 24px;
  margin-top: 8px;
  margin-bottom: 8px;
}

.stack {
  display: grid;
  gap: 12px;
}

.compact {
  gap: 10px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
}

.field-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

input, textarea, select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 18, 31, 0.9);
  color: var(--text);
  padding: 12px 14px;
}

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

#job-bank-brands-text {
  min-height: 110px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
}

button:disabled,
select:disabled {
  opacity: 0.62;
  cursor: wait;
}

.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #18202b;
  font-weight: 700;
}

.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

#job-form > button[type="submit"] {
  width: auto !important;
  min-width: 0;
  display: inline-flex;
  justify-self: start;
  align-self: start;
  justify-content: center;
  flex: 0 0 auto;
  padding: 10px 18px;
  order: 99;
}

.danger {
  background: rgba(226, 125, 125, 0.18);
  color: #ffd4d4;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 20px;
}

.store-switcher {
  margin-bottom: 18px;
  padding: 14px 20px;
}

.store-picker {
  min-width: 320px;
}

.job-store-select {
  min-width: 320px;
}

.store-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.store-check {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.top-actions, .button-row, .toolbar, .inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-field {
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline-field > input {
  flex: 1 1 auto;
}

.compact-action {
  padding: 10px 14px;
  white-space: nowrap;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
}

.user-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 14px;
}

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.subtabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.subtab {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.subtab.active {
  background: rgba(212, 169, 79, 0.16);
  color: var(--accent-strong);
}

.subtab-panel {
  display: none;
}

.subtab-panel.active {
  display: block;
}

.dashboard-contracts-host {
  gap: 18px;
}

.tab {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.tab.active {
  background: rgba(212, 169, 79, 0.16);
  color: var(--accent-strong);
}

.tab-panel {
  display: none;
  gap: 18px;
}

.tab-panel.active {
  display: grid;
}

.grid {
  display: grid;
  gap: 18px;
}

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

.rule-panel {
  display: grid;
  gap: 12px;
}

.rule-panel.subtab-panel {
  display: none;
}

.rule-panel.subtab-panel.active {
  display: grid;
}

.rule-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.rule-panel h3 {
  margin: 0;
}

.cost-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.cost-fields.subtab-panel {
  display: none;
}

.cost-fields.subtab-panel.active {
  display: grid;
}

.cost-fields .rule-panel-head,
.cost-fields .table-wrap {
  grid-column: 1 / -1;
}

.cost-feature-box {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.cost-feature-box .rule-panel-head {
  grid-column: 1 / -1;
}

.cost-feature-box h3 {
  margin: 0 0 6px;
}

.domestic-table {
  min-width: 520px;
}

.domestic-table td:first-child,
.domestic-table th:first-child {
  min-width: 180px;
}

.handling-table {
  min-width: 880px;
}

.handling-table td:nth-child(3),
.handling-table th:nth-child(3) {
  min-width: 420px;
}

.gap-ranges-table {
  min-width: 1180px;
}

.gap-ranges-table td:nth-child(7),
.gap-ranges-table th:nth-child(7) {
  min-width: 220px;
}

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

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

.jobs-manager-toolbar {
  justify-content: space-between;
  align-items: center;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 18px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.stat-card strong {
  display: block;
  font-size: 32px;
  margin-top: 8px;
}

.table-wrap {
  overflow: auto;
}

.jobs-table {
  min-width: 1460px;
}

.jobs-table th:first-child,
.jobs-table td:first-child {
  width: 44px;
}

.jobs-table td:nth-child(7),
.jobs-table th:nth-child(7) {
  min-width: 96px;
}

.jobs-table td:nth-child(8),
.jobs-table th:nth-child(8) {
  min-width: 165px;
}

.jobs-table td:nth-child(9),
.jobs-table th:nth-child(9) {
  min-width: 130px;
}

.jobs-table td:nth-child(10),
.jobs-table th:nth-child(10),
.jobs-table td:nth-child(11),
.jobs-table th:nth-child(11) {
  min-width: 170px;
}

.jobs-table td:nth-child(12),
.jobs-table th:nth-child(12) {
  min-width: 280px;
}

.jobs-table td:last-child,
.jobs-table th:last-child {
  min-width: 190px;
}

.job-actions-cell {
  white-space: nowrap;
}

.job-actions-cell button {
  margin-right: 8px;
}

.job-actions-cell button:last-child {
  margin-right: 0;
}

.verify-panel {
  padding: 18px;
}

.verify-summary-grid,
.verify-metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.verify-result-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.verify-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(6, 17, 30, 0.9);
  overflow: hidden;
}

.verify-card summary {
  list-style: none;
  cursor: pointer;
  padding: 18px;
}

.verify-card summary::-webkit-details-marker {
  display: none;
}

.verify-card-body {
  padding: 0 18px 18px;
}

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

.verify-status-cluster {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.verify-pill {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 13px;
}

.verify-table th,
.verify-table td {
  padding: 8px 10px;
  vertical-align: top;
}

.verify-table th {
  width: 42%;
  color: var(--muted);
  text-align: left;
  font-weight: 600;
}

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

.verify-settings-box {
  margin-top: 16px;
}

.verify-settings-box summary {
  cursor: pointer;
  color: var(--accent-strong);
  margin-bottom: 10px;
}

.import-check-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
}

.import-check-badge.importable {
  background: rgba(136, 208, 167, 0.16);
  color: #b9f0cc;
}

.import-check-badge.review {
  background: rgba(212, 169, 79, 0.16);
  color: var(--accent-strong);
}

.import-check-badge.blocked {
  background: rgba(226, 125, 125, 0.16);
  color: #ffd2d2;
}

.import-check-detail-grid {
  display: grid;
  gap: 18px;
}

.review-guidance {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(212, 169, 79, 0.28);
  background: rgba(212, 169, 79, 0.08);
  color: var(--accent-strong);
}

.verify-status-active {
  background: rgba(136, 208, 167, 0.18);
  color: #c6ffd8;
}

.verify-status-qty_zero {
  background: rgba(212, 169, 79, 0.18);
  color: #ffe2a2;
}

.verify-status-excluded,
.verify-status-error {
  background: rgba(226, 125, 125, 0.18);
  color: #ffd4d4;
}

.jobs-table tr.is-selected {
  background: rgba(212, 169, 79, 0.08);
}

.job-status {
  display: inline-flex;
  align-items: center;
  min-width: 82px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  justify-content: center;
}

.job-phase-cell {
  display: grid;
  gap: 2px;
  line-height: 1.35;
  white-space: normal;
}

.account-health-view {
  display: grid;
  gap: 18px;
}

.account-health-title {
  margin: 12px 0 6px;
}

.health-section-grid {
  grid-template-columns: repeat(2, minmax(420px, 1fr));
  align-items: start;
}

.health-metric-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: stretch;
}

.health-metric-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 132px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045);
}

.health-metric-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.health-metric-summary {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
}

.health-pill.good {
  background: rgba(136, 208, 167, 0.16);
  color: #c6ffd8;
}

.health-pill.warn {
  background: rgba(212, 169, 79, 0.16);
  color: var(--accent-strong);
}

.health-pill.bad {
  background: rgba(226, 125, 125, 0.16);
  color: #ffd4d4;
}

.health-warning-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.orders-grid {
  display: grid;
  grid-template-columns: minmax(520px, 0.95fr) minmax(620px, 1.25fr);
  gap: 18px;
  align-items: start;
}

.orders-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
  margin-bottom: 18px;
}

.orders-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.orders-summary-card {
  border: 1px solid rgba(212, 169, 79, 0.14);
  border-radius: 18px;
  background: rgba(8, 16, 28, 0.72);
  padding: 16px 18px;
}

.orders-summary-card .eyebrow {
  margin-bottom: 8px;
}

.orders-summary-card strong {
  display: block;
  font-size: 30px;
  line-height: 1.05;
}

.orders-summary-card .hint {
  margin-top: 8px;
}

.orders-analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
  margin-bottom: 18px;
}

.orders-analysis-card {
  border: 1px solid rgba(212, 169, 79, 0.14);
  border-radius: 24px;
  background: rgba(8, 16, 28, 0.72);
  padding: 20px;
}

.orders-analysis-card h3 {
  margin-bottom: 6px;
}

.orders-analysis-card .hint {
  margin-bottom: 16px;
}

.orders-pie-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.orders-pie {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(18, 31, 49, 0.95);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(212, 169, 79, 0.12);
}

.orders-pie::after {
  content: "";
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: rgba(6, 12, 20, 0.96);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.orders-pie-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
  text-align: center;
  padding: 0 22px;
}

.orders-pie-center strong {
  font-size: 30px;
  line-height: 1;
}

.orders-pie-center span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.orders-pie-legend {
  display: grid;
  gap: 10px;
}

.orders-pie-legend-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.orders-pie-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
}

.orders-pie-legend-row .label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orders-pie-legend-row .value,
.orders-pie-legend-row .ratio {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.orders-detail-stack {
  display: grid;
  gap: 16px;
}

.orders-export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 18px;
  margin-bottom: 14px;
}

.orders-sheet-layout {
  margin-top: 18px;
}

#orders-sheet-service-account-json {
  min-height: 180px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.orders-sheet-mapping-table select {
  min-width: 220px;
}

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

.orders-monthly-chart {
  display: grid;
  gap: 12px;
}

.orders-month-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 180px;
  gap: 14px;
  align-items: center;
}

.orders-month-label {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.orders-month-bar-wrap {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.orders-month-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(212, 169, 79, 0.72), rgba(212, 169, 79, 1));
}

.orders-month-meta {
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.orders-month-meta strong {
  font-variant-numeric: tabular-nums;
}

.orders-month-meta span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.orders-items-table th,
.orders-items-table td,
.orders-table th,
.orders-table td {
  white-space: normal;
  vertical-align: top;
}

.orders-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.orders-items-stack {
  display: grid;
  gap: 14px;
}

.orders-item-card {
  border: 1px solid rgba(212, 169, 79, 0.18);
  border-radius: 18px;
  background: rgba(8, 16, 28, 0.6);
  padding: 16px;
}

.orders-item-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.orders-item-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hidden {
  display: none !important;
}

@media (max-width: 1200px) {
  .health-section-grid {
    grid-template-columns: 1fr;
  }

  .orders-analysis-grid,
  .orders-grid {
    grid-template-columns: 1fr;
  }

  .orders-detail-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .orders-pie-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .orders-pie-legend {
    width: 100%;
  }

  .orders-month-row {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .orders-month-meta {
    justify-items: start;
    text-align: left;
  }
}

.job-phase-cell span:first-child,
.jobs-table td:nth-child(7),
.jobs-table td:nth-child(9),
.jobs-table td:nth-child(10),
.jobs-table td:nth-child(11) {
  font-variant-numeric: tabular-nums;
}

.job-status-running {
  background: rgba(136, 208, 167, 0.18);
  color: var(--ok);
}

.job-status-claimed,
.job-status-queued {
  background: rgba(212, 169, 79, 0.18);
  color: var(--accent-strong);
}

.job-status-done {
  background: rgba(91, 129, 198, 0.18);
  color: #b9d3ff;
}

.job-status-failed,
.job-status-stopped {
  background: rgba(226, 125, 125, 0.18);
  color: #ffd4d4;
}

.rule-table {
  min-width: 760px;
}

.rule-table th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}

.rule-table td {
  min-width: 110px;
}

.rule-table td:last-child,
.rule-table th:last-child {
  min-width: 90px;
}

.rule-table input,
.rule-table select {
  min-width: 100px;
  padding: 10px 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.json-box, .log-box {
  margin: 0;
  background: rgba(4, 10, 18, 0.92);
  border-radius: 16px;
  padding: 16px;
  min-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
}

.compact-box {
  min-height: 80px;
  margin-bottom: 14px;
}

.log-box {
  max-height: 360px;
}

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

.checkbox input {
  width: auto;
}

.error {
  color: var(--danger);
  min-height: 20px;
}

.success {
  color: var(--ok);
}

code {
  color: var(--accent-strong);
}

@media (max-width: 980px) {
  .settings-grid,
  .jobs-grid,
  .admin-grid,
  .tools-grid,
  .admin-health-grid,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .cost-fields.subtab-panel.active {
    grid-template-columns: 1fr;
  }

  .cost-feature-box {
    grid-template-columns: 1fr;
  }

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

  .brand-lockup {
    align-items: flex-start;
  }

  .verify-card-head,
  .verify-section-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .verify-status-cluster {
    justify-content: flex-start;
  }
}
