/* Tokens: docs/design-system.md. Names such as --teal stay so existing rules keep working. */
:root {
    --ink: #0f172a;
    --muted: #64748b;
    --paper: #f8fafc;
    --paper-2: #f1f5f9;
    --card: #ffffff;
    --line: #e2e8f0;
    --table-bg: #ffffff;
    --table-head: #e4ebf3;
    --table-line: #c5d0dc;
    --field: #f8fafc;
    --field-line: #e2e8f0;
    --field-focus: #ffffff;
    --field-off: #f1f5f9;
    --sidebar: #0f172a;
    --sidebar-2: #1e293b;
    --sidebar-text: #cbd5e1;
    --teal: #2563eb;
    --teal-deep: #1d4ed8;
    --teal-soft: #eff6ff;
    --copper: #b91c1c;
    --copper-soft: #fef2f2;
    --gold: #b45309;
    --gold-soft: #fffbeb;
    --green: #15803d;
    --green-soft: #f0fdf4;
    --slate: #475569;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-table: 14px;
    --glass: #ffffff;
    --glass-sheen: #ffffff;
    --glass-edge: #e2e8f0;
    --glass-blur: none;
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
    --bs-body-bg: #f8fafc;
    --bs-body-color: #0f172a;
    --bs-body-font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    --bs-border-color: #e2e8f0;
    --bs-border-radius: 8px;
    --bs-border-radius-sm: 6px;
    --bs-border-radius-lg: 12px;
    --bs-link-color: #1d4ed8;
    --bs-link-hover-color: #1e40af;
    --bs-card-bg: #ffffff;
    --bs-card-border-color: #e2e8f0;
    --bs-card-cap-bg: #f8fafc;
    --bs-modal-bg: #ffffff;
    --bs-dropdown-bg: #ffffff;
    --bs-dropdown-border-color: #e2e8f0;
    --bs-dropdown-link-color: #0f172a;
    --bs-dropdown-link-hover-bg: #f1f5f9;
    --bs-dropdown-link-hover-color: #0f172a;
    --bs-tertiary-bg: #f8fafc;
    --bs-secondary-bg: #f1f5f9;
    --bs-secondary-color: #64748b;
    --bs-list-group-bg: #ffffff;
    --bs-pagination-bg: #ffffff;
    --bs-pagination-border-color: #e2e8f0;
    --bs-pagination-hover-bg: #f1f5f9;
    --bs-pagination-hover-color: #0f172a;
    --bs-pagination-active-bg: #2563eb;
    --bs-pagination-active-border-color: #2563eb;
    --bs-success: #15803d;
    --bs-success-rgb: 21, 128, 61;
    --bs-warning: #b45309;
    --bs-warning-rgb: 180, 83, 9;
    --bs-danger: #b91c1c;
    --bs-danger-rgb: 185, 28, 28;
    --bs-focus-ring-color: rgba(37, 99, 235, 0.28);
    --sidebar-w: 248px;
    --sidebar-collapsed-w: 76px;
    --font: "IBM Plex Sans", "Segoe UI", sans-serif;
    --display: "IBM Plex Sans", "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    color: var(--ink);
    background-color: var(--paper);
    background-image: none;
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
}

a { color: var(--teal-deep); text-decoration: none; }
a:hover { color: var(--teal); }

h1, h2, h3 {
    font-family: var(--display);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
}

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 0.65rem; }
h3 { font-size: 0.95rem; margin: 0; }
.panel-head h2,
.modal-header h2 { margin: 0; }

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    z-index: 80;
    background: var(--teal);
    color: white;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
}
.skip-link:focus { top: 0.75rem; color: white; }

.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--sidebar);
    border-right: 1px solid #1e293b;
    box-shadow: none;
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 40;
    padding: 1.15rem 0.85rem 1rem;
    overflow: hidden;
    transition: width 0.18s ease, transform 0.2s ease;
}

.side-nav {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.brand {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.35rem 0.7rem 1.1rem;
    color: white;
}

.brand-lockup {
    display: block;
    width: 100%;
    height: auto;
}

.brand-mark {
    display: none;
    width: 36px;
    height: 36px;
}

.nav-label {
    margin: 0.85rem 0.75rem 0.35rem;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #94a3b8;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--sidebar-text);
    border-radius: 10px;
    padding: 0.48rem 0.7rem;
    margin-bottom: 0.12rem;
    font-weight: 500;
}

.side-link i { width: 1.1rem; text-align: center; color: #94a3b8; }
.side-link:hover { background: rgba(255, 255, 255, 0.06); color: white; }
.side-link.active {
    background: #1e293b;
    color: white;
    box-shadow: inset 3px 0 0 var(--teal);
}
.side-link.active i { color: #bfdbfe; }
.side-link .count {
    margin-left: auto;
    background: var(--teal);
    color: white;
    border-radius: 999px;
    min-width: 1.3rem;
    text-align: center;
    font-size: 0.72rem;
    padding: 0.05rem 0.35rem;
    font-family: var(--mono);
}

.side-foot {
    flex-shrink: 0;
    padding: 0.55rem 0.15rem 0.15rem;
    color: #94a3b8;
    font-size: 0.78rem;
}
.side-note { margin: 0 0.6rem 0.55rem; }

.sidebar-collapse {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    border: 0;
    background: transparent;
    color: #94a3b8;
    border-radius: 10px;
    padding: 0.48rem 0.7rem;
    font: inherit;
    font-weight: 500;
    font-size: 0.92rem;
    cursor: pointer;
    text-align: left;
}
.sidebar-collapse:hover { background: rgba(255, 255, 255, 0.1); color: white; }
.sidebar-collapse [data-collapse-icon="collapsed"],
.sidebar-collapse [data-collapse-label="collapsed"] { display: none; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; transition: margin-left 0.18s ease; }

@media (min-width: 861px) {
    html.sidebar-collapsed .sidebar {
        width: var(--sidebar-collapsed-w);
        padding-inline: 0.45rem;
    }
    html.sidebar-collapsed .app-main { margin-left: var(--sidebar-collapsed-w); }
    html.sidebar-collapsed .app-content { max-width: none; }
    html.sidebar-collapsed .brand {
        justify-content: center;
        gap: 0;
        padding-inline: 0;
    }
    html.sidebar-collapsed .brand-lockup { display: none; }
    html.sidebar-collapsed .brand-mark { display: block; }
    html.sidebar-collapsed .nav-label {
        height: 1px;
        margin: 0.55rem 0.55rem;
        padding: 0;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.08);
        color: transparent;
        font-size: 0;
        letter-spacing: 0;
    }
    html.sidebar-collapsed .side-link {
        justify-content: center;
        gap: 0;
        position: relative;
        padding-inline: 0.35rem;
    }
    html.sidebar-collapsed .side-link > span:not(.count) {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    html.sidebar-collapsed .side-link .count {
        position: absolute;
        top: 0.15rem;
        right: 0.2rem;
        margin: 0;
        min-width: 1rem;
        font-size: 0.62rem;
        padding: 0 0.22rem;
    }
    html.sidebar-collapsed .side-note { display: none; }
    html.sidebar-collapsed .sidebar-collapse {
        justify-content: center;
        gap: 0;
        padding-inline: 0.35rem;
    }
    html.sidebar-collapsed .sidebar-collapse [data-collapse-icon="expanded"],
    html.sidebar-collapsed .sidebar-collapse [data-collapse-label="expanded"] { display: none; }
    html.sidebar-collapsed .sidebar-collapse [data-collapse-icon="collapsed"] { display: inline; }
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1.5rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    box-shadow: none;
}

.search-form { flex: 1; max-width: 520px; position: relative; }
.search-field { position: relative; }
.search-field > i {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}
.search-field input {
    width: 100%;
    border: 1px solid var(--field-line);
    background-color: var(--field);
    box-shadow: inset 0 1px 1px rgba(8, 28, 52, 0.04);
    border-radius: var(--radius-sm);
    padding: 0.45rem 2rem 0.45rem 2.3rem;
    font: inherit;
    color: var(--ink);
}
.search-field input:focus { outline: 2px solid rgba(37, 99, 235, 0.28); border-color: var(--teal); }
.search-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    max-height: min(70vh, 520px);
    overflow: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 30;
    padding: 0.45rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.search-panel[hidden] { display: none !important; }
body.search-open { overflow: hidden; }
body.search-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--ink) 45%, transparent);
    z-index: 45;
}
body.search-open .topbar {
    z-index: 50;
    background: transparent;
    border-bottom-color: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
body.search-open .topbar::before {
    content: "";
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--ink) 45%, transparent);
    z-index: 0;
}
body.search-open .menu-toggle,
body.search-open .user-chip { visibility: hidden; }
body.search-open .search-form {
    position: fixed;
    z-index: 2;
    top: max(1.25rem, env(safe-area-inset-top));
    right: max(1.75rem, env(safe-area-inset-right));
    bottom: max(1.25rem, env(safe-area-inset-bottom));
    left: max(1.75rem, env(safe-area-inset-left));
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    max-width: none;
    padding: 0.85rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}
