/* ────────────────────────────────────────────────────────────────────
   NimShare — Tungsten Automation Brand Book design tokens
   Mirrors printix-tonerwatch so the two products feel like siblings.
   ──────────────────────────────────────────────────────────────────── */

:root {
    /* Primary palette */
    --tw-primary:        #002854;
    --tw-deep:           #00123B;
    --tw-primary-alt:    #004766;
    --tw-accent:         #00A0FB;
    --tw-accent-hover:   #0090E0;
    --tw-light-blue:     #9DDDF9;
    --tw-muted-blue:     #8094AA;
    --tw-faint-blue:     #D9DFE6;
    --tw-text:           #231F20;
    --tw-white:          #FFFFFF;
    --tw-gray-100:       #FAFAFA;
    --tw-gray-200:       #F0F0F0;
    --tw-gray-300:       #E4E4E4;

    /* Accents (< 20% visual weight) */
    --tw-magenta:        #D030E8;
    --tw-green:          #00EB86;
    --tw-salmon:         #FF6D69;
    --tw-yellow:         #FFC600;

    /* Status */
    --status-ok:         #016839;
    --status-warn:       #FFC600;
    --status-critical:   #DC2626;
    --status-unknown:    #8094AA;

    /* Product-pillar gradient — Print & Workplace Automation */
    --pillar-gradient:   linear-gradient(180deg, #00EB86 0%, #00A0FB 100%);
    --pillar-gradient-h: linear-gradient(90deg,  #00EB86 0%, #00A0FB 100%);

    /* Sidebar backdrop — quiet, deep, brand-compliant */
    --sidebar-bg:        linear-gradient(180deg,
                            #00123B 0%,
                            #002854 55%,
                            #00325F 100%);

    /* Typography */
    --font-sans:         'Red Hat Display', 'Arial', -apple-system,
                          BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono:         ui-monospace, 'SF Mono', Monaco, 'Cascadia Mono',
                          'Roboto Mono', monospace;

    /* 4 px grid */
    --sp-1:  4px;  --sp-2:  8px;  --sp-3: 12px;  --sp-4: 16px;
    --sp-5: 20px;  --sp-6: 24px;  --sp-8: 32px;  --sp-10: 40px;
    --sp-12: 48px; --sp-16: 64px;

    --r-sm: 6px;   --r: 10px;   --r-lg: 14px;

    --shadow-sm:   0 1px 2px rgba(0, 18, 59, .04);
    --shadow:      0 4px 12px rgba(0, 18, 59, .08);
    --shadow-lg:   0 12px 32px rgba(0, 18, 59, .12);
    --shadow-side: 4px 0 20px rgba(0, 18, 59, .10);

    --t-fast: 120ms cubic-bezier(.4, 0, .2, 1);
    --t:      180ms cubic-bezier(.4, 0, .2, 1);

    --sidebar-w: 260px;
    --workspace-max: 1400px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--tw-gray-100);
    color: var(--tw-text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--tw-accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--tw-accent-hover); }

h1, h2, h3, h4 { color: var(--tw-primary); letter-spacing: -0.01em; }
h1 { font-size: 1.9rem;  font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.45rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
h4 { font-size: 1rem;    font-weight: 500; }

/* ── App shell ─────────────────────────────────────────────────── */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}
.app-shell.auth-mode { grid-template-columns: 1fr; background: var(--tw-gray-100); }

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
    background: var(--sidebar-bg);
    color: var(--tw-white);
    display: flex; flex-direction: column;
    position: sticky; top: 0;
    height: 100vh;
    overflow: hidden;
    box-shadow: var(--shadow-side);
    border-right: 1px solid rgba(255,255,255,.05);
}
.sidebar-brand { flex: 0 0 auto; }
.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-footer { flex: 0 0 auto; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.10); border-radius: 6px; }

.sidebar-brand {
    padding: var(--sp-6) var(--sp-5) var(--sp-8);
    display: flex; align-items: center; gap: var(--sp-3);
    color: var(--tw-white); text-decoration: none; position: relative;
}
.sidebar-brand .logo-tile {
    width: 44px; height: 44px; flex-shrink: 0;
    background: #fff; border-radius: 10px; padding: 6px;
    box-shadow: 0 2px 6px rgba(0,18,59,.35);
    display: flex; align-items: center; justify-content: center;
}
.sidebar-brand .wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.sidebar-brand .wordmark .name { font-weight: 900; font-size: 1.15rem; letter-spacing: .01em; }
.sidebar-brand .wordmark .product {
    font-weight: 500; font-size: .7rem; color: var(--tw-light-blue);
    letter-spacing: .16em; text-transform: uppercase; margin-top: 3px;
}

.sidebar-nav { display: flex; flex-direction: column; padding: 0 var(--sp-3); gap: 2px; }
.sidebar-nav a {
    color: rgba(255,255,255,.82);
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-sm);
    transition: background var(--t-fast), color var(--t-fast);
    font-weight: 500;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: var(--tw-white); }
.sidebar-nav a.active {
    background: rgba(0,160,251,.16);
    color: var(--tw-white);
    box-shadow: inset 2px 0 0 var(--tw-accent);
}

.sidebar-footer {
    margin-top: auto;
    padding: var(--sp-4) var(--sp-5) var(--sp-6);
    font-size: .78rem; color: rgba(255,255,255,.55);
    border-top: 1px solid rgba(255,255,255,.06);
}

/* Diagonal accent bar bottom-right of sidebar (Tungsten graphic element) */
.sidebar::after {
    content: '';
    position: absolute;
    right: -20px; bottom: 60px;
    width: 90px; height: 220px;
    background: linear-gradient(180deg, transparent 0%, rgba(0,160,251,.18) 45%, rgba(0,235,134,.15) 100%);
    transform: skewX(-14deg);
    pointer-events: none;
    filter: blur(0.5px);
}

/* ── Workspace ─────────────────────────────────────────────────── */
.workspace {
    max-width: var(--workspace-max);
    margin: 0 auto;
    padding: var(--sp-8) var(--sp-8) var(--sp-16);
    width: 100%;
}
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: var(--sp-8); gap: var(--sp-6); flex-wrap: wrap; }
.page-header p.lede { color: var(--tw-muted-blue); margin-top: var(--sp-2); max-width: 60ch; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    padding: var(--sp-6);
}
.card + .card { margin-top: var(--sp-6); }
/* Row / flex / grid layouts arrange cards side-by-side; the vertical
   .card + .card rule doesn't apply then and would push adjacent cards
   visually out of alignment. */
.row > .card + .card,
[style*="display:flex"] > .card + .card,
[style*="display:grid"] > .card + .card { margin-top: 0; }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--tw-primary); margin-bottom: var(--sp-4); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-5);
    border-radius: var(--r-sm);
    font: 700 .95rem var(--font-sans);
    border: none; cursor: pointer;
    transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), color var(--t-fast);
    text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--tw-yellow); color: var(--tw-primary); box-shadow: 0 2px 4px rgba(255,198,0,.35); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(255,198,0,.45); }
.btn-secondary { background: var(--tw-primary); color: var(--tw-white); }
.btn-secondary:hover:not(:disabled) { background: var(--tw-primary-alt); color: var(--tw-white); }
.btn-ghost     { background: transparent; color: var(--tw-primary); border: 1px solid var(--tw-gray-300); }
.btn-ghost:hover:not(:disabled) { background: var(--tw-gray-200); }
.btn-danger    { background: #b91c1c; color: var(--tw-white); }
.btn-sm { padding: var(--sp-2) var(--sp-3); font-size: .85rem; }

/* ── Forms ─────────────────────────────────────────────────────── */
label { display: block; font-weight: 500; color: var(--tw-primary); font-size: .9rem; margin-bottom: var(--sp-1); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=datetime-local], select, textarea {
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--tw-gray-300);
    border-radius: var(--r-sm);
    font: 400 .95rem var(--font-sans);
    color: var(--tw-text);
    background: var(--tw-white);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--tw-accent);
    box-shadow: 0 0 0 3px rgba(0,160,251,.16);
}
.field + .field { margin-top: var(--sp-4); }
.helper { font-size: .8rem; color: var(--tw-muted-blue); margin-top: var(--sp-1); }

