/*
 * MIW OMS shell (2026-11 redesign). Loaded last, after miw-admin-theme.css and miw-control-room.css.
 *
 * Colours come only from the --mcr-* tokens in miw-control-room.css (MIW pink on graphite, dark by default),
 * so this file adds layout, density and device behaviour, never a new palette:
 *   1. Tokens for spacing, type and the phone dock
 *   2. Full-width page frame (data uses the whole screen) and sticky top bar
 *   3. Section tabs with sprite icons (public/images/miw-sprite.svg)
 *   4. Dense data: stats, tables, sticky headers, tabular numbers
 *   5. Phones: bottom dock, stacked table cards, 16px inputs, safe areas
 *   6. Touch screens: 44px targets
 *   7. Large screens: more columns, never wasted width
 *   8. Motion and print
 */

/* ---------- 1. Tokens ---------- */

:root {
    --mcr-space-1: 0.25rem;
    --mcr-space-2: 0.5rem;
    --mcr-space-3: 0.75rem;
    --mcr-space-4: 1rem;
    --mcr-space-6: 1.5rem;
    --mcr-gutter: 1rem;
    --mcr-topbar-h: 3.5rem;
    --mcr-dock-h: 4rem;
    --mcr-safe-bottom: env(safe-area-inset-bottom, 0px);
    --mcr-safe-left: env(safe-area-inset-left, 0px);
    --mcr-safe-right: env(safe-area-inset-right, 0px);
    --mcr-row-hover: var(--mcr-accent-soft);
    --mcr-ease: cubic-bezier(0.2, 0, 0, 1);
    --mcr-on-accent: white;
}

@media (min-width: 768px) {
    :root {
        --mcr-gutter: 1.25rem;
    }
}

@media (min-width: 1280px) {
    :root {
        --mcr-gutter: 1.5rem;
    }
}

.mcr-icon {
    display: inline-block;
    flex: none;
    width: 1.15rem;
    height: 1.15rem;
    vertical-align: middle;
}

/* ---------- 2. Page frame ---------- */

html:root .fi-main {
    max-width: none !important;
    padding-inline: calc(var(--mcr-gutter) + var(--mcr-safe-left)) calc(var(--mcr-gutter) + var(--mcr-safe-right)) !important;
}

html:root .fi-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
}

html:root .fi-topbar nav {
    min-height: var(--mcr-topbar-h);
}

html:root .fi-header {
    gap: var(--mcr-space-3);
}

html:root .fi-header-heading {
    font-size: clamp(1.35rem, 1.1rem + 0.9vw, 1.85rem) !important;
    line-height: 1.15;
}

html:root .fi-header-subheading {
    color: var(--mcr-muted) !important;
    max-width: 72ch;
}

html:root .fi-page-header-main-ctn,
html:root .fi-page-main {
    row-gap: var(--mcr-space-6);
}

/* The page body always spans the content width, even when its content is narrow. */
html:root .fi-page-header-main-ctn > .fi-page-main {
    width: 100%;
}

html:root .fi-breadcrumbs {
    font-family: var(--mcr-font-mono);
    font-size: 0.72rem;
}

/* Sidebar: denser list, clear current page, quiet scrollbar. */
html:root .fi-sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: var(--mcr-border-strong) transparent;
}

html:root .fi-sidebar-item-btn {
    min-height: 2.25rem;
    border-radius: var(--mcr-radius-s) !important;
}

html:root .fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background: var(--mcr-accent-soft) !important;
    box-shadow: inset 2px 0 0 var(--mcr-accent);
}

html:root .fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-label,
html:root .fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-icon {
    color: var(--mcr-accent-text) !important;
}

/* Brand name stays on one line beside the sidebar toggle. */
html:root .fi-topbar .fi-logo {
    white-space: nowrap;
}

/* ---------- 3. Section tabs ---------- */

.mcr-section-tab {
    gap: 0.45rem;
}

.mcr-section-tab .mcr-icon {
    width: 1.05rem;
    height: 1.05rem;
    color: var(--mcr-quiet);
}

.mcr-section-tab:hover .mcr-icon,
.mcr-section-tab[aria-current="page"] .mcr-icon {
    color: currentColor;
}

