:root {
    /* Roche brand palette */
    --roche-blue: #0b41cd;        /* primary brand blue */
    --roche-dark: #022366;        /* dark navy */
    --roche-blue-600: #0934a6;    /* hover */
    --roche-light: #e8eefc;       /* tint */
    /* Lighter gradient stops used across hero / headers / panels. */
    --grad-start: #0e3bb0;        /* lighter navy */
    --grad-end: #2f6fe0;          /* lighter blue */
    --fg: #1a1a2e;
    --muted: #5b6472;
    --border: #dce1e9;
    --accent: var(--roche-blue);
    --bg: #f4f6fa;
    --card: #ffffff;
    --ok-bg: #e6f4ea;
    --ok-fg: #1a7f37;
    --no-bg: #fdecec;
    --no-fg: #b42318;

    /* Elevation scale — one consistent shadow language across the app. */
    --shadow-sm: 0 1px 4px rgba(2, 35, 102, 0.06);
    --shadow-md: 0 4px 14px rgba(2, 35, 102, 0.1);
    --shadow-lg: 0 12px 32px rgba(2, 35, 102, 0.16);

    /* Corner-radius scale. */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* Standard easing/duration for hovers and state changes. */
    --transition: 0.18s ease;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

/* Keyboard-accessible focus ring on every interactive element — visible only
   for keyboard navigation, so mouse users keep the clean look. */
:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(11, 65, 205, 0.35);
    border-radius: var(--radius-sm);
}
a:focus-visible,
button:focus-visible,
.db-card:focus-visible,
.avatar:focus-visible {
    box-shadow: 0 0 0 3px rgba(11, 65, 205, 0.35);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    margin: 0;
    font-family: "Roche Sans", "RocheSans", Arial, "Helvetica Neue", Helvetica, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--fg);
    background: var(--bg);
    line-height: 1.5;
}

/* Thin Roche-blue accent strip across the very top of the page. */
body::before {
    content: "";
    display: block;
    height: 4px;
    background: linear-gradient(90deg, var(--roche-dark), var(--roche-blue) 60%, #00c7d4);
}

header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1.5rem;
    padding: 0.85rem 2rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 30;
}

header .logo { height: 40px; width: auto; justify-self: start; }
header h1 {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
    text-align: center;
    justify-self: center;
    white-space: nowrap;
    color: var(--roche-dark);
}
.user { justify-self: end; position: relative; }

/* Round avatar button showing the signed-in user's initial. */
.avatar {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    background: var(--roche-blue);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(2, 35, 102, 0.18);
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.avatar:hover { background: var(--roche-blue-600); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.avatar:active { transform: translateY(0); }

/* Dropdown revealed when the avatar is clicked. */
.user-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 20;
    min-width: 200px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(2, 35, 102, 0.16);
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.user-menu .user-id {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.5;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--border);
    word-break: break-all;
}
.user-menu .user-id strong { color: var(--roche-dark); font-size: 0.9rem; }
.user-menu button { width: 100%; padding: 0.4rem 0.7rem; font-size: 0.82rem; }

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(2, 35, 102, 0.12);
    padding: 2.2rem 2.4rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.login-logo { height: 44px; width: auto; margin-bottom: 1rem; }
.login-card h1 { font-size: 1.4rem; margin: 0; color: var(--roche-dark); }
.login-sub { color: var(--muted); margin: 0.3rem 0 1.6rem; }
.login-card form { display: flex; flex-direction: column; gap: 0.6rem; text-align: left; }
.login-card label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.login-card input {
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
}
.login-card button { margin-top: 0.4rem; padding: 0.6rem; font-size: 0.95rem; }
.login-error { color: var(--no-fg); font-size: 0.85rem; margin: 0; }
.login-note { color: var(--muted); font-size: 0.75rem; margin: 1.4rem 0 0; line-height: 1.4; }
.sso-btn {
  display: block;
  margin-top: 0.6rem;
  padding: 0.7rem 1rem;
  background: var(--roche-blue);
  color: #fff;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}
.sso-btn:hover { background: var(--roche-blue-600); }

/* ── Access control page ─────────────────────────────────────────────────── */
.access-main { max-width: 560px; margin: 1.5rem auto; padding: 0 2rem 2.5rem; }
.access-card { background: var(--card); }
.panel-head.static { cursor: default; }
.access-intro { color: var(--muted); font-size: 0.88rem; margin: 0 0 1.1rem; line-height: 1.5; }
#grant-form { display: flex; flex-direction: column; gap: 0.4rem; }
#grant-form label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--roche-dark);
    margin-top: 0.6rem;
}
#grant-form select, #grant-form input { width: 100%; }
#grant-form button { margin-top: 1.1rem; align-self: flex-start; padding: 0.55rem 1.4rem; }
.access-msg { font-size: 0.85rem; margin: 0.8rem 0 0; color: var(--roche-dark); }
.access-msg.error { color: var(--no-fg); }

nav#breadcrumb {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0.6rem 2rem;
    font-size: 0.85rem;
    color: var(--muted);
}
nav#breadcrumb .crumb { color: var(--muted); font-weight: 500; cursor: default; }
nav#breadcrumb .crumb.current { color: var(--roche-dark); font-weight: 600; }
nav#breadcrumb .crumb-sep { margin: 0 0.5rem; color: var(--border); }

