:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --text: #142033;
    --muted: #667085;
    --border: #d8dee9;
    --primary: #2563eb;
    --primary-text: #ffffff;
    --danger: #dc2626;
    --shadow: 0 16px 40px rgba(15, 23, 42, 0.10);
    --radius: 18px;
}

html[data-theme="dark"] {
    --bg: #0b1120;
    --panel: #121a2b;
    --text: #f8fafc;
    --muted: #9ca3af;
    --border: #253047;
    --primary: #60a5fa;
    --primary-text: #07111f;
    --danger: #f87171;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; text-decoration: none; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.brand {
    font-weight: 800;
    letter-spacing: 0.02em;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.nav a,
.theme-toggle,
.btn {
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.nav a:hover,
.btn:hover,
.theme-toggle:hover { border-color: var(--primary); }

.theme-toggle {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
}

.page {
    width: min(1180px, calc(100% - 24px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}

.login-card { width: min(430px, 100%); }

.section-head {
    text-align: center;
    margin: 16px 0 22px;
}

h1, h2 { margin: 0 0 12px; }

.muted { color: var(--muted); margin-top: 0; }

.form-grid {
    display: grid;
    gap: 10px;
    width: fit-content;
    max-width: 100%;
    min-width: min(100%, 390px);
    margin: 0 auto 22px;
}

label {
    font-weight: 800;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

textarea { min-height: 110px; resize: vertical; }

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.check-row input { width: auto; }

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
}

.btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-text);
}

.btn.small { padding: 8px 12px; min-height: 36px; }

.stat-grid,
.action-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 22px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card span { font-size: clamp(2rem, 8vw, 3.5rem); font-weight: 900; }
.stat-card small { color: var(--muted); font-weight: 800; }
.stat-card.danger span { color: var(--danger); }

.table-card,
.asset-list { margin-top: 18px; }
.table-scroll { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 11px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th { color: var(--muted); font-size: 0.9rem; }

.filter-bar {
    display: flex;
    justify-content: center;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.asset-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    gap: 14px;
}

.asset-card h2 { text-align: center; }

.detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 9px 14px;
}

.detail-grid span { color: var(--muted); font-weight: 800; }
.detail-grid strong { overflow-wrap: anywhere; }

.flash-wrap { display: grid; gap: 10px; margin-bottom: 16px; }
.flash {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--panel);
    font-weight: 700;
}
.flash.success { border-color: #22c55e; }
.flash.error { border-color: var(--danger); color: var(--danger); }

@media (max-width: 760px) {
    .topbar {
        grid-template-columns: 1fr auto;
    }
    .brand { grid-column: 1 / 2; }
    .theme-toggle { grid-column: 2 / 3; grid-row: 1; justify-self: end; }
    .nav {
        grid-column: 1 / -1;
        justify-content: center;
    }
    .nav a { padding: 9px 11px; font-size: 0.92rem; }
    .stat-grid,
    .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-bar { align-items: stretch; }
    .filter-bar > * { width: 100%; }
}

@media (max-width: 430px) {
    .page { width: min(100% - 16px, 1180px); padding-top: 16px; }
    .stat-grid,
    .action-grid { grid-template-columns: 1fr; }
    .card { padding: 14px; }
    .detail-grid { grid-template-columns: 1fr; }
}

.hidden {
    display: none !important;
}

.quick-add-card {
    grid-column: 1 / -1;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--panel) 86%, var(--accent));
}

.quick-add-card h3 {
    margin: 0 0 12px;
    text-align: center;
}

.quick-add-message {
    min-height: 1.4em;
    margin-bottom: 10px;
    color: var(--muted);
    text-align: center;
    font-weight: 700;
}

.compact-grid {
    margin-top: 0;
}

.btn.secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

/* --- master page pattern patch --- */

.form-grid{
    width:100%;
    max-width:760px;
    min-width:unset;
    margin:0 auto 18px;
    gap:18px;
}

.form-section{
    width:100%;
}

.form-section h3{
    margin:0 0 10px;
}

.form-section label{
    display:block;
    margin:10px 0 6px;
}

.form-actions{
    text-align:center;
    margin-top:10px;
}

/* stacked record cards */
.record-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(320px,1fr));
    gap:16px;
    margin-top:12px;
}

.record-card{
    background:var(--bg);
    border:1px solid var(--border);
    border-radius:16px;
    padding:16px;
}

.record-header{
    margin-bottom:10px;
    padding-bottom:8px;
    border-bottom:1px solid var(--border);
}

.record-header h3{
    margin:0;
    text-align:center;
}

.record-section{
    margin-top:14px;
}

.record-section h4{
    margin:0 0 6px;
}

.record-section p{
    margin:4px 0;
}

.record-section a{
    color:var(--primary);
    font-weight:700;
}

/* mobile tighten */
@media (max-width:760px){

    .form-grid{
        max-width:100%;
        gap:14px;
    }

    .record-grid{
        grid-template-columns:1fr;
    }

}

/* --- customer form compact desktop layout --- */

@media (min-width: 761px){

    .form-grid{
        max-width: 980px;
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }

    .form-section:first-child,
    .form-section:last-of-type,
    .form-actions{
        grid-column: 1 / -1;
    }

    .form-section:first-child{
        max-width: 760px;
        margin: 0 auto;
        width: 100%;
    }

    .form-actions{
        text-align: center;
    }

}

