html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Lightweight "Snowflake-style" tabs: flat labels, blue underline on active */
.nav-tabs.nav-tabs-lite {
  border-bottom: 1px solid #dee2e6;
}
.nav-tabs.nav-tabs-lite .nav-link {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #6c757d;
  padding: 0.5rem 1rem;
  margin-bottom: -1px;
  font-weight: 500;
}
.nav-tabs.nav-tabs-lite .nav-link:hover {
  color: #212529;
  border-bottom-color: transparent;
}
.nav-tabs.nav-tabs-lite .nav-link.active {
  color: #0d6efd;
  background: transparent;
  border-bottom-color: #0d6efd;
  font-weight: 600;
}

/* Sortable table headers — reusable across pipeline tables */
th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable:hover {
  background-color: rgba(0,0,0,0.15);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Pipeline table body — slightly smaller than header for visual hierarchy */
.pipeline-table tbody {
  font-size: 0.9em;
}

/* Connector icons — Fivetran-style small inline logos */
img[src*="connectors/"] {
  vertical-align: text-bottom;
}

.sort-arrow::after { content: ''; margin-left: 4px; }
.sort-asc::after { content: '\25B2'; font-size: 0.7em; }
.sort-desc::after { content: '\25BC'; font-size: 0.7em; }

/* Run history table — compact font */
#run-history-table { font-size: 0.8rem; }
#run-history-table thead { font-size: 0.75rem; }

/* ─────────────────────────────────────────────────────────────────────
   Left navigation rail (Snowflake-style sidebar)
   Used by Portal + Internal layouts. Body opt-in via .has-rail.
   Toggle .rail-collapsed on <body> to switch to icon-only mode.
   ───────────────────────────────────────────────────────────────────── */
:root {
    --rail-w: 220px;
    --rail-w-collapsed: 56px;
    --rail-trans: width 0.15s ease, margin-left 0.15s ease;
}

/* Lock the page to viewport height so the main pane owns vertical scroll
   instead of the document. Keeps the fixed rail glued in place and stops
   wide tables/pages from creating a body-level scrollbar that fights the
   sidebar. */
html.has-rail, body.has-rail {
    margin: 0; height: 100vh; overflow: hidden;
    background: #f6f8fa;
}

.app-rail {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--rail-w);
    display: flex; flex-direction: column;
    z-index: 1030;
    transition: var(--rail-trans);
    overflow: hidden;
}
body.rail-collapsed .app-rail { width: var(--rail-w-collapsed); }

/* Theme variants */
.app-rail.theme-portal {
    background: #0d6efd; color: #ffffff;
    --rail-fg-muted: rgba(255,255,255,0.78);
    --rail-hover: rgba(255,255,255,0.12);
    --rail-active: rgba(255,255,255,0.22);
    --rail-border: rgba(255,255,255,0.15);
    --rail-group: rgba(255,255,255,0.55);
    --rail-raised: #0b62e4;   /* profile menu surface — must be opaque, it overlaps page content */
}
.app-rail.theme-internal {
    background: #212529; color: #ffffff;
    --rail-fg-muted: rgba(255,255,255,0.7);
    --rail-hover: rgba(255,255,255,0.08);
    --rail-active: rgba(255,255,255,0.18);
    --rail-border: rgba(255,255,255,0.12);
    --rail-group: rgba(255,255,255,0.5);
    --rail-raised: #2b3035;
}

/* Header: brand + collapse toggle */
.rail-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 12px 12px 16px;
    gap: 6px;
}
.rail-head .brand {
    display: flex; align-items: center; gap: 8px;
    color: inherit; text-decoration: none;
    font-weight: 700; font-size: 1.1rem;
    overflow: hidden; white-space: nowrap;
    flex: 1 1 auto; min-width: 0;
}
.rail-head .brand i { font-size: 1.25rem; flex: 0 0 auto; }
.rail-head .brand .brand-img {
    width: 24px; height: 24px;
    flex: 0 0 auto;
    object-fit: contain;
    border-radius: 4px;
}
body.rail-collapsed .rail-head .brand .brand-text { display: none; }

.rail-toggle {
    background: transparent; border: 0; color: inherit;
    width: 28px; height: 28px; border-radius: 5px;
    display: grid; place-items: center; cursor: pointer;
    flex: 0 0 auto;
}
.rail-toggle:hover { background: var(--rail-hover); }
.rail-toggle i { font-size: 1rem; }