@media (min-width: 861px) {
    body.search-open .search-form {
        right: auto;
        left: 50%;
        width: 70%;
        max-width: 70%;
        transform: translateX(-50%);
    }
}
body.search-open .search-field { flex: none; }
body.search-open .search-field input {
    background: var(--field);
    border-color: var(--teal);
    box-shadow: none;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    font-size: 1rem;
}
body.search-open .search-panel {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    flex: 1;
    min-height: 0;
    max-height: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    gap: 0.55rem;
}
body.search-open .search-panel:has(.search-empty:only-child) {
    align-items: center;
    justify-content: center;
}
.search-group {
    --group: var(--teal);
    --group-soft: var(--teal-soft);
    flex-shrink: 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 3px solid var(--group);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.search-group[data-group="samples"],
.search-group[data-group="publications"],
.search-group[data-group="messages"],
.search-group[data-group="chat"],
.search-group[data-group="calendar"] { --group: var(--teal); --group-soft: var(--teal-soft); }
.search-group[data-group="tasks"],
.search-group[data-group="announcements"] { --group: var(--gold); --group-soft: var(--gold-soft); }
.search-group[data-group="logbook"] { --group: var(--green); --group-soft: var(--green-soft); }
.search-group[data-group="media"],
.search-group[data-group="instruments"],
.search-group[data-group="people"] { --group: var(--slate); --group-soft: var(--paper-2); }
.search-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0.38rem 0.6rem;
    background: var(--group-soft);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--group);
}
.search-label i {
    width: 1.35rem;
    height: 1.35rem;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: var(--group);
    color: white;
    font-size: 0.72rem;
}
.search-hit {
    display: block;
    margin: 0;
    padding: 0.42rem 0.7rem 0.42rem 0.85rem;
    border-radius: 0;
    color: var(--ink);
    text-decoration: none;
}
.search-hit strong { display: block; font-weight: 600; font-size: 0.92rem; }
.search-hit span { display: block; color: var(--muted); font-size: 0.78rem; }
.search-group .search-hit.is-active,
.search-group .search-hit:hover { background: var(--group-soft); }
.search-hit mark { background: #dbeafe; color: inherit; padding: 0 0.05rem; border-radius: 2px; }
.search-empty { margin: 0; padding: 0.8rem 0.95rem; color: var(--muted); }

.user-chip {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.user-chip .dropdown-toggle {
    text-align: left;
}
.topbar-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    flex-shrink: 0;
}
.topbar-icon.is-active {
    border-color: var(--teal);
    color: var(--teal);
}
.topbar-count {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
    min-width: 1.15rem;
    padding: 0.05rem 0.3rem;
    border-radius: 999px;
    background: var(--teal);
    color: white;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
}
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--teal);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 0.85rem;
}
.user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    text-align: left;
}
.user-meta strong { display: block; font-size: 0.92rem; line-height: 1.15; }
.user-meta span { display: block; color: var(--muted); font-size: 0.78rem; line-height: 1.15; }

.app-content { padding: 1.15rem 1.5rem 2rem; max-width: none; }

.page-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-end;
    margin: 0.15rem 0 1rem;
}
.eyebrow {
    margin: 0 0 0.2rem;
    color: var(--teal-deep);
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 700;
}
.lead-quiet { color: var(--muted); margin: 0.35rem 0 0; max-width: 46rem; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem 1.1rem;
    margin-bottom: 1rem;
}
.panel-notice {
    background: var(--green-soft);
    border-color: #bbf7d0;
}
.panel-notice .panel-head {
    align-items: center;
    flex-direction: row;
}
.panel-notice .panel-head form {
    margin-left: auto;
    flex-shrink: 0;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: baseline;
    margin-bottom: 0.8rem;
}
.panel-head p { margin: 0; color: var(--muted); font-size: 0.88rem; }