/* --- desktop density tighten --- */

@media (min-width: 761px){

    .page{
        width:min(1380px, calc(100% - 32px));
        padding:18px 0 32px;
    }

    .page-header,
    .section-head{
        margin:8px 0 14px;
    }

    .page-header h1,
    .section-head h1{
        margin-bottom:6px;
    }

    .card{
        padding:16px 18px;
    }

    h1{
        font-size:1.8rem;
    }

    h2{
        font-size:1.35rem;
        margin-bottom:10px;
    }

    h3{
        font-size:1.05rem;
        margin-bottom:8px;
    }

    label{
        font-size:0.9rem;
    }

    input,
    select,
    textarea{
        padding:9px 12px;
        border-radius:12px;
        min-height:38px;
    }

    textarea{
        min-height:82px;
    }

    .form-grid{
        max-width:1120px;
        gap:12px 18px;
        margin-bottom:12px;
    }

    .form-section label{
        margin:6px 0 4px;
    }

    .form-section h3{
        margin:0 0 6px;
    }

    .form-actions{
        margin-top:4px;
    }

    .btn{
        min-height:38px;
        padding:9px 14px;
    }

    .record-grid{
        gap:12px;
    }

    .record-card{
        padding:12px;
    }

    .record-section{
        margin-top:10px;
    }
}

/* --- final density trim --- */

@media (min-width:761px){

    .page{
        width:min(1460px, calc(100% - 24px));
    }

    .card{
        padding:14px 16px;
    }

    .form-grid{
        max-width:1180px;
        gap:10px 14px;
    }

    input,
    select,
    textarea{
        min-height:34px;
        padding:7px 10px;
        font-size:0.95rem;
    }

    textarea{
        min-height:72px;
    }

    label{
        margin-bottom:2px;
        font-size:0.88rem;
    }

    h1{
        font-size:1.65rem;
    }

    h2{
        font-size:1.25rem;
    }

    h3{
        font-size:1rem;
    }

    .btn{
        min-height:34px;
        padding:7px 12px;
        font-size:0.92rem;
    }

}

.asset-link-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:34px;
    padding:7px 16px;
    border-radius:999px;
    border:1px solid var(--primary);
    background:var(--primary);
    color:var(--primary-text);
    text-decoration:none;
    font-weight:800;
    line-height:1;
}

.asset-link-btn:hover{
    filter:brightness(1.08);
    transform:translateY(-1px);
}

/* force asset type names to look clickable */
table a.asset-link-btn,
.asset-link-btn{
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    min-height:34px !important;
    padding:8px 18px !important;
    border-radius:999px !important;
    border:1px solid var(--primary) !important;
    background:var(--primary) !important;
    color:var(--primary-text) !important;
    font-weight:900 !important;
    text-decoration:none !important;
    line-height:1 !important;
    box-shadow:0 4px 14px rgba(96,165,250,.22) !important;
}

table a.asset-link-btn:hover,
.asset-link-btn:hover{
    filter:brightness(1.08) !important;
    transform:translateY(-1px) !important;
}

/* --- shared UI polish layer: spacing, hierarchy, actions, hover only --- */

.card + .card {
    margin-top: 18px;
}

.card h2,
.card h3 {
    letter-spacing: 0.01em;
}

.form-section {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--panel) 92%, var(--bg));
}

.form-section h3,
.record-section h4 {
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.stat-card span,
.metric-value,
.stat-number {
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: 900;
    line-height: 1.05;
}

.stat-card small,
.metric-label,
.stat-label {
    color: var(--muted);
    font-weight: 800;
    letter-spacing: 0.01em;
}

.nav a,
.btn,
.theme-toggle,
.asset-link-btn {
    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        color 0.18s ease,
        filter 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.nav a:hover,
.nav a:focus-visible {
    background: color-mix(in srgb, var(--primary) 8%, var(--panel));
}

.btn:hover,
.btn:focus-visible,
.theme-toggle:hover,
.theme-toggle:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.10);
}

@media (hover:hover) {
    .card,
    .stat-card,
    .record-card {
        transition:
            transform 0.18s ease,
            box-shadow 0.18s ease,
            border-color 0.18s ease;
    }

    .card:hover,
    .stat-card:hover,
    .record-card:hover {
        transform: translateY(-2px);
        border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
        box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
    }
}

tbody tr {
    transition: background 0.18s ease;
}

tbody tr:hover {
    background: color-mix(in srgb, var(--primary) 5%, transparent);
}

td[data-label="Actions"] {
    white-space: nowrap;
}

td[data-label="Actions"] .btn,
td[data-label="Actions"] form {
    margin-right: 6px;
    margin-top: 2px;
    margin-bottom: 2px;
}

td[data-label="Actions"] .btn:last-child,
td[data-label="Actions"] form:last-child {
    margin-right: 0;
}

table a:not(.btn):not(.asset-link-btn),
.record-section a:not(.btn):not(.asset-link-btn) {
    color: var(--primary);
    font-weight: 700;
}

