:root {
  color-scheme: light;
  font-family: "Segoe UI", "Meiryo", sans-serif;
  --ink: #102033;
  --muted: #667789;
  --line: #d9e1e7;
  --line-strong: #c3d0d8;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --surface-band: #eef3f6;
  --navy: #071a44;
  --blue: #0d4f93;
  --teal: #087d8c;
  --gold: #d5a224;
  --gold-soft: #fff6dd;
  --danger: #9a241d;
  --danger-soft: #ffe8e3;
  --success: #166b3b;
  --success-soft: #dcf4e7;
  background: #f3f6f8;
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f3f6f8;
}

.recentLaunchInputs {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 12px;
}

.recentLaunchInputs summary {
  cursor: pointer;
  color: var(--navy);
  font-weight: 700;
  user-select: none;
}

.recentLaunchInputsList {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.recentLaunchInputsItems {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.recentLaunchInputsItems li {
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recentLaunchInputsEmpty {
  color: var(--muted);
}

.loginOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(243, 246, 248, 0.96);
}

.loginOverlay.hidden {
  display: none;
}

.loginCard {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 35px rgba(7, 26, 68, 0.16);
}

.loginBrand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.loginBrand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.loginBrand h2 {
  margin: 0;
  color: var(--navy);
}

.loginCard label,
.tenantAdminGrid label {
  display: grid;
  gap: 6px;
  color: #33465b;
  font-size: 13px;
}

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

.authBox span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #33465b;
  background: var(--surface-soft);
  font-size: 12px;
}

.tenantAdminGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.tenantAdminGrid > div {
  display: grid;
  gap: 10px;
  align-content: start;
}

.tenantAdminGrid h3 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 15px;
}

.appHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(7, 26, 68, 0.07);
  color: var(--ink);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brandBlock {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.brandMark {
  position: relative;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 6px;
  background: white;
  box-shadow: none;
  overflow: hidden;
}

.brandMark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 800;
  color: var(--navy);
}

p {
  margin: 4px 0 0;
  color: var(--muted);
}

button,
select,
input,
textarea {
  border: 1px solid #b8c4ca;
  background: white;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--ink);
}

select:focus,
input:focus,
textarea:focus {
  outline: 2px solid rgba(8, 125, 140, 0.25);
  border-color: var(--teal);
}

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

button {
  cursor: pointer;
}

.fieldLabel {
  margin: 0 0 6px;
  color: #33465b;
  font-size: 13px;
}

.appTabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
  align-items: center;
}

.appTabs button {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--navy);
  font-weight: 800;
}

.appTabs button.active {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
  box-shadow: inset 0 -2px 0 var(--gold);
}

.topNav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
}

.topNav button {
  min-height: 38px;
  border-color: transparent;
  background: transparent;
  color: #41546a;
  font-weight: 700;
  padding: 8px 12px;
}

.topNav button.active {
  background: #edf5f7;
  color: var(--teal);
  box-shadow: inset 0 -2px 0 var(--gold);
}

#refreshBtn {
  border-color: var(--navy);
  background: var(--navy);
  color: white;
  font-weight: 700;
}

main {
  padding: 20px 24px 28px;
}

.viewSection {
  display: none;
}

.viewSection.activeView {
  display: block;
}

.toolbar.viewSection.activeView {
  display: flex;
}

.layout.viewSection.activeView {
  display: grid;
}