/* Laptops: keep every section visible by tightening the tabs before they scroll. */
@media (min-width: 1024px) and (max-width: 1535.98px) {
    html:root .fi-topbar nav.mcr-section-tabs {
        margin-inline-start: 0.75rem;
    }

    .mcr-section-tab {
        padding: 0 0.55rem;
        font-size: 0.82rem;
    }
}

/* ---------- 4. Dense data ---------- */

/* Stat cards fill the row: as many as fit, never fewer than 13rem wide. */
html:root .fi-wi-stats-overview-stats-ctn {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)) !important;
    gap: var(--mcr-space-3) !important;
}

html:root .fi-wi-stats-overview-stat {
    padding: var(--mcr-space-4) !important;
}

html:root .fi-wi-stats-overview-stat-value {
    font-family: var(--mcr-font-display);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

html:root .fi-wi-stats-overview-stat-label {
    color: var(--mcr-muted) !important;
}

/* Widgets: share the row on wide screens. */
html:root .fi-wi {
    gap: var(--mcr-gutter) !important;
}

/* Tables: header row stays in view while scrolling a long list inside its card. */
html:root .fi-ta-content,
html:root .fi-ta-table-ctn {
    scrollbar-width: thin;
    scrollbar-color: var(--mcr-border-strong) transparent;
}

html:root .fi-ta-header-cell {
    color: var(--mcr-muted) !important;
    font-family: var(--mcr-font-mono);
    font-size: 0.7rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

html:root .fi-ta-header-cell .fi-ta-header-cell-sort-btn {
    font: inherit;
    letter-spacing: inherit;
}

html:root .fi-ta-row {
    transition: background-color 120ms var(--mcr-ease);
}

html:root .fi-ta-row:hover > td,
html:root .fi-ta-row.fi-clickable:hover > td {
    background: var(--mcr-row-hover) !important;
}

html:root .fi-ta-cell {
    font-variant-numeric: tabular-nums;
}

/* Desktop density: more rows on screen (Filament's default row is ~3rem tall). */
@media (min-width: 640px) {
    html:root .fi-ta-cell .fi-ta-text,
    html:root .fi-ta-cell .fi-ta-icon,
    html:root .fi-ta-cell .fi-ta-image,
    html:root .fi-ta-cell .fi-ta-color,
    html:root .fi-ta-cell .fi-ta-checkbox,
    html:root .fi-ta-cell .fi-ta-toggle {
        padding-block: 0.5rem !important;
    }

    html:root .fi-ta-header-cell {
        padding-block: 0.6rem !important;
    }
}

html:root .fi-ta-header-toolbar {
    gap: var(--mcr-space-3);
}

html:root .fi-ta-search-field {
    min-width: min(100%, 16rem);
}

/* Badges read as status chips: monospace, compact, never wrapping mid-label. */
html:root .fi-badge {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Sections and cards: one radius, one border, a bit more breathing room in the header. */
html:root .fi-section-header {
    padding-block: var(--mcr-space-3) !important;
}

html:root .fi-section-header-heading {
    font-family: var(--mcr-font-display);
    font-weight: 600 !important;
}

/* Long code-like values (SKUs, order numbers, file names) wrap instead of pushing the layout wide. */
html:root .fi-main code,
html:root .fi-main .font-mono {
    overflow-wrap: anywhere;
}

/* ---------- 5. Phones ---------- */

.mcr-dock {
    display: none;
}

@media (max-width: 767.98px) {
    .mcr-dock {
        position: fixed;
        inset: auto 0 0 0;
        z-index: 35;
        display: grid;
        grid-auto-columns: minmax(0, 1fr);
        grid-auto-flow: column;
        align-items: stretch;
        min-height: var(--mcr-dock-h);
        padding: 0.25rem calc(0.25rem + var(--mcr-safe-right)) calc(0.25rem + var(--mcr-safe-bottom)) calc(0.25rem + var(--mcr-safe-left));
        border-top: 1px solid var(--mcr-border);
        background: color-mix(in srgb, var(--mcr-sidebar) 92%, transparent);
        -webkit-backdrop-filter: saturate(1.4) blur(12px);
        backdrop-filter: saturate(1.4) blur(12px);
    }

    .mcr-dock-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        min-width: 0;
        min-height: 3.25rem;
        padding: 0.25rem 0.15rem;
        border: 0;
        border-radius: var(--mcr-radius-m);
        background: transparent;
        color: var(--mcr-muted);
        font: 500 0.68rem/1.1 var(--mcr-font-display, inherit);
        text-decoration: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .mcr-dock-item span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mcr-dock-item .mcr-icon {
        width: 1.4rem;
        height: 1.4rem;
    }

    .mcr-dock-item[aria-current="page"] {
        color: var(--mcr-accent-text);
        font-weight: 600;
    }

    .mcr-dock-item[aria-current="page"] .mcr-icon {
        filter: drop-shadow(0 0 6px var(--mcr-accent-soft));
    }

    .mcr-dock-item:active {
        background: var(--mcr-raised);
    }

    .mcr-dock-item:focus-visible {
        outline: 2px solid var(--mcr-focus);
        outline-offset: -2px;
    }

    /* Content and toasts clear the dock. */
    html:root .fi-main-ctn {
        padding-bottom: calc(var(--mcr-dock-h) + var(--mcr-safe-bottom) + 0.75rem);
    }

    html:root .fi-no {
        bottom: calc(var(--mcr-dock-h) + var(--mcr-safe-bottom)) !important;
    }

    /* The dock already switches sections, so the top-bar dropdown would repeat it. */
    html:root .fi-topbar .mcr-section-select {
        display: none !important;
    }

    /* The open sidebar drawer sits above the dock. */
    html:root .fi-sidebar.fi-sidebar-open {
        z-index: 40;
    }

    html:root .fi-header {
        flex-wrap: wrap;
    }

    html:root .fi-header .fi-ac {
        width: 100%;
        flex-wrap: wrap;
    }

    /* iOS zooms into inputs under 16px; keep them at 16px on phones. */
    html:root .fi-input,
    html:root .fi-select-input,
    html:root .fi-main select,
    html:root .fi-main textarea,
    html:root .fi-main input:not([type="checkbox"]):not([type="radio"]) {
        font-size: 16px !important;
    }

    html:root .fi-modal-window {
        max-height: calc(100dvh - 1rem);
    }
}

/* Stacked tables (Filament stackedOnMobile, on for every table): each row becomes a card. */
@media (max-width: 639.98px) {
    html:root .fi-main table.fi-ta-table-stacked-on-mobile {
        width: 100% !important;
        min-width: 0 !important;
    }

    html:root .fi-ta-table-stacked-on-mobile > tbody > tr.fi-ta-row {
        margin: 0.5rem;
        padding: 0.5rem 0.25rem;
        border: 1px solid var(--mcr-border);
        border-radius: var(--mcr-radius-m);
        background: var(--mcr-surface);
    }

    html:root .fi-ta-table-stacked-on-mobile > tbody > tr.fi-ta-row:hover > td {
        background: transparent !important;
    }

    html:root .fi-ta-table-stacked-on-mobile .fi-ta-cell-label {
        color: var(--mcr-quiet);
        font-family: var(--mcr-font-mono);
        font-size: 0.68rem;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    /* Two fields per line inside each card, so a row reads at a glance instead of a long scroll. */
    html:root .fi-ta-table-stacked-on-mobile > tbody > tr.fi-ta-row {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.15rem 0.75rem;
    }

    html:root .fi-ta-table-stacked-on-mobile > tbody > tr.fi-ta-row > td {
        display: block;
        min-width: 0;
        padding: 0.3rem 0.5rem !important;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    html:root .fi-ta-table-stacked-on-mobile > tbody > tr.fi-ta-row > td:first-child,
    html:root .fi-ta-table-stacked-on-mobile > tbody > tr.fi-ta-row > td.fi-ta-actions-cell,
    html:root .fi-ta-table-stacked-on-mobile > tbody > tr.fi-ta-row > td[colspan] {
        grid-column: 1 / -1;
    }

    html:root .fi-ta-table-stacked-on-mobile > tbody > tr.fi-ta-row > td:first-child {
        font-weight: 600;
    }

    html:root .fi-ta-table-stacked-on-mobile > tbody > tr.fi-ta-row > td .fi-ta-cell-content,
    html:root .fi-ta-table-stacked-on-mobile > tbody > tr.fi-ta-row > td .fi-ta-text,
    html:root .fi-ta-table-stacked-on-mobile > tbody > tr.fi-ta-row > td .fi-ta-icon {
        padding: 0 !important;
    }

    html:root .fi-ta-table-stacked-on-mobile .fi-ta-cell-label {
        margin-bottom: 0.1rem;
    }

    html:root .fi-resource-print-log-orders .fi-ta-table.fi-ta-table-stacked-on-mobile {
        min-width: 0;
    }

    /* Report tables enhanced by miw-responsive-reports.js stay full width too. */
    html:root .fi-main table.miw-responsive-table {
        width: 100% !important;
        min-width: 0 !important;
    }
}

/* ---------- 6. Touch screens ---------- */

@media (pointer: coarse) {
    html:root .fi-btn,
    html:root .fi-icon-btn,
    html:root .fi-sidebar-item-btn,
    html:root .fi-dropdown-list-item,
    html:root .fi-tabs-item,
    html:root .fi-pagination-item-btn,
    html:root .mcr-section-tab {
        min-height: 44px;
    }

    html:root .fi-icon-btn {
        min-width: 44px;
    }

    html:root .fi-checkbox-input,
    html:root .fi-radio-input {
        width: 1.25rem;
        height: 1.25rem;
    }

    html:root .fi-ta-row:hover > td {
        background: inherit !important;
    }
}

/* ---------- 7. Large screens ---------- */

@media (min-width: 1600px) {
    html:root .fi-wi-stats-overview-stats-ctn {
        grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)) !important;
    }

    .mcr-panel {
        padding: 1.15rem 1.25rem;
    }
}

@media (min-width: 1920px) {
    html:root .fi-ta-cell,
    html:root .fi-ta-header-cell {
        padding-block: 0.55rem !important;
    }
}

/* ---------- 8. Motion and print ---------- */

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

@media print {
    .mcr-dock,
    html:root .fi-topbar,
    html:root .fi-sidebar {
        display: none !important;
    }

    html:root .fi-main {
        padding: 0 !important;
    }
}

/* ---------- 9. Sections in the menu drawer ---------- */

.mcr-drawer-sections {
    display: none;
}

@media (max-width: 1023.98px) {
    .mcr-drawer-sections {
        display: grid;
        gap: 0.5rem;
        margin: 0 0 1rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--mcr-border);
    }

    .mcr-drawer-sections-label {
        margin: 0;
        color: var(--mcr-quiet);
        font-family: var(--mcr-font-mono);
        font-size: 0.7rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .mcr-drawer-sections-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .mcr-drawer-section {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        min-height: 3rem;
        padding: 0.5rem 0.75rem;
        border: 1px solid var(--mcr-border);
        border-radius: var(--mcr-radius-m);
        background: var(--mcr-raised);
        color: var(--mcr-text);
        font-weight: 600;
        font-size: 0.9rem;
        text-decoration: none;
    }

    .mcr-drawer-section .mcr-icon {
        width: 1.25rem;
        height: 1.25rem;
        color: var(--mcr-muted);
    }

    .mcr-drawer-section[aria-current="page"] {
        border-color: var(--mcr-accent);
        background: var(--mcr-accent-soft);
        color: var(--mcr-accent-text);
    }

    .mcr-drawer-section[aria-current="page"] .mcr-icon {
        color: currentColor;
    }

    .mcr-drawer-section:focus-visible {
        outline: 2px solid var(--mcr-focus);
        outline-offset: 2px;
    }

    /* The drawer scrolls above the dock on phones. */
    html:root .fi-sidebar.fi-sidebar-open .fi-sidebar-nav {
        padding-bottom: calc(var(--mcr-dock-h) + var(--mcr-safe-bottom) + 1rem);
    }
}

/* ---------- 10. Entry tabs (pages that share one menu item) ---------- */

.mcr-entry-tabs {
    display: flex;
    gap: 0.25rem;
    margin: 1rem 0 0;
    padding: 0.25rem;
    overflow-x: auto;
    border: 1px solid var(--mcr-border);
    border-radius: var(--mcr-radius-m);
    background: var(--mcr-surface);
    scrollbar-width: none;
}

.mcr-entry-tabs::-webkit-scrollbar {
    display: none;
}

.mcr-entry-tab {
    display: inline-flex;
    flex: none;
    align-items: center;
    min-height: 2.25rem;
    padding: 0 0.9rem;
    border-radius: var(--mcr-radius-s);
    color: var(--mcr-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.mcr-entry-tab:hover {
    background: var(--mcr-raised);
    color: var(--mcr-text);
}

.mcr-entry-tab[aria-current="page"] {
    background: var(--mcr-accent);
    color: var(--mcr-on-accent);
    font-weight: 600;
}

.mcr-entry-tab:focus-visible {
    outline: 2px solid var(--mcr-focus);
    outline-offset: 2px;
}

@media (pointer: coarse) {
    .mcr-entry-tab {
        min-height: 44px;
    }
}

/* ---------- 11. All pages ---------- */

.mcr-all-pages {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
    gap: var(--mcr-gutter);
}

.mcr-all-pages-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mcr-all-pages-list {
    display: grid;
    gap: 0.15rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mcr-all-pages-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 2.5rem;
    padding: 0.35rem 0.6rem;
    border-radius: var(--mcr-radius-s);
    color: var(--mcr-text);
    font-size: 0.9rem;
    text-decoration: none;
}

.mcr-all-pages-list a:hover {
    background: var(--mcr-raised);
}

.mcr-all-pages-list small {
    flex: none;
    color: var(--mcr-quiet);
    font-family: var(--mcr-font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ------------------------------------------------------------------
   Page polish: every page shares one header, table and empty-state look.
   ------------------------------------------------------------------ */

/* Header: heading on the left, actions on the right, on one line where it fits. */
html:root .fi-header {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
}

html:root .fi-header > div:first-child {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: var(--mcr-space-3);
    align-items: center;
    min-width: 0;
}

html:root .fi-header > div:first-child > :not(.miw-page-icon) {
    grid-column: 2;
}

html:root .fi-header-actions-ctn {
    margin-inline-start: auto;
}

html:root .fi-header-actions-ctn .fi-ac {
    justify-content: flex-end;
}

/* The menu entry's icon, in a tinted tile beside the heading. */
html:root .miw-page-icon {
    grid-column: 1;
    grid-row: 1 / span 3;
    display: inline-grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--mcr-radius-m);
    background: var(--mcr-accent-soft);
    color: var(--mcr-accent-text);
    box-shadow: inset 0 0 0 1px var(--mcr-border);
}

html:root .miw-page-icon svg {
    width: 1.4rem;
    height: 1.4rem;
}

/* A list page's "Section > List" trail repeats the heading, so lists drop it; record pages keep theirs. */
html:root .fi-resource-list-records-page .fi-breadcrumbs {
    display: none;
}

/* Tables: a raised card with a tinted header row and a clear first column. */
html:root .fi-ta-ctn {
    border-radius: var(--mcr-radius-m) !important;
    overflow: hidden;
}

html:root .fi-ta-table > thead > tr {
    background: var(--mcr-panel-soft);
}

html:root .fi-ta-table > thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

html:root .fi-ta-row > td.fi-ta-cell:not(.fi-ta-selection-cell):first-of-type .fi-ta-text-item,
html:root .fi-ta-row > td.fi-ta-selection-cell + td.fi-ta-cell .fi-ta-text-item {
    font-weight: 600;
    color: var(--mcr-text);
}

html:root .fi-ta-row:hover > td:first-child {
    box-shadow: inset 3px 0 0 var(--mcr-accent);
}

/* Empty states: an accent tile and a friendlier, centred message. */
html:root .fi-ta-empty-state {
    padding-block: var(--mcr-space-6) !important;
}

html:root .fi-ta-empty-state-icon-bg {
    background: var(--mcr-accent-soft) !important;
    color: var(--mcr-accent-text) !important;
    border-radius: var(--mcr-radius-m) !important;
    width: 3.5rem;
    height: 3.5rem;
}

html:root .fi-ta-empty-state-heading {
    font-family: var(--mcr-font-display);
    font-size: 1.15rem !important;
}

html:root .fi-ta-empty-state-description {
    color: var(--mcr-muted) !important;
    max-width: 48ch;
    margin-inline: auto;
}

/* Section cards on record and settings pages match the dashboard cards. */
html:root .fi-section:not(.fi-section-not-contained) {
    border-radius: var(--mcr-radius-m) !important;
}

html:root .fi-section-header-heading {
    font-family: var(--mcr-font-display);
}

@media (max-width: 639px) {
    html:root .miw-page-icon {
        width: 2.25rem;
        height: 2.25rem;
    }

    html:root .miw-page-icon svg {
        width: 1.15rem;
        height: 1.15rem;
    }

    html:root .fi-header-actions-ctn {
        margin-inline-start: 0;
        width: 100%;
    }

    html:root .fi-header-actions-ctn .fi-ac {
        justify-content: flex-start;
    }
}

/* Some resources title their lists with a lower-case plural ("billing statements"); headings always start with a capital. */
html:root .fi-header-heading::first-letter {
    text-transform: uppercase;
}

/* Columns marked visibleFrom() stay hidden below their breakpoint, also in the stacked phone cards. */
@media (max-width: 767px) {
    html:root .fi-ta-cell.md\:fi-visible,
    html:root .fi-ta-header-cell.md\:fi-visible {
        display: none !important;
    }
}

@media (max-width: 1023px) {
    html:root .fi-ta-cell.lg\:fi-visible,
    html:root .fi-ta-header-cell.lg\:fi-visible {
        display: none !important;
    }
}

/* ------------------------------------------------------------------
   TV dashboards: one card per screen, a link per site.
   ------------------------------------------------------------------ */
html:root .miw-tv {
    display: grid;
    gap: var(--mcr-gutter);
}

html:root .miw-tv-access {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--mcr-space-3);
    padding: var(--mcr-space-4);
    border-radius: var(--mcr-radius-m);
    background: var(--mcr-tone-soft);
    box-shadow: inset 3px 0 0 var(--mcr-tone), inset 0 0 0 1px var(--mcr-border);
}

html:root .miw-tv-access strong {
    font-family: var(--mcr-font-display);
    font-size: 1.05rem;
    margin-inline-end: var(--mcr-space-2);
}

html:root .miw-tv-access p {
    margin-top: var(--mcr-space-1);
    color: var(--mcr-muted);
    max-width: 72ch;
}

html:root .miw-tv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    gap: var(--mcr-gutter);
}

html:root .miw-tv-card {
    display: flex;
    flex-direction: column;
    gap: var(--mcr-space-3);
    padding: var(--mcr-space-4);
    border-radius: var(--mcr-radius-m);
    background: var(--mcr-panel);
    box-shadow: inset 0 0 0 1px var(--mcr-border);
}

html:root .miw-tv-card header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--mcr-space-3);
    align-items: start;
}

html:root .miw-tv-card h2 {
    font-family: var(--mcr-font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--mcr-text);
}

html:root .miw-tv-card header p {
    color: var(--mcr-muted);
    font-size: 0.875rem;
    margin-top: 0.15rem;
}

html:root .miw-tv-icon {
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--mcr-radius-m);
    background: var(--mcr-accent-soft);
    color: var(--mcr-accent-text);
}

html:root .miw-tv-icon svg {
    width: 1.3rem;
    height: 1.3rem;
}

html:root .miw-tv-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--mcr-space-2);
}