/* Nav body */
.rail-nav { flex: 1 1 auto; overflow-y: auto; padding: 4px 8px; }
.rail-nav .nav-item-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; margin: 1px 0;
    color: var(--rail-fg-muted); text-decoration: none;
    border-radius: 6px; font-size: 0.93rem;
    white-space: nowrap; overflow: hidden;
}
.rail-nav .nav-item-link i { width: 18px; font-size: 1rem; flex: 0 0 auto; text-align: center; }
.rail-nav .nav-item-link:hover { background: var(--rail-hover); color: #fff; }
.rail-nav .nav-item-link.active { background: var(--rail-active); color: #fff; font-weight: 600; }

.rail-nav .nav-group-label {
    padding: 14px 12px 4px; font-size: 0.7rem; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--rail-group);
    white-space: nowrap; overflow: hidden;
}
body.rail-collapsed .rail-nav .nav-item-link .label,
body.rail-collapsed .rail-nav .nav-group-label {
    display: none;
}
body.rail-collapsed .rail-nav .nav-item-link {
    justify-content: center; padding: 8px 0;
}

/* Docs is now a single top-level rail link to docs.elglide.com (the expandable
   submenu + "Help" group label were removed 2026-06-18 — see Portal _Layout). */

/* Separates the pinned help zone (Docs / What's New) from the groups above it.
   A bare rule rather than a group label — the "Help" label was removed as
   redundant 2026-06-18 and the divider carries the same separation silently. */
.rail-nav .nav-divider {
    height: 1px; background: var(--rail-border);
    margin: 10px 10px 8px;
}

/* Footer: user identity chip + its popup menu */
.rail-foot {
    border-top: 1px solid var(--rail-border);
    padding: 10px 12px 14px;
    display: flex; flex-direction: column; gap: 8px;
    position: relative;      /* containing block for .profile-menu */
}
.rail-foot .user-row {
    display: flex; align-items: center; gap: 8px;
    color: #fff; font-size: 0.82rem; min-width: 0;
}
.rail-foot .user-row .avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,0.18); display: grid; place-items: center;
    font-weight: 700; font-size: 0.75rem; flex: 0 0 auto;
}
.rail-foot .user-row .meta { line-height: 1.15; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.rail-foot .user-row .meta .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-foot .user-row .meta .role {
    font-size: 0.68rem; color: var(--rail-fg-muted);
    text-transform: uppercase; letter-spacing: 0.04em;
}
/* The avatar+name chip opens the profile menu (was a direct link until 2026-07-18).
   It is a <button> now, so it needs the usual button reset before the chip styles. */
.rail-foot .user-row .user-link {
    display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0;
    color: inherit; text-decoration: none; border-radius: 6px; padding: 2px 4px; margin: -2px -4px;
    background: transparent; border: 0; font: inherit; text-align: left; cursor: pointer;
}
.rail-foot .user-row .user-link:hover { background: var(--rail-hover); }
.rail-foot .user-row .user-link .chev {
    flex: 0 0 auto; font-size: 0.7rem; color: var(--rail-fg-muted);
    transition: transform 0.15s ease;
}
.rail-foot .user-row .user-link[aria-expanded="true"] .chev { transform: rotate(180deg); }
.rail-foot .user-row form { margin: 0; }

/* Popup menu — opens upward from the chip; holds the per-user items (My Profile,
   Notifications) plus Logout. */
.profile-menu {
    position: absolute; bottom: 100%; left: 12px; right: 12px; z-index: 20;
    margin-bottom: 6px; padding: 4px;
    background: var(--rail-raised);
    border: 1px solid var(--rail-border); border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.28);
}
.profile-menu[hidden] { display: none; }
.profile-menu .profile-menu-item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 7px 10px; border-radius: 6px;
    color: #fff; font-size: 0.82rem; text-decoration: none;
    background: transparent; border: 0; font-family: inherit; text-align: left; cursor: pointer;
}
.profile-menu .profile-menu-item:hover { background: var(--rail-hover); }
.profile-menu .profile-menu-item i { font-size: 0.9rem; flex: 0 0 auto; }
.profile-menu .profile-menu-sep {
    height: 1px; background: var(--rail-border); margin: 4px 6px;
}

body.rail-collapsed .rail-foot .user-row .meta,
body.rail-collapsed .rail-foot .user-row .user-link .chev {
    display: none;
}
body.rail-collapsed .rail-foot .user-row { justify-content: center; }
body.rail-collapsed .rail-foot .user-row .user-link { flex: 0 0 auto; padding: 2px; margin: -2px; }
/* The collapsed rail is too narrow to inherit the chip's left/right insets —
   pin the menu to a readable width just clear of the rail edge. */