.flash {
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

@media (max-width: 760px) {
    .form-section {
        padding: 10px;
    }

    td[data-label="Actions"] {
        white-space: normal;
    }

    td[data-label="Actions"] .btn,
    td[data-label="Actions"] form {
        display: inline-flex;
        margin-bottom: 6px;
    }
}


/* --- desktop detail label/value gap tighten --- */
@media (min-width: 761px) {
    .detail-grid {
        grid-template-columns: max-content 1fr;
        column-gap: 6px;
        row-gap: 6px;
        align-items: start;
    }

    .detail-grid span,
    .detail-grid strong {
        margin: 0;
        padding: 0;
    }

    .detail-grid span {
        white-space: nowrap;
    }
}

/* --- mobile-first renderer split and bottom navigation --- */

.mobile-renderer {
    display: block;
}

.desktop-renderer {
    display: none;
}

.mobile-topbar {
    display: grid;
    grid-template-columns: 1fr auto;
}

.mobile-topbar .brand {
    grid-column: auto;
}

.mobile-topbar .theme-toggle {
    grid-column: auto;
    grid-row: auto;
    justify-self: end;
}

.has-mobile-nav .page {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    border-top: 1px solid var(--border);
    box-shadow: 0 -12px 34px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(12px);
}

.mobile-bottom-nav a {
    flex: 0 0 auto;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 800;
    white-space: nowrap;
}

.mobile-bottom-nav a:hover,
.mobile-bottom-nav a:focus-visible {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, var(--panel));
}

@media screen and (max-width: 767px) {
    .page {
        width: min(100% - 16px, 1180px);
        padding-top: 16px;
    }

    .card,
    .stat-card,
    .record-card,
    .form-section {
        border-radius: 14px;
    }

    .stat-grid,
    .action-grid,
    .record-grid,
    .asset-list,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        max-width: 100%;
        gap: 14px;
    }

    .filter-bar {
        align-items: stretch;
    }

    .filter-bar > * {
        width: 100%;
    }

    .table-scroll {
        overflow-x: visible;
    }

    .table-scroll table,
    .table-scroll thead,
    .table-scroll tbody,
    .table-scroll th,
    .table-scroll td,
    .table-scroll tr {
        display: block;
    }

    .table-scroll thead {
        display: none;
    }

    .table-scroll tr {
        margin-bottom: 12px;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--bg);
    }

    .table-scroll td {
        display: grid;
        grid-template-columns: minmax(120px, 40%) 1fr;
        gap: 8px;
        padding: 8px 0;
        border-bottom: 1px solid var(--border);
        overflow-wrap: anywhere;
    }

    .table-scroll td:last-child {
        border-bottom: 0;
    }

    .table-scroll td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 900;
    }

    .table-scroll td:not([data-label])::before {
        content: "";
    }

    .table-scroll td[data-label="Actions"],
    .table-scroll td[data-label="Action"] {
        grid-template-columns: 1fr;
    }

    .table-scroll td[data-label="Actions"]::before,
    .table-scroll td[data-label="Action"]::before {
        margin-bottom: 2px;
    }
}

@media (min-width: 768px) {
    .mobile-renderer {
        display: none !important;
    }

    .desktop-renderer {
        display: grid !important;
    }

    .has-mobile-nav .page {
        padding-bottom: 32px;
    }
}

/* --- true mobile app shell --- */

