:root {
  --sidebar: #15232a;
  --sidebar-strong: #0f1b21;
  --accent: #0b7fbd;
  --accent-strong: #05679c;
  --line: #dfe7ec;
  --muted: #62737e;
  --text: #23313a;
  --surface: #ffffff;
  --background: #f5f7f9;
  --success: #16805a;
  --danger: #bf2e3b;
  --warning: #9a6500;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.app {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  background: var(--sidebar);
  color: #d8e4ea;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.brand {
  height: 74px;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #5bc0eb;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand span {
  display: block;
  color: #ffffff;
  font-weight: 500;
}

.brand img {
  display: block;
  max-width: 62px;
  max-height: 48px;
  object-fit: contain;
}

.brand-mark {
  font-size: 17px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.nav a,
.nav-session button {
  position: relative;
  color: #c7d4da;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  gap: 6px;
  font-size: 11px;
  text-align: center;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-separator {
  display: block;
  flex: 0 0 1px;
  height: 1px;
  margin: 6px 14px;
  background: rgba(255, 255, 255, 0.13);
}

.nav-session {
  flex: 0 0 auto;
  margin: 0 0 12px;
  padding: 0;
}

.nav-session button {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.nav-session button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav a.active {
  background: var(--sidebar-strong);
  color: #ffffff;
}

.nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background: #1ba4e7;
}

.nav-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  background: #f6f8fa;
  overflow-y: auto;
}

.login-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: clamp(18px, 4vh, 32px) 16px;
}

.login-card {
  width: min(100%, 390px);
  margin: auto;
}

.login-form {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(17, 37, 48, 0.09);
  padding: 28px;
}

.login-brand {
  display: flex;
  justify-content: center;
}

.login-brand img {
  display: block;
  width: auto;
  height: 39px;
  max-width: 100%;
  object-fit: contain;
}

.login-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 48px;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.login-title {
  text-align: left;
  margin-bottom: 2px;
}

.login-title h1 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.2;
}

.login-submit {
  min-height: 42px;
  margin-top: 4px;
}

.login-links {
  text-align: center;
  font-size: 13px;
}

.login-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  padding-top: 12px;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.content {
  padding: 16px;
  flex: 1;
}

.app-footer {
  min-height: 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
  font-size: 12px;
  background: #f8fafb;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-head > .toolbar {
  flex: 0 1 320px;
  justify-content: flex-end;
  margin-left: auto;
  padding-top: 4px;
}

.page-head > .toolbar select {
  width: min(320px, 42vw);
}

h1 {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

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

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(17, 37, 48, 0.04);
}

.card {
  padding: 18px 20px;
}

.metric-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-value {
  margin-top: 12px;
  font-size: 28px;
  font-weight: 700;
}

.procedure-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
}

.procedure-dashboard-grid > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 14px 16px;
}

.procedure-dashboard-grid span,
.procedure-dashboard-grid strong {
  display: block;
}

.procedure-dashboard-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.procedure-dashboard-grid strong {
  margin-top: 8px;
  font-size: 24px;
}

.panel {
  margin-bottom: 20px;
  overflow: hidden;
}