/* ── Tables ────────────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: separate; border-spacing: 0;
    background: var(--tw-white);
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--tw-gray-300);
}
.table th, .table td { padding: var(--sp-3) var(--sp-4); text-align: left; vertical-align: middle; }
.table th {
    background: var(--tw-gray-200);
    color: var(--tw-primary);
    font-weight: 700; font-size: .8rem;
    text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--tw-gray-300);
}
.table td { border-bottom: 1px solid var(--tw-gray-200); font-size: .95rem; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--tw-gray-100); }

/* ── Public share landing ──────────────────────────────────────── */
.landing-shell {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: var(--sp-6);
    background: radial-gradient(1200px 600px at 20% 0%, rgba(0,160,251,.10), transparent 70%),
                radial-gradient(900px 500px at 80% 100%, rgba(0,235,134,.06), transparent 70%),
                var(--tw-gray-100);
}
.landing-card {
    width: 100%; max-width: 520px;
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-10);
    position: relative;
    overflow: hidden;
}
.landing-card::before {
    /* diagonal accent bar top-right, Tungsten graphic element */
    content: ''; position: absolute; right: -40px; top: -40px;
    width: 200px; height: 200px;
    background: linear-gradient(135deg, var(--tw-accent) 0%, var(--tw-green) 100%);
    transform: rotate(20deg);
    opacity: .12;
    border-radius: 20px;
}
.landing-brand { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.landing-brand .logo-tile { background: var(--tw-primary); color: var(--tw-white); border-radius: 8px; padding: var(--sp-2) var(--sp-3); font-weight: 900; letter-spacing: .05em; font-size: .85rem; }
.landing-brand small { color: var(--tw-muted-blue); }
.landing-meta { color: var(--tw-muted-blue); font-size: .85rem; margin-top: var(--sp-2); }
.file-tile {
    background: var(--tw-gray-100);
    border: 1px solid var(--tw-gray-300);
    border-radius: var(--r);
    padding: var(--sp-4);
    margin: var(--sp-6) 0;
    display: flex; align-items: center; gap: var(--sp-4);
}
.file-tile .icon {
    width: 40px; height: 40px;
    background: var(--pillar-gradient);
    border-radius: 8px;
    display: grid; place-items: center;
    color: var(--tw-white); font-weight: 900;
    font-size: .8rem;
}
.file-tile .meta { display: flex; flex-direction: column; }
.file-tile .name { font-weight: 700; color: var(--tw-primary); }
.file-tile .sub { color: var(--tw-muted-blue); font-size: .85rem; }

/* ── Language dropdown (tonerwatch-style <details>) ────────────── */
.sidebar-lang { position: relative; margin-bottom: var(--sp-3); }
.sidebar-lang summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 8px 14px;
    color: rgba(255, 255, 255, .78);
    border-radius: var(--r-sm);
    font-size: .88rem;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-lang summary::-webkit-details-marker { display: none; }
.sidebar-lang summary::marker { content: none; }
.sidebar-lang summary:hover { background: rgba(255, 255, 255, .10); color: var(--tw-white); }
.sidebar-lang summary svg { width: 18px; height: 18px; opacity: .85; flex-shrink: 0; }
.sidebar-lang summary .label { flex: 1; }
.sidebar-lang summary .chev {
    margin-left: auto; opacity: .6;
    transition: transform var(--t-fast);
}
.sidebar-lang[open] summary .chev { transform: rotate(180deg); }
.sidebar-lang .menu {
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--r-sm);
    padding: var(--sp-1);
    margin-top: var(--sp-1);
}
.sidebar-lang .menu a {
    display: block;
    padding: 8px 14px;
    color: rgba(255, 255, 255, .78);
    border-radius: 4px;
    font-size: .85rem;
    text-decoration: none;
    transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-lang .menu a:hover { background: rgba(255, 255, 255, .10); color: var(--tw-white); }
.sidebar-lang .menu a.current { color: var(--tw-white); font-weight: 700; }
.sidebar-lang .menu a.current::before { content: '✓ '; opacity: .8; }

/* ── (legacy) horizontal chips — still used on login/setup ────── */
.lang-switcher {
    display: flex;
    gap: 3px;
    flex-wrap: nowrap;
    justify-content: space-between;
    width: 100%;
}
.lang-switcher a {
    flex: 1;
    padding: 4px 0;
    border-radius: 6px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: rgba(255, 255, 255, .70);
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .08);
    text-decoration: none;
    text-align: center;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.lang-switcher a:hover {
    background: rgba(255, 255, 255, .12);
    color: var(--tw-white);
}
.lang-switcher a.active {
    background: rgba(0, 160, 251, .30);
    color: var(--tw-white);
    border-color: rgba(0, 160, 251, .55);
}

/* Light-domain variant, used on public / landing / login pages */
.lang-switcher.light a {
    color: var(--tw-muted-blue);
    background: var(--tw-gray-100);
    border-color: var(--tw-gray-300);
}
.lang-switcher.light a:hover {
    background: var(--tw-gray-200);
    color: var(--tw-primary);
}
.lang-switcher.light a.active {
    background: rgba(0, 160, 251, .15);
    color: var(--tw-primary);
    border-color: var(--tw-accent);
}

/* ── Sidebar user card ─────────────────────────────────────────── */
.user-card {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: var(--r-sm);
    margin-bottom: var(--sp-3);
}
.user-card .avatar {
    width: 36px; height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tw-accent) 0%, var(--tw-green) 100%);
    display: grid; place-items: center;
    color: var(--tw-white);
    font-weight: 900;
    font-size: .85rem;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.user-card .avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.user-card .name-block { flex: 1; min-width: 0; }