@media screen and (max-width: 767px) {
    body.has-mobile-nav {
        min-height: 100dvh;
        background:
            radial-gradient(circle at top, color-mix(in srgb, var(--primary) 12%, transparent), transparent 34rem),
            var(--bg);
    }

    body.mobile-menu-open {
        overflow: hidden;
    }

    .mobile-renderer {
        display: block !important;
    }

    .desktop-renderer {
        display: none !important;
    }

    .mobile-app-header {
        position: sticky;
        top: 0;
        z-index: 40;
        display: grid !important;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 12px;
        min-height: 64px;
        padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
        background: color-mix(in srgb, var(--panel) 92%, transparent);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 10px 26px rgba(15, 23, 42, 0.10);
        backdrop-filter: blur(16px);
    }

    .mobile-app-title {
        min-width: 0;
        display: grid;
        gap: 2px;
    }

    .mobile-app-kicker {
        color: var(--muted);
        font-size: 0.74rem;
        font-weight: 900;
        letter-spacing: 0.12em;
        line-height: 1;
        text-transform: uppercase;
    }

    .mobile-app-title strong {
        overflow: hidden;
        color: var(--text);
        font-size: 1.05rem;
        line-height: 1.15;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .has-mobile-nav .page {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 14px 12px calc(94px + env(safe-area-inset-bottom));
    }

    .page > .card,
    .page > .table-card,
    .page > .asset-list,
    .page > .record-grid,
    .page > .stat-grid,
    .page > .action-grid,
    .page > .filter-bar,
    .page > .section-head,
    .page > .page-header,
    .flash-wrap {
        width: min(100%, 520px);
        margin-left: auto;
        margin-right: auto;
    }

    .section-head,
    .page-header {
        margin-top: 6px;
        margin-bottom: 14px;
        padding: 0 4px;
        text-align: left;
    }

    .section-head h1,
    .page-header h1 {
        font-size: 1.45rem;
        line-height: 1.15;
    }

    .section-head p,
    .page-header p,
    .muted {
        font-size: 0.95rem;
    }

    .card,
    .stat-card,
    .record-card,
    .form-section,
    .table-scroll tr {
        border-radius: 22px;
        box-shadow: 0 12px 30px rgba(15, 23, 42, 0.10);
    }

    .card,
    .record-card,
    .form-section {
        padding: 16px;
    }

    input,
    select,
    textarea {
        min-height: 48px;
        border-radius: 16px;
        font-size: 1rem;
    }

    textarea {
        min-height: 120px;
    }

    .btn,
    .asset-link-btn {
        min-height: 46px !important;
        border-radius: 16px !important;
        font-size: 0.98rem;
    }

    .mobile-bottom-nav {
        left: 10px;
        right: 10px;
        bottom: 10px;
        z-index: 60;
        display: grid !important;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
        overflow: visible;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
        background: color-mix(in srgb, var(--panel) 94%, transparent);
        border: 1px solid var(--border);
        border-radius: 26px;
        box-shadow: 0 -8px 34px rgba(0, 0, 0, 0.26);
        backdrop-filter: blur(18px);
    }

    .mobile-nav-item {
        width: 100%;
        min-width: 0;
        min-height: 58px;
        display: grid;
        grid-template-rows: 1fr auto;
        place-items: center;
        gap: 3px;
        padding: 7px 4px;
        border: 0;
        border-radius: 20px;
        background: transparent;
        color: var(--muted);
        font: inherit;
        font-size: 0.7rem;
        font-weight: 900;
        line-height: 1;
        text-align: center;
        cursor: pointer;
    }

    .mobile-nav-icon {
        width: 28px;
        height: 28px;
        display: grid;
        place-items: center;
        border-radius: 999px;
        color: inherit;
        font-size: 1.24rem;
        line-height: 1;
    }

    .mobile-nav-item.active {
        background: color-mix(in srgb, var(--primary) 12%, transparent);
        color: var(--primary);
    }

    .mobile-nav-primary .mobile-nav-icon {
        width: 40px;
        height: 40px;
        margin-top: -18px;
        background: var(--primary);
        color: var(--primary-text);
        box-shadow: 0 10px 22px rgba(37, 99, 235, 0.32);
        font-size: 1.45rem;
    }

    .mobile-menu-backdrop {
        position: fixed;
        inset: 0;
        z-index: 70;
        background: rgba(0, 0, 0, 0.42);
        backdrop-filter: blur(4px);
    }

    .mobile-more-menu {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(92px + env(safe-area-inset-bottom));
        z-index: 80;
        padding: 10px 12px 14px;
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: 28px;
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
    }

    .mobile-more-handle {
        width: 42px;
        height: 5px;
        margin: 0 auto 10px;
        border-radius: 999px;
        background: var(--border);
    }

    .mobile-more-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 12px;
        padding: 0 2px;
    }

    .mobile-more-head strong {
        font-size: 1.05rem;
    }

    .mobile-menu-close {
        width: 38px;
        height: 38px;
        display: grid;
        place-items: center;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: var(--bg);
        color: var(--text);
        font-size: 1.5rem;
        line-height: 1;
    }

    .mobile-more-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .mobile-more-link {
        min-height: 72px;
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
        gap: 10px;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 20px;
        background: var(--bg);
    }

    .mobile-more-link span {
        width: 36px;
        height: 36px;
        display: grid;
        place-items: center;
        border-radius: 14px;
        background: color-mix(in srgb, var(--primary) 10%, transparent);
        font-size: 1.25rem;
    }

    .mobile-more-link strong {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-more-link.active {
        border-color: var(--primary);
        background: color-mix(in srgb, var(--primary) 10%, var(--bg));
    }
}

/* --- full mobile app screen polish: content layer only --- */

@media screen and (max-width: 767px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    body.has-mobile-nav {
        -webkit-tap-highlight-color: transparent;
        overscroll-behavior-y: contain;
    }

    .page > * {
        max-width: 520px;
    }

    .page-header,
    .section-head {
        position: relative;
    }

    .page-header h1,
    .section-head h1 {
        margin-bottom: 4px;
        font-weight: 950;
        letter-spacing: -0.03em;
    }

    .page-header p,
    .section-head p,
    .muted {
        color: var(--muted);
        line-height: 1.4;
    }

    .stat-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .stat-card {
        min-height: 118px;
        align-content: center;
        padding: 16px 10px;
        text-align: center;
    }

    .stat-card span {
        font-size: clamp(2rem, 13vw, 3rem);
        letter-spacing: -0.04em;
    }

    .stat-card small {
        max-width: 100%;
        overflow: hidden;
        font-size: 0.78rem;
        text-overflow: ellipsis;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .action-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .action-grid .btn,
    .form-actions .btn,
    .record-header .btn,
    .record-section .btn,
    td[data-label="Actions"] .btn,
    td[data-label="Action"] .btn,
    td[data-label="Actions"] button,
    td[data-label="Action"] button {
        width: 100%;
    }

    .action-grid .btn {
        min-height: 56px !important;
        display: grid;
        place-items: center;
        text-align: center;
    }

    .card,
    .record-card,
    .form-section,
    .table-scroll tr {
        background: color-mix(in srgb, var(--panel) 96%, var(--bg));
        border-color: color-mix(in srgb, var(--border) 78%, transparent);
    }

    .card {
        margin-bottom: 14px;
    }

    .card h2,
    .record-header h2,
    .record-header h3,
    .form-section h3 {
        font-weight: 950;
        letter-spacing: -0.015em;
    }

    .record-header {
        margin: -2px 0 12px;
        padding-bottom: 10px;
    }

    .record-header h2,
    .record-header h3 {
        text-align: left;
    }

    .record-section {
        display: grid;
        gap: 8px;
    }

    .record-section p {
        margin: 0;
        padding: 10px 0;
        border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
        line-height: 1.45;
    }

    .record-section p:last-child {
        border-bottom: 0;
    }

    .record-section strong {
        font-weight: 900;
    }

    .form-grid {
        gap: 12px;
    }

    .form-section {
        display: grid;
        gap: 6px;
    }

    .form-section label,
    .form-grid > label {
        margin: 4px 0 0;
        font-size: 0.78rem;
        letter-spacing: 0.07em;
        text-transform: uppercase;
    }

    input,
    select,
    textarea {
        appearance: none;
        -webkit-appearance: none;
        background: color-mix(in srgb, var(--bg) 92%, var(--panel));
        border-color: color-mix(in srgb, var(--border) 86%, transparent);
    }

    input:focus,
    select:focus,
    textarea:focus {
        outline: 3px solid color-mix(in srgb, var(--primary) 24%, transparent);
        border-color: var(--primary);
    }

    input[type="date"] {
        min-height: 50px;
    }

    input[type="checkbox"] {
        width: 22px;
        height: 22px;
        min-height: 22px;
        border-radius: 7px;
    }

    .filter-bar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .filter-bar .btn,
    .filter-bar button,
    .filter-bar a {
        width: 100%;
    }

    .table-scroll tr {
        margin-bottom: 14px;
        padding: 14px;
    }

    .table-scroll td {
        grid-template-columns: 1fr;
        gap: 3px;
        padding: 10px 0;
    }

    .table-scroll td::before {
        font-size: 0.72rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    td[data-label="Actions"],
    td[data-label="Action"] {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 8px;
        padding-top: 12px;
    }

    td[data-label="Actions"] form,
    td[data-label="Action"] form {
        display: grid !important;
        width: 100%;
        margin: 0 !important;
    }

    .quick-add-card {
        border-radius: 22px;
        background: color-mix(in srgb, var(--primary) 8%, var(--panel));
    }

    .quick-add-card .form-grid {
        margin-bottom: 0;
    }

    .mobile-bottom-nav {
        touch-action: manipulation;
    }

    .mobile-nav-item:active,
    .mobile-more-link:active,
    .btn:active,
    .stat-card:active,
    .record-card:active {
        transform: scale(0.985);
    }

    .mobile-more-menu {
        max-height: min(72dvh, 560px);
        overflow-y: auto;
    }

    .mobile-more-grid {
        padding-bottom: 2px;
    }
}

@media screen and (max-width: 380px) {
    .mobile-bottom-nav {
        left: 6px;
        right: 6px;
        bottom: 6px;
        border-radius: 22px;
    }

    .mobile-nav-item {
        min-height: 54px;
        font-size: 0.66rem;
    }

    .mobile-nav-icon {
        width: 25px;
        height: 25px;
        font-size: 1.12rem;
    }

    .mobile-nav-primary .mobile-nav-icon {
        width: 36px;
        height: 36px;
    }

    .stat-grid,
    .action-grid {
        gap: 8px;
    }
}

/* --- mobile app shell: finance-style full app experience --- */
@media (max-width: 768px) {
    :root {
        --mobile-header-height: 64px;
        --mobile-nav-height: 74px;
    }

    html,
    body {
        width: 100%;
        min-height: 100%;
        overflow-x: hidden;
    }

    body.has-mobile-nav {
        padding-top: calc(var(--mobile-header-height) + env(safe-area-inset-top));
        padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
        background:
            radial-gradient(circle at top left, color-mix(in srgb, var(--primary) 12%, transparent), transparent 34rem),
            var(--bg);
    }

    .desktop-renderer {
        display: none !important;
    }

    .mobile-renderer {
        display: flex !important;
    }

    .mobile-app-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 60;
        min-height: calc(var(--mobile-header-height) + env(safe-area-inset-top));
        padding: calc(8px + env(safe-area-inset-top)) 8px 8px;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        background: color-mix(in srgb, var(--bg) 92%, transparent);
        border-bottom: 1px solid var(--border);
        backdrop-filter: blur(18px);
    }

    .mobile-app-title {
        min-width: 0;
        display: grid;
        gap: 1px;
        line-height: 1.05;
    }

    .mobile-app-kicker {
        font-size: 0.86rem;
        font-weight: 800;
        color: var(--text);
        opacity: 0.92;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-transform: lowercase;
    }

    .mobile-app-title strong {
        font-size: 1rem;
        font-weight: 900;
        color: var(--text);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-header-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mobile-header-more,
    .mobile-header-gear,
    .mobile-app-header .theme-toggle {
        min-width: 44px;
        height: 44px;
        border: 1px solid var(--border);
        background: color-mix(in srgb, var(--panel) 82%, var(--bg));
        color: var(--text);
        box-shadow: none;
    }

    .mobile-header-more {
        min-width: 68px;
        border-radius: 18px;
        padding: 0 14px;
        font-size: 1rem;
        font-weight: 900;
    }

    .mobile-header-gear,
    .mobile-app-header .theme-toggle {
        border-radius: 14px;
        display: grid;
        place-items: center;
        padding: 0;
        font-size: 1rem;
    }

    .page {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 14px 8px 18px;
    }

    .page-header,
    .section-head {
        text-align: left;
        margin: 0 0 18px;
        padding: 17px 17px 18px;
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: 14px;
        box-shadow: none;
    }

    .page-header h1,
    .section-head h1 {
        margin: 0 0 2px;
        font-size: 1.45rem;
        line-height: 1.1;
        font-weight: 950;
    }

    .page-header .muted,
    .section-head .muted {
        margin: 0;
        color: color-mix(in srgb, var(--primary) 72%, var(--text));
        font-size: 0.96rem;
    }

    .muted {
        color: color-mix(in srgb, var(--primary) 62%, var(--muted));
    }

    .stat-grid,
    .action-grid,
    .record-grid,
    .asset-list {
        grid-template-columns: 1fr !important;
        gap: 16px;
        margin: 0 0 18px;
    }

    .stat-card {
        min-height: 132px;
        padding: 24px 18px;
        border-radius: 14px;
        background: var(--panel);
        border: 1px solid var(--border);
        box-shadow: none;
        display: grid;
        place-items: center;
        gap: 8px;
    }

    .stat-card small {
        order: 1;
        color: color-mix(in srgb, var(--primary) 58%, var(--text));
        font-size: 0.95rem;
        font-weight: 900;
        text-align: center;
    }

    .stat-card span {
        order: 2;
        font-size: clamp(2.05rem, 12vw, 3.2rem);
        line-height: 1;
        font-weight: 950;
        color: var(--text);
    }

    .stat-card::after {
        content: "";
        order: 3;
        width: 100%;
        max-width: 14rem;
        text-align: center;
        color: color-mix(in srgb, var(--primary) 64%, var(--muted));
        font-size: 0.9rem;
    }

    .stat-card.danger {
        border-color: color-mix(in srgb, #fbbf24 55%, var(--border));
    }

    .stat-card.danger span {
        color: #fbbf24;
    }

    .action-grid .btn,
    .btn {
        min-height: 48px;
        border-radius: 14px;
        font-size: 0.98rem;
    }

    .card,
    .record-card,
    .asset-card,
    .table-card,
    .quick-add-card {
        border-radius: 14px;
        background: var(--panel);
        border: 1px solid var(--border);
        box-shadow: none;
    }

    .record-card,
    .asset-card,
    .card {
        padding: 16px;
    }

    .record-header {
        margin-bottom: 12px;
        padding-bottom: 10px;
    }

    .record-header h3,
    .asset-card h2,
    .card h2,
    .card h3 {
        text-align: left;
        font-size: 1.05rem;
    }

    .form-grid,
    .filter-bar {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        display: grid;
        grid-template-columns: 1fr;
        gap: 14px;
        margin: 0 0 18px;
    }

    .form-section,
    .filter-bar > * {
        width: 100%;
    }

    label {
        display: block;
        margin: 0 0 6px;
        font-size: 0.92rem;
    }

    input,
    select,
    textarea {
        min-height: 48px;
        border-radius: 14px;
        font-size: 16px;
        background: color-mix(in srgb, var(--bg) 88%, var(--panel));
    }

    textarea {
        min-height: 112px;
    }

    .table-scroll {
        overflow: visible;
    }

    table.mobile-cards,
    table.mobile-cards thead,
    table.mobile-cards tbody,
    table.mobile-cards tr,
    table.mobile-cards th,
    table.mobile-cards td {
        display: block;
        width: 100%;
    }

    table.mobile-cards thead {
        display: none;
    }

    table.mobile-cards tr {
        margin-bottom: 14px;
        padding: 14px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--panel);
    }

    table.mobile-cards td {
        display: grid;
        grid-template-columns: minmax(92px, 38%) 1fr;
        gap: 10px;
        border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
        padding: 9px 0;
        text-align: left;
        overflow-wrap: anywhere;
    }

    table.mobile-cards td:last-child {
        border-bottom: 0;
    }

    table.mobile-cards td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 900;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 6px;
        right: 6px;
        bottom: 0;
        z-index: 70;
        min-height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
        display: grid !important;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 6px;
        align-items: center;
        background: color-mix(in srgb, var(--bg) 92%, transparent);
        border: 1px solid var(--border);
        border-bottom: 0;
        border-radius: 16px 16px 0 0;
        backdrop-filter: blur(18px);
    }

    .mobile-nav-item {
        min-width: 0;
        min-height: 50px;
        border: 0;
        border-radius: 12px;
        background: transparent;
        color: var(--text);
        display: grid;
        place-items: center;
        gap: 2px;
        font: inherit;
        font-size: 0.75rem;
        font-weight: 900;
        line-height: 1;
    }

    .mobile-nav-icon {
        font-size: 1.05rem;
        line-height: 1;
    }

    .mobile-nav-item.active {
        background: color-mix(in srgb, var(--primary) 22%, transparent);
        color: var(--text);
    }

    .mobile-nav-primary {
        color: var(--primary-text);
    }

    .mobile-nav-primary .mobile-nav-icon {
        width: 56px;
        height: 56px;
        margin-top: -28px;
        border-radius: 50%;
        display: grid;
        place-items: center;
        background: var(--primary);
        color: var(--primary-text);
        box-shadow: 0 14px 26px color-mix(in srgb, var(--primary) 34%, transparent);
        font-size: 1.8rem;
    }

    .mobile-nav-primary span:last-child {
        margin-top: -8px;
    }

    .mobile-menu-backdrop {
        position: fixed;
        inset: 0;
        z-index: 80;
        background: rgba(0, 0, 0, 0.48);
        backdrop-filter: blur(4px);
    }

    .mobile-more-menu {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        z-index: 90;
        display: block !important;
        padding: 10px 14px 16px;
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: 22px;
        box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
    }

    .mobile-more-menu[hidden],
    .mobile-menu-backdrop[hidden] {
        display: none !important;
    }

    .mobile-more-handle {
        width: 46px;
        height: 5px;
        margin: 0 auto 12px;
        border-radius: 999px;
        background: var(--border);
    }

    .mobile-more-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 12px;
    }

    .mobile-more-head strong {
        font-size: 1.2rem;
    }

    .mobile-menu-close {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        border: 1px solid var(--border);
        background: var(--bg);
        color: var(--text);
        font-size: 1.4rem;
        font-weight: 900;
    }

    .mobile-more-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .mobile-more-link {
        min-height: 76px;
        padding: 12px;
        display: grid;
        place-items: center;
        gap: 6px;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: color-mix(in srgb, var(--bg) 88%, var(--panel));
        text-align: center;
        font-size: 0.92rem;
    }

    .mobile-more-link span {
        font-size: 1.35rem;
    }

    .mobile-more-link.active {
        border-color: var(--primary);
        background: color-mix(in srgb, var(--primary) 18%, var(--panel));
    }
}

@media (min-width: 769px) {
    .mobile-renderer {
        display: none !important;
    }
}

/* --- mobile app nav and clickable record entries patch --- */
[data-entry-url] {
    cursor: pointer;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .mobile-fab {
        position: fixed;
        left: 50%;
        bottom: calc(78px + env(safe-area-inset-bottom));
        z-index: 75;
        width: 58px;
        height: 58px;
        border-radius: 999px;
        display: grid !important;
        place-items: center;
        background: var(--primary);
        color: var(--primary-text);
        box-shadow: 0 14px 28px color-mix(in srgb, var(--primary) 36%, transparent);
        font-size: 2rem;
        font-weight: 900;
        line-height: 1;
        text-decoration: none;
        transform: translateX(-50%);
    }

    .mobile-fab:active {
        transform: translateX(-50%) scale(0.96);
    }
}

/* --- hard mobile app shell visibility fix --- */
body.mobile-shell-active.has-mobile-nav {
    padding-top: calc(64px + env(safe-area-inset-top));
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
}
body.mobile-shell-active .desktop-renderer { display: none !important; }
body.mobile-shell-active .mobile-renderer { display: flex !important; }
body.mobile-shell-active .mobile-app-header {
    position: fixed !important; top: 0; left: 0; right: 0; z-index: 900;
    min-height: calc(64px + env(safe-area-inset-top)); display: grid !important;
}
body.mobile-shell-active .mobile-bottom-nav {
    position: fixed !important; left: 6px; right: 6px; bottom: 0; z-index: 920;
    min-height: calc(74px + env(safe-area-inset-bottom)); display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; align-items: center;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    border: 1px solid var(--border); border-bottom: 0; border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.26); backdrop-filter: blur(18px);
}
body.mobile-shell-active .mobile-bottom-nav .mobile-nav-item {
    min-width: 0; min-height: 52px; display: grid !important; place-items: center; gap: 3px;
    padding: 6px 4px; border: 0; border-radius: 12px; background: transparent; color: var(--text);
    font-size: 0.72rem; font-weight: 900; line-height: 1; text-align: center; text-decoration: none;
}
body.mobile-shell-active .mobile-bottom-nav .mobile-nav-item.active { background: color-mix(in srgb, var(--primary) 24%, transparent); }
body.mobile-shell-active .mobile-fab {
    position: fixed !important; left: 50%; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 930;
    width: 58px; height: 58px; display: grid !important; place-items: center; border-radius: 999px;
    background: var(--primary); color: var(--primary-text); box-shadow: 0 14px 28px color-mix(in srgb, var(--primary) 36%, transparent);
    font-size: 2rem; font-weight: 900; line-height: 1; text-decoration: none; transform: translateX(-50%);
}
body.mobile-shell-active .page { width: 100%; max-width: 100%; margin: 0; padding: 14px 8px 18px; }
body:not(.mobile-shell-active) .mobile-renderer { display: none !important; }