.panel-head {
  min-height: 54px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.panel-title {
  margin: 0;
  font-size: 16px;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.panel-head-actions form {
  display: flex;
  margin: 0;
}

.panel-head-actions .button.compact {
  height: 34px;
  min-height: 34px;
}

.panel-body {
  padding: 18px;
}

.collapsible-panel .panel-head {
  flex-wrap: nowrap;
}

.panel-toggle {
  flex: 0 0 34px;
}

.panel-toggle .button-icon {
  transition: transform 0.16s ease;
}

.collapsible-panel.is-collapsed .panel-body {
  display: none;
}

.collapsible-panel.is-collapsed .panel-head {
  border-bottom: 0;
}

.collapsible-panel.is-collapsed .panel-toggle .button-icon {
  transform: rotate(-90deg);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 100%;
}

.toolbar select {
  min-width: 220px;
}

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

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

.form-grid .full {
  grid-column: 1 / -1;
}

.compact-form {
  align-items: end;
}

.compact-form .filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.compact-form .filter-actions .button {
  min-height: 38px;
  white-space: nowrap;
}

label {
  display: block;
  margin-bottom: 6px;
  color: #3b4b54;
  font-weight: 650;
  font-size: 12px;
}

.field-help {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd9df;
  background: #ffffff;
  color: var(--text);
  border-radius: 5px;
  padding: 9px 10px;
  font: inherit;
  min-height: 38px;
}

input[type="file"] {
  padding: 7px 10px;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #62737e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: #eef4f7;
  color: var(--accent);
  outline: none;
}

.password-toggle .button-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, transparent 50%, #7b8b94 50%),
    linear-gradient(135deg, #7b8b94 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 16px,
    calc(100% - 12px) 16px;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
  line-height: 1.35;
  padding-right: 34px;
}

select::-ms-expand {
  display: none;
}

.ordered-multiselect {
  display: grid;
  gap: 8px;
  border: 1px solid #cfd9df;
  border-radius: 5px;
  background: #ffffff;
  padding: 8px;
}

.ordered-multiselect.is-invalid {
  border-color: #e05260;
  box-shadow: 0 0 0 2px rgba(224, 82, 96, 0.12);
}

.key-mapping-field {
  display: grid;
  gap: 8px;
}

.key-mapping-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.key-column {
  min-width: 0;
}

.key-column-title {
  margin-bottom: 6px;
  color: #3b4b54;
  font-size: 12px;
  font-weight: 700;
}

.key-pair-preview {
  display: grid;
  overflow: hidden;
  border: 1px solid #d7e1e7;
  border-radius: 5px;
  background: #ffffff;
}

.key-pair-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid #e5edf2;
}

.key-pair-row:first-child {
  border-top: 0;
}

.key-pair-row > div {
  min-width: 0;
  padding: 7px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-left: 1px solid #e5edf2;
  font-size: 12px;
}

.key-pair-row > div:first-child {
  border-left: 0;
  color: var(--muted);
  font-weight: 700;
}

.key-pair-head {
  background: #f5f8fa;
  color: #52666f;
  font-weight: 700;
  text-transform: uppercase;
}

.key-pair-row.is-missing {
  background: #fff6f0;
  color: #9a4c00;
}

.key-pair-empty {
  padding: 9px;
  color: var(--muted);
  font-size: 12px;
}

.selected-order {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
  align-items: center;
}

.selected-empty,
.column-empty {
  color: var(--muted);
  font-size: 12px;
}

.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  border: 1px solid #c7d4dc;
  border-radius: 5px;
  background: #eef7fb;
  color: #24343d;
  padding: 4px 5px;
  font-size: 12px;
  line-height: 1.2;
}

.chip-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.chip-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-chip button {
  min-height: 22px;
  border: 1px solid #c7d4dc;
  border-radius: 4px;
  background: #ffffff;
  color: #24343d;
  padding: 2px 5px;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.column-options {
  display: grid;
  gap: 5px;
  max-height: 150px;
  overflow: auto;
  padding-top: 8px;
  border-top: 1px solid #e2e9ee;
}

.column-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px;
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.column-option:hover {
  background: #f3f7f9;
}

.column-option input {
  width: auto;
}

.column-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-option small {
  color: var(--muted);
  font-size: 11px;
}

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

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

.checkline input {
  width: auto;
}

.form-checkline {
  align-self: start;
  padding-top: 24px;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid #c7d4dc;
  border-radius: 5px;
  background: #ffffff;
  color: #24343d;
  padding: 7px 12px;
  font-weight: 650;
  cursor: pointer;
}

.button-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

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

.button.danger {
  color: var(--danger);
  border-color: #f0c7cc;
}

.has-modal-open {
  overflow: hidden;
}

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

.confirm-modal[hidden] {
  display: none;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 27, 33, 0.46);
}

.confirm-dialog {
  position: relative;
  width: min(100%, 430px);
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 20px 54px rgba(17, 37, 48, 0.22);
  padding: 18px;
}

.confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: #eef3f6;
  color: var(--muted);
}

.confirm-icon.is-danger {
  background: #fff0f1;
  color: var(--danger);
}

.confirm-content h2 {
  margin: 0 0 7px;
  font-size: 18px;
  line-height: 1.3;
}

.confirm-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.confirm-actions .button {
  min-width: 86px;
}

.app-notice {
  animation: notice-slide 0.16s ease-out;
}

@keyframes notice-slide {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.code-list {
  display: grid;
  gap: 8px;
}

.code-list div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.code-list span {
  color: var(--muted);
  font-weight: 700;
}

.code-list code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fbfcfd;
  padding: 8px 10px;
}

.api-usage-section + .api-usage-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.api-usage-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.api-usage-heading h3 {
  margin: 0;
  font-size: 14px;
}

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