.user-card .name-block .name {
    color: var(--tw-white);
    font-weight: 600;
    font-size: .88rem;
    line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-card .name-block .email {
    color: rgba(255, 255, 255, .55);
    font-size: .72rem;
    line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-card .signout {
    flex-shrink: 0;
    color: rgba(255, 255, 255, .55);
    padding: 6px;
    border-radius: 6px;
    text-decoration: none;
    transition: color var(--t-fast), background var(--t-fast);
}
.user-card .signout:hover {
    color: var(--tw-white);
    background: rgba(255, 255, 255, .08);
}

/* ── File browser ──────────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    color: var(--tw-muted-blue);
    font-size: .9rem;
    margin-bottom: var(--sp-4);
    flex-wrap: wrap;
}
.breadcrumb a {
    color: var(--tw-accent);
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 4px;
}
.breadcrumb a:hover { background: var(--tw-gray-200); }
.breadcrumb .sep { color: var(--tw-gray-300); font-size: 1rem; }
.breadcrumb .current { color: var(--tw-primary); font-weight: 700; }

.browse-toolbar {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
    flex-wrap: wrap;
}

.file-icon {
    width: 32px; height: 32px;
    flex-shrink: 0;
    border-radius: 6px;
    display: grid; place-items: center;
    color: var(--tw-white);
    font-weight: 900;
    font-size: .65rem;
    letter-spacing: .04em;
    background: linear-gradient(135deg, var(--tw-accent) 0%, var(--tw-primary-alt) 100%);
}
.file-icon.folder { background: linear-gradient(135deg, #FFC600 0%, #FF9900 100%); }
.file-icon.pdf    { background: linear-gradient(135deg, #DC2626 0%, #7f1010 100%); }
.file-icon.doc    { background: linear-gradient(135deg, #2b6cb0 0%, #1a365d 100%); }
.file-icon.xls    { background: linear-gradient(135deg, #059669 0%, #064e3b 100%); }
.file-icon.ppt    { background: linear-gradient(135deg, #ea580c 0%, #7c2d12 100%); }
.file-icon.img    { background: linear-gradient(135deg, #ec4899 0%, #831843 100%); }
.file-icon.vid    { background: linear-gradient(135deg, #7c3aed 0%, #4c1d95 100%); }
.file-icon.zip    { background: linear-gradient(135deg, #64748b 0%, #1e293b 100%); }
.file-icon.txt    { background: linear-gradient(135deg, #6b7280 0%, #374151 100%); }

.browse-name {
    display: flex; align-items: center; gap: var(--sp-3);
}
.browse-name a { color: var(--tw-primary); font-weight: 500; text-decoration: none; }
.browse-name a:hover { color: var(--tw-accent); }

.scope-tile {
    display: block;
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: var(--r-lg);
    padding: var(--sp-6);
    text-decoration: none;
    color: var(--tw-primary);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--t-fast), transform var(--t-fast);
    position: relative;
    overflow: hidden;
}
.scope-tile:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    color: var(--tw-primary);
}
.scope-tile h3 { color: var(--tw-primary); font-size: 1.1rem; margin-bottom: var(--sp-2); }
.scope-tile p { color: var(--tw-muted-blue); font-size: .88rem; }
.scope-tile .icon {
    width: 48px; height: 48px; border-radius: var(--r);
    display: grid; place-items: center;
    color: var(--tw-white); font-size: 1.4rem; font-weight: 900;
    margin-bottom: var(--sp-4);
}

.actions-menu { position: relative; display: inline-block; }
.actions-menu > button {
    background: transparent; border: 1px solid var(--tw-gray-300);
    color: var(--tw-primary); padding: 4px 10px; border-radius: 6px;
    cursor: pointer; font-size: .85rem;
}
.actions-menu > button:hover { background: var(--tw-gray-200); }
.actions-menu > .menu {
    position: absolute; top: 100%; right: 0;
    background: var(--tw-white); border: 1px solid var(--tw-gray-300);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-2) 0;
    min-width: 200px;
    z-index: 20;
    display: none;
}
.actions-menu[open] > .menu { display: block; }
.actions-menu .menu button,
.actions-menu .menu form button,
.actions-menu .menu a {
    display: block; width: 100%; text-align: left;
    padding: 8px 16px; background: none; border: none; cursor: pointer;
    color: var(--tw-text); font-size: .9rem;
    text-decoration: none;
}
.actions-menu .menu button:hover,
.actions-menu .menu a:hover { background: var(--tw-gray-100); color: var(--tw-primary); }
.actions-menu .menu .divider { height: 1px; background: var(--tw-gray-200); margin: 4px 0; }
.actions-menu .menu form { margin: 0; }

/* ── Browser layout with left library + folder tree sidebar ────── */
.browse-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: var(--sp-4);
    align-items: start;
}
@media (max-width: 800px) {
    .browse-layout { grid-template-columns: 1fr; }
    .tree-panel { display: none; }
}
.lib-section { margin-bottom: var(--sp-3); }
.lib-section:last-child { margin-bottom: 0; }
.lib-heading {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--tw-muted-blue);
    padding: 6px 8px 4px;
    font-weight: 700;
}
.lib-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 8px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--tw-primary);
    font-size: .92rem;
    line-height: 1.1;
}
.lib-item:hover { background: var(--tw-gray-100); }
.lib-item.active { background: rgba(0,160,251,.14); font-weight: 700; }
.lib-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border-radius: 7px;
    color: #fff;
    font-size: .95rem;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.lib-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tree-panel {
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: var(--r);
    padding: var(--sp-3);
    max-height: 70vh;
    overflow-y: auto;
    font-size: .88rem;
}
.tree-panel .tree-node {
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 4px;
    color: var(--tw-primary);
    display: flex; align-items: center; gap: 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tree-panel .tree-node:hover { background: var(--tw-gray-200); }
.tree-panel .tree-node.active { background: rgba(0,160,251,.12); font-weight: 700; }
.tree-panel .tree-node .toggle { color: var(--tw-muted-blue); font-size: .75rem; width: 14px; text-align: center; }
.tree-panel .tree-children { padding-left: var(--sp-4); }
.tree-panel .tree-children.collapsed { display: none; }

.ai-tag {
    display: inline-flex;
    padding: 2px 6px;
    background: rgba(0, 160, 251, .12);
    color: var(--tw-primary-alt);
    border-radius: 4px;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .02em;
    margin-left: 6px;
}
.ai-risk {
    display: inline-flex;
    padding: 2px 6px;
    background: rgba(220, 38, 38, .10);
    color: var(--status-critical);
    border-radius: 4px;
    font-size: .68rem;
    font-weight: 700;
    margin-left: 6px;
}

.search-bar {
    display: flex; gap: var(--sp-2); margin-bottom: var(--sp-3); align-items: center;
    background: var(--tw-white); border: 1px solid var(--tw-gray-300); border-radius: var(--r-sm);
    padding: 4px 8px 4px 12px;
}
.search-bar input {
    flex: 1; border: none; outline: none; background: transparent; font-size: .95rem;
    padding: 6px 0; font-family: var(--font-sans);
}
.search-bar .icon { color: var(--tw-muted-blue); font-size: 1rem; }
.search-bar button {
    background: var(--tw-accent); color: white; border: none; border-radius: 4px;
    padding: 6px 12px; font-size: .85rem; cursor: pointer;
}
.search-results {
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: var(--r);
    padding: var(--sp-3);
    margin-bottom: var(--sp-3);
}
.search-results .hit {
    padding: 8px 10px;
    border-bottom: 1px solid var(--tw-gray-200);
    cursor: pointer;
    display: flex; align-items: center; gap: var(--sp-3);
}
.search-results .hit:last-child { border-bottom: none; }
.search-results .hit:hover { background: var(--tw-gray-100); }
.search-results .hit .score { font-family: var(--font-mono); font-size: .7rem; color: var(--tw-muted-blue); }

.preview-frame {
    width: 100%; height: 70vh; border: none; background: var(--tw-gray-200); border-radius: var(--r-sm);
}
.preview-image {
    display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: var(--r-sm);
}

/* ── Seafile-style browser rows with hover actions ────────────── */
.seafile-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: var(--r);
    overflow: hidden;
}
.seafile-table thead th {
    background: transparent;
    color: var(--tw-muted-blue);
    font-weight: 500;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--tw-gray-200);
    text-align: left;
}
.seafile-table td {
    padding: 10px var(--sp-4);
    border-bottom: 1px solid var(--tw-gray-200);
    font-size: .92rem;
    vertical-align: middle;
}
.seafile-table tr:last-child td { border-bottom: none; }
.seafile-table tbody tr {
    transition: background var(--t-fast);
    position: relative;
}
.seafile-table tbody tr:hover { background: var(--tw-gray-100); }
.seafile-table tbody tr.selected { background: rgba(0, 160, 251, .06); }

.seafile-name {
    display: flex; align-items: center; gap: var(--sp-3);
    color: var(--tw-primary); font-weight: 500;
    text-decoration: none;
}
.seafile-name:hover .name-text { color: var(--tw-accent); }
.seafile-name .file-icon {
    width: 24px; height: 24px;
    border-radius: 4px;
    font-size: .55rem;
    flex-shrink: 0;
}

/* Row-action icons revealed on hover — Seafile pattern */
.row-actions {
    display: flex; align-items: center; gap: 4px;
    opacity: 0;
    transition: opacity var(--t-fast);
    justify-content: flex-end;
}
.seafile-table tbody tr:hover .row-actions,
.seafile-table tbody tr.selected .row-actions,
.row-actions.persistent { opacity: 1; }
.row-actions button,
.row-actions a {
    background: transparent;
    border: none;
    padding: 6px;
    color: var(--tw-muted-blue);
    cursor: pointer;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1;
    text-decoration: none;
    transition: background var(--t-fast), color var(--t-fast);
}
.row-actions button:hover,
.row-actions a:hover {
    background: var(--tw-gray-200);
    color: var(--tw-primary);
}