.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
}
.btn-teal {
    background: var(--teal);
    border: 1px solid var(--teal);
    color: white;
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.8rem;
    font-weight: 600;
    box-shadow: none;
}
.btn-teal:hover, .btn-teal:focus { background: var(--teal-deep); border-color: var(--teal-deep); color: white; }
.btn-outline-ink {
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.8rem;
    font-weight: 600;
    box-shadow: none;
}
.btn-outline-ink:hover, .btn-outline-ink:focus { border-color: #cbd5e1; background: var(--paper); color: var(--ink); }
.btn-ghost {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    border-radius: var(--radius-sm);
}
.btn-ghost:hover, .btn-ghost:focus { background: var(--paper-2); color: var(--ink); }
.btn-copper {
    background: var(--copper);
    border: 1px solid var(--copper);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 600;
    box-shadow: none;
}
.btn-copper:hover, .btn-copper:focus { background: #991b1b; border-color: #991b1b; color: white; }
.btn:disabled, .btn-teal:disabled { opacity: 0.55; }

.form-control, .form-select, textarea.form-control {
    border-color: var(--field-line);
    border-radius: var(--radius-sm);
    background-color: var(--field);
    box-shadow: none;
    font: inherit;
    font-size: 0.92rem;
    color: var(--ink);
}
.form-control:focus, .form-select:focus {
    border-color: var(--teal);
    background-color: var(--field-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.form-control::placeholder { color: var(--muted); }
.form-control[aria-invalid="true"],
.form-select[aria-invalid="true"],
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--copper);
    background-color: var(--copper-soft);
}
.form-check-input {
    background-color: var(--field);
    border-color: var(--field-line);
}
.form-label { font-weight: 600; font-size: 0.86rem; margin-bottom: 0.3rem; }

.panel-table {
    padding: 0;
    overflow-x: auto;
    border-color: var(--table-line);
    background: var(--table-bg);
    border-radius: var(--radius-table);
    box-shadow: none;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--muted) 45%, var(--line)) transparent;
}
.panel-table::-webkit-scrollbar { height: 8px; width: 8px; }
.panel-table::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--muted) 45%, var(--line));
    border-radius: 999px;
}
.panel-table::-webkit-scrollbar-track { background: transparent; }
.table-lab,
.panel > .table,
.panel .table-responsive > .table {
    width: max-content;
    min-width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--ink);
    font-size: 0.8125rem;
    line-height: 1.35;
    --bs-table-bg: var(--table-bg);
    --bs-table-color: var(--ink);
    --bs-table-border-color: var(--table-line);
    --bs-table-striped-bg: transparent;
    --bs-table-striped-color: var(--ink);
    --bs-table-accent-bg: transparent;
    --bs-table-hover-bg: var(--paper-2);
    --bs-table-hover-color: var(--ink);
}
.table-lab th,
.table-lab td,
.panel > .table > thead > tr > th,
.panel > .table > tbody > tr > td,
.panel .table-responsive > .table > thead > tr > th,
.panel .table-responsive > .table > tbody > tr > td {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid var(--table-line);
    border-right: 1px solid var(--table-line);
    box-shadow: none;
    text-align: left;
    vertical-align: middle;
}
.table-lab th:last-child,
.table-lab td:last-child,
.panel > .table > thead > tr > th:last-child,
.panel > .table > tbody > tr > td:last-child,
.panel .table-responsive > .table > thead > tr > th:last-child,
.panel .table-responsive > .table > tbody > tr > td:last-child { border-right: 0; }
.table-lab th,
.panel > .table > thead > tr > th,
.panel .table-responsive > .table > thead > tr > th {
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
    background: var(--table-head);
    white-space: nowrap;
    vertical-align: bottom;
}
.table-lab td,
.panel > .table > tbody > tr > td,
.panel .table-responsive > .table > tbody > tr > td {
    background: var(--table-bg);
    white-space: nowrap;
}
.table-lab td .note,
.panel > .table td .note,
.panel .table-responsive > .table td .note {
    white-space: normal;
    max-width: 24rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.table-lab td:has(.empty),
.panel > .table td:has(.empty),
.panel .table-responsive > .table td:has(.empty) { white-space: normal; }
.cell-clip {
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.panel-table .table-lab > tbody > tr:last-child > td { border-bottom: 0; }
.table-lab tbody tr:hover > td,
.panel > .table tbody tr:hover > td,
.panel .table-responsive > .table tbody tr:hover > td { background: var(--paper-2); }
.table-lab tbody tr.is-selected > td,
.table-lab tbody tr.is-selected:hover > td {
    background: var(--teal-soft);
    box-shadow: inset 0 1px 0 var(--teal), inset 0 -1px 0 var(--teal);
}
.table-lab tbody tr.is-selected > td:first-child {
    box-shadow: inset 1px 0 0 var(--teal), inset 0 1px 0 var(--teal), inset 0 -1px 0 var(--teal);
}
.table-lab tbody tr.is-selected > td:last-child {
    box-shadow: inset -1px 0 0 var(--teal), inset 0 1px 0 var(--teal), inset 0 -1px 0 var(--teal);
}
.table-lab tbody tr.is-selected > td:only-child { box-shadow: inset 0 0 0 1px var(--teal); }
.table-lab th.col-actions,
.table-lab td.col-actions,
.panel > .table > thead > tr > th.col-actions,
.panel > .table > tbody > tr > td.col-actions,
.panel .table-responsive > .table > thead > tr > th.col-actions,
.panel .table-responsive > .table > tbody > tr > td.col-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}
.table-lab th:has(input[type="checkbox"]),
.table-lab td:has(input[type="checkbox"]) {
    width: 2.75rem;
    text-align: center;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}
.table-lab input[type="checkbox"] {
    appearance: none;
    width: 15px;
    height: 15px;
    margin: 0;
    border: 1.5px solid color-mix(in srgb, var(--muted) 50%, var(--line));
    border-radius: 4px;
    background-color: var(--card);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 11px 11px;
    vertical-align: middle;
    cursor: pointer;
}
.table-lab input[type="checkbox"]:checked {
    background-color: var(--teal);
    border-color: var(--teal);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5 6.5 11.5 12.5 4.5'/%3E%3C/svg%3E");
}
.table-lab input[type="checkbox"]:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.panel:not(.panel-table) > .table-responsive {
    margin-left: -1.1rem;
    margin-right: -1.1rem;
    width: calc(100% + 2.2rem);
    max-width: none;
}
.panel:not(.panel-table) > .table-responsive:last-child { margin-bottom: -1.1rem; }
.example-mark,
.urgent-mark {
    display: inline-flex;
    align-items: center;
    margin-left: 0.45rem;
    padding: 0.08rem 0.45rem;
    border-radius: 999px;
    background: var(--teal);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
}
.urgent-mark { background: var(--copper); }
.example-banner {
    background: var(--teal-soft);
    border-color: var(--teal);
}
.example-banner .panel-head { margin-bottom: 0.2rem; }
.example-banner .lead-quiet { max-width: 40rem; }
.example-links {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.85rem;
}
.example-link {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem 0.85rem;
    padding: 0.7rem 0.85rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink);
}
.example-link:hover { border-color: var(--teal); color: var(--ink); }
.example-link strong { display: block; font-weight: 600; }
.example-link .note { display: block; }
.example-link .example-mark { flex: none; margin: 0.15rem 0 0; }
.col-filter {
    display: block;
    width: 100%;
    min-width: 6.75rem;
    box-sizing: border-box;
    margin-top: 0.35rem;
    border: 1px solid var(--table-line);
    border-radius: 8px;
    background-color: var(--table-bg);
    color: var(--ink);
    padding: 0.22rem 0.45rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}