.api-usage-section .code-list code {
  overflow-x: auto;
  text-overflow: clip;
}

.api-usage-note {
  margin-top: 12px;
  border-left: 3px solid var(--accent);
  background: #f3f8fb;
  color: #455862;
  padding: 10px 12px;
  line-height: 1.55;
}

.api-example {
  margin-top: 14px;
}

.api-example-label {
  margin-bottom: 7px;
  color: #3b4b54;
  font-size: 12px;
  font-weight: 700;
}

.api-example pre {
  margin: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101b22;
  color: #d9e8ef;
  padding: 13px;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.api-example code {
  white-space: pre;
}

.account-password-form {
  width: 100%;
  max-width: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 12px;
  row-gap: 14px;
  align-items: start;
}

.account-password-form .wide {
  grid-column: auto;
}

.account-password-form .full {
  grid-column: 1 / span 2;
}

.account-form-help {
  margin-top: -4px;
}

.account-password-form .actions {
  margin-top: 4px;
}

.account-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.account-summary div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
}

.account-summary span {
  font-size: 12px;
}

.account-summary code {
  min-width: 0;
}

.button.compact {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.button.icon-only {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  gap: 0;
}

.button.compact.icon-only {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
}

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

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

th,
td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

th {
  color: #596c76;
  font-size: 12px;
  text-transform: uppercase;
  background: #fbfcfd;
}

td.actions-cell {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}

.actions-cell .actions {
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.actions-cell .button {
  width: 34px;
  white-space: nowrap;
}

.connections-table {
  table-layout: fixed;
  min-width: 1180px;
}

.connections-table .col-name {
  width: 190px;
}

.connections-table .col-type {
  width: 120px;
}

.connections-table .col-status {
  width: 130px;
}

.connections-table .col-updated {
  width: 190px;
}

.connections-table .col-actions {
  width: 160px;
}

.connections-table .name-cell,
.connections-table .type-cell,
.connections-table .updated-cell,
.connections-table .dsn-cell {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connections-table .status-cell {
  text-align: left;
}

.connections-table .actions {
  align-items: center;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 7px;
}

.connections-table .actions form,
.connections-table .actions .button {
  width: auto;
}

.dashboard-jobs-table,
.recent-runs-table,
.dashboard-procedure-runs-table,
.jobs-table,
.tasks-table,
.mappings-table,
.api-keys-table,
.job-runs-table,
.task-runs-table,
.watermark-table {
  table-layout: fixed;
}

.dashboard-jobs-table {
  min-width: 950px;
}

.dashboard-jobs-table th:nth-child(1) { width: 150px; }
.dashboard-jobs-table th:nth-child(2) { width: 170px; }
.dashboard-jobs-table th:nth-child(3) { width: 170px; }
.dashboard-jobs-table th:nth-child(4) { width: 90px; }
.dashboard-jobs-table th:nth-child(5) { width: 170px; }
.dashboard-jobs-table th:nth-child(6) { width: 110px; }
.dashboard-jobs-table th:nth-child(7) { width: 70px; }

.recent-runs-table {
  min-width: 760px;
}

.recent-runs-table th:nth-child(1) { width: 70px; }
.recent-runs-table th:nth-child(3) { width: 120px; }
.recent-runs-table th:nth-child(4) { width: 180px; }
.recent-runs-table th:nth-child(5) { width: 180px; }

.dashboard-procedure-runs-table {
  min-width: 1080px;
}

.dashboard-procedure-runs-table th:nth-child(1) { width: 120px; }
.dashboard-procedure-runs-table th:nth-child(2) { width: 180px; }
.dashboard-procedure-runs-table th:nth-child(3) { width: 130px; }
.dashboard-procedure-runs-table th:nth-child(4) { width: 100px; }
.dashboard-procedure-runs-table th:nth-child(5) { width: 190px; }
.dashboard-procedure-runs-table th:nth-child(6) { width: 190px; }
.dashboard-procedure-runs-table th:nth-child(7) { width: 110px; }
.dashboard-procedure-runs-table th:nth-child(8) { width: 64px; }

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

.jobs-table .col-name { width: 210px; }
.jobs-table .col-interval { width: 90px; }
.jobs-table .col-next-run { width: 190px; }
.jobs-table .col-status { width: 120px; }
.jobs-table .col-schedule { width: 120px; }
.jobs-table .col-updated { width: 190px; }
.jobs-table .col-actions { width: 180px; }

.jobs-table .datetime-cell {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.tasks-table {
  min-width: 1320px;
}

.tasks-table .col-name { width: 150px; }
.tasks-table .col-object { width: 190px; }
.tasks-table .col-keys { width: 250px; }
.tasks-table .col-mode { width: 90px; }
.tasks-table .col-delete { width: 130px; }
.tasks-table .col-status { width: 110px; }
.tasks-table .col-actions { width: 176px; }

.tasks-table .object-cell,
.tasks-table .keys-cell {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mappings-table {
  min-width: 1030px;
}

.mappings-table th:nth-child(1) { width: 220px; }
.mappings-table th:nth-child(2) { width: 44px; }
.mappings-table th:nth-child(3) { width: 220px; }
.mappings-table th:nth-child(4) { width: 110px; }
.mappings-table th:nth-child(5) { width: 150px; }
.mappings-table th:nth-child(6) { width: 80px; }
.mappings-table th:nth-child(7) { width: 110px; }
.mappings-table th:nth-child(8) { width: 96px; }

.api-keys-table {
  min-width: 960px;
}

.api-keys-table th:nth-child(1) { width: 220px; }
.api-keys-table th:nth-child(2) { width: 180px; }
.api-keys-table th:nth-child(3) { width: 120px; }
.api-keys-table th:nth-child(4) { width: 190px; }
.api-keys-table th:nth-child(5) { width: 190px; }
.api-keys-table th:nth-child(6) { width: 96px; }

.logs-panel {
  overflow: hidden;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  overflow-x: auto;
}

.dashboard-tabs {
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.dashboard-tabs .tab-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.tab-button {
  appearance: none;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #596c76;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  min-height: 48px;
  padding: 0 18px;
  white-space: nowrap;
}

.tab-button:hover {
  color: var(--text);
}

.tab-button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel {
  display: none;
}

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

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

.parameter-head label {
  margin-bottom: 0;
}

.parameter-head .field-help {
  margin-top: 5px;
}

.parameter-table-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
}

.procedure-parameters-table {
  min-width: 930px;
  table-layout: fixed;
}

.procedure-parameters-table th:nth-child(1) { width: 170px; }
.procedure-parameters-table th:nth-child(2) { width: 150px; }
.procedure-parameters-table th:nth-child(3) { width: 140px; }
.procedure-parameters-table th:nth-child(4) { width: 150px; }
.procedure-parameters-table th:nth-child(5) { width: 90px; }
.procedure-parameters-table th:nth-child(6) { width: 90px; }
.procedure-parameters-table th:nth-child(7) { width: 110px; }

.procedure-parameters-table select {
  min-height: 34px;
  padding: 6px 8px;
}

.parameter-check {
  text-align: center;
}

.parameter-check input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.procedures-table {
  min-width: 1260px;
  table-layout: fixed;
}

.procedures-table th:nth-child(1) { width: 160px; }
.procedures-table th:nth-child(2) { width: 180px; }
.procedures-table th:nth-child(3) { width: 230px; }
.procedures-table th:nth-child(4) { width: 76px; }
.procedures-table th:nth-child(5) { width: 140px; }
.procedures-table th:nth-child(6) { width: 100px; }
.procedures-table th:nth-child(7) { width: 72px; }
.procedures-table th:nth-child(8) { width: 100px; }
.procedures-table th:nth-child(9) { width: 190px; }

.procedure-run-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.procedure-run-fields .wide {
  grid-column: span 2;
}

.procedure-runs-table {
  min-width: 1350px;
  table-layout: fixed;
}

.procedure-runs-table th:nth-child(1) { width: 120px; }
.procedure-runs-table th:nth-child(2) { width: 170px; }
.procedure-runs-table th:nth-child(3) { width: 150px; }
.procedure-runs-table th:nth-child(4) { width: 100px; }
.procedure-runs-table th:nth-child(5) { width: 180px; }
.procedure-runs-table th:nth-child(6) { width: 190px; }
.procedure-runs-table th:nth-child(7) { width: 190px; }
.procedure-runs-table th:nth-child(8) { width: 130px; }
.procedure-runs-table th:nth-child(9) { width: 64px; }

.procedure-run-detail .panel-head {
  align-items: flex-start;
}

.run-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.run-summary-grid > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 11px 12px;
}

.run-summary-grid span,
.run-summary-grid strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.run-summary-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 5px;
  text-transform: uppercase;
}

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

.run-json-grid > div {
  min-width: 0;
}

.run-json-grid pre {
  min-height: 150px;
  max-height: 360px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101b22;
  color: #d9e8ef;
  padding: 13px;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.procedure-attempts-table {
  min-width: 1050px;
}

.procedure-events-table {
  min-width: 1200px;
}

.job-runs-table {
  min-width: 1244px;
}

.job-runs-table th:nth-child(1) { width: 72px; }
.job-runs-table th:nth-child(2) { width: 220px; }
.job-runs-table th:nth-child(3) { width: 128px; }
.job-runs-table th:nth-child(4) { width: 190px; }
.job-runs-table th:nth-child(5) { width: 190px; }
.job-runs-table th:nth-child(6) { width: 380px; }
.job-runs-table th:nth-child(7) { width: 64px; }

.task-runs-table {
  min-width: 1344px;
}

.task-runs-table th:nth-child(1) { width: 64px; }
.task-runs-table th:nth-child(2) { width: 76px; }
.task-runs-table th:nth-child(3) { width: 220px; }
.task-runs-table th:nth-child(4) { width: 128px; }
.task-runs-table th:nth-child(5) { width: 100px; }
.task-runs-table th:nth-child(6) { width: 100px; }
.task-runs-table th:nth-child(7) { width: 190px; }
.task-runs-table th:nth-child(8) { width: 190px; }
.task-runs-table th:nth-child(9) { width: 212px; }
.task-runs-table th:nth-child(10) { width: 64px; }

.watermark-table {
  min-width: 944px;
}

.watermark-table th:nth-child(1) { width: 260px; }
.watermark-table th:nth-child(2) { width: 420px; }
.watermark-table th:nth-child(3) { width: 200px; }
.watermark-table th:nth-child(4) { width: 64px; }

.job-run-task-runs-table {
  min-width: 1268px;
}

.job-run-task-runs-table th:nth-child(1) { width: 64px; }
.job-run-task-runs-table th:nth-child(2) { width: 220px; }
.job-run-task-runs-table th:nth-child(3) { width: 128px; }
.job-run-task-runs-table th:nth-child(4) { width: 100px; }
.job-run-task-runs-table th:nth-child(5) { width: 100px; }
.job-run-task-runs-table th:nth-child(6) { width: 190px; }
.job-run-task-runs-table th:nth-child(7) { width: 190px; }
.job-run-task-runs-table th:nth-child(8) { width: 212px; }
.job-run-task-runs-table th:nth-child(9) { width: 64px; }

.log-name-cell,
.log-time-cell,
.log-error-cell,
.log-watermark-cell {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jobs-table .actions,
.tasks-table .actions,
.mappings-table .actions {
  align-items: center;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 7px;
}

.jobs-table .actions form,
.jobs-table .actions .button,
.tasks-table .actions form,
.tasks-table .actions .button,
.mappings-table .actions form,
.mappings-table .actions .button {
  width: auto;
}

.tasks-table .actions .button {
  min-width: 34px;
}

.connections-table td,
.dashboard-jobs-table td,
.recent-runs-table td,
.dashboard-procedure-runs-table td,
.jobs-table td,
.tasks-table td,
.mappings-table td,
.api-keys-table td,
.job-runs-table td,
.task-runs-table td,
.watermark-table td {
  white-space: nowrap;
}

.dashboard-jobs-table td,
.recent-runs-table td,
.dashboard-procedure-runs-table td,
.jobs-table td,
.tasks-table td,
.mappings-table td,
.api-keys-table td,
.job-runs-table td,
.task-runs-table td,
.watermark-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.connections-table td.actions-cell,
.dashboard-jobs-table td.actions-cell,
.dashboard-procedure-runs-table td.actions-cell,
.jobs-table td.actions-cell,
.tasks-table td.actions-cell,
.mappings-table td.actions-cell,
.api-keys-table td.actions-cell,
.job-runs-table td.actions-cell,
.task-runs-table td.actions-cell,
.watermark-table td.actions-cell {
  overflow: visible;
  text-overflow: clip;
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  background: #e5f6ee;
  color: var(--success);
}

.badge.fail {
  background: #fde8eb;
  color: var(--danger);
}

.badge.idle {
  background: #eef3f6;
  color: #50626c;
}

.badge.warn {
  background: #fff4d8;
  color: var(--warning);
}

.flash {
  border-radius: 6px;
  padding: 11px 14px;
  margin-bottom: 16px;
  border: 1px solid;
}

.flash.message {
  background: #eaf7f1;
  border-color: #b9e2d1;
  color: #146345;
}

.flash.error {
  background: #fff0f1;
  border-color: #f0c7cc;
  color: #9c2230;
}

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

.panel-body > .panel-body-empty {
  margin: -18px;
}

.brand-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 16px;
}

.brand-preview {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 16px;
}

.brand-preview-frame {
  min-height: 118px;
  border: 1px dashed #bfd0d9;
  border-radius: 6px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  padding: 16px;
}

.brand-preview-frame.dark {
  background: var(--sidebar);
  border-color: rgba(255, 255, 255, 0.16);
}

.brand-preview-frame img {
  max-width: 180px;
  max-height: 76px;
  object-fit: contain;
}

.brand-preview-frame.favicon img {
  max-width: 48px;
  max-height: 48px;
}

.brand-preview-frame.login img {
  max-width: 140px;
  max-height: 78px;
}

@media (max-width: 1000px) {
  .app {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .content {
    padding: 16px;
  }

  .app-footer {
    padding: 0 18px;
  }

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

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

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

  .account-password-form .wide {
    grid-column: span 1;
  }

  .account-password-form .full {
    grid-column: 1 / -1;
  }

  .key-mapping-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .procedure-run-fields,
  .run-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

}

@media (max-width: 700px) {
  body {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .login-shell {
    padding: 16px 14px;
  }

  .login-card {
    width: min(100%, 360px);
  }

  .login-form {
    border-radius: 6px;
    gap: 14px;
    padding: 22px 18px;
  }

  .login-title h1 {
    font-size: 20px;
  }

  .login-brand img {
    height: 39px;
  }

  .app {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 0;
    height: 66px;
    overflow: visible;
    flex-direction: row;
    align-items: stretch;
    box-shadow: 0 1px 4px rgba(17, 37, 48, 0.14);
  }

  .brand {
    width: 72px;
    height: 66px;
    flex: 0 0 72px;
    padding: 10px 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 0;
  }

  .brand img {
    max-width: 52px;
    max-height: 42px;
  }

  .brand span:not(.brand-mark) {
    display: none;
  }

  .nav {
    flex: 1;
    min-width: 0;
    flex-direction: row;
    gap: 0;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .nav a {
    min-width: 72px;
    min-height: 66px;
    padding: 8px 6px;
    flex: 0 0 72px;
    font-size: 10px;
  }

  .nav-separator {
    flex: 0 0 1px;
    width: 1px;
    height: 34px;
    margin: 16px 8px;
  }

  .nav-session {
    flex: 0 0 72px;
    margin: 0;
  }

  .nav-session button {
    min-width: 72px;
    min-height: 66px;
    padding: 8px 6px;
    font-size: 10px;
  }

  .nav a.active::before {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 0;
    width: auto;
    height: 4px;
  }

  .nav-icon {
    width: 20px;
    height: 20px;
  }

  .main {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .content {
    padding: 16px;
  }

  .page-head {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }

  .page-head > .toolbar {
    flex: 1 0 auto;
    justify-content: stretch;
    margin-left: 0;
    padding-top: 0;
    width: 100%;
  }

  .page-head > .toolbar select {
    width: 100%;
  }

  h1 {
    font-size: 24px;
  }

  .panel {
    margin-bottom: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .panel-head {
    padding: 13px 14px;
    gap: 10px;
  }

  .panel-body {
    padding: 14px;
  }

  .panel-body > .panel-body-empty {
    margin: -14px;
  }

  .toolbar,
  .toolbar select,
  .page-head > .button {
    width: 100%;
  }

  .actions {
    align-items: stretch;
  }

  .actions .button,
  .actions form,
  .actions button {
    width: 100%;
  }

  .actions-cell .actions {
    align-items: center;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-end;
  }

  .actions-cell .actions .button,
  .actions-cell .actions form,
  .actions-cell .actions button {
    width: auto;
  }

  .code-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .api-usage-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .button {
    min-height: 38px;
  }

  .panel > table {
    display: table;
    overflow: visible;
  }

  th,
  td {
    padding: 10px 14px;
  }

  td.actions-cell {
    white-space: nowrap;
    min-width: 170px;
  }

  .app-footer {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
  }

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

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

  .form-grid .wide {
    grid-column: auto;
  }

  .procedure-run-fields,
  .run-summary-grid,
  .procedure-dashboard-grid,
  .run-json-grid {
    grid-template-columns: 1fr;
  }

  .procedure-run-fields .wide {
    grid-column: auto;
  }
}