html:root .miw-tv-sites {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: var(--mcr-space-2);
    margin-top: auto;
}

html:root .miw-tv-site {
    display: flex;
    border-radius: var(--mcr-radius-s);
    box-shadow: inset 0 0 0 1px var(--mcr-border-strong);
    overflow: hidden;
}

html:root .miw-tv-open {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--mcr-space-2);
    min-height: 2.5rem;
    padding: 0 var(--mcr-space-3);
    font-weight: 600;
    color: var(--mcr-text);
    white-space: nowrap;
}

html:root .miw-tv-open img {
    width: 1.1rem;
    height: auto;
    border-radius: 2px;
}

html:root .miw-tv-open-hint {
    margin-inline-start: auto;
    color: var(--mcr-accent-text);
    font-size: 0.75rem;
}

html:root .miw-tv-open:hover,
html:root .miw-tv-copy:hover {
    background: var(--mcr-row-hover);
}

html:root .miw-tv-copy {
    padding: 0 var(--mcr-space-3);
    border-inline-start: 1px solid var(--mcr-border-strong);
    color: var(--mcr-muted);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

html:root .miw-tv-btn {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0 var(--mcr-space-4);
    border-radius: var(--mcr-radius-s);
    background: var(--mcr-accent);
    color: var(--mcr-on-accent);
    font-weight: 600;
}