/* Two-column shell: fixed-width sidebar + fluid content. */
.layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.5rem;
    align-items: start;
    padding: 0 2rem 2.5rem;
    max-width: 1320px;
    margin: 0 auto;
}

/* ── Left column: collapsible selector panels ─────────────────────────────── */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: sticky;
    top: 1rem;
    background: #fbfcfe;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* Inside the explorer pane the panels are flush (no individual card chrome). */
.sidebar .panel {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}
.sidebar .panel:hover { box-shadow: none; }

/* Explorer-style toolbar header: light, compact, uppercase, folder accent. */
.sidebar .panel-head {
    background: #eef2f9;
    color: var(--roche-dark);
    border-bottom: 1px solid var(--border);
    padding: 0.55rem 0.8rem;
}
.sidebar .panel-title {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--roche-dark);
}
.sidebar .panel-title::before {
    content: "\1F5C0";
    font-size: 0.9rem;
}
.sidebar .panel-toggle {
    background: transparent;
    color: var(--muted);
}
.sidebar .panel-toggle:hover { background: rgba(2, 35, 102, 0.08); color: var(--roche-dark); box-shadow: none; }
.sidebar .panel-body { padding: 0.7rem 0.7rem; }

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.panel:hover { box-shadow: var(--shadow-md); }
.panel-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 0.9rem;
    background: linear-gradient(135deg, var(--grad-start) 0%, var(--grad-end) 100%);
    color: #fff;
    cursor: pointer;
    user-select: none;
    /* Panel headers use the <header> tag; cancel the app-header sticky/z-index
       so they don't float above the user dropdown. */
    position: static;
    z-index: auto;
}
.panel-title { font-weight: 600; font-size: 0.95rem; }
.panel-toggle {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    border-radius: 5px;
    width: 24px;
    height: 24px;
    line-height: 1;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0;
    cursor: pointer;
}
.panel-toggle:hover { background: rgba(255, 255, 255, 0.3); box-shadow: none; }
.panel-body { padding: 0.8rem 0.9rem; }
.panel.collapsed .panel-body { display: none; }

.filter-row { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.6rem; }
.filter-row input[type="text"], #version-select { width: 100%; }
.check { font-size: 0.82rem; color: var(--muted); display: flex; align-items: center; gap: 0.35rem; }