.col-filter:focus {
    outline: 2px solid rgba(37, 99, 235, 0.28);
    border-color: var(--teal);
    background-color: var(--field-focus);
}
.table-lab th a {
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
}
.table-lab th a i { font-size: 0.62rem; color: var(--muted); opacity: 0.45; }
.table-lab th.is-sorted a,
.table-lab th a:hover { color: var(--teal-deep); }
.table-lab th.is-sorted a i,
.table-lab th a:hover i { color: var(--teal); opacity: 1; }
[data-ajax-table] { position: relative; }
[data-ajax-table].is-loading .table-lab,
[data-ajax-table].is-loading .sample-cards { opacity: 0.55; }
[data-ajax-table].is-loading::before {
    content: "";
    position: absolute;
    z-index: 2;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--teal);
}
.table-status {
    font-weight: 600;
    margin: 0;
    padding: 0.75rem 1rem 0;
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--card);
}
.id-link {
    font-family: var(--mono);
    font-size: 0.84rem;
    font-weight: 500;
    white-space: nowrap;
}
.table-lab td.place-depth-1 { padding-left: 1.85rem; }
.table-lab td.place-depth-2 { padding-left: 2.9rem; }
.table-lab td.place-depth-3 { padding-left: 3.95rem; }
.table-lab td.place-depth-4 { padding-left: 5rem; }
.table-lab td.place-depth-5 { padding-left: 6.05rem; }
.table-lab td.place-depth-6 { padding-left: 7.1rem; }
.table-lab td.place-depth-7 { padding-left: 8.15rem; }
.table-lab td.place-depth-8 { padding-left: 9.2rem; }
.storage-table .table-lab td,
.protocol-table .table-lab td { white-space: normal; }
.place-map-body {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem;
}
.place-node {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 7.5rem;
    max-width: 100%;
    padding: 0.55rem 0.65rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--paper);
}
.place-map-body > .place-node {
    background: var(--teal-soft);
    border-color: color-mix(in srgb, var(--teal) 28%, var(--line));
}
.place-node-children {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px dashed var(--line);
}
.place-node-name {
    color: var(--ink);
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
}
.place-node-name:hover,
.place-node-name:focus { color: var(--teal); }
.place-node-kind {
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.3;
}
.place-node.is-slot {
    min-width: 4.75rem;
    background: var(--paper-2);
}
.place-node.is-retired { border-style: dashed; }
.place-node.is-retired .place-node-name { color: var(--muted); }
.tasks-table .table-lab { width: 100%; min-width: 0; }
.tasks-table .table-lab td,
.tasks-table .table-lab th { white-space: normal; overflow-wrap: normal; word-break: normal; vertical-align: top; }
.tasks-table .table-lab th:nth-child(4),
.tasks-table .table-lab td:nth-child(4) { white-space: nowrap; }
.tasks-table .table-lab th.col-actions,
.tasks-table .table-lab td.col-actions { white-space: nowrap; width: 1%; }
.tasks-table .col-filter { min-width: 0; width: 100%; }
.tasks-table > .empty { padding: 1.1rem 0.85rem 1.25rem; }
@media (max-width: 760px) {
    .place-map-body > .place-node { width: 100%; }
}
.cell-wrap { white-space: normal; max-width: 36rem; }

.status {
    display: inline-flex;
    align-items: center;
    align-self: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3;
    background: var(--paper-2);
    color: var(--slate);
    white-space: nowrap;
}
.status::before {
    content: "";
    width: 0.38rem;
    height: 0.38rem;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}
.status-intake, .status-active { background: var(--paper-2); color: var(--slate); }
.status-measured { background: var(--teal-soft); color: var(--teal-deep); }
.status-review { background: var(--gold-soft); color: var(--gold); }
.status-finished { background: var(--green-soft); color: var(--green); }
.status-discarded { background: var(--copper-soft); color: var(--copper); }
.status-other { background: var(--paper-2); color: var(--slate); }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }
.chip {
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    border-radius: var(--radius-sm);
    padding: 0.22rem 0.65rem;
    font-size: 0.85rem;
    font-weight: 600;
}
.chip.active { background: var(--teal); color: white; border-color: var(--teal); }

.people-table .table-lab { width: 100%; min-width: 36rem; table-layout: fixed; }
.people-table .col-role { width: 8.5rem; }
.people-table .col-person { width: 34%; }
.people-table .table-lab th.col-actions,
.people-table .table-lab td.col-actions { width: 2.75rem; padding-left: 0.35rem; padding-right: 0.35rem; }
.people-table .form-control,
.people-table .form-select {
    width: 100%;
    min-width: 0;
    height: 1.75rem;
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    font-size: 0.8125rem;
    line-height: 1.75rem;
}
.people-table .table-lab th,
.people-table .table-lab td { padding-top: 0.3rem; padding-bottom: 0.3rem; }
.people-actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.75rem; }
.measurements-table .table-lab td,
.material-table .table-lab td { vertical-align: top; }
.material-table .table-lab,
.authors-table .table-lab { width: 100%; }
.material-table .table-lab td,
.authors-table .table-lab td { white-space: normal; }
.material-table .table-lab th.col-actions,
.material-table .table-lab td.col-actions,
.authors-table .table-lab th.col-actions,
.authors-table .table-lab td.col-actions { white-space: nowrap; width: 1%; }
.instrument-table .table-lab { width: 100%; }
.instrument-table .table-lab td,
.instrument-table .table-lab th { white-space: normal; }
.instrument-table .table-lab th.col-actions,
.instrument-table .table-lab td.col-actions { white-space: nowrap; width: 1%; }
.instrument-table .col-filter { min-width: 0; width: 100%; }
.instrument-log .table-lab { width: 100%; min-width: 0; }
.instrument-log .table-lab td,
.instrument-log .table-lab th { white-space: normal; }
.instrument-log .col-filter { min-width: 0; width: 100%; }
.report-table .table-lab { width: 100%; min-width: 0; }
.report-table .table-lab td,
.report-table .table-lab th { white-space: normal; overflow-wrap: normal; word-break: normal; vertical-align: top; }
.report-table .col-filter { min-width: 0; width: 100%; }
.report-table .report-figure { margin: 0; color: var(--muted); font-size: 0.88rem; }
.report-table .report-figure b { color: var(--ink); }
.report-table .report-meta { padding: 0.55rem 0.85rem 0.7rem; margin: 0; }
.report-table > .empty { padding: 1.1rem 0.85rem 1.25rem; }
.logbook-range { margin-bottom: 0; border-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.logbook-range + [data-ajax-table] { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.logbook-range .row { padding: 0.75rem; }
.calendar-table .table-lab { width: 100%; min-width: 0; }
.calendar-table .table-lab td,
.calendar-table .table-lab th { white-space: normal; overflow-wrap: normal; word-break: normal; }
.calendar-table .table-lab th.col-actions,
.calendar-table .table-lab td.col-actions {
    position: sticky;
    right: 0;
    z-index: 1;
    white-space: nowrap;
    width: 1%;
    background: var(--table-bg);
    box-shadow: -8px 0 8px -8px color-mix(in srgb, var(--ink) 16%, transparent);
}
.calendar-table .table-lab th.col-actions { z-index: 2; background: var(--table-head); }
.calendar-table .col-filter { min-width: 0; width: 100%; padding-left: 0.45rem; padding-right: 0.45rem; }

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 3rem;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--table-line);
    background: var(--table-bg);
    position: sticky;
    left: 0;
    z-index: 1;
}
.table-toolbar-actions,
.table-toolbar-end,
.table-export {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.table-toolbar-end { margin-left: auto; }
.table-toolbar .btn:disabled { opacity: 0.45; }
.table-toolbar [data-bulk-count] {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--ink);
}
.table-toolbar .is-on { border-color: var(--teal); color: var(--teal-deep); }
.adv-count {
    display: inline-grid;
    place-items: center;
    min-width: 1.15rem;
    height: 1.15rem;
    margin-left: 0.15rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--teal);
    color: white;
    font-size: 0.72rem;
    font-family: var(--mono);
}
.search-popover {
    position: fixed;
    z-index: 35;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 0.85rem 1rem 1rem;
}
.search-popover[hidden] { display: none !important; }
.search-popover .panel-head { margin-bottom: 0.7rem; }