.feedStatusList {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.feedStatusItem {
  border: 1px solid #d6e1ea;
  border-radius: 6px;
  display: grid;
  gap: 4px;
  padding: 10px;
}

.feedStatusItem strong {
  color: #001b4a;
}

.feedStatusItem span {
  font-weight: 800;
}

.feedStatusItem small {
  color: #50647a;
}

.feedStatusItem.ok {
  border-color: #bfe8d1;
  background: #f4fbf7;
}

.feedStatusItem.review {
  border-color: #f2d2b7;
  background: #fff8f2;
}

.feedStatusItem.danger {
  border-color: #f1b9b2;
  background: #fff5f4;
}

.operationsSwitcher.viewSection.activeView {
  display: flex;
}

.createSwitcher.viewSection.activeView {
  display: flex;
}

.settingsSwitcher.viewSection.activeView {
  display: flex;
}

[data-create-panel]:not(.activeCreatePanel) {
  display: none !important;
}

[data-ops-panel]:not(.activeOpsPanel) {
  display: none !important;
}

[data-settings-panel]:not(.activeSettingsPanel) {
  display: none !important;
}

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

.spapiOverviewGrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 12px;
  padding: 0 14px 14px;
}

.spapiStatusGrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  padding: 14px;
}

.systemHealthMetrics {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.systemHealthSummary {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(0, 1fr);
  gap: 12px;
  padding: 0 14px 14px;
}

.systemHealthVerdict,
.systemHealthMeta {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 16px;
}

.systemHealthVerdict strong {
  display: block;
  color: var(--navy);
  font-size: 20px;
}

.systemHealthVerdict span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

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

.compactPre {
  height: 180px;
}

.metricCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(7, 26, 68, 0.06);
}

.metricCard span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metricCard strong {
  font-size: 28px;
  color: var(--navy);
}