/* --- verified mobile shell correction --- */
@media (max-width: 768px) {
    body.mobile-shell-active.has-mobile-nav {
        padding-top: calc(64px + env(safe-area-inset-top));
        padding-bottom: calc(92px + env(safe-area-inset-bottom));
    }

    body.mobile-shell-active .desktop-renderer {
        display: none !important;
    }

    body.mobile-shell-active .mobile-renderer {
        display: block !important;
    }

    body.mobile-shell-active .mobile-app-header {
        display: grid !important;
    }

    body.mobile-shell-active .mobile-bottom-nav {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }

    body.mobile-shell-active .mobile-fab {
        display: grid !important;
    }

    body.mobile-shell-active .mobile-menu-backdrop[hidden],
    body.mobile-shell-active .mobile-more-menu[hidden] {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .mobile-app-header,
    .mobile-bottom-nav,
    .mobile-fab,
    .mobile-menu-backdrop,
    .mobile-more-menu {
        display: none !important;
    }
}


/* --- production mobile-first app readiness patch --- */
html {
    min-width: 0;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-width: 0;
    overflow-x: hidden;
    touch-action: manipulation;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.btn,
.nav a,
.mobile-nav-item,
.mobile-more-link,
.asset-link-btn,
[role="button"] {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

img,
svg,
video,
canvas {
    max-width: 100%;
    height: auto;
}

@supports (height: 100dvh) {
    body {
        min-height: 100dvh;
    }
}

@media (max-width: 768px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overscroll-behavior-x: none;
    }

    body.has-mobile-nav,
    body.mobile-shell-active.has-mobile-nav {
        padding-top: calc(64px + env(safe-area-inset-top)) !important;
        padding-right: env(safe-area-inset-right);
        padding-bottom: calc(94px + env(safe-area-inset-bottom)) !important;
        padding-left: env(safe-area-inset-left);
    }

    body.mobile-menu-open {
        overflow: hidden;
    }

    .page {
        width: 100% !important;
        max-width: 100% !important;
        padding: 14px 10px 18px !important;
    }

    .page > * {
        width: 100%;
        max-width: 560px;
        margin-right: auto;
        margin-left: auto;
    }

    .mobile-app-header {
        min-width: 0;
        padding-right: calc(12px + env(safe-area-inset-right)) !important;
        padding-left: calc(12px + env(safe-area-inset-left)) !important;
    }

    .mobile-app-title,
    .mobile-header-actions,
    .mobile-bottom-nav,
    .mobile-more-menu,
    .mobile-more-grid,
    .card,
    .record-card,
    .form-section,
    .table-card,
    .table-scroll,
    form,
    fieldset {
        min-width: 0;
    }

    .mobile-app-title strong,
    .mobile-app-title span,
    .mobile-nav-item span,
    .mobile-more-link strong,
    .record-header,
    .record-card,
    .card,
    td,
    th {
        overflow-wrap: anywhere;
    }

    .mobile-bottom-nav,
    body.mobile-shell-active .mobile-bottom-nav {
        left: max(6px, env(safe-area-inset-left)) !important;
        right: max(6px, env(safe-area-inset-right)) !important;
        bottom: 0 !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }

    .mobile-nav-item {
        min-width: 0;
        min-height: 54px;
        padding: 7px 3px;
    }

    .mobile-nav-item span:last-child {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-fab {
        bottom: calc(82px + env(safe-area-inset-bottom)) !important;
    }

    input,
    select,
    textarea,
    button,
    .btn,
    .asset-link-btn {
        min-height: 48px;
    }

    input[type="checkbox"],
    input[type="radio"] {
        min-height: 0;
        width: 22px;
        height: 22px;
    }

    .form-grid,
    .filter-bar,
    .form-actions {
        width: 100%;
        max-width: 100%;
    }

    .form-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .form-actions .btn,
    .filter-bar .btn,
    .filter-bar button,
    .filter-bar a {
        width: 100%;
    }

    .table-scroll {
        width: 100%;
        overflow-x: visible;
    }

    .table-scroll table,
    .table-scroll thead,
    .table-scroll tbody,
    .table-scroll tr,
    .table-scroll th,
    .table-scroll td,
    table.mobile-cards,
    table.mobile-cards thead,
    table.mobile-cards tbody,
    table.mobile-cards tr,
    table.mobile-cards th,
    table.mobile-cards td {
        display: block;
        width: 100%;
    }

    .table-scroll thead,
    table.mobile-cards thead {
        display: none;
    }

    .table-scroll tr,
    table.mobile-cards tr {
        margin-bottom: 14px;
        padding: 14px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--panel);
        box-shadow: none;
    }

    .table-scroll td,
    table.mobile-cards td {
        display: grid;
        grid-template-columns: 1fr;
        gap: 3px;
        padding: 10px 0;
        border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
        text-align: left;
        overflow-wrap: anywhere;
    }

    .table-scroll td:last-child,
    table.mobile-cards td:last-child {
        border-bottom: 0;
    }

    .table-scroll td::before,
    table.mobile-cards td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.72rem;
        font-weight: 900;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .table-scroll td:not([data-label])::before,
    table.mobile-cards td:not([data-label])::before {
        content: "";
    }

    td[data-label="Actions"],
    td[data-label="Action"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    td[data-label="Actions"] form,
    td[data-label="Action"] form,
    td[data-label="Actions"] .btn,
    td[data-label="Action"] .btn,
    td[data-label="Actions"] button,
    td[data-label="Action"] button {
        width: 100%;
        margin: 0 !important;
    }
}

@media (display-mode: standalone) {
    body.has-mobile-nav {
        -webkit-user-select: none;
        user-select: none;
    }

    input,
    textarea,
    select,
    [contenteditable="true"] {
        -webkit-user-select: text;
        user-select: text;
    }
}
