/* Shared UI finish for the operational tools outside the primary workspace. */
:root {
  --zi-ink: #12213c;
  --zi-muted: #64738b;
  --zi-line: #dce4ef;
  --zi-surface: rgba(255, 255, 255, .96);
  --zi-navy: #071832;
  --zi-blue: #3158d7;
  --zi-teal: #087f78;
  --zi-focus: #7aa7ff;
  --zi-shadow: 0 18px 48px rgba(7, 24, 50, .09);
  color-scheme: light;
}

html { scroll-behavior: smooth; text-size-adjust: 100%; }
body {
  min-width: 320px;
  min-height: 100dvh;
  color: var(--zi-ink);
  background-color: #f5f7fb;
  background-image:
    radial-gradient(circle at 8% -8%, rgba(49, 88, 215, .09), transparent 30rem),
    radial-gradient(circle at 96% 4%, rgba(8, 127, 120, .08), transparent 28rem);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, [role="button"], a { -webkit-tap-highlight-color: transparent; }
button, input, select, textarea, summary, a { outline: none; }
:where(button, input, select, textarea, summary, a):focus-visible {
  outline: 3px solid #7aa7ff;
  outline: 3px solid color-mix(in srgb, var(--zi-focus) 72%, transparent);
  outline-offset: 2px;
}

:where(button, .primary, .secondary, .danger, .button, .upload, .table-action) {
  min-height: 44px;
  border-radius: 10px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background-color .16s ease;
}
:where(button, .primary, .secondary, .danger, .button, .upload, .table-action):not(:disabled):active {
  transform: translateY(1px);
}
:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  min-height: 44px;
  border-color: #cfd9e7;
  border-radius: 10px;
  background: #fff;
}
:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus {
  border-color: var(--zi-blue);
  box-shadow: 0 0 0 4px rgba(49, 88, 215, .1);
}

:where(.top, .topbar, body > header) {
  position: sticky;
  z-index: 30;
  top: 0;
  border-bottom: 1px solid rgba(220, 228, 239, .9);
  box-shadow: 0 8px 24px rgba(7, 24, 50, .08);
}
:where(.top, .topbar, body > header) nav { align-items: center; }
:where(.top, .topbar, body > header) nav a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border-radius: 9px;
  padding-inline: 10px;
}

:where(.card, .panel, .integration-card, .table-wrap, .connection) {
  border-color: var(--zi-line);
  box-shadow: var(--zi-shadow);
}
:where(.card, .panel, .integration-card) { background: var(--zi-surface); }
:where(.heading, .intro) h1 { text-wrap: balance; }
:where(.heading, .intro) p { text-wrap: pretty; }

.table-wrap {
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: #a9b7ca transparent;
}
.table-wrap::after {
  content: "Swipe to see more →";
  display: none;
  padding: 8px 14px;
  color: var(--zi-muted);
  background: #f7f9fc;
  font-size: .72rem;
  text-align: right;
}
table th { position: sticky; top: 0; z-index: 1; }
tbody tr { transition: background-color .16s ease; }

dialog { max-width: min(920px, calc(100vw - 24px)); }
dialog::backdrop { backdrop-filter: blur(5px); }

@media (max-width: 760px) {
  :where(.top, .topbar, body > header) {
    position: sticky;
    gap: 10px;
    padding: 10px 14px;
  }
  :where(.top, .topbar, body > header) nav {
    max-width: 60vw;
    overflow-x: auto;
    gap: 4px;
    scrollbar-width: none;
  }
  :where(.top, .topbar, body > header) nav::-webkit-scrollbar { display: none; }
  :where(.top, .topbar, body > header) nav a { flex: 0 0 auto; }
  main { padding-inline: max(14px, env(safe-area-inset-left)); }
  :where(.heading, .intro) { gap: 16px; }
  :where(.heading, .intro) h1 { font-size: clamp(1.75rem, 8vw, 2.35rem); }
  :where(.toolbar, .catalog-tools, .connection, .form-actions, .dialog-actions) { gap: 10px; }
  :where(.toolbar, .catalog-tools) > * { min-width: 0; width: 100%; }
  .table-wrap::after { display: block; }
  :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { font-size: 16px; }
  dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 96dvh;
    margin: auto 0 0;
    border-radius: 20px 20px 0 0;
  }
  dialog form { max-height: 96dvh; }
  :where(.dialog-actions, .form-actions) {
    position: sticky;
    z-index: 3;
    bottom: 0;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(12px);
  }
  :where(.dialog-actions, .form-actions) button { flex: 1; justify-content: center; }
}

@media (max-width: 480px) {
  :where(.top, .topbar, body > header) img { max-width: 112px; max-height: 34px; }
  :where(.top, .topbar, body > header) nav { max-width: 54vw; font-size: .75rem; }
  :where(.card, .panel, .integration-card) { border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