.search-builder .builder {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.65rem;
    margin-bottom: 0.85rem;
}
.rule-row {
    display: grid;
    grid-template-columns: 92px minmax(160px, 220px) minmax(0, 1fr) 36px;
    gap: 0.4rem;
    align-items: center;
}
.rule-where,
.rule-row .form-control,
.rule-row .form-select,
.rule-remove {
    height: 38px;
    border-radius: 8px;
}
.rule-where {
    display: none;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.rule-row:first-child .rule-where { display: flex; }
.rule-row:first-child .join-select { display: none; }
.rule-row .join-select { font-weight: 700; text-align: center; padding-left: 0.35rem; padding-right: 1.4rem; }
.rule-remove {
    width: 36px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--muted);
    display: grid;
    place-items: center;
    padding: 0;
}
.rule-remove:hover { color: var(--ink); border-color: var(--ink); }
.rule-row:only-child .rule-remove { visibility: hidden; }
.builder-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.builder-submit { display: flex; gap: 0.45rem; flex-wrap: wrap; }

.bulk-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    background: var(--card);
    border: 1px solid var(--line);
    color: var(--ink);
    border-radius: var(--radius-table);
    box-shadow: none;
    padding: 0.55rem 0.85rem;
    margin-bottom: 0.75rem;
}
.bulk-bar:not(.d-none) {
    border-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-bottom: 0;
}
.bulk-bar:not(.d-none) + [data-ajax-table] {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    margin-top: -1px;
}
.bulk-bar .form-select { max-width: 220px; }
.bulk-bar [data-bulk-count] {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--ink);
}
.bulk-badge {
    display: inline-grid;
    place-items: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.28rem;
    border-radius: 6px;
    background: var(--teal);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.table-toolbar .btn,
.bulk-bar .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: var(--radius-sm);
    padding: 0.32rem 0.7rem;
    font-size: 0.8125rem;
    font-weight: 600;
}
.table-toolbar .btn i,
.bulk-bar .btn i { font-size: 0.85rem; }
.table-toolbar .table-export-toggle {
    border-radius: var(--radius);
    padding: 0.28rem 0.35rem 0.28rem 0.7rem;
    gap: 0.4rem;
}
.table-toolbar .table-export-toggle::after { content: none; }
.table-export-caret {
    display: inline-flex;
    align-items: center;
    align-self: stretch;
    margin: -0.28rem 0 -0.28rem 0.2rem;
    padding-left: 0.45rem;
    border-left: 1px solid var(--line);
}
.table-export-caret::before {
    content: "";
    width: 0.4rem;
    height: 0.4rem;
    margin-right: 0.28rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
}
.table-toolbar .dropdown-menu { min-width: 8.5rem; }
.bulk-bar .btn-copper {
    background: var(--card);
    color: var(--copper);
    border-color: color-mix(in srgb, var(--copper) 35%, var(--line));
}
.bulk-bar .btn-copper:hover,
.bulk-bar .btn-copper:focus {
    background: var(--copper-soft);
    color: var(--copper);
    border-color: var(--copper);
}

.record-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 1rem;
    align-items: start;
}
.record-quiet { margin: 0 0 0.85rem; color: var(--muted); font-size: 0.88rem; }
.record-quiet p { margin: 0; }
.record-quiet p + p { margin-top: 0.2rem; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 0.35rem 0.6rem; margin: 0; }
.kv dt { color: var(--muted); font-size: 0.82rem; margin: 0; }
.kv dd { margin: 0; font-weight: 600; }
.person { padding: 0.55rem 0; border-top: 1px solid var(--line); }
.person:first-of-type { border-top: 0; }
.person small { display: block; color: var(--muted); font-weight: 500; }
.note { color: var(--muted); font-size: 0.88rem; margin: 0.2rem 0 0; }

.table-lab td .inbox-message {
    display: -webkit-box;
    max-width: 24rem;
    overflow: hidden;
    color: var(--ink);
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.table-lab td .inbox-message:hover { color: var(--teal-deep); }

.nav-tabs { border-bottom: 1px solid var(--line); gap: 0.2rem; }
.nav-tabs .nav-link {
    border: 0;
    color: var(--muted);
    font-weight: 700;
    border-radius: 10px 10px 0 0;
    padding: 0.55rem 0.8rem;
}
.nav-tabs .nav-link.active { color: var(--ink); background: transparent; box-shadow: inset 0 -2px 0 var(--teal); }
.section-split {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 1.25rem 1.5rem;
    align-items: start;
}
.section-list { min-width: 0; max-width: 40rem; }
.section-split .section-list { max-width: none; }
.section-add .form-label { margin-bottom: 0.25rem; }
.section-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    margin-bottom: 0.5rem;
}
.tab-count {
    display: inline-block;
    margin-left: 0.35rem;
    min-width: 1.15rem;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: var(--paper-2);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    vertical-align: 1px;
}
.nav-link.active .tab-count { background: var(--teal-soft); color: var(--teal-deep); }

.thread { display: flex; flex-direction: column; gap: 0.75rem; }
.bubble {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.75rem 0.85rem;
    background: var(--card);
    box-shadow: none;
}
.bubble.alert { border-color: #bfdbfe; background: var(--teal-soft); }
.bubble header, .chat-line header { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.25rem; }
.bubble-actions, .row-actions { display: inline-flex; align-items: center; gap: 0.2rem; vertical-align: middle; }
.bubble-actions form, .row-actions form { display: inline-flex; margin: 0; }
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 1.3rem;
    line-height: 1;
}
.icon-btn .bi { font-size: 1em; line-height: 1; }
.table-lab .icon-btn,
.panel > .table .icon-btn,
.panel .table-responsive .table .icon-btn {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 6px;
    font-size: 0.9rem;
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--paper-2); color: var(--ink); }
.icon-btn.is-on { color: var(--teal); }
.icon-btn.is-danger { color: var(--copper); }
.icon-btn.is-danger:hover, .icon-btn.is-danger:focus-visible { background: var(--copper-soft); color: var(--copper); }
.bubble p, .chat-line p { margin: 0; white-space: pre-wrap; }

.file-row { display: flex; gap: 0.75rem; align-items: center; padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.thumb {
    width: 54px;
    height: 54px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--paper);
    border: 1px solid var(--line);
}
.file-kind {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--teal-deep);
}