/* ── Right column: content ────────────────────────────────────────────────── */
.content { min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
.empty-state {
    background: var(--card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 3rem 2rem;
    text-align: center;
    color: var(--muted);
    animation: fade-in 0.3s var(--ease-out);
}
.empty-state::before {
    content: "\1F5C2\FE0F";
    display: block;
    font-size: 2.2rem;
    margin-bottom: 0.6rem;
    opacity: 0.7;
}

h2 { font-size: 1.2rem; color: var(--roche-dark); font-weight: 700; }
h3 { font-size: 0.98rem; margin-bottom: 0.4rem; color: var(--roche-dark); font-weight: 600; }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Controls grouped on the right of a panel header (toggle). */
.head-actions { display: inline-flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.head-actions .panel-toggle { flex: 0 0 auto; }

/* Publish action row inside the panel body. Database and table panels share
   this layout so their Publish buttons line up consistently. */
.panel-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.8rem;
}
.panel-actions button {
    min-width: 160px;
    padding: 0.45rem 0.9rem;
    font-size: 0.82rem;
    text-align: center;
    white-space: nowrap;
}
.panel-actions button[hidden] { display: none; }

/* Database/Table publish buttons share the same fixed size. */
.publish-btn {
    min-width: 150px;
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    text-align: center;
    white-space: nowrap;
}

/* Version selector shown in the (dark) table-details panel header, next to
   the table name. */
.version-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
}
.version-filter select {
    font-weight: 400;
    padding: 0.25rem 0.45rem;
    font-size: 0.82rem;
}

/* Database details key/value grid. */
.meta-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    margin: 0;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--shadow-sm);
}
.meta-grid dt,
.meta-grid dd {
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid var(--border);
}
/* Zebra striping keyed off each label/value pair (every 4 grid cells). */
.meta-grid dt:nth-of-type(odd),
.meta-grid dt:nth-of-type(odd) + dd {
    background: #f6f8fc;
}
.meta-grid dt:nth-of-type(even),
.meta-grid dt:nth-of-type(even) + dd {
    background: var(--card);
}
.meta-grid dt:last-of-type,
.meta-grid dt:last-of-type + dd {
    border-bottom: none;
}
.meta-grid dt {
    color: var(--roche-dark);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-right: 1px solid var(--border);
    white-space: nowrap;
}
.meta-grid dd { margin: 0; font-size: 0.9rem; color: var(--fg); word-break: break-word; }

.toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin: 0.75rem 0;
    flex-wrap: wrap;
}

input[type="text"], select, textarea {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    font: inherit;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--roche-blue);
    box-shadow: 0 0 0 3px var(--roche-light);
}
textarea { width: 100%; resize: vertical; }

/* Compact search boxes in the sidebar tree. */
#db-search, .tree-search input[type="text"] {
    padding: 0.32rem 0.55rem;
    font-size: 0.82rem;
    border-radius: 5px;
}

