:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --panel: #ffffff;
    --ink: #18212f;
    --muted: #667085;
    --line: #d9dee7;
    --brand: #146c6f;
    --brand-strong: #0d4749;
    --accent: #b8324f;
    --ok: #18794e;
    --bad: #b42318;
    --shadow: 0 10px 30px rgba(24, 33, 47, .08);
    --manual-card-height: 220px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
}

body.modal-open {
    overflow: hidden;
}

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

button,
.button {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    padding: 0 16px;
    font: inherit;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: var(--brand-strong);
}

button.danger {
    background: var(--bad);
}

button.danger:hover {
    background: #8f1d14;
}

.button.secondary {
    background: #e7ecef;
    color: var(--ink);
}

.button.secondary:hover {
    background: #d8e0e5;
}

input,
select {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    padding: 0 12px;
    font: inherit;
    width: 100%;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: .92rem;
    font-weight: 700;
}

.auth-shell {
    min-height: 100vh;
    padding: 20px;
    background:
        linear-gradient(135deg, rgba(20, 108, 111, .12), transparent 36%),
        linear-gradient(315deg, rgba(184, 50, 79, .12), transparent 38%),
        var(--bg);
}

.auth-shell .page {
    width: 100%;
    min-height: 100svh;
    margin: 0;
    padding: clamp(20px, 4vw, 48px);
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(440px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 26px;
    overflow: hidden;
}

.auth-brand {
    display: grid;
    gap: 8px;
    justify-items: center;
    margin: -4px 0 12px;
}

.auth-logo {
    width: min(210px, 74%);
    height: auto;
    display: block;
}

.auth-car {
    width: min(220px, 78%);
    height: auto;
    display: block;
    margin: -2px auto 0;
}

.auth-card h1,
.page-header h1 {
    margin: 0;
    line-height: 1.05;
}

.auth-card h1 {
    margin-bottom: 18px;
}

.auth-card p {
    color: var(--muted);
}

.auth-card form,
.panel form {
    display: grid;
    gap: 16px;
}

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

.app-shell {
    min-height: 100vh;
    --sidebar-width: 250px;
    --sidebar-rail-width: 76px;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: #111820;
    color: #fff;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    overflow: hidden;
    transition: width .2s ease, padding .2s ease;
    z-index: 20;
}

.sidebar-toggle {
    position: fixed;
    top: 18px;
    left: calc(var(--sidebar-width) - 58px);
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 6px;
    background: rgba(255, 255, 255, .08);
    display: grid;
    place-content: center;
    gap: 4px;
    z-index: 30;
    transition: left .2s ease, background .2s ease, border-color .2s ease;
}

.sidebar-toggle span {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #fff;
    display: block;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, .15);
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-rail-width);
    padding: 74px 12px 18px;
}

.sidebar-collapsed .sidebar-toggle {
    left: 17px;
    background: var(--brand);
    border-color: var(--brand);
}

.brand {
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.08rem;
    font-weight: 800;
    min-width: 0;
}

.brand-logo,
.sidebar nav,
.account {
    transition: opacity .12s ease, visibility .12s ease;
}