body.rail-collapsed .profile-menu { left: 6px; right: auto; width: 176px; }

/* Main content pane — owns vertical scroll, not the document */
.app-main {
    margin-left: var(--rail-w);
    height: 100vh;
    overflow-y: auto;
    overflow-x: auto;
    padding: 18px 24px 40px;
    transition: var(--rail-trans);
}
body.rail-collapsed .app-main { margin-left: var(--rail-w-collapsed); }

/* Slim, theme-aware scrollbars (WebKit + Firefox) */
.rail-nav { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.28) transparent; }
.rail-nav::-webkit-scrollbar { width: 6px; }
.rail-nav::-webkit-scrollbar-track { background: transparent; }
.rail-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.22); border-radius: 3px; }
.rail-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

.app-main { scrollbar-width: thin; scrollbar-color: #c7ced6 transparent; }
.app-main::-webkit-scrollbar { width: 10px; height: 10px; }
.app-main::-webkit-scrollbar-track { background: transparent; }
.app-main::-webkit-scrollbar-thumb { background: #c7ced6; border-radius: 5px; }
.app-main::-webkit-scrollbar-thumb:hover { background: #9aa3ad; }

/* Floating "Book a Demo" CTA — fixed top-right circular FAB.
   Mirrors .ai-fab shape (3.25rem circle, gradient, soft shadow) but uses
   a warm amber→orange palette to distinguish it from the AI sparkle's
   blue. Tooltip via title attribute; visible label hidden. */
.demo-fab {
    position: fixed; top: 1.25rem; right: 1.25rem;
    width: 3.25rem; height: 3.25rem;
    border-radius: 50%; border: none;
    z-index: 1040; /* above navbar (1030), below offcanvas (1050) */
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    color: #fff; text-decoration: none;
    box-shadow: 0 4px 14px rgba(253, 126, 20, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.demo-fab:hover {
    color: #fff;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 18px rgba(253, 126, 20, 0.45);
}
.demo-fab:focus-visible {
    outline: 3px solid rgba(253, 126, 20, 0.5); outline-offset: 3px;
}
.demo-fab i { font-size: 1.4rem; line-height: 1; }

/* ─── Borderless icon-only buttons (site-wide) ──────────────────────────
   Replaces `btn btn-sm btn-outline-secondary` / `btn-outline-danger` for
   any button whose entire content is a single icon: row actions, inline
   copy/regenerate, banner copies, etc. Bordered btn-primary etc. still
   used for primary actions that need visual weight. */
.icon-btn {
    background: transparent;
    border: 0;
    padding: 1px 2px;
    line-height: 1;
    color: #5a6470;
    border-radius: 4px;
    transition: background .12s ease, color .12s ease;
}
.icon-btn:hover { background: rgba(0, 0, 0, .06); color: #212529; }
.icon-btn:focus-visible { outline: 2px solid #86b7fe; outline-offset: 1px; }
.icon-btn i { font-size: 14px; }
.icon-btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn.icon-danger { color: #b02a37; }
.icon-btn.icon-danger:hover { color: #b02a37; background: rgba(176, 42, 55, .08); }
.icon-btn.icon-success { color: #198754; }
.icon-btn.icon-error { color: #b02a37; }
/* Adjacent icon buttons sit flush */
.icon-btn + .icon-btn { margin-left: 1px; }
/* Icon button immediately after inline text */
.icon-btn-after-text { margin-left: 4px; }

/* Borderless primary icon button (e.g. table-header "+" add) */
.icon-btn-primary {
    background: transparent;
    border: 0;
    padding: 1px 4px;
    color: #0d6efd;
    border-radius: 4px;
    transition: background .12s ease;
}
.icon-btn-primary:hover { background: rgba(13, 110, 253, .1); }
.icon-btn-primary:focus-visible { outline: 2px solid #86b7fe; outline-offset: 1px; }
.icon-btn-primary i { font-size: 16px; }

/* Inline row used for code + copy-icon pairs in alert banners. Tighter
   than Bootstrap's gap-2 (8px) — keeps the copy icon close to the value
   it acts on. */
.icon-inline-row { display: flex; align-items: center; gap: 4px; margin-top: 4px; }

/* Tight form rows used by Connection forms and shared modals (SSH tunnel,
   etc.). Promoted here from connections.css's .conn-form scope so any
   .row.row-tight tightens regardless of container. */
.row-tight { margin-bottom: 0.4rem; }
.row-tight > [class*="col-"] { padding-top: 0; padding-bottom: 0; }
.help-text { font-size: 0.7rem; color: #6c757d; }

/* Borderless info-tooltip glyph used inline next to inputs.
   Pattern: <i class="bi bi-info-circle tip-icon" title="..."></i>
   Renders as a small muted ⓘ; cursor:help signals the tooltip. */
.tip-icon {
    color: #6c757d;
    font-size: 14px;
    cursor: help;
    margin-left: 4px;
}
.tip-icon:hover { color: #495057; }

/* Read-only "label-style" value display used in banners (egress allowlist
   IPs/CIDR). Looks like inline code but is explicitly NOT an input — no
   border, light-gray background, full triple-click selection. Pair with
   .ip-key for the leading "IPs:" / "IP/CIDR:" prefix. */
.ip-key {
    font-size: .75rem;
    color: #495057;
    font-weight: 600;
    min-width: 60px;
    display: inline-block;
}
.ip-value {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .75rem;
    color: #b02a73;
    padding: 2px 6px;
    background: #f8f9fa;
    border-radius: 3px;
    user-select: all;
}
/* Single-line footer for banner metadata (region · last-changed · notice). */
.banner-meta {
    font-size: .7rem;
    color: #6c757d;
    margin-top: 6px;
}
.banner-meta .dot { margin: 0 .35rem; opacity: .5; }

/* ─────────────────────────────────────────────────────────────────────────
   Elglide-internal (delegating-as-tenant) visual language.

   Used to flag controls / sections visible only to staff with
   PortalType=Internal (regardless of whether they're currently delegating).
   Palette matches the floating "Delegating Tenant" chip in
   _InternalViewBanner.cshtml so the page reads as one consistent "you're
   in staff mode" cue.

   Two utilities, used together:
     .elglide-internal-field — wrapper around one or more form controls
     .elglide-internal-badge — small "Internal" pill on the section/label

   Old per-page treatments retired 2026-05-29 — feedback_internal_ui_css.md:
     - Tasks/Detail.cshtml's purple .acc-internal + .badge-internal
     - Connections/Edit.cshtml's inline yellow on RowHash Threshold
     - _SqlServerForm.cshtml's plain "(Elglide-internal)" text on ReadMode
   ───────────────────────────────────────────────────────────────────────── */
.elglide-internal-field {
    background: #fff3cd;            /* matches _InternalViewBanner.cshtml */
    border: 1px dashed #ffe69c;
    border-radius: 4px;
    padding: .35rem .6rem;
}
.elglide-internal-badge {
    display: inline-block;
    background: #664d03;            /* matches _InternalViewBanner.cshtml text */
    color: #fff;
    font-size: .62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
    padding: 1px 6px;
    border-radius: 3px;
    vertical-align: middle;
    line-height: 1.3;
}
/* Section header accessory — accordion cards (Tasks/Detail.cshtml). The
   header gets the pale-amber tint; the body inherits the page bg so the
   form fields stay readable. */
.acc-card.acc-internal .acc-hdr,
.elglide-internal-section .section-head {
    background: #fff8e1;
}


/* ── Invoice document ────────────────────────────────────────────────────
   Shared by the tenant portal page and the internal review modal, so the
   document staff review is the one the customer prints. Print rules strip
   the app chrome and leave the document alone on the page. */
.invoice-doc {
    font-size: 0.9rem;
}

.invoice-doc-head {
    border-bottom: 2px solid #212529;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}

.invoice-doc-title {
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.1;
}

.invoice-doc-number {
    font-family: var(--bs-font-monospace, monospace);
    color: #6c757d;
}

.invoice-doc-parties {
    margin-bottom: 0.75rem;
}

.invoice-doc-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    margin-bottom: 0.15rem;
}

/* Remit-to and bill-to are plain text with newlines — preserve them without
   letting a long address force the page to scroll sideways. */
.invoice-doc-block {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.invoice-doc-lines thead th {
    border-bottom: 1px solid #adb5bd;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
}

.invoice-doc-total td {
    border-top: 1px solid #212529;
    font-weight: 600;
}

.invoice-doc-payments {
    font-size: 0.82rem;
}


/* The invoice modal's new-line row. Tinted and top-ruled so it reads as an input
   area rather than a committed line — an identical-looking row led to lines being
   typed, never added, and a $0.00 total. */
.im-newline-row > td {
    background: #f8f9fa;
    border-top: 2px solid #dee2e6;
}