button {
    background: var(--roche-blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.1rem;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}
button:hover { background: var(--roche-blue-600); box-shadow: 0 4px 12px rgba(11, 65, 205, 0.28); transform: translateY(-1px); }
button:active { transform: translateY(0); box-shadow: none; }
button:disabled { opacity: 0.55; cursor: wait; box-shadow: none; transform: none; }
button.secondary { background: #fff; color: var(--roche-blue); border: 1px solid var(--roche-blue); }
button.secondary:hover { background: var(--roche-light); box-shadow: none; }

ul.list { list-style: none; padding: 0; margin: 0; }
ul.list li {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.55rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
ul.list li:hover {
    border-color: var(--border);
    border-left-color: var(--roche-blue);
    box-shadow: 0 3px 12px rgba(2, 35, 102, 0.08);
}
ul.list .title { font-weight: 600; color: var(--roche-dark); }
ul.list .sub { font-size: 0.82rem; color: var(--muted); margin-top: 0.25rem; }

/* Compact list variant used inside the sidebar panels. */
ul.list.compact { max-height: 340px; overflow-y: auto; }
ul.list.compact li { padding: 0.55rem 0.7rem; margin-bottom: 0.4rem; }
ul.list.compact .title { font-size: 0.88rem; }
ul.list.compact .sub { font-size: 0.75rem; }
ul.list li.active {
    border-left-color: var(--roche-blue);
    background: var(--roche-light);
}
ul.list li.hint, li.hint {
    cursor: default;
    color: var(--muted);
    font-size: 0.82rem;
    border-left-color: transparent;
    background: transparent;
    border-style: dashed;
}
ul.list li.hint:hover { box-shadow: none; border-left-color: transparent; }

/* ── Nested Databases → Tables tree ──────────────────────────────────────── */
ul.list.tree { max-height: 60vh; overflow-y: auto; }

/* Tree nodes are plain containers; the inner .node-row is the clickable card. */
ul.list.tree li.tree-node {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0 0 0.4rem 0;
    cursor: default;
    transition: none;
}
ul.list.tree li.tree-node:hover { box-shadow: none; }

/* Frozen header (database name + table search) for the expanded node. */
.node-sticky {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--card);
    padding-bottom: 0.4rem;
}

.node-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.node-row:hover {
    border-left-color: var(--roche-blue);
    box-shadow: 0 3px 12px rgba(2, 35, 102, 0.08);
}
.node-row.active {
    border-left-color: var(--roche-blue);
    background: var(--roche-light);
}
.node-row .node-main { flex: 1; min-width: 0; }
.node-row .title { font-size: 0.88rem; }
.node-row .sub { font-size: 0.75rem; }

.caret {
    flex: none;
    width: 1.2rem;
    padding: 0;
    margin-top: 0.05rem;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: none;
}
.caret:hover { background: transparent; color: var(--roche-blue); box-shadow: none; }

/* Per-database table search, frozen with the database name. */
.tree-search { margin-top: 0.4rem; padding-left: 1.6rem; display: flex; flex-direction: column; gap: 0.35rem; }
.tree-search input[type="text"] { width: 100%; }

/* Nested table list under each database — lightweight rows, not cards. */
ul.children {
    list-style: none;
    margin: 0.1rem 0 0.2rem 0.95rem;
    padding: 0 0 0 0.7rem;
    border-left: 2px solid var(--border);
}
ul.children li.table-node {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0;
    padding: 0.45rem 0.5rem;
    margin: 0;
    cursor: pointer;
    transition: background 0.12s;
}
ul.children li.table-node:first-child { border-top: none; }
ul.children li.table-node:hover {
    background: var(--roche-light);
    box-shadow: none;
}
ul.children li.table-node.active {
    background: var(--roche-light);
    box-shadow: inset 2px 0 0 var(--roche-blue);
}
ul.children li.table-node .title {
    font-size: 0.82rem;
    font-weight: 500;
}
ul.children li.table-node .sub { font-size: 0.7rem; }
ul.children li.hint {
    border: none;
    background: transparent;
    padding: 0.3rem 0.5rem;
}

/* Published/unpublished status dot for table rows. */
.dot {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}
.dot.pub { background: #1f9d55; box-shadow: 0 0 0 3px rgba(31, 157, 85, 0.18); }
.dot.unpub { background: #d64545; box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.16); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.16rem 0.55rem;
    border-radius: 999px;
    background: var(--ok-bg);
    color: var(--ok-fg);
    margin-left: 0.5rem;
    vertical-align: middle;
}
/* Leading status dot rendered via ::before so any .badge reads as a pill. */
.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.badge.no { background: var(--no-bg); color: var(--no-fg); }

.desc-block { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem; margin: 0.75rem 0 1.5rem; box-shadow: 0 1px 4px rgba(2, 35, 102, 0.05); }
.desc-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 0.5rem; }
.desc-meta span { font-size: 0.78rem; color: var(--muted); }
.btn-group { display: inline-flex; gap: 0.5rem; }

/* Read-only description text (view mode). */
.desc-text { margin: 0; white-space: pre-wrap; font-size: 0.9rem; }
.desc-text.empty { color: var(--muted); font-style: italic; }

/* Column description view/edit layout inside the table cell. */
.col-desc-meta { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; }
.col-edit-actions { display: inline-flex; gap: 0.4rem; }
/* The explicit display above outranks the [hidden] attribute's default
   display:none, so restore it for hidden action groups. */
[hidden] { display: none !important; }
table#columns td button { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

table#columns { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(2, 35, 102, 0.05); }
table#columns th, table#columns td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); font-size: 0.88rem; vertical-align: top; }
table#columns th { background: var(--roche-blue); color: #fff; font-weight: 600; letter-spacing: 0.01em; }
table#columns tbody tr:hover { background: var(--roche-light); }
table#columns td textarea { min-height: 2.2rem; }
.col-type { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.82rem; color: var(--muted); }

#toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--roche-dark);
    color: #fff;
    padding: 0.8rem 1.1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    box-shadow: 0 6px 20px rgba(2, 35, 102, 0.3);
}
#toast.error { background: var(--no-fg); }

/* Full-page blocking overlay shown during publish/unpublish. */
#overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 35, 102, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: wait;
}
#overlay[hidden] { display: none; }
.overlay-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    color: var(--roche-dark);
    font-weight: 600;
    padding: 1.1rem 1.6rem;
    border-radius: 10px;
    font-size: 0.95rem;
    box-shadow: 0 10px 32px rgba(2, 35, 102, 0.35);
}
.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid var(--roche-light);
    border-top-color: var(--roche-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Gentle fade-in for the main content regions on each page. */
.home-main, .layout, .access-main { animation: fade-in 0.35s var(--ease-out); }

/* ── Skeleton loaders ─────────────────────────────────────────────────────
   Shimmer placeholders shown while data is being fetched, so the page never
   appears empty or janky during load. */
.skeleton {
    position: relative;
    overflow: hidden;
    background: #e9edf3;
    border-radius: var(--radius-sm);
}
.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.6) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.1rem;
    margin-top: 1.1rem;
}
.skeleton-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.2rem;
}
.skeleton-line { height: 0.7rem; margin-bottom: 0.6rem; }
.skeleton-line.lg { height: 1rem; width: 60%; }
.skeleton-line.sm { width: 40%; }
.skeleton-line:last-child { margin-bottom: 0; }