.structure-viewer {
    height: 360px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: white;
    margin-bottom: 0.8rem;
    position: relative;
    overflow: hidden;
}
.structure-panel.has-model {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}
.structure-panel.has-model .structure-body {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.35fr);
    gap: 1rem 1.25rem;
    align-items: start;
}
.structure-fields { min-width: 0; }
.structure-panel.has-model .structure-viewer {
    height: min(42rem, calc(100dvh - 12rem));
    min-height: 320px;
    margin-bottom: 0;
    overflow: hidden;
    position: sticky;
    top: 5rem;
}
.structure-viewer canvas {
    max-width: 100%;
    max-height: 100%;
}
.structure-note,
.structure-legend {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    max-width: calc(100% - 1.2rem);
}
.structure-note {
    top: 0.6rem;
    left: 0.6rem;
    display: grid;
    gap: 0.05rem;
    padding: 0.35rem 0.55rem;
    border-radius: 10px;
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid var(--line);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.72rem;
    line-height: 1.4;
}
.structure-legend {
    left: 0.6rem;
    bottom: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.structure-key {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.12rem 0.45rem 0.12rem 0.28rem;
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--ink);
}
.structure-key i {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(12, 16, 22, 0.2);
}
.structure-empty {
    margin: 0;
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    color: var(--muted);
    text-align: center;
}
.structure-panel.has-model .structure-grid { grid-template-columns: 1fr 1fr; }
.structure-panel.has-model .structure-grid .span-2,
.structure-panel.has-model .structure-grid .span-4 { grid-column: 1 / -1; }
.structure-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem 1rem;
}
.structure-grid .span-2 { grid-column: span 2; }
.structure-grid .span-4 { grid-column: 1 / -1; }
.structure-metric .form-label {
    margin-bottom: 0.28rem;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.structure-metric .form-control {
    font-size: 1.12rem;
    font-weight: 650;
    background-color: var(--field);
    border-color: var(--field-line);
    padding: 0.55rem 0.7rem;
}
.structure-metric .form-control:focus {
    background-color: var(--field-focus);
    border-color: var(--teal);
}
.structure-metric .form-control:disabled {
    color: var(--ink);
    opacity: 1;
    background-color: var(--field-off);
}
.cif-note {
    margin: 0.28rem 0 0;
    color: var(--teal-deep);
    font-size: 0.75rem;
    font-weight: 650;
}
.file-cif-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.45rem;
}
.file-cif-actions form { margin: 0; }
.structure-metric dd {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 650;
    line-height: 1.3;
}
.structure-metric dd.is-empty { color: var(--muted); font-weight: 500; }
.structure-metric.is-aside .form-control,
.structure-metric.is-aside dd { font-size: 0.98rem; font-weight: 600; }
.field-photo-frame {
    position: relative;
    aspect-ratio: 4 / 3;
    border: 1px solid #c5ced8;
    border-radius: 6px;
    background:
        linear-gradient(to top right, transparent calc(50% - 0.5px), #c5ced8, transparent calc(50% + 0.5px)),
        linear-gradient(to top left, transparent calc(50% - 0.5px), #c5ced8, transparent calc(50% + 0.5px)),
        #fff;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.field-photo-frame.has-photo { background: #fff; }
.field-photo-frame span {
    padding: 0.15rem 0.4rem;
    background: #fff;
    color: #8b97a6;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.field-photo-frame a,
.field-photo-frame img,
.field-photo-open {
    display: block;
    width: 100%;
    height: 100%;
}
.field-photo-open {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}
.photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr) 4.5rem;
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-items: center;
    background: rgba(3, 16, 31, 0.92);
    color: white;
}
.photo-viewer[hidden] { display: none; }
.photo-viewer figure {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
}
.photo-viewer img {
    max-width: min(92vw, 1100px);
    max-height: calc(100dvh - 9rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    background: #fffdf8;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.photo-viewer figcaption {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    font-size: 0.92rem;
}
.photo-viewer figcaption span { color: #9aafc6; font-family: var(--mono); font-size: 0.78rem; }
.photo-viewer-close,
.photo-viewer-nav {
    border: 0;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
}
.photo-viewer-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    font-size: 1.4rem;
    line-height: 1;
}
.photo-viewer-nav {
    width: 3rem;
    height: 3rem;
    margin: 0 auto;
    border-radius: 999px;
    font-size: 1.8rem;
    line-height: 1;
    grid-row: 2;
}
.photo-viewer-nav.is-prev { grid-column: 1; }
.photo-viewer-nav.is-next { grid-column: 3; }
.photo-viewer-close:hover,
.photo-viewer-nav:hover { background: rgba(255, 255, 255, 0.22); }
.photo-viewer-nav[disabled] { opacity: 0.25; cursor: default; }
.field-photo-frame img { object-fit: cover; }
.field-photo-add {
    display: inline-flex;
    margin-top: 0.45rem;
}
.field-photo-add input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: 0.7rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.timeline time { color: var(--muted); font-size: 0.8rem; font-family: var(--mono); }

.stat-grid, .hub-grid, .dash-grid { display: grid; gap: 0.8rem; }
.stat-grid { grid-template-columns: repeat(4, 1fr); margin-bottom: 1rem; }
.hub-grid { grid-template-columns: repeat(3, 1fr); }
.dash-grid { grid-template-columns: 1.3fr 0.7fr; }
.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.85rem 1rem;
}
.stat b { display: block; font-family: var(--display); font-size: 1.6rem; font-weight: 600; line-height: 1; letter-spacing: -0.03em; }
.stat span { color: var(--muted); font-size: 0.85rem; }

.hub-card {
    display: block;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    color: var(--ink);
    min-height: 108px;
}
.hub-card:hover { border-color: var(--teal); color: var(--ink); box-shadow: var(--shadow-md); }
.hub-card strong { display: block; font-family: var(--display); font-size: 1.05rem; font-weight: 600; margin-bottom: 0.3rem; }
.hub-card span { color: var(--muted); }

.calendar-layout { display: flex; flex-direction: column; }
.calendar-layout > .cal-agenda { order: 1; margin-top: 0; }
.calendar-layout > .cal-scroll { order: 2; margin-top: 1rem; }
.cal-scroll { overflow-x: auto; }
.cal { width: 100%; min-width: 560px; display: grid; grid-template-columns: 104px repeat(7, minmax(60px, 1fr)); }
.cal-cell { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0.4rem; min-height: 92px; background: var(--card); }
.cal-head { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 700; background: var(--paper); min-height: 0; padding: 0; }
.cal-day {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    min-height: 2.25rem;
    border: 0;
    background: transparent;
    padding: 0.4rem;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
    font-weight: inherit;
    text-align: left;
    cursor: pointer;
}
.cal-day:hover, .cal-head.is-picked { background: var(--teal-soft); color: var(--ink); }
.cal-name { font-weight: 700; background: var(--paper); }
.cal-slot { position: relative; }
.cal-book {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}
.cal-slot:hover .cal-book { background: rgba(37, 99, 235, 0.06); }
.cal-slot.is-picked .cal-book { background: var(--teal-soft); box-shadow: inset 0 0 0 2px var(--teal); }
.booking-chip {
    position: relative;
    z-index: 1;
    display: block;
    background: var(--teal-soft);
    border-left: 3px solid var(--teal);
    border-radius: 8px;
    padding: 0.3rem 0.4rem;
    margin-bottom: 0.3rem;
    color: var(--ink);
    font-size: 0.78rem;
    line-height: 1.25;
}
.booking-chip b { display: block; }

.messenger { display: flex; flex-direction: column; padding: 0; overflow: hidden; min-height: 520px; }
.messenger-thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
    min-height: 320px;
    padding: 0.85rem 0.9rem 0.55rem;
    background: var(--card);
}
.thread-push { margin-top: auto; }
.msg {
    display: flex;
    gap: 0.45rem;
    align-items: flex-end;
    width: fit-content;
    max-width: min(75%, 32rem);
    align-self: flex-start;
    margin-bottom: 0.35rem;
}
.msg.grouped { margin-bottom: 0.15rem; }
.msg.mine { align-self: flex-end; }
.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--paper-2);
    color: var(--ink);
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex: none;
}
.msg-stack { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: 100%; }
.msg.mine .msg-stack { align-items: flex-end; }
.msg-name { font-size: 0.75rem; color: var(--muted); margin: 0 0.35rem 0.15rem; }
.msg-bubble {
    padding: 0.42rem 0.72rem;
    border-radius: 12px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    box-shadow: none;
    line-height: 1.35;
    overflow-wrap: break-word;
}
.msg-bubble.tail { border-bottom-left-radius: 5px; }
.msg-bubble p, .msg-bubble div { margin: 0; }
.msg-bubble ul, .msg-bubble ol { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.msg.mine .msg-bubble { background: var(--teal); color: white; border-color: var(--teal); }
.msg.mine .msg-bubble.tail { border-bottom-left-radius: 12px; border-bottom-right-radius: 5px; }
.msg.mine .msg-bubble a { color: white; }
.msg time { margin-top: 0.18rem; font-size: 0.68rem; color: var(--muted); line-height: 1; }
.messenger-compose {
    display: flex;
    gap: 0.55rem;
    align-items: flex-end;
    padding: 0.7rem;
    border-top: 1px solid var(--line);
    background: var(--card);
}
.wysiwyg { flex: 1; min-width: 0; border: 1px solid var(--field-line); border-radius: var(--radius-sm); background-color: var(--field); overflow: hidden; }
.wysiwyg-bar { display: flex; gap: 0.15rem; padding: 0.25rem 0.4rem; border-bottom: 1px solid var(--line); }
.wysiwyg-bar button {
    width: 30px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
}
.wysiwyg-bar button:hover { background: white; color: var(--ink); }
.wysiwyg-area {
    min-height: 44px;
    max-height: 140px;
    overflow-y: auto;
    padding: 0.45rem 0.75rem;
    outline: none;
}
.wysiwyg-area[data-empty="true"]::before {
    content: attr(data-placeholder);
    color: var(--muted);
}
.messenger-send {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--teal);
    color: white;
    flex: none;
}
.messenger-send:hover { background: var(--teal-deep); }