.row-check {
    opacity: 0;
    transition: opacity var(--t-fast);
}
.seafile-table tbody tr:hover .row-check,
.seafile-table tbody tr.selected .row-check,
.row-check:checked,
.row-check.persistent { opacity: 1; }

/* Right-click context menu */
.ctx-menu {
    position: fixed;
    z-index: 100;
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-2) 0;
    min-width: 220px;
    display: none;
}
.ctx-menu.open { display: block; }
.ctx-menu button {
    display: block; width: 100%; text-align: left;
    padding: 8px 16px; background: none; border: none;
    color: var(--tw-text); font-size: .9rem;
    cursor: pointer;
    display: flex; align-items: center; gap: var(--sp-3);
}
.ctx-menu button:hover { background: var(--tw-gray-100); color: var(--tw-primary); }
.ctx-menu .divider { height: 1px; background: var(--tw-gray-200); margin: 4px 0; }
.ctx-menu button .kbd {
    margin-left: auto;
    color: var(--tw-muted-blue);
    font-family: var(--font-mono);
    font-size: .75rem;
}

/* Library tiles on /browse root — Seafile-inspired, dezenter */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--sp-4);
    margin: var(--sp-4) 0 var(--sp-8);
}
.library-tile {
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: var(--r);
    padding: var(--sp-4);
    display: flex; align-items: center; gap: var(--sp-3);
    text-decoration: none;
    color: var(--tw-text);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.library-tile:hover {
    border-color: var(--tw-accent);
    box-shadow: var(--shadow);
    color: var(--tw-primary);
}
.library-tile .icon {
    width: 40px; height: 40px;
    border-radius: 8px;
    display: grid; place-items: center;
    color: var(--tw-white);
    font-size: 1.2rem;
    flex-shrink: 0;
    background: var(--tw-accent);
}
.library-tile.personal .icon { background: linear-gradient(135deg, var(--tw-accent), var(--tw-primary-alt)); }
.library-tile.public   .icon { background: linear-gradient(135deg, var(--tw-green), var(--tw-accent)); }
.library-tile.group    .icon { background: linear-gradient(135deg, var(--tw-magenta), var(--tw-accent)); }
.library-tile .info { flex: 1; min-width: 0; }
.library-tile .info .title {
    font-weight: 700; color: var(--tw-primary); font-size: .95rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.library-tile .info .sub {
    font-size: .78rem; color: var(--tw-muted-blue);
}

.library-section-title {
    color: var(--tw-primary);
    font-size: 1.05rem;
    font-weight: 700;
    margin: var(--sp-6) 0 var(--sp-3);
    display: flex; align-items: center; gap: var(--sp-2);
}

/* Drag-drop drop-zone overlay */
.dropzone {
    position: relative;
    border: 2px dashed transparent;
    border-radius: var(--r);
    transition: border-color var(--t), background var(--t);
    padding: var(--sp-2);
    min-height: 200px;
}
.dropzone.drag-over {
    border-color: var(--tw-accent);
    background: rgba(0, 160, 251, .05);
}
.dropzone.drag-over::before {
    content: "↓ " attr(data-drop-label);
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: var(--tw-accent);
    font-weight: 700;
    font-size: 1.4rem;
    background: var(--tw-white);
    padding: var(--sp-3) var(--sp-6);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    z-index: 5;
    pointer-events: none;
}

.bulk-toolbar {
    display: none;
    position: sticky;
    top: 0;
    background: var(--tw-primary);
    color: var(--tw-white);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-sm);
    align-items: center;
    gap: var(--sp-4);
    margin-bottom: var(--sp-3);
    z-index: 10;
}
.bulk-toolbar.on { display: flex; }
.bulk-toolbar .count { font-weight: 700; }
.bulk-toolbar button {
    background: transparent;
    color: var(--tw-white);
    border: 1px solid rgba(255,255,255,.35);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: .88rem;
}
.bulk-toolbar button:hover { background: rgba(255,255,255,.10); }

/* Grid view */
.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--sp-4);
}
.grid-tile {
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: var(--r);
    padding: var(--sp-4);
    text-align: center;
    box-shadow: var(--shadow-sm);
    position: relative;
    cursor: pointer;
    transition: box-shadow var(--t-fast);
}
.grid-tile:hover { box-shadow: var(--shadow); }
.grid-tile.selected { border-color: var(--tw-accent); background: rgba(0,160,251,.04); }
.grid-tile .icon-big { width: 80px; height: 80px; margin: 0 auto var(--sp-3); border-radius: 10px; }
.grid-tile .name { font-weight: 700; color: var(--tw-primary); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-tile .meta { color: var(--tw-muted-blue); font-size: .78rem; margin-top: 4px; }
.grid-tile .check {
    position: absolute; top: 8px; left: 8px;
    width: 20px; height: 20px;
}
.grid-tile .actions-menu {
    position: absolute; top: 6px; right: 6px;
}

.view-toggle {
    display: inline-flex;
    background: var(--tw-gray-200);
    border-radius: var(--r-sm);
    padding: 3px;
    gap: 3px;
}
.view-toggle button {
    background: transparent; border: none; padding: 6px 12px; border-radius: 4px;
    cursor: pointer; font-size: .85rem;
    color: var(--tw-muted-blue);
}
.view-toggle button.active {
    background: var(--tw-white);
    color: var(--tw-primary);
    box-shadow: var(--shadow-sm);
}

/* Modal */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,18,59,.55);
    display: none;
    align-items: center; justify-content: center;
    z-index: 50;
    padding: var(--sp-4);
}
.modal-backdrop.open { display: flex; }
.modal-panel {
    background: var(--tw-white);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    max-width: 560px; width: 100%;
    max-height: 90vh; overflow-y: auto;
    padding: var(--sp-6);
}
.modal-panel h2 { color: var(--tw-primary); margin-bottom: var(--sp-4); }
.modal-panel .actions {
    display: flex; justify-content: flex-end; gap: var(--sp-3);
    margin-top: var(--sp-6);
}
.modal-result {
    display: flex; gap: var(--sp-2); align-items: center; margin-top: var(--sp-4);
    padding: var(--sp-3); background: var(--tw-gray-100); border-radius: var(--r-sm);
}
.modal-result input { flex: 1; }