.sidebar-collapsed .brand-logo,
.sidebar-collapsed .sidebar nav,
.sidebar-collapsed .account {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #2d3330;
    border: 1px solid rgba(255, 255, 255, .14);
    display: block;
    overflow: hidden;
    flex: 0 0 auto;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.brand-logo {
    display: block;
    width: min(108px, calc(var(--sidebar-width) - 142px));
    min-width: 0;
    flex: 0 1 auto;
}

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

.sidebar nav {
    display: grid;
    gap: 6px;
}

.sidebar nav a {
    color: #d9e3ec;
    border-radius: 6px;
    padding: 10px;
}

.sidebar nav a:hover {
    background: rgba(255, 255, 255, .09);
}

.account {
    margin-top: auto;
    color: #d9e3ec;
    position: relative;
}

.account-menu {
    position: relative;
}

.account-menu summary {
    min-height: 48px;
    list-style: none;
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 10px;
    align-items: center;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 8px;
    background: rgba(255, 255, 255, .04);
    cursor: pointer;
}

.account-menu summary::-webkit-details-marker {
    display: none;
}

.account-menu summary:hover,
.account-menu[open] summary {
    background: rgba(255, 255, 255, .09);
}

.account-avatar {
    width: 34px;
    height: 34px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: var(--brand);
    color: #fff;
    font-size: .9rem;
    font-weight: 900;
}

.account-meta {
    min-width: 0;
    display: grid;
    gap: 1px;
}

.account-name {
    color: #fff;
    font-weight: 850;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-role {
    color: #9aa8b7;
    font-size: .82rem;
    text-transform: capitalize;
}

.account-menu-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 60;
    display: grid;
    gap: 4px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    background: #18212b;
    box-shadow: 0 14px 32px rgba(0, 0, 0, .28);
}

.account-menu-panel a {
    color: #e6edf3;
    border-radius: 6px;
    padding: 10px;
    font-weight: 750;
}

.account-menu-panel a:hover {
    background: rgba(255, 255, 255, .1);
}

.page {
    margin-left: var(--sidebar-width);
    padding: 28px;
    transition: margin-left .2s ease;
}

.sidebar-collapsed .page {
    margin-left: var(--sidebar-rail-width);
}

.manual-viewer-page {
    height: 100vh;
    padding: 0;
    overflow: hidden;
}

.page-header {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--accent);
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.search {
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(240px, 440px) auto;
    gap: 10px;
}

.actions,
.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.user-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 4px;
}

.delete-user-form {
    display: flex;
    justify-content: flex-start;
    margin-top: 12px;
}

.unlock-user-form {
    display: flex;
    justify-content: flex-start;
    margin-top: 12px;
}

.delete-user-form button {
    width: auto;
}

.user-status {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: .88rem;
    font-weight: 750;
}

.user-status.ok {
    color: var(--ok);
}

.user-status.bad {
    color: var(--bad);
}

.inline-form input,
.inline-form select {
    width: min(230px, 100%);
}

.create-user-panel {
    display: grid;
    gap: 16px;
}

.create-user-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.create-user-form label {
    display: grid;
    gap: 6px;
}

.create-user-form label span,
.field-label {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.create-user-form button {
    min-height: 48px;
    white-space: nowrap;
}

.smtp-settings-panel,
.mechanic-settings-panel,
.youtube-settings-panel {
    display: grid;
    gap: 16px;
}

.smtp-settings-form,
.mechanic-settings-form,
.youtube-settings-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(170px, 1fr));
    gap: 12px;
    align-items: end;
}

.smtp-settings-form label,
.mechanic-settings-form label,
.youtube-settings-form label {
    display: grid;
    gap: 6px;
}

.smtp-settings-form label span,
.mechanic-settings-form label span,
.youtube-settings-form label span {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.smtp-settings-form button,
.mechanic-settings-form button,
.youtube-settings-form button {
    min-height: 48px;
}

@media (min-width: 781px) {
    .youtube-settings-form button {
        grid-column: 3;
    }
}

.account-panel {
    display: grid;
    gap: 16px;
    max-width: 760px;
}

.account-password-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    max-width: 420px;
}

.account-password-form label span {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.account-password-form button {
    min-height: 48px;
}

.settings-checkbox {
    grid-template-columns: auto 1fr;
    align-items: center;
    align-self: center;
}

.settings-checkbox input {
    width: auto;
    min-height: auto;
}

.manual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.compact-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.manual-card,
.result,
.panel,
.table-wrap {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.manual-card-wrap {
    position: relative;
    display: grid;
    height: var(--manual-card-height);
    min-width: 0;
}

.manual-card {
    height: 100%;
    padding: 18px 72px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--ink);
}

.manual-card:hover {
    border-color: rgba(20, 108, 111, .4);
}

.manual-card span {
    color: var(--brand);
    font-size: .8rem;
    font-weight: 800;
}

.manual-card h2,
.panel h2 {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.18;
}

.manual-card h2,
.manual-card p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
}

.manual-card h2 {
    -webkit-line-clamp: 3;
}