.flash {
    margin: 0 0 0.85rem;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    background: var(--green-soft);
    border: 1px solid #bbf7d0;
    color: #14532d;
    font-weight: 500;
    line-height: 1.45;
}
.flash + .page-head { margin-top: 0; }
.flash.error, .alert-danger {
    background: var(--copper-soft);
    color: #7f1d1d;
    border: 1px solid #fecaca;
}
.alert-warning {
    background: var(--gold-soft);
    color: #78350f;
    border: 1px solid #fde68a;
}
.alert-success {
    background: var(--green-soft);
    color: #14532d;
    border: 1px solid #bbf7d0;
}
.alert-info {
    background: var(--teal-soft);
    color: var(--teal-deep);
    border: 1px solid #bfdbfe;
}

.empty { padding: 1.25rem 0.2rem; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-family: var(--font); font-weight: 600; font-size: 1rem; margin-bottom: 0.2rem; }

.dt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
    padding: 0.6rem 0.85rem;
    border-top: 1px solid var(--table-line);
    background: var(--table-bg);
    color: var(--muted);
    font-size: 0.8125rem;
    position: sticky;
    left: 0;
    z-index: 1;
}
.dt-info { font-variant-numeric: tabular-nums; }
.dt-footer .pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
    gap: 0.35rem;
}
.dt-footer .page-item .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0 0.4rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--ink);
    box-shadow: none;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
}
.dt-footer .page-link:hover {
    background: var(--paper-2);
    border-color: var(--line);
    color: var(--ink);
}
.dt-footer .page-item.active .page-link,
.dt-footer .page-item.active .page-link:hover {
    background: var(--teal);
    border-color: var(--teal);
    color: white;
}
.dt-footer .page-item.disabled .page-link {
    color: var(--muted);
    background: var(--card);
    border-color: var(--line);
    opacity: 0.45;
}
.dt-footer .page-item.page-ellipsis .page-link {
    min-width: 1.4rem;
    border-color: transparent;
    background: transparent;
    opacity: 1;
    color: var(--muted);
}

.status-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2.5rem 1.25rem;
    background: var(--paper);
}
.status-card {
    width: min(34rem, 100%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2rem 2rem 1.7rem;
}
.status-card .eyebrow { margin: 0; }
.status-card h1 {
    margin: 0;
    font-size: 1.85rem;
    line-height: 1.28;
    max-width: 16ch;
}
.status-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
    max-width: 32rem;
}
.status-card .btn-teal { margin-top: 0.4rem; }

.guest-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(28rem, 34rem);
}
.guest-story {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: var(--sidebar);
    color: #d4e0ee;
    padding: 2.35rem 3.1rem 1.7rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1.35rem;
}
.guest-video {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.04);
}
.guest-story::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(3, 10, 22, 0.42) 0%, rgba(3, 12, 24, 0.28) 42%, rgba(3, 10, 22, 0.72) 100%),
        linear-gradient(100deg, rgba(3, 12, 26, 0.82) 0%, rgba(4, 18, 36, 0.62) 58%, rgba(8, 28, 52, 0.34) 100%);
}
.brand-logo {
    width: min(22.5rem, 100%);
    height: auto;
    display: block;
}
.guest-copy {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    width: 100%;
    min-width: 0;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}
.guest-story h1 {
    color: white;
    font-size: clamp(2.7rem, 4.2vw, 3.55rem);
    line-height: 0.98;
    letter-spacing: -0.034em;
    max-width: 10ch;
    margin: 0;
}
.guest-lead {
    margin: 0;
    max-width: 52ch;
    font-size: 0.95rem;
    line-height: 1.45;
}
.workflow {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0.95rem;
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.workflow li {
    display: grid;
    grid-template-columns: 1.7rem 1fr;
    gap: 0.7rem;
    align-items: start;
    padding: 0.58rem 0.15rem;
}
.workflow li + li {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.step-no {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: #9ec4f5;
    padding-top: 0.18rem;
}
.workflow b {
    display: block;
    color: #fff;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    line-height: 1.25;
}
.workflow span {
    display: block;
    margin-top: 0.12rem;
    color: rgba(213, 226, 239, 0.82);
    font-size: 0.84rem;
    line-height: 1.4;
}
.workflow-around {
    width: 100%;
    margin: 0;
}
.workflow-around p {
    margin: 0 0 0.55rem;
    color: rgba(255, 255, 255, 0.48);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.workflow-around ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
    gap: 0.5rem;
}
.workflow-around li {
    min-width: 0;
    color: rgba(213, 226, 239, 0.82);
    font-size: 0.78rem;
    line-height: 1.35;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 14px;
    padding: 0.7rem 0.75rem 0.75rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.workflow-around b {
    display: block;
    color: #fff;
    font-weight: 600;
    font-size: 0.84rem;
    letter-spacing: -0.01em;
    margin-bottom: 0.18rem;
}
.workflow-around span { display: block; }
.guest-note {
    margin: auto 0 0;
    color: rgba(255, 255, 255, 0.46);
    font-size: 0.78rem;
    line-height: 1.45;
}
.guest-form { display: grid; place-items: center; padding: 2rem; background: var(--paper); }
.login-card {
    width: min(440px, 100%);
    padding: 1.5rem 1.4rem 1.2rem;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
}
.login-title { margin-bottom: 1rem; }
.demo-account {
    width: 100%;
    text-align: left;
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.4rem;
}
.demo-account:hover { border-color: var(--teal); }
.demo-account b { display: block; }
.demo-account span { color: var(--muted); font-size: 0.82rem; }

.menu-toggle { display: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: var(--radius-sm); padding: 0.35rem 0.55rem; }

.form-check-input:checked {
    background-color: var(--teal);
    border-color: var(--teal);
}
.form-check-input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.panel.group-ops { padding-bottom: 0; overflow: hidden; }
.group-note {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}
.group-note i { color: var(--teal); margin-top: 0.15rem; }
.mixed-flag {
    color: var(--copper);
    font-weight: 700;
    font-size: 0.78rem;
    margin-left: 0.35rem;
}
.group-ops .form-select.is-mixed,
.group-ops .form-control.is-mixed,
.group-picks.is-mixed {
    border-color: #fecaca;
    box-shadow: inset 0 0 0 1px #fecaca;
}
.type-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
}
.type-line .form-select { flex: 1; }
.urgent-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    white-space: nowrap;
    font-weight: 600;
}
.urgent-toggle .form-check-input { margin: 0; }
.group-label-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    margin-bottom: 0.35rem;
}
.group-inline-check,
.group-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
}
.group-inline-check { align-items: center; font-size: 0.92rem; }
.group-check {
    color: var(--slate);
    font-size: 0.92rem;
    margin-bottom: 0.55rem;
}
.group-check .form-check-input,
.group-inline-check .form-check-input { margin-top: 0.2rem; flex: none; }
.group-inline-check .form-check-input { margin-top: 0; }
.group-check.is-warn span { color: var(--copper); }
.group-picks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    border: 1px solid var(--field-line);
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
    background: var(--field);
}
.group-picks .form-check { margin: 0; display: flex; align-items: center; gap: 0.4rem; }
.group-picks .form-check-input { margin: 0; }
.group-foot {
    display: flex;
    justify-content: flex-end;
    margin: 0.4rem -1.1rem 0;
    padding: 0.85rem 1.1rem;
    background: var(--paper);
    border-top: 1px solid var(--line);
}