/* ── Collapsible sidebar section ───────────────────────────────── */
.nav-section {
    padding: var(--sp-3) var(--sp-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(255, 255, 255, .55);
    font-size: .72rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}
.nav-section .chevron {
    font-size: .8rem;
    transition: transform var(--t-fast);
}
.nav-section.collapsed + .nav-section-body { display: none; }
.nav-section.collapsed .chevron { transform: rotate(-90deg); }

/* ── Utilities ─────────────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.row   { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.muted { color: var(--tw-muted-blue); }
.mono  { font-family: var(--font-mono); font-size: .9em; }
.chip  {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 999px;
    background: var(--tw-gray-200); color: var(--tw-primary);
    font-size: .75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
}
.chip-ok       { background: rgba(0,235,134,.15); color: var(--status-ok); }
.chip-warn     { background: rgba(255,198,0,.20); color: #634e12; }
.chip-critical { background: rgba(220,38,38,.15); color: var(--status-critical); }

/* ── Expandable "Ablage" nav-group (blue chip when active) ───── */
.nav-group { margin: 4px 0; user-select: none; }
.nav-group-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--sp-3) var(--sp-4);
    color: rgba(255,255,255,.82);
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--r-sm);
    transition: background var(--t-fast);
}
.nav-group-head:hover { background: rgba(255,255,255,.06); color: var(--tw-white); }
.nav-group .chevron { font-size: .75rem; transition: transform var(--t-fast); opacity: .7; }
.nav-group.collapsed .chevron { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-body { display: none; }
.nav-group-body { padding: 2px 0 4px; display: flex; flex-direction: column; gap: 1px; }
.nav-sub {
    display: flex !important;
    align-items: center;
    gap: 8px !important;
    padding: 6px 12px 6px 32px !important;
    color: rgba(255,255,255,.72) !important;
    font-size: .88rem !important;
    font-weight: 400 !important;
    border-radius: 4px !important;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-sub:hover { background: rgba(255,255,255,.05) !important; color: var(--tw-white) !important; }
.nav-sub.active {
    background: rgba(0,160,251,.16) !important;
    color: var(--tw-white) !important;
    font-weight: 600 !important;
}
.nav-sub-ic { font-size: .95rem; opacity: .85; flex-shrink: 0; }

/* ── Mobile top-bar + off-canvas drawer ───────────────────────── */
.mobile-topbar { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }

    /* Compact top-bar — hamburger + tiny logo + brand text. Hard-limited to
       48 px so it never blows up under browser chrome or long titles. */
    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        padding: 0 10px;
        height: 48px;
        min-height: 48px;
        max-height: 48px;
        background: var(--tw-primary);
        color: #fff;
        position: sticky;
        top: 0;
        z-index: 20;
        box-shadow: 0 2px 6px rgba(0,0,0,.14);
        overflow: hidden;
    }
    .mobile-menu-btn {
        background: transparent;
        border: 0;
        color: #fff;
        padding: 4px;
        border-radius: 6px;
        cursor: pointer;
        display: flex;
        flex: 0 0 auto;
    }
    .mobile-menu-btn svg { width: 22px; height: 22px; }
    .mobile-menu-btn:active { background: rgba(255,255,255,.14); }
    .mobile-brand {
        display: flex; align-items: center; gap: 6px;
        color: #fff; text-decoration: none;
        font-weight: 700; font-size: .95rem;
        line-height: 1;
        flex: 0 1 auto;
        min-width: 0;
    }
    .mobile-brand img {
        width: 24px !important; height: 24px !important;
        max-width: 24px; max-height: 24px;
        border-radius: 5px; background: #fff; padding: 1px;
        flex: 0 0 24px;
    }

    /* Sidebar: off-canvas drawer */
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        z-index: 25;
        width: 82%;
        max-width: 320px;
        height: 100vh; max-height: 100vh;
        transform: translateX(-105%);
        transition: transform .25s cubic-bezier(.4,0,.2,1);
    }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open { overflow: hidden; }

    .nav-backdrop {
        display: block;
        position: fixed; inset: 0;
        background: rgba(0,18,59,.55);
        z-index: 22;
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s;
    }
    body.nav-open .nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    /* Any nav link click closes the drawer */
    .sidebar a { -webkit-tap-highlight-color: rgba(255,255,255,.1); }

    .workspace {
        padding: var(--sp-4);
        width: 100%;
        max-width: 100%;
    }
    /* When the workspace hosts the file-manager on mobile, keep the whole
       thing scrollable and don't force flex-height. */
    /* .fm is display:block globally — no grid override needed. */
    .fm-main { padding: 12px 12px 40px !important; }
    .fm-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .fm-breadcrumb {
        font-size: .95rem;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 4px;
    }
    .fm-toolbar {
        flex-wrap: wrap;
        gap: 6px;
    }
    .fm-toolbar .fm-btn { flex-shrink: 0; }
    .fm-list .col-owner,
    .fm-list .col-date,
    .fm-list .col-size { display: none; }
    .fm-list td, .fm-list th { padding: 10px 8px; font-size: .92rem; }
    .fm-list .col-check { width: 30px; }
    .fm-list .col-actions { width: auto; }
    .fm-icon { width: 32px; height: 32px; }
    /* On mobile, row actions are always visible (no hover on touch) */
    .fm-row-actions { opacity: 1 !important; }
    .fm-row-actions button { padding: 8px 6px; font-size: 1.05rem; }
    .fm-name { gap: 8px; }
    .fm-name-text { font-size: .95rem; }
    .fm-searchbar { padding: 10px 12px; }
    .fm-searchbar input { font-size: 1rem; /* prevents iOS auto-zoom */ }

    /* Page headers on other views also compact */
    .workspace .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }
    .workspace .page-header h1 { font-size: 1.5rem; }
    .workspace .page-header .lede { font-size: .9rem; }

    /* Cards & tables mobile-friendly */
    .card { padding: 16px; }
    .table th, .table td { padding: 8px 6px; font-size: .85rem; }

    /* Modal panels never overflow the viewport */
    .modal-panel {
        width: calc(100vw - 20px);
        max-width: 100%;
        max-height: 90vh;
        overflow-y: auto;
        margin: 10px;
    }

    /* Kill horizontal scroll — everything wraps. Clip on the workspace
       instead of the body so mobile Safari doesn't unstick position:sticky
       elements (top-bar, table headers). */
    .workspace { min-width: 0; overflow-x: clip; }
    html, body { overflow-x: hidden; }
}

/* Close drawer on link click (delegated in JS) */
body.nav-open { position: relative; }

/* ═══════════════════════════════════════════════════════════════════
   File Manager — Seafile-style two-pane view
   ═══════════════════════════════════════════════════════════════════ */

/* Break out of the workspace's inner padding so the file manager fills
   the whole content area edge-to-edge. */
.workspace:has(.fm) { padding: 0; }