.manual-card p {
    margin: 0;
    margin-top: auto;
    color: var(--muted);
    line-height: 1.2;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
}

.video-search {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    gap: 10px;
    margin-bottom: 16px;
}

.video-admin-panel {
    display: grid;
    gap: 16px;
}

.video-add-form {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

.video-add-form label span {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.video-section {
    margin-bottom: 26px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.curated-video-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.video-card {
    display: grid;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.video-thumb,
.video-embed {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #111820;
}

.video-embed {
    display: block;
    border: 0;
}

.video-thumb {
    position: relative;
    display: block;
    color: #fff;
}

.video-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.video-thumb span {
    position: absolute;
    inset: auto 12px 12px auto;
    padding: 6px 9px;
    border-radius: 6px;
    background: rgba(17, 24, 32, .86);
    font-weight: 850;
}

.video-body {
    display: grid;
    gap: 9px;
    padding: 14px;
}

.video-body h3 {
    margin: 0;
    line-height: 1.18;
}

.video-body p {
    margin: 0;
    color: var(--muted);
}

.video-meta {
    font-size: .88rem;
    font-weight: 750;
}

.video-notes {
    color: var(--ink);
    font-weight: 700;
}

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

.video-actions form {
    display: inline-flex;
}

.video-more-actions {
    margin-top: 14px;
}

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

.video-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
}

.video-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 32, .72);
}

.video-modal-panel {
    position: relative;
    z-index: 1;
    width: min(1040px, 100%);
    max-height: min(86vh, 760px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .32);
}

.video-modal-header,
.video-modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
}

.video-modal-header {
    border-bottom: 1px solid var(--line);
}

.video-modal-header h2 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
}

.video-modal-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 240px;
    max-height: calc(86vh - 130px);
    border: 0;
    background: #111820;
}

.video-modal-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
}

.pin-form {
    position: absolute;
    top: 10px;
    right: 10px;
}

.pin-form button {
    min-height: 30px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--brand);
    padding: 0 10px;
    font-size: .78rem;
    font-weight: 800;
}

.pin-form button:hover {
    background: var(--brand);
    color: #fff;
}

.section {
    margin: 0 0 24px;
}

.section h2 {
    margin: 0 0 12px;
}

.results {
    display: grid;
    gap: 10px;
}

.result {
    padding: 14px 16px;
    color: var(--ink);
}

.result span {
    display: block;
    color: var(--muted);
    font-size: .9rem;
    margin-top: 3px;
}

.result p {
    margin: 8px 0 0;
}

mark {
    background: #ffe08a;
    color: inherit;
}

.library-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    align-items: center;
    min-height: 48px;
    margin: -8px 0 18px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    color: var(--muted);
    font-weight: 800;
}

.library-breadcrumbs a {
    color: var(--brand);
}

.library-drilldown {
    margin-top: 22px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.library-drilldown h2 {
    margin: 0 0 14px;
}

.drilldown-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.drilldown-list a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f9fafb;
    color: var(--ink);
    font-weight: 750;
}

.drilldown-list a:hover {
    border-color: rgba(20, 108, 111, .36);
    color: var(--brand);
    background: #eef6f6;
}

.mechanic-status {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    box-shadow: var(--shadow);
}

.mechanic-status span {
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.mechanic-status strong {
    color: var(--brand);
}

.mechanic-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: calc(100svh - 120px);
    min-height: 520px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.mechanic-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 360px) auto;
    gap: 16px;
    justify-content: space-between;
    align-items: end;
    padding: 16px;
    border-bottom: 1px solid var(--line);
    background: #fbfcfd;
}

.mechanic-clear {
    min-height: 42px;
    white-space: nowrap;
}