.metricCard small {
  display: block;
  min-height: 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.metricCard.alertMetric strong {
  color: var(--danger);
}

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

.listingStatusPanel {
  min-height: 480px;
}

.opsPanel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.opsPanelTitle {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  font-weight: 800;
}

.opsPanelTitle.withActions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.dashboardAckActions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.dashboardAckActions button {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.opsList {
  display: grid;
  gap: 0;
}

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

.opsListItem {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(220px, 1.3fr) minmax(160px, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 46px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: white;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.opsListItem:hover {
  background: #f6fbfd;
}

.opsListItem.staticOpsItem {
  cursor: default;
}

.opsListItem.staticOpsItem:hover {
  background: white;
}

.opsListItem.warningOpsItem {
  border-left: 4px solid var(--gold);
  background: #fffaf0;
}

.opsListItem.warningOpsItem:hover {
  background: #fffaf0;
}

.opsListItem strong,
.opsListItem span,
.opsListItem em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opsListItem strong {
  color: var(--navy);
}

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

.opsListItem em {
  color: var(--danger);
  font-size: 12px;
  font-style: normal;
}

.opsEmpty {
  padding: 14px 12px;
  color: var(--muted);
}

.listingSummaryGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfe;
}

.listingSummaryGrid strong {
  display: block;
  font-size: 24px;
  color: var(--navy);
}

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

.listingSummaryMeta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 12px;
  background: #fbfdfe;
  border-bottom: 1px solid var(--line);
}

.listingStatusRows {
  display: grid;
  padding: 8px 12px 12px;
  max-height: 620px;
  overflow: auto;
  align-content: start;
}

.listingStatusRow {
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) minmax(110px, 0.7fr) minmax(110px, 0.7fr) minmax(150px, 0.9fr) minmax(110px, 0.7fr) minmax(180px, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.listingStatusRowHead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: white;
  padding-top: 6px;
  padding-bottom: 8px;
}

.listingStatusRowHead span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.listingStatusRow strong,
.listingStatusRow span,
.listingStatusRow em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.listingStatusRow strong {
  color: var(--navy);
  font-size: 14px;
}

.listingStatusRow span {
  color: var(--ink);
  font-size: 13px;
}

.listingStatusRow em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.opsSubnote {
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.createJob,
.runnerPanel,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(7, 26, 68, 0.04);
}

.createJob,
.runnerPanel {
  margin-bottom: 16px;
}

.createSwitcher,
.operationsSwitcher,
.settingsSwitcher {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(7, 26, 68, 0.04);
}

.createSwitcher.activeView,
.operationsSwitcher.activeView,
.settingsSwitcher.activeView {
  display: flex;
}

.createSwitcher p,
.operationsSwitcher p,
.settingsSwitcher p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.inlineTitle {
  padding: 0;
  border: 0;
  background: transparent;
}

.createSwitcher .panelTitle.inlineTitle,
.operationsSwitcher .panelTitle.inlineTitle,
.settingsSwitcher .panelTitle.inlineTitle {
  padding: 0;
  border: 0;
  background: transparent;
}

.createTabs,
.opsTabs,
.settingsTabs,
.spapiRegistryTabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6fafb;
}

.createTabs button,
.opsTabs button,
.settingsTabs button,
.spapiRegistryTabs button {
  min-width: 104px;
  border-color: transparent;
  background: transparent;
  color: var(--navy);
  font-weight: 800;
}

.createTabs button.active,
.opsTabs button.active,
.settingsTabs button.active,
.spapiRegistryTabs button.active {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.spapiRegistryTabs {
  margin: 12px 14px 0;
}

.spapiRegistryHint {
  margin: 10px 14px 0;
  padding: 10px 12px;
  border: 1px solid #cfe0e7;
  border-radius: 8px;
  background: #f7fbfd;
  color: var(--muted);
  font-size: 13px;
}

[data-create-panel]:not(.activeCreatePanel) {
  display: none !important;
}

[data-settings-panel]:not(.activeSettingsPanel) {
  display: none !important;
}

[data-spapi-registry-panel]:not(.activeSpapiRegistryPanel) {
  display: none !important;
}

.workflowHint {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px 0;
}

.workflowHint span {
  padding: 5px 9px;
  border: 1px solid #cfe0e7;
  border-radius: 999px;
  background: #f6fafb;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

.dangerWorkflow span {
  border-color: #f0c8bc;
  background: var(--danger-soft);
  color: var(--danger);
}

.createSummary {
  margin: 12px 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.createSummary.ready {
  border-color: #9fd0bf;
  background: #f1faf6;
}

.createSummary.blocked {
  border-color: #f1c8b5;
  background: #fff7f2;
}

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

.createSummaryTitle {
  color: var(--navy);
  font-weight: 800;
}

.createSummaryState {
  padding: 4px 8px;
  border-radius: 999px;
  background: #dfeaf0;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

.createSummary.ready .createSummaryState {
  background: #cfeadb;
  color: #1f6b48;
}

.createSummary.blocked .createSummaryState {
  background: #f5d7c9;
  color: var(--danger);
}

.createSummaryGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 8px;
}

.createSummaryItem {
  min-width: 0;
  padding: 8px;
  border: 1px solid #dbe8ee;
  border-radius: 6px;
  background: white;
}

.createSummaryItem span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.createSummaryItem strong {
  display: block;
  overflow: hidden;
  color: var(--navy);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.createSummaryIssues {
  margin-top: 8px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.createResultPanel {
  margin: 0 14px 14px;
  padding: 12px;
  border: 1px solid #9fd0bf;
  border-radius: 8px;
  background: #f1faf6;
  color: var(--navy);
}

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

.createResultHead strong,
.createResultHead span {
  display: block;
}

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

.createResultStatus {
  padding: 4px 8px;
  border-radius: 999px;
  background: #cfeadb;
  color: #1f6b48 !important;
  font-size: 12px;
  font-weight: 900;
}

.createResultMeta {
  margin-top: 8px;
  color: #44596c;
  font-size: 13px;
}

.createResultWarning {
  margin-top: 8px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}

.progressNotice {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 4px 8px;
  align-items: center;
  padding: 10px 0;
  color: var(--navy);
}

.progressNotice strong {
  font-size: 13px;
}

.progressNotice small {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}

.progressDot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  animation: progressPulse 1s ease-in-out infinite;
}

@keyframes progressPulse {
  0% { opacity: 0.35; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.35; transform: scale(0.8); }
}

.createResultActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.createResultActions button {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
  font-weight: 800;
}

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

.runnerBody {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px;
}

.runnerBody button,
.jobRuleActions button {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
  font-weight: 700;
}

.runnerBody select,
.runnerBody input[type="search"] {
  min-width: 180px;
}

.inlineAction {
  padding: 4px 6px;
  border-color: #c8d5db;
  background: #eef6f8;
  color: var(--navy);
  text-align: left;
  font-size: 12px;
  line-height: 1.35;
}

.dangerInline {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
}

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

.hint {
  display: inline-block;
  min-width: 92px;
  padding: 3px 7px;
  border-radius: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.hint.ok { background: var(--success-soft); color: var(--success); }
.hint.review { background: var(--gold-soft); color: #7b5700; }
.hint.candidate { background: var(--danger-soft); color: var(--danger); }
.hint.neutral { background: #eef1f3; color: var(--muted); }

.rulesLayout {
  max-height: 300px;
  overflow: auto;
}

.rulesDetail,
.workerPreviewOutput {
  height: 260px;
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: #101820;
  color: #d8f3dc;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.exclusionLayout {
  display: grid;
  grid-template-columns: minmax(260px, 0.35fr) minmax(520px, 0.65fr);
  gap: 0;
  border-top: 1px solid var(--line);
}

.compactTitle {
  border-top: 0;
}

.reasonChecks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding: 14px;
}

.reasonChecks label {
  justify-content: space-between;
  gap: 12px;
}

.reasonChecks .count {
  color: var(--muted);
  font-size: 12px;
}

.exclusionConditions {
  border-top: 1px solid var(--line);
}

.exclusionConditions .tableWrap {
  max-height: 360px;
  overflow: auto;
}

.exclusionConditions td input[type="text"],
.exclusionConditions td input[type="number"],
.exclusionConditions td select {
  min-width: 120px;
}

.exclusionConditions td:nth-child(2) input,
.exclusionConditions td:nth-child(3) select,
.exclusionConditions td:nth-child(9) input {
  min-width: 180px;
}

.settingsEditor {
  border-top: 1px solid var(--line);
}

.settingsForm,
.formGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  padding: 14px;
}

.settingsForm label,
.formGrid label {
  align-items: stretch;
  flex-direction: column;
}

.formGrid .wide {
  grid-column: span 2;
}

.advancedCredentialBlock {
  border: 1px solid #d5e4ea;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fbfc;
}

.advancedCredentialBlock summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.nestedFormGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.nestedFormGrid .wide {
  grid-column: 1 / -1;
}

.formGrid .check {
  justify-content: center;
  align-items: center;
  flex-direction: row;
}

.formGrid .metaInline {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.formSectionTitle {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-top: 4px;
  padding: 10px 0 6px;
  border-top: 1px solid #e2ebef;
}

.formSectionTitle:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.formSectionTitle strong {
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
}

.formSectionTitle span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.fieldHelp {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.panelSubTitle {
  padding: 10px 14px 8px;
  border-top: 1px solid var(--line);
  background: #f8fbfc;
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
}

.confirmSection {
  border-top-color: #f1c8b5;
}

.confirmSection strong,
.confirmSection span {
  color: var(--danger);
}

.policyRanges {
  padding: 0 14px 14px;
}

.bulkCopyPanel {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfdfe;
}

.bulkCopyGrid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.2fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: start;
}

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

.bulkCopyGrid select {
  min-width: 0;
}

.bulkCopyGrid select[multiple] {
  min-height: 170px;
}

.bulkCopyOptions {
  display: grid;
  gap: 10px;
}

.buttonRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.bulkCopyOptions button {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
  font-weight: 700;
}

.profileSubTables {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 14px;
  padding: 0 14px 14px;
}

.profileSubTable {
  min-width: 0;
}

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

.toolbarActions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.rangeToolbar button,
.formGrid button {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
  font-weight: 700;
}

.rangeTableWrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.rangeTable {
  min-width: 980px;
}

.profileRangeTable {
  min-width: 980px;
}

.profileLeadTable {
  min-width: 620px;
}

.rangeTable input,
.rangeTable select {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
}

.rangeTable th:nth-child(1),
.rangeTable td:nth-child(1) {
  width: 80px;
}

.rangeTable th:nth-child(2),
.rangeTable td:nth-child(2) {
  width: 80px;
}

.profileRangeTable th:nth-child(1),
.profileRangeTable td:nth-child(1),
.profileRangeTable th:nth-child(2),
.profileRangeTable td:nth-child(2) {
  width: 150px;
  min-width: 150px;
}

.profileRangeTable th:nth-child(3),
.profileRangeTable td:nth-child(3) {
  width: 92px;
  min-width: 92px;
}

.profileRangeTable th:nth-child(4),
.profileRangeTable td:nth-child(4) {
  width: 112px;
  min-width: 112px;
}

.rangeTable th:nth-child(5),
.rangeTable td:nth-child(5) {
  width: 130px;
}

.rangeTable th:nth-child(8),
.rangeTable td:nth-child(8) {
  width: 80px;
}

.rangeTable button,
.dangerActions button {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.rulePreview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: #33444c;
  font-size: 13px;
}

.rulePreview strong {
  color: var(--ink);
}

.rulePreview span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: white;
}

.storeProfilePreview {
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  background: #fbfcfd;
}

.profilePreviewHead {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.profilePreviewHead strong {
  color: var(--ink);
}

.profilePreviewHead span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  color: var(--navy);
  background: #eef6f8;
  border: 1px solid #cbdbe3;
  border-radius: 999px;
  font-size: 13px;
}

.warningText strong,
.warningText span {
  color: #8f3d0e;
}

.warningText span {
  background: #fff2e9;
  border-color: #f0cdb8;
}

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

.profilePreviewTitle {
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.miniProfileTable {
  width: 100%;
  font-size: 12px;
}

.miniProfileTable th,
.miniProfileTable td {
  padding: 5px 6px;
  vertical-align: top;
}

.profileEmpty {
  color: var(--muted);
  border: 1px dashed #cbd6dc;
  border-radius: 6px;
  padding: 8px;
}

.historyList {
  padding: 10px;
}

.historyList strong {
  display: block;
  margin-bottom: 8px;
}

.historyList button {
  padding: 5px 8px;
  font-size: 12px;
}

.historyList button[data-history-action="restore"] {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.dangerCheck {
  color: #8f3d0e;
  font-weight: 700;
}

.dangerCheck input {
  accent-color: #b9471d;
}

.formGrid button {
  align-self: end;
}

.deleteGrid {
  grid-template-columns: minmax(260px, 0.8fr) minmax(220px, 0.6fr) minmax(320px, 1fr) minmax(220px, 0.6fr);
}

.checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checks button {
  margin-top: auto;
}

.toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #35475a;
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(640px, 1.1fr) minmax(420px, 0.9fr);
  gap: 16px;
}

.panelTitle {
  padding: 12px 14px;
  background: var(--surface-band);
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  color: var(--navy);
}

.meta {
  padding: 8px 14px;
  color: var(--muted);
  font-size: 13px;
}

.meta.warning {
  color: #8f3d0e;
  background: #fff4ed;
  border-top: 1px solid #f1c8b5;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid #edf1f3;
  text-align: left;
  vertical-align: top;
}

th {
  color: #52636c;
  font-weight: 700;
  background: #fafbfc;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f4f8fa;
}

.jobListActions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.jobListActions button {
  padding: 4px 7px;
  border-color: #c8d5db;
  background: #eef6f8;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.jobListActions button.danger {
  border-color: #e5c2ba;
  background: var(--danger-soft);
  color: var(--danger);
}

.status {
  display: inline-block;
  min-width: 76px;
  padding: 3px 7px;
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.status.RUNNING,
.status.ACTIVE { background: #dceeff; color: #075389; }
.status.QUEUED { background: var(--gold-soft); color: #7b5700; }
.status.STOPPING { background: #fff3cd; color: #805600; }
.status.FAILED,
.status.STALE { background: var(--danger-soft); color: var(--danger); }
.status.COMPLETED,
.status.DONE { background: var(--success-soft); color: var(--success); }
.status.CANCELLED,
.status.STOPPED { background: #e7e8ea; color: #505a60; }

.jobActionNote {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  background: #fff8dd;
  color: #805600;
  font-size: 12px;
  font-weight: 700;
}

.detailBox {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.5;
}

.jobDetailStructured {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.jobDetailHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2ebef;
}

.jobDetailKicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.jobDetailHeader h2 {
  margin: 2px 0 4px;
  color: var(--navy);
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

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

.jobDetailStatus {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.jobNextAction {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid #d7e7ee;
  border-radius: 8px;
  background: #f6fafb;
}

.jobNextAction strong {
  color: var(--navy);
  white-space: nowrap;
}

.jobNextAction span {
  color: #385064;
  text-align: right;
}

.jobStopSummary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid #cfd4d8;
  border-radius: 8px;
  background: #f4f6f7;
  color: #33444c;
}

.jobStopSummary strong {
  display: block;
  color: #2f3a40;
}

.jobStopSummary span {
  overflow-wrap: anywhere;
}

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

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

.jobDetailItem {
  min-width: 0;
  padding: 9px;
  border: 1px solid #dfe9ee;
  border-radius: 6px;
  background: white;
}

.jobDetailItem span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.jobDetailItem strong {
  display: block;
  overflow: hidden;
  color: var(--navy);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jobDetailCard {
  padding: 10px;
  border: 1px solid #dfe9ee;
  border-radius: 8px;
  background: white;
}

.jobDetailCardTitle {
  margin-bottom: 8px;
  color: var(--navy);
  font-weight: 900;
}

.jobBindingLine {
  color: #385064;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.jobBindingIssue {
  margin-top: 6px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}

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

.jobWebDbBlock {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  padding: 8px;
  border: 1px solid #e4eef3;
  border-radius: 6px;
  background: #f8fbfc;
  color: #385064;
  font-size: 12px;
}

.jobWebDbBlock strong {
  color: var(--navy);
  font-size: 13px;
}

.jobWebDbBlock span {
  overflow-wrap: anywhere;
}

.listingSnapshotGroups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.listingSnapshotGroup {
  border: 1px solid #e4eef3;
  border-radius: 6px;
  padding: 8px;
  background: #f8fbfc;
}

.listingSnapshotHead {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  color: #385064;
  font-size: 12px;
}

.listingSnapshotHead strong {
  color: var(--navy);
  font-size: 13px;
}

.jobEvents {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.jobEvent {
  padding-bottom: 7px;
  border-bottom: 1px solid #eef3f5;
}

.jobEvent:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.jobEvent span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.jobEvent strong {
  display: block;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

.logSummary {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfc;
  color: var(--navy);
  font-size: 13px;
}

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

.logSummaryHead strong,
.logSummaryHead span {
  display: block;
}

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

.logSummaryState {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

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

.logSummaryState.review {
  background: var(--danger-soft);
  color: var(--danger);
}

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

.logSignal {
  min-width: 0;
  padding: 8px;
  border: 1px solid #dfe9ee;
  border-radius: 6px;
  background: white;
}

.logSignal.ok {
  border-color: #b9dccb;
}

.logSignal.review {
  border-color: #f0c8bc;
  background: #fff7f2;
}

.logSignal span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.logSignal strong {
  display: block;
  overflow: hidden;
  color: var(--navy);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logSignalBlock {
  margin-top: 10px;
  padding: 9px;
  border: 1px solid #dfe9ee;
  border-radius: 6px;
  background: white;
}

.logSignalBlock.danger {
  border-color: #f0c8bc;
  background: #fff7f2;
}

.logSignalBlock strong {
  display: block;
  margin-bottom: 5px;
  color: var(--navy);
}

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

.logSignalBlock span {
  display: block;
  color: #385064;
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.jobRuleActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tableScroll {
  overflow: auto;
  border-top: 1px solid var(--line);
}

.clickableRow {
  cursor: pointer;
}

.clickableRow:hover {
  background: #f3f8fa;
}

.manifestPanel {
  color: #102333;
  font-family: inherit;
  white-space: normal;
}

.manifestHeader {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: 8px;
  background: #f7fbfd;
  border: 1px solid #cfe0e7;
}

.manifestHeader h3 {
  margin: 2px 0 4px;
  color: var(--navy);
  font-size: 16px;
}

.manifestHeader p,
.manifestKicker,
.manifestHashBox span,
.manifestCards span,
.manifestNote {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.manifestHashBox {
  min-width: 180px;
  padding: 8px;
  border-radius: 8px;
  background: white;
  border: 1px solid #d8e4e9;
}

.manifestHashBox strong,
.manifestCards strong {
  display: block;
  margin-top: 4px;
  color: var(--navy);
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

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

.manifestCards > div {
  min-height: 54px;
  padding: 10px;
  border: 1px solid #d8e4e9;
  border-radius: 8px;
  background: white;
}

.manifestSafety {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.manifestPill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

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

.manifestPill.review {
  color: var(--danger);
  background: var(--danger-soft);
}

.manifestTableWrap {
  margin-top: 10px;
  overflow: auto;
  border: 1px solid #d8e4e9;
  border-radius: 8px;
  background: white;
}

.manifestTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.manifestTable th,
.manifestTable td {
  padding: 8px;
  border-bottom: 1px solid #edf2f5;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.manifestTable th {
  color: var(--muted);
  background: #f3f8fa;
  font-size: 11px;
  text-transform: uppercase;
}

.manifestJson {
  margin-top: 10px;
  color: var(--navy);
}

.manifestJson summary {
  cursor: pointer;
  font-weight: 800;
}

.manifestJson pre {
  height: 320px;
  margin-top: 8px;
  border-radius: 8px;
}

.inlineCheck {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid #c8d5db;
  border-radius: 6px;
  color: var(--navy);
  background: #f7fafb;
  font-weight: 700;
}

pre {
  margin: 0;
  padding: 14px;
  height: 560px;
  overflow: auto;
  background: #101820;
  color: #d8f3dc;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

@media (max-width: 1100px) {
  .appHeader {
    align-items: flex-start;
    flex-direction: column;
  }

  .topNav {
    margin-left: 0;
  }

  .dashboardGrid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .spapiOverviewGrid,
  .dashboardOpsGrid,
  .bulkCopyGrid,
  .profileSubTables,
  .profilePreviewTables,
  .systemHealthSummary,
  .tenantAdminGrid,
  .layout {
    grid-template-columns: 1fr;
  }

  .spapiStatusGrid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .opsListItem {
    grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1fr) minmax(140px, 0.8fr);
  }

  .listingSummaryGrid,
  .listingStatusRow {
    grid-template-columns: 1fr;
  }

  .listingStatusRowHead {
    display: none;
  }

  .formGrid,
  .settingsForm {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  main {
    padding: 12px;
  }

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

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

  .opsListItem {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.viewSection:not(.activeView) {
  display: none !important;
}

.viewSection.activeView {
  display: block;
}

.toolbar.viewSection.activeView {
  display: flex;
}

.layout.viewSection.activeView {
  display: grid;
}