/* Stack the two columns on narrow screens. */
@media (max-width: 820px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: static; }
}

/* ── Header Home link (browse view) ──────────────────────────────────────── */
.user { display: flex; align-items: center; gap: 0.9rem; }
.home-link {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--roche-dark);
    text-decoration: none;
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}
.home-link:hover { background: var(--roche-light); border-color: var(--roche-blue); }
.home-link.active { background: var(--roche-blue); color: #fff; border-color: var(--roche-blue); }

/* ── Landing page ────────────────────────────────────────────────────────── */
.home-header {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 1.5rem;
    padding: 0.85rem 2rem;
    background: linear-gradient(135deg, var(--grad-start) 0%, var(--grad-end) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: var(--shadow-md);
}
.home-header .brand { display: flex; align-items: center; gap: 0.85rem; }
.home-header a.brand { text-decoration: none; cursor: pointer; }
.home-header .logo-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 0.6rem;
    background: #fff;
    border-radius: 8px;
}
.home-header .logo { height: 22px; width: auto; display: block; }
.home-header .brand-sep { width: 1px; height: 26px; background: rgba(255, 255, 255, 0.3); }
.home-header .brand-name { font-size: 1.2rem; font-weight: 700; color: #fff; white-space: nowrap; }

.catalog-toolbar { margin: 0 0 1.2rem; }
.home-search { position: relative; max-width: 560px; width: 100%; }
.home-search-icon {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    opacity: 0.5;
    pointer-events: none;
}
.home-search input {
    width: 100%;
    padding: 0.65rem 0.95rem 0.65rem 2.4rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--fg);
    font-size: 0.92rem;
    outline: none;
    box-shadow: 0 1px 2px rgba(2, 35, 102, 0.04);
}
.home-search input::placeholder { color: var(--muted); }
.home-search input:focus { border-color: var(--roche-blue); box-shadow: 0 0 0 3px rgba(11, 65, 205, 0.12); }
.home-search input:focus + .home-search-icon { opacity: 0.8; }

.home-actions { display: flex; align-items: center; gap: 1rem; justify-self: end; }
.home-actions .home-link {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}
.home-actions .home-link:hover { background: rgba(255, 255, 255, 0.12); }
.home-actions .home-link.active { background: #fff; color: var(--roche-dark); border-color: #fff; }
.home-actions .user { gap: 0; }

.home-main { max-width: 1240px; margin: 0 auto; padding: 1.8rem 2rem 3rem; }

/* Hero banner */
.hero {
    display: flex;
    align-items: center;
    gap: 1.6rem;
    padding: 2rem 2.4rem;
    border-radius: 16px;
    background: linear-gradient(120deg, var(--grad-start) 0%, var(--grad-end) 100%);
    color: #fff;
    box-shadow: 0 10px 30px rgba(2, 35, 102, 0.18);
}
.hero-mark {
    flex: none;
    width: 88px;
    height: 88px;
    border-radius: 14px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem;
    box-shadow: 0 6px 18px rgba(2, 35, 102, 0.25);
}
.hero-logo { width: 100%; height: auto; display: block; }
.hero-text h1 { margin: 0 0 0.5rem; font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.hero-sub { margin: 0 0 1rem; max-width: 720px; color: rgba(255, 255, 255, 0.9); font-size: 1rem; }
.hero-pill {
    display: inline-block;
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Stat cards */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.2rem;
    margin: 1.6rem 0;
}
.stat-card {
    width: 100%;
    font-family: inherit;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1rem;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover {
    border-color: var(--roche-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--grad-start) 0%, var(--grad-end) 100%);
}
.stat-card:hover .stat-num,
.stat-card:hover .stat-label { color: #fff; }
.stat-num { display: block; font-size: 2.1rem; font-weight: 800; color: var(--roche-blue); line-height: 1.1; }
.stat-label {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Catalog groups */
.catalog-group { margin-top: 2rem; }
.catalog-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--border);
}
.catalog-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--roche-dark);
    word-break: break-all;
}
.catalog-summary { flex: none; font-size: 0.82rem; color: var(--muted); white-space: nowrap; }

.db-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.1rem;
    margin-top: 1.1rem;
}
.db-card {
    display: block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.db-card:hover {
    border-color: var(--roche-blue);
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    background: linear-gradient(135deg, var(--grad-start) 0%, var(--grad-end) 100%);
}
.db-card:hover .db-name,
.db-card:hover .db-icon,
.db-card:hover .db-card-path,
.db-card:hover .db-card-foot,
.db-card:hover .foot-meta { color: #fff; }
.db-card-head { display: flex; align-items: center; gap: 0.5rem; }
.db-icon { font-size: 1rem; color: var(--roche-blue); display: inline-flex; }
.db-name { font-weight: 700; color: var(--roche-dark); }
.db-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--roche-blue);
    background: var(--roche-light);
    padding: 0.1rem 0.5rem;
    border-radius: 6px;
}
.db-card-head .dot { margin-left: auto; }
.db-card-path { margin: 0.55rem 0 0.9rem; font-size: 0.8rem; color: var(--muted); word-break: break-all; }
.db-card-foot { display: flex; align-items: center; gap: 0.9rem; font-size: 0.8rem; color: var(--muted); }
.foot-meta { display: inline-flex; align-items: center; gap: 0.3rem; white-space: nowrap; }

/* Inline SVG glyph: scales with text, picks up the surrounding color. */
.ic {
    width: 1.05em;
    height: 1.05em;
    flex: none;
    vertical-align: -0.15em;
}
.foot-meta .ic { color: var(--roche-blue); opacity: 0.85; }
.src-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.55rem;
    border-radius: 6px;
    text-transform: lowercase;
}
.src-badge.src-glue { color: var(--ok-fg); background: var(--ok-bg); }
.src-badge.src-redshift { color: #8a4b00; background: #fdeedd; }
.src-badge.src-other { color: var(--muted); background: var(--bg); }

.home-hint { color: var(--muted); padding: 1.5rem 0; }

@media (max-width: 820px) {
    .home-header { grid-template-columns: 1fr auto; }
    .home-search { grid-column: 1 / -1; order: 3; justify-self: stretch; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .hero { flex-direction: column; text-align: center; }
}