.mechanic-chat-log {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 18px;
    min-height: 0;
    overflow: auto;
    background: linear-gradient(180deg, #fff, #f8fafb);
}

.mechanic-message {
    display: flex;
}

.mechanic-message div {
    max-width: min(780px, 100%);
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.mechanic-message.user {
    justify-content: flex-end;
}

.mechanic-message.user div {
    background: #eef6f6;
    border-color: rgba(20, 108, 111, .24);
}

.mechanic-message strong {
    display: block;
    margin-bottom: 6px;
}

.mechanic-message p {
    margin: 0;
    white-space: pre-wrap;
}

.mechanic-sources {
    display: grid;
    gap: 7px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.mechanic-sources a {
    font-weight: 750;
}

.mechanic-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.mechanic-images a {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 750;
}

.mechanic-images img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background: #f6f7f9;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.mechanic-images span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mechanic-composer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--line);
    background: #fff;
    z-index: 1;
}

.mechanic-composer textarea {
    min-height: 72px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    font: inherit;
}

.mechanic-composer button {
    align-self: end;
    min-height: 48px;
}

.manual-viewer {
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    background: var(--bg);
}

.viewer-toolbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .94);
}

.viewer-toolbar h1 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.2;
}

.manual-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.flash {
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    background: #fff;
}

.flash.success {
    border-color: rgba(24, 121, 78, .35);
    color: var(--ok);
}

.flash.error {
    border-color: rgba(180, 35, 24, .35);
    color: var(--bad);
}