.fm {
    display: block;
    min-height: calc(100vh - 12px);
    background: var(--tw-white);
}
.fm-with-tree {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    align-items: stretch;
}
.fm-tree {
    border-right: 1px solid var(--tw-gray-200);
    background: var(--tw-gray-100);
    /* First row lines up with the file table's first row (below the header
       + search + table thead in .fm-main). Approx: header 60 + search 46 +
       thead 32 ≈ 138px minus the row's own 4px top-pad. */
    padding: 134px 6px 12px;
    overflow-y: auto;
    max-height: calc(100vh - 12px);
    position: sticky;
    top: 0;
    font-size: .93rem;
}
.fm-tree .ft-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: default;
}
.fm-tree .ft-row:hover { background: var(--tw-gray-200); }
.fm-tree .ft-row.active { background: rgba(0,160,251,.14); font-weight: 700; }
.fm-tree .ft-toggle {
    width: 12px;
    text-align: center;
    color: var(--tw-muted-blue);
    font-size: .75rem;
    user-select: none;
}
.fm-tree .ft-icon { font-size: 1.05rem; line-height: 1; flex-shrink: 0; }
.fm-tree .ft-label {
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.fm-tree .ft-children.collapsed { display: none; }
/* Desktop-only: Tree-Toggle-Button versteckt */
.fm-tree-toggle { display: none; }

/* v1.10.67: Folder-Picker im Move/Copy-Modal — echter Ordner-Browser
   statt Dropdown. Reuse der ft-* Styles wäre möglich, aber der Picker
   braucht ein sichtbares Highlight des ausgewählten Ziels + einen
   scrollbaren Container mit fester Höhe. */
.folder-picker-panel { max-width: 560px; }
.folder-picker {
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid var(--tw-gray-300, #d0d7de);
    border-radius: 6px;
    padding: 6px 4px;
    background: var(--tw-card-bg, #fafbfc);
    margin-top: 4px;
}
.folder-picker .fp-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
}
.folder-picker .fp-row:hover { background: var(--tw-gray-200, #eef1f5); }
.folder-picker .fp-row.selected {
    background: rgba(0,160,251,.18);
    font-weight: 600;
    outline: 1px solid rgba(0,160,251,.5);
}
.folder-picker .fp-toggle {
    width: 14px;
    text-align: center;
    color: var(--tw-muted-blue, #6b7280);
    font-size: .75rem;
    flex-shrink: 0;
}
.folder-picker .fp-icon { font-size: 1.05rem; line-height: 1; flex-shrink: 0; }
.folder-picker .fp-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.folder-picker-target {
    margin-top: 10px;
    padding: 8px 10px;
    background: var(--tw-gray-100, #f5f7fa);
    border-radius: 4px;
    font-size: .95rem;
}
.folder-picker-target strong { color: var(--tw-primary, #085a9c); }
@media (max-width: 640px) {
    .folder-picker { max-height: 280px; }
}

@media (max-width: 780px) {
    .fm-with-tree { grid-template-columns: 1fr; }
    /* v1.10.52: Tree als Bottom-Sheet-Overlay statt komplett weg.
       Standard hidden, per body.fm-tree-mobile-open eingeblendet. */
    .fm-tree {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(88vw, 340px);
        max-width: 100vw;
        background: var(--tw-surface, #fff);
        z-index: 1000;
        box-shadow: 4px 0 20px rgba(0,0,0,.15);
        overflow-y: auto;
        transform: translateX(-105%);
        transition: transform 220ms ease;
        padding: 12px 4px;
    }
    body.fm-tree-mobile-open .fm-tree {
        transform: translateX(0);
    }
    body.fm-tree-mobile-open::after {
        content: "";
        position: fixed; inset: 0;
        background: rgba(0,0,0,.35);
        z-index: 999;
        pointer-events: none; /* Klicks reichen an document durch → JS-Handler */
    }
    .fm-tree-toggle { display: inline-flex; }
}

/* ── Folder-icon picker grids ────────────────────────────────── */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--tw-gray-300);
    border-radius: 8px;
}
.emoji-tile {
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-200);
    border-radius: 6px;
    width: 44px;
    height: 44px;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.emoji-tile:hover { background: var(--tw-gray-100); }
.emoji-tile.selected { border-color: var(--tw-primary); box-shadow: 0 0 0 2px rgba(0,160,251,.4); }
.color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px;
}
.color-tile {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
}
.color-tile.selected { border-color: var(--tw-primary); box-shadow: 0 0 0 2px rgba(0,160,251,.4); }
.color-tile.color-none {
    background: var(--tw-gray-100) !important;
    color: var(--tw-muted-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ── DB-Wizard mobile-friendly layout ────────────────────────── */
.db-wizard-modeswitch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 8px 0 4px;
}
.db-wizard-modeswitch label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--tw-gray-100);
    border-radius: 8px;
    cursor: pointer;
    font-size: .95rem;
}
.db-wizard-modeswitch label:has(input:checked) {
    background: rgba(0,160,251,.10);
    outline: 2px solid var(--tw-primary-alt);
}
.db-wizard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.db-wizard-row .field { margin: 0; }
.db-wizard-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    align-items: stretch;
}
.db-wizard-actions .btn { flex: 1 1 auto; min-width: 140px; }
.db-wizard-actions .btn-primary { margin-left: auto; }
@media (max-width: 640px) {
    .db-wizard-row { grid-template-columns: 1fr; }
    .db-wizard-modeswitch { grid-template-columns: 1fr; }
    .db-wizard-actions .btn { flex: 1 1 100%; margin-left: 0 !important; }
}

/* v1.10.49 — Mobile-Sammelfix aus dem UX-Audit. Grob:
   - iOS zoomt Inputs < 16px beim Focus; global 16px auf Handy
   - Touch-Targets >= 40x40 (Apple/Google-Empfehlung ist 44, wir kompromissen
     wegen der dichten fm-row-actions)
   - kleinstmögliche Fontgrößen 12.8-13.6px, alles darunter unlesbar
   - Modals bekommen ihren padding zurechtgestutzt damit Content nicht am Rand klebt
   - .sig-*-audit Meta-Zeilen hebbar auf .85rem */
/* v1.10.49 — BYO-Cert-Row klappt auf Mobile korrekt um. Vorher schoss
   der "Prüfen"-Button aus der Zeile weil min-width der beiden Felder
   ~340px + Gap ergaben. Auf Mobile: alle Kinder untereinander. */
@media (max-width: 640px) {
    #sigByoWrap .row > .field { flex: 1 1 100% !important; min-width: 0 !important; }
    #sigByoWrap .row > button { flex: 1 1 100%; }
}

/* v1.10.49 — Signatures Detail two-column: eine Karte pro Zeile, breite
   Tabellen in scroll-container wrappen. */
@media (max-width: 900px) {
    .sig-detail-cols { grid-template-columns: 1fr !important; }
    .sig-detail-cols .card { min-width: 0 !important; }
    .sig-detail-cols table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* v1.10.58 — jede Landing-Karte (Share/Folder/Sign/Done) hat einen
   absolut positionierten Owner-Avatar oben rechts. Auf Mobile überlappt
   der Logo + Titel — deshalb auf Mobile flat-layouten: static + block,
   kleiner (48px), sitzt rechtsbündig oberhalb des Inhalts. Wir nutzen
   Attributselektoren um jeden position:absolute-Avatar in .landing-card
   automatisch mitzunehmen — kein einzelnes Retrofitting nötig. */
@media (max-width: 640px) {
    .sig-owner-avatar,
    .landing-card img[style*="position:absolute"],
    .landing-shell img[style*="position:absolute"] {
        position: static !important;
        width: 48px !important;
        height: 48px !important;
        margin: 0 0 12px auto !important;
        display: block !important;
        top: auto !important;
        right: auto !important;
    }
}

/* v1.10.56 — Mobile: jede breite Tabelle bekommt ihren eigenen
   horizontal-scroll Container, statt die GANZE Seite zu overflow'n.
   `display:block` bricht das Tabellen-Layout mit ein bisschen Reflow,
   aber alle Zellen bleiben lesbar und die Seite scrollt vertikal
   sauber. Als Notbremse verhindert `body { overflow-x: hidden }` dass
   irgendein anderer Rogue-Container den Body zum horizontal-Scrollen
   zwingt — Cards und Tables scrollen intern, die Seite selbst nie.
   Explizit: die neue table-Regel gilt auf ALLE .table Klassen — die
   dedizierten `.sig-detail-cols table` Regel weiter unten bleibt als
   Verstärkung (falls jemand das wieder ändern sollte). */
@media (max-width: 780px) {
    /* Notbremse: NIEMALS horizontal-scroll auf dem Body. Wenn irgendein
       Element trotzdem overflow'd, wird es intern gescrollt oder unsichtbar
       — die Seite selbst bleibt fest. */
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    /* Cards + Content-Container: nie über den Viewport ragen. */
    .card, .page-header, .workspace, main.workspace {
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    /* Jede Tabelle bekommt einen internen horizontal-scroll wenn sie zu
       breit ist. display:block ist entscheidend damit overflow greift —
       Tabellen sind default `display:table` und ignorieren overflow. */
    .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    /* Innerhalb der Tabelle bleiben die Zellen als table-row angeordnet,
       damit Spalten korrekt aligned bleiben. table-layout:auto (default)
       damit Content-basierte Spaltenbreite gilt — sonst würde eine
       Actions-Spalte mit einem 90px-Button gleich breit sein wie eine
       800px Name-Spalte, was den Button abschneidet. */
    .table thead, .table tbody, .table tr {
        display: table;
        width: 100%;
        table-layout: auto;
    }
    /* Lange Strings (E-Mails, URLs, Slugs) brechen statt zu overflow'n. */
    .table td, .table th {
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    /* Row-action-Button-Cluster dürfen umbrechen auf mehreren Zeilen. */
    .table td .row, .table td div[style*="flex"] {
        flex-wrap: wrap;
    }
}

/* v1.10.53 — nimConfirm / nimAlert / nimToast Dialoge (siehe
   wwwroot/js/dialogs.js). Reuse .modal-backdrop/.modal-panel Basis
   und ergänzen Icon-Header + Danger-Variante + Toast-Container. */
.nim-dialog-panel { max-width: 460px; }
.nim-dialog-head {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 8px;
}
.nim-dialog-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
    font-size: 1.4rem; flex-shrink: 0;
    background: var(--tw-gray-100, #f0f2f5);
}
.nim-dialog-icon-question { background: rgba(0,40,84,.08); color: var(--tw-primary, #002854); }
.nim-dialog-icon-warning  { background: rgba(217,140,0,.12); color: #a06b00; }
.nim-dialog-icon-error    { background: rgba(211,51,51,.12); color: var(--status-critical, #d33); }
.nim-dialog-icon-success  { background: rgba(42,127,42,.12); color: var(--status-ok, #2a7f2a); }
.nim-dialog-icon-info     { background: rgba(0,40,84,.08); color: var(--tw-primary, #002854); }
.nim-dialog-title {
    margin: 0; font-size: 1.1rem; font-weight: 600;
    line-height: 1.3;
}
.nim-dialog-body {
    margin: 8px 0 20px 0;
    color: var(--tw-text, #1a1a1a);
    line-height: 1.5;
}
.nim-dialog-actions {
    display: flex; justify-content: flex-end; gap: 8px;
    flex-wrap: wrap;
}
.nim-dialog-primary-danger {
    background: var(--status-critical, #d33);
    color: #fff;
    border: 1px solid var(--status-critical, #d33);
    padding: 10px 18px; border-radius: 6px;
    font-weight: 500; cursor: pointer;
    min-height: 40px;
}
.nim-dialog-primary-danger:hover:not(:disabled) { filter: brightness(1.1); }
.nim-dialog-primary-danger:focus-visible {
    outline: 2px solid var(--status-critical, #d33);
    outline-offset: 2px;
}

/* Toast-Container: fixed bottom-right, stack top→bottom */
#nimToastRoot {
    position: fixed;
    bottom: 20px; right: 20px;
    display: flex; flex-direction: column; gap: 8px;
    z-index: 3000;
    max-width: min(360px, calc(100vw - 40px));
    pointer-events: none;
}
.nim-toast {
    background: var(--tw-dark, #001d3d);
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
    font-size: .9rem; line-height: 1.4;
    animation: nim-toast-in 260ms ease-out;
    pointer-events: auto;
    word-wrap: break-word;
}
.nim-toast-success { background: var(--status-ok, #2a7f2a); }
.nim-toast-warning { background: #a06b00; }
.nim-toast-error   { background: var(--status-critical, #d33); }
.nim-toast-fade    { animation: nim-toast-out 300ms ease-in forwards; }
@keyframes nim-toast-in {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
@keyframes nim-toast-out {
    to { transform: translateY(-8px); opacity: 0; }
}
@media (max-width: 640px) {
    #nimToastRoot {
        left: 12px; right: 12px; bottom: 12px;
        max-width: none;
    }
    .nim-toast { font-size: .95rem; }
}

/* v1.10.52 — PDF-Preview auf Sign-Landing: doppel-scroll auf iOS ist
   frustrierend, oft "scroll gefangen". Auf Mobile lassen wir den
   PDF-Container natürlich mitscrollen mit der Seite. */
@media (max-width: 780px) {
    #pdfPages {
        max-height: none !important;
        overflow-y: visible !important;
    }
}

/* v1.10.52 — Sig-Summary-Sprachwahl war schmaler als der Nachbar-Button.
   Angleichen auf 40px Höhe, damit die Row visuell konsistent ist. */
.sig-summary-card select {
    min-height: 40px;
    padding: 8px 12px;
}

@media (max-width: 640px) {
    input, select, textarea { font-size: 16px !important; }
    .btn-sm { min-height: 40px; padding: 10px 14px; }
    .fm-row-actions button { min-width: 40px; min-height: 40px; }
    .landing-card { padding: var(--sp-5); }
    .modal-panel { padding: 12px !important; }
    .sig-audit-when, .sig-audit-who, .sig-audit-note { font-size: .85rem; }
    /* Signatur-Modus-Toggles bekommen fettere Touch-Targets */
    .sig-shell button[onclick^="setSigMode"] { padding: 10px 14px !important; font-size: .9rem !important; min-height: 40px; }
    /* Mobile-Topbar Titel darf clippen mit Ellipsis statt zu overflow'n */
    .mobile-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
    /* Landing-Card innen enger */
    .landing-shell { padding: var(--sp-3) !important; }
    /* Extreme Micro-Fonts (Wizard-Steps, Details) auf mindestens 12px */
    body { --min-mobile-font: .75rem; }
    p.muted, span.muted, div.muted { font-size: max(0.85rem, .75rem); }
}

/* Prevent accidental modal closes: the modal-panel captures mousedown so a
   drag that ends outside the panel still counts as an "inside" interaction. */
.modal-panel { user-select: text; }

/* ── Avatar popover (Profil / Abmelden) ─────────────────────── */
.avatar-popover {
    position: fixed;
    z-index: 9600;
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,.18);
    padding: 6px;
    min-width: 180px;
    animation: avatarPopIn .12s ease-out;
}
@keyframes avatarPopIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.avatar-popover a {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: var(--tw-text);
    border-radius: 6px;
    font-size: .92rem;
}
.avatar-popover a:hover { background: var(--tw-gray-100); }
.avatar-popover a.logout { color: var(--status-critical, #d33); border-top: 1px solid var(--tw-gray-200); margin-top: 2px; padding-top: 10px; }

/* Nav-badge for unread notifications, plus visual highlight on unread notif cards. */
.nav-badge {
    display: inline-block;
    background: var(--status-critical, #d33);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: .72rem;
    font-weight: 700;
    margin-left: 6px;
    line-height: 1.4;
    min-width: 18px;
    text-align: center;
    vertical-align: middle;
}
.notif-unread {
    border-left: 3px solid var(--tw-primary-alt, #00a0fb);
    background: rgba(0,160,251,.04);
}

/* ── Signer landing: two-column layout with audit sidebar ─── */
.sig-shell { max-width: 1200px; margin: 0 auto; padding: 20px; }
.sig-two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
}
.sig-audit {
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-200);
    border-radius: 12px;
    padding: 16px;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.sig-audit-list {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}
.sig-audit-list::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--tw-gray-200);
}
.sig-audit-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    position: relative;
}
.sig-audit-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--tw-white);
    border: 2px solid var(--tw-gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    z-index: 1;
    flex-shrink: 0;
}
.sig-audit-item.sig-audit-signed .sig-audit-icon { border-color: var(--status-ok, #22a05a); background: rgba(34,160,90,.10); }
.sig-audit-item.sig-audit-declined .sig-audit-icon { border-color: var(--status-critical, #d33); background: rgba(211,51,51,.10); }
.sig-audit-item.sig-audit-viewed .sig-audit-icon { border-color: var(--tw-primary-alt, #00a0fb); background: rgba(0,160,251,.10); }
.sig-audit-item.sig-audit-finalized .sig-audit-icon { border-color: var(--tw-yellow, #ffc600); background: rgba(255,198,0,.15); }
.sig-audit-body { flex: 1; min-width: 0; }
.sig-audit-title { font-weight: 600; font-size: .9rem; }
.sig-audit-who { font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-audit-when { font-size: .72rem; margin-top: 2px; }
.sig-audit-note {
    font-size: .82rem;
    background: var(--tw-gray-100);
    padding: 4px 8px;
    border-radius: 6px;
    margin-top: 4px;
    font-style: italic;
    color: var(--tw-text);
}
@media (max-width: 900px) {
    .sig-two-col { grid-template-columns: 1fr; }
    .sig-audit { position: static; max-height: none; }
}

/* ── Main file pane ────────────────────────────────────────────── */
.fm-main {
    padding: 18px 24px 40px;
    overflow-x: hidden;
    position: relative;
}
.fm-main {
    /* Keep the drop target always big enough to hit — otherwise the dashed
       outline "shrinks" as files fill the list because .fm-main is only as
       tall as its content. */
    min-height: calc(100vh - 20px);
}
.fm-main.drag {
    outline: 3px dashed var(--tw-primary-alt);
    outline-offset: -12px;
    background: rgba(0,160,251,.04);
}
.fm-main.drag::after {
    content: attr(data-drop-label) " — Datei(en) hier ablegen";
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--tw-primary);
    color: #fff;
    padding: 18px 28px;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,.35);
    font-weight: 700;
    font-size: 1.1rem;
    z-index: 9999;
    pointer-events: none;
    letter-spacing: .5px;
}

/* ── Upload progress panel (bottom-right toast) ─────────────────── */
.up-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    max-height: 60vh;
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0,0,0,.22);
    z-index: 9500;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: .92rem;
}
.up-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--tw-primary);
    color: #fff;
    font-weight: 700;
}
.up-panel-close {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: .8;
    padding: 0 4px;
}
.up-panel-close:hover { opacity: 1; }
.up-panel-body {
    overflow-y: auto;
    padding: 8px 12px;
}
.up-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid var(--tw-gray-200);
}
.up-row:last-child { border-bottom: 0; }
.up-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.up-row-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--tw-text);
    flex: 1;
    min-width: 0;
}
.up-row-bar {
    height: 6px;
    background: var(--tw-gray-200);
    border-radius: 3px;
    overflow: hidden;
}
.up-row-bar-fill {
    height: 100%;
    width: 0;
    background: var(--tw-primary-alt);
    transition: width .15s linear;
}
.up-row-status {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--tw-muted-blue);
    font-size: .85rem;
    font-weight: 600;
    flex-shrink: 0;
}
.up-row-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: .78rem;
    color: var(--tw-muted-blue);
    font-variant-numeric: tabular-nums;
}
.up-row-meta > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-row-speed { text-align: center; opacity: .85; }
.up-row-eta { text-align: right; opacity: .85; }
.up-row-ok .up-row-bar-fill { background: var(--status-ok, #22a05a); }
.up-row-ok .up-row-status { color: var(--status-ok, #22a05a); font-weight: 700; }
.up-row-err .up-row-bar-fill { background: var(--status-critical, #d33); }
.up-row-err .up-row-status { color: var(--status-critical, #d33); font-weight: 700; cursor: help; }
.fm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--tw-gray-200);
    gap: 12px;
    flex-wrap: wrap;
}
.fm-breadcrumb {
    font-size: 1.05rem;
    color: var(--tw-muted-blue);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.fm-breadcrumb a {
    color: var(--tw-primary-alt);
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 3px;
}
.fm-breadcrumb a:hover { background: var(--tw-gray-200); }
.fm-crumb-current { color: var(--tw-primary); font-weight: 700; }
.fm-crumb-sep { color: var(--tw-muted-blue); opacity: .6; }

.fm-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.fm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: 6px;
    color: var(--tw-primary);
    cursor: pointer;
    font-size: .88rem;
    font-weight: 500;
    transition: all .12s;
}
.fm-btn:hover {
    background: var(--tw-gray-100);
    border-color: var(--tw-primary-alt);
    color: var(--tw-primary-alt);
}
.fm-btn-primary {
    background: var(--tw-primary-alt);
    border-color: var(--tw-primary-alt);
    color: #fff;
}
.fm-btn-primary:hover {
    background: var(--tw-primary);
    color: #fff;
}

.fm-searchbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--tw-gray-100);
    border-radius: 8px;
    margin-bottom: 12px;
}
.fm-searchbar input {
    flex: 1;
    border: 0;
    background: transparent;
    outline: none;
    font-size: .92rem;
    color: var(--tw-primary);
}
.fm-search-icon { opacity: .55; }
.fm-search-results {
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: 8px;
    margin-bottom: 12px;
    max-height: 320px;
    overflow-y: auto;
}
.fm-search-results .hit {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--tw-gray-200);
}
.fm-search-results .hit:last-child { border-bottom: 0; }
.fm-search-results .hit:hover { background: var(--tw-gray-100); }
.fm-search-results .score { font-size: .72rem; color: var(--tw-muted-blue); margin-left: 6px; }

.fm-flash {
    padding: 8px 12px; margin-bottom: 10px; border-radius: 6px; font-size: .9rem;
}
.fm-flash-ok  { background: rgba(0,235,134,.08); color: var(--status-ok); border-left: 3px solid var(--status-ok); }
.fm-flash-err { background: rgba(220,38,38,.08); color: var(--status-critical); border-left: 3px solid var(--status-critical); }

.fm-bulkbar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    margin-bottom: 10px;
    background: rgba(0,160,251,.10);
    border-radius: 6px;
    font-size: .88rem;
}
.fm-bulkbar.on { display: flex; }
.fm-bulkbar button {
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-300);
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: .85rem;
}
.fm-bulkbar button:hover { background: var(--tw-gray-100); }

/* ── File list ──────────────────────────────────────────────────── */
.fm-list {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}
.fm-list thead th {
    text-align: left;
    padding: 8px 12px;
    color: var(--tw-muted-blue);
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--tw-gray-300);
    background: var(--tw-gray-100);
    position: sticky;
    top: 0;
    z-index: 2;
}
.fm-sort { cursor: pointer; user-select: none; }
.fm-sort:hover { color: var(--tw-primary); }
.fm-sort-caret { display: inline-block; width: 12px; color: var(--tw-primary-alt); font-size: .8rem; margin-left: 2px; }
.fm-list tbody tr {
    border-bottom: 1px solid var(--tw-gray-200);
    cursor: default;
    transition: background .08s;
}
.fm-list tbody tr:hover { background: rgba(0,160,251,.06); }
.fm-list tbody tr.selected { background: rgba(0,160,251,.12); }
.fm-list td {
    padding: 8px 12px;
    vertical-align: middle;
    color: var(--tw-primary);
}
.fm-list .col-check   { width: 36px; }
.fm-list .col-size    { width: 110px; }
.fm-list .col-date    { width: 170px; }
.fm-list .col-owner   { width: 160px; }
.fm-list .col-actions { width: 150px; text-align: right; }

.fm-name {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--tw-primary);
    text-decoration: none;
    max-width: 100%;
}
.fm-name:hover { color: var(--tw-primary-alt); }
.fm-name-text { overflow: hidden; text-overflow: ellipsis; }

.fm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    flex-shrink: 0;
    font-size: 1rem;
}
.fm-icon-folder {
    background: linear-gradient(135deg,#ffd966,#e6b800);
    color: #6b4b00;
    font-size: 1.05rem;
}
.fm-icon-file {
    background: #eef2f6;
    color: var(--tw-primary);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: -.5px;
}
.fm-icon-file.pdf { background: #fde3e3; color: #b31313; }
.fm-icon-file.doc { background: #dde8fb; color: #1d4ed8; }
.fm-icon-file.xls { background: #d8f0dd; color: #106b2c; }
.fm-icon-file.ppt { background: #fde3d0; color: #b04a08; }
.fm-icon-file.img { background: #e9d5ff; color: #6d28d9; }
.fm-icon-file.vid { background: #dbeafe; color: #1e40af; }
.fm-icon-file.zip { background: #f4e3ff; color: #8b5cf6; }
.fm-icon-file.txt { background: #f1f5f9; color: #475569; }

.fm-row-actions {
    display: inline-flex;
    gap: 2px;
    opacity: 0;
    transition: opacity .1s;
    justify-content: flex-end;
}
.fm-list tbody tr:hover .fm-row-actions,
.fm-list tbody tr.selected .fm-row-actions { opacity: 1; }
.fm-row-actions button {
    background: transparent;
    border: 0;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: .95rem;
    color: var(--tw-muted-blue);
}
.fm-row-actions button:hover {
    background: var(--tw-white);
    color: var(--tw-primary-alt);
    box-shadow: 0 0 0 1px var(--tw-gray-300);
}
.fm-row-actions form { display: inline; margin: 0; }

.fm-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--tw-muted-blue);
}
.fm-empty-art { font-size: 4rem; opacity: .5; margin-bottom: 12px; }
.fm-empty-title { font-size: 1rem; font-weight: 600; margin-bottom: 4px; color: var(--tw-primary); }
.fm-empty-hint { font-size: .85rem; }

/* Mobile column-hide + fm sidebar override are handled in the app-shell
   mobile media block above — nothing more needed here. */