.autofill { font-size: 0.75rem; color: var(--teal-deep); font-weight: 700; }

.protocol-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; align-items: start; }
.protocol-form form { display: grid; gap: 0.35rem; margin-bottom: 1rem; }
.panel,
.protocol-form { overflow-wrap: anywhere; }

@media (min-width: 1101px) {
    .guest-shell { height: 100dvh; }
    .guest-story, .guest-form { min-height: 0; }
    .guest-copy {
        flex: 1;
        min-height: 0;
        overflow: auto;
        padding-right: 0.35rem;
    }
    .guest-form { overflow: auto; }
}
@media (max-width: 1100px) {
    .record-grid, .dash-grid, .stat-grid, .hub-grid { grid-template-columns: 1fr 1fr; }
    .guest-shell { grid-template-columns: 1fr; }
    .guest-story { padding: 2rem; min-height: 70vh; }
    .guest-story h1 { font-size: 2.6rem; }
}
@media (max-width: 700px) {
    .workflow-around ul { grid-template-columns: 1fr; }
    .guest-story { padding: 1.5rem 1.25rem 1.35rem; }
    .guest-story h1 { font-size: 2.35rem; }
    .specimen-form .section-pair,
    .specimen-form form,
    .protocol-form form { display: grid; grid-template-columns: 1fr; }
    .specimen-form .btn,
    .protocol-form .btn { width: 100%; }
    .protocol-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-105%); transition: transform 0.2s ease; }
    .sidebar.is-open { transform: none; }
    .app-main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .sidebar-collapse { display: none; }
    .record-grid, .dash-grid, .stat-grid, .hub-grid, .section-split, .structure-grid, .structure-panel.has-model .structure-body { grid-template-columns: 1fr; }
    .structure-panel.has-model .structure-viewer { height: 240px; min-height: 0; }
    .structure-grid .span-2, .structure-grid .span-4 { grid-column: auto; }
    .rule-row { grid-template-columns: 1fr auto; }
    .rule-row .rule-field, .rule-row .rule-value { grid-column: 1 / -1; }
    .user-meta { display: none; }
    .page-head, .panel-head { flex-direction: column; align-items: flex-start; }
}

.dropdown-menu,
.modal-content,
.card,
.list-group,
.offcanvas,
.toast,
.popover {
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
}
.dropdown-menu { border-radius: 10px; padding: 0.35rem; }
.dropdown-item { border-radius: var(--radius-sm); }
.modal-content { border-radius: var(--radius); overflow: hidden; }
.modal-header,
.modal-footer { border-color: var(--line); background: var(--card); }
.welcome-modal .modal-dialog { max-width: min(40rem, calc(100vw - 1.5rem)); }
.welcome-modal .modal-body { container-type: inline-size; }
.welcome-modal .modal-header.is-dark {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--sidebar);
    border-bottom-color: transparent;
    padding: 0.7rem 0.85rem 0.7rem 1rem;
}
.welcome-modal .modal-header h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.welcome-logo { width: 8.4rem; height: auto; display: block; }
.welcome-step .eyebrow { margin-bottom: 0.3rem; }
.welcome-step-title {
    margin: 0 0 0.55rem;
    color: var(--ink);
    font-size: 1.35rem;
    line-height: 1.2;
}
.welcome-points {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0.65rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    background: var(--teal-soft);
    border: 1px solid var(--teal);
    border-radius: var(--radius);
}
@container (min-width: 34rem) {
    .welcome-points { grid-template-columns: repeat(3, 1fr); }
}
.welcome-points li {
    margin: 0;
    padding: 0.7rem 0.75rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.welcome-points b { display: block; margin-bottom: 0.15rem; color: var(--ink); font-size: 0.92rem; font-weight: 600; }
.welcome-points span { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.welcome-foot { justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.modal-backdrop.show { background: rgba(15, 23, 42, 0.45); }
.card { border-radius: var(--radius); }
.list-group-item { background: transparent; border-color: var(--line); }
.input-group-text {
    background-color: var(--field-off);
    border-color: var(--field-line);
    color: var(--slate);
}
.form-control:disabled, .form-select:disabled {
    background-color: var(--field-off);
    color: var(--ink);
    opacity: 1;
}
.nav-tabs .nav-link:hover { background: var(--paper-2); }

.field-error { color: var(--copper); font-size: 0.86rem; margin: 0.25rem 0 0.5rem; }
.task-state { font-weight: 700; }
.task-heading { font-size: 1rem; margin: 1rem 0 0.4rem; }
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.8rem;
    margin: 0;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--table-line);
    background: var(--table-head);
    color: var(--muted);
    font-size: 0.8125rem;
    position: sticky;
    left: 0;
    z-index: 1;
}
.role-abilities { margin-top: 1rem; font-size: 0.82rem; }
.role-abilities p { margin: 0.45rem 0; }
.sample-cards { display: none; }
.samples-wide { min-width: 720px; }
.sample-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.55rem;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--table-line);
}
.cal-agenda { display: block; margin-top: 1rem; }
.agenda-row { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center; padding: 0.45rem 0; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.grow { flex: 1; min-width: 0; }
.prewrap { margin: 0; white-space: pre-wrap; }
.announcement-copy { margin: 0.3rem 0; white-space: pre-wrap; }
.thumb-fallback {
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.field-narrow { max-width: 5.5rem; }
.col-check { width: 2.25rem; }

@media (max-width: 760px) {
    .samples-wide { display: none; }
    .sample-cards { display: block; }
    .cal-scroll { display: none; }
    .cal-agenda { display: block; }
    .dt-footer,
    .table-toolbar,
    .bulk-bar { align-items: flex-start; }
    .dt-footer { flex-direction: column; }
    .table-toolbar { justify-content: flex-start; }
    .example-link { flex-direction: column-reverse; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