.status-overview {
    display: grid;
    gap: 16px;
    padding: 18px;
    margin-bottom: 22px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.status-overview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.status-overview-header h2,
.section-heading h2 {
    margin: 0;
}

.status-summary {
    border-radius: 999px;
    padding: 8px 12px;
    font-size: .82rem;
    font-weight: 850;
    white-space: nowrap;
    border: 1px solid currentColor;
}

.status-summary.ok {
    color: var(--ok);
    background: rgba(24, 121, 78, .08);
}

.status-summary.bad {
    color: var(--bad);
    background: rgba(180, 35, 24, .08);
}

.requirements {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.requirement-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    min-height: 86px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.requirement-card > div {
    min-width: 0;
}

.requirement-card strong,
.requirement-card span {
    display: block;
}

.requirement-card strong {
    line-height: 1.2;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.requirement-card div span {
    margin-top: 5px;
    color: var(--muted);
    font-size: .86rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.requirement-card.ok {
    border-color: rgba(24, 121, 78, .28);
}

.requirement-card.bad {
    border-color: rgba(180, 35, 24, .34);
    background: #fffafa;
}

.status-dot {
    width: 12px;
    height: 12px;
    margin-top: 3px;
    border-radius: 999px;
    background: var(--bad);
    box-shadow: 0 0 0 4px rgba(180, 35, 24, .1);
}

.requirement-card.ok .status-dot {
    background: var(--ok);
    box-shadow: 0 0 0 4px rgba(24, 121, 78, .1);
}

.section-heading {
    margin: 4px 0 12px;
}

.table-wrap {
    overflow-x: auto;
}

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

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: .82rem;
    text-transform: uppercase;
}

.panel {
    padding: 18px;
    margin-bottom: 16px;
}

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-row select {
    width: 130px;
}

.permission-dropdown {
    position: relative;
    margin: 14px 0;
    max-width: 420px;
}

.permission-dropdown .field-label {
    margin: 0 0 6px;
}

.permission-dropdown details {
    position: relative;
}

.permission-dropdown summary {
    min-height: 48px;
    padding: 11px 42px 11px 14px;
    list-style: none;
    cursor: pointer;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font-weight: 800;
}

.permission-dropdown summary::-webkit-details-marker {
    display: none;
}

.permission-dropdown summary::after {
    content: "";
    position: absolute;
    top: 19px;
    right: 16px;
    width: 9px;
    height: 9px;
    border: solid var(--muted);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.permission-dropdown details[open] summary::after {
    top: 23px;
    transform: rotate(225deg);
}

.permission-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: grid;
    max-height: 280px;
    overflow: auto;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.permission-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    padding: 9px 8px;
    color: var(--ink);
    font-weight: 700;
    border-radius: 6px;
}

.permission-option:hover {
    background: #f4f7fa;
}

.permission-option-all {
    border-bottom: 1px solid var(--line);
    border-radius: 6px 6px 0 0;
    color: var(--teal);
}

.permission-option input {
    width: auto;
    min-height: auto;
    margin-top: 3px;
}

.manual-checks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.manual-checks label {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    color: var(--ink);
    font-weight: 500;
}

.manual-checks input {
    width: auto;
    min-height: auto;
    margin-top: 4px;
}

@media (max-width: 780px) {
    .sidebar {
        position: fixed;
        inset: 0 0 auto 0;
        width: 100%;
        min-height: auto;
        padding: 12px 64px 12px 14px;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        align-content: flex-start;
        gap: 10px;
        z-index: 40;
    }

    .sidebar-toggle {
        left: auto;
        right: 14px;
        top: 16px;
        background: var(--brand);
        border-color: var(--brand);
        z-index: 50;
    }

    .sidebar-collapsed .sidebar {
        width: 100%;
        padding: 12px 64px 12px 14px;
    }

    .sidebar-collapsed .sidebar-toggle {
        left: auto;
        right: 14px;
    }

    .sidebar-collapsed .sidebar {
        flex-wrap: nowrap;
    }

    .sidebar-collapsed .sidebar nav,
    .sidebar-collapsed .account {
        display: none;
    }

    .sidebar-collapsed .brand-logo {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .brand {
        width: calc(100vw - 128px);
        max-width: calc(100vw - 128px);
        min-width: 0;
        overflow: hidden;
    }

    .brand-logo {
        width: auto;
        max-width: calc(100vw - 198px);
        overflow: hidden;
    }

    .brand-logo img {
        width: auto;
        max-width: 100%;
        max-height: 34px;
    }

    .sidebar nav {
        display: grid;
        width: auto;
        flex: 1 1 100%;
        order: 3;
        gap: 6px;
    }

    .sidebar nav a,
    .account-menu-panel a {
        padding: 8px 10px;
    }

    .account {
        margin-left: auto;
        margin-top: 0;
        width: auto;
        min-width: max-content;
    }

    .account-menu-panel {
        top: calc(100% + 8px);
        bottom: auto;
    }

    .page {
        margin-left: 0;
        padding: 94px 18px 18px;
    }

    .sidebar-collapsed .page {
        margin-left: 0;
        padding-top: 94px;
    }

    .manual-viewer-page {
        height: 100vh;
        padding: 76px 0 0;
    }

    .page-header,
    .search,
    .create-user-form,
    .account-password-form,
    .mechanic-toolbar,
    .smtp-settings-form,
    .mechanic-settings-form,
    .youtube-settings-form,
    .video-search,
    .video-add-form {
        display: grid;
        grid-template-columns: 1fr;
    }

    .mechanic-composer {
        grid-template-columns: 1fr;
    }

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

    .mechanic-chat-log {
        min-height: 340px;
        overflow: visible;
    }

    .mechanic-composer {
        position: sticky;
        bottom: 0;
        border: 1px solid var(--line);
        border-radius: 0 0 8px 8px;
        box-shadow: 0 -10px 24px rgba(24, 33, 47, .08);
    }

    .status-overview-header {
        align-items: stretch;
        display: grid;
    }

    .status-summary {
        justify-self: start;
    }

    .actions {
        align-items: stretch;
    }

    .actions > * {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .auth-card {
        padding: 20px;
    }

    .auth-logo {
        width: min(190px, 78%);
    }

    .auth-car {
        width: min(205px, 82%);
    }

    .sidebar {
        padding: 10px 58px 10px 10px;
    }

    .account {
        width: 100%;
        margin-left: 0;
    }

    .manual-grid,
    .manual-checks,
    .video-grid,
    .curated-video-grid {
        grid-template-columns: 1fr;
    }

    .inline-form input,
    .inline-form select,
    .inline-form button,
    .create-user-form button,
    .account-password-form button,
    .smtp-settings-form button,
    .mechanic-settings-form button,
    .youtube-settings-form button,
    .video-search button,
    .video-add-form button,
    .video-modal-actions .button,
    .permission-dropdown {
        width: 100%;
    }

    .video-modal {
        padding: 12px;
    }

    .video-modal-header,
    .video-modal-actions {
        display: grid;
    }

    .viewer-toolbar {
        align-items: stretch;
        display: grid;
    }
}
