/* ================================================================
   Integra3D-Cloud  --  Nextcloud 26 Design Language
   Brand: #000207 (Integra3D dark) | Flat, minimal, clean
   Exact match of Integra3D Nextcloud theming (container 105)
   Built: February 2026
   ================================================================ */

/* ================================================================
   1.  CSS CUSTOM PROPERTIES
   ================================================================ */
:root {
    /* -- Brand palette (exact from Integra3D NC theming DB) -- */
    --color-primary:            #000207;
    --color-primary-dark:       #000002;
    --color-primary-darker:     #000000;
    --color-primary-light:      #e5e5e6;
    --color-primary-lighter:    #f2f2f3;
    --color-primary-rgb:        0, 2, 7;
    --color-primary-text:       #ffffff;
    --color-primary-element:    #000207;
    --color-primary-element-hover: #323438;

    /* -- Accent color for interactive elements (buttons, links, active states) -- */
    --color-accent:             #D63384;
    --color-accent-dark:        #B52A6F;
    --color-accent-light:       rgba(214, 51, 132, 0.1);
    --color-accent-rgb:         214, 51, 132;

    /* -- Semantic colours -- */
    --color-success:            #46ba61;
    --color-success-dark:       #38994e;
    --color-success-light:      #e6f5eb;
    --color-success-rgb:        70, 186, 97;

    --color-error:              #e9322d;
    --color-error-dark:         #c52a26;
    --color-error-light:        #fce4e4;
    --color-error-rgb:          233, 50, 45;

    --color-warning:            #eca700;
    --color-warning-dark:       #c48c00;
    --color-warning-light:      #fef3cd;
    --color-warning-rgb:        236, 167, 0;

    --color-info:               #0082c9;
    --color-info-dark:          #006ba4;
    --color-info-light:         #d9eef9;
    --color-info-rgb:           0, 130, 201;

    /* -- Neutral surfaces (NC26 style) -- */
    --color-main-background:    #ffffff;
    --color-background-hover:   #f5f5f5;
    --color-background-dark:    #ededed;
    --color-background-darker:  #dbdbdb;
    --color-input-bg:           #ffffff;
    --color-card-bg:            #ffffff;

    /* -- Text (NC26 spec) -- */
    --color-main-text:          #222222;
    --color-text-secondary:     #555555;
    --color-text-maxcontrast:   #767676;
    --color-text-disabled:      #b0b0b0;
    --color-text-link:          #000207;
    --color-text-inverse:       #ffffff;

    /* -- Header (exact Integra3D NC: #000207 dark header) -- */
    --color-header:             #000207;
    --color-header-text:        #ffffff;
    --color-header-text-dim:    rgba(255, 255, 255, 0.7);

    /* -- Sidebar -- */
    --color-sidebar-bg:         #ffffff;
    --color-sidebar-border:     #ededed;

    /* -- Overlays -- */
    --color-modal-backdrop:     rgba(0, 0, 0, 0.50);
    --color-dropzone-bg:        rgba(0, 2, 7, 0.06);

    /* -- Borders (NC26: 7% and 14% darken of white) -- */
    --border-color:             #ededed;
    --border-color-dark:        #dbdbdb;

    /* -- Radii (NC26 spec) -- */
    --border-radius:            3px;
    --border-radius-md:         6px;
    --border-radius-large:      10px;
    --border-radius-xl:         16px;
    --border-radius-pill:       100px;
    --border-radius-rounded:    50%;

    /* -- Shadows (NC26: very subtle, uses rgba(77,77,77,0.5)) -- */
    --shadow-xs:                0 1px 1px rgba(77, 77, 77, 0.04);
    --shadow-sm:                0 1px 2px rgba(77, 77, 77, 0.06);
    --shadow:                   0 1px 3px rgba(77, 77, 77, 0.1);
    --shadow-md:                0 2px 6px rgba(77, 77, 77, 0.12);
    --shadow-lg:                0 4px 14px rgba(77, 77, 77, 0.15);
    --shadow-xl:                0 8px 30px rgba(77, 77, 77, 0.18);
    --shadow-focus:             0 0 0 2px rgba(var(--color-accent-rgb), 0.4);
    --shadow-focus-error:       0 0 0 2px rgba(var(--color-error-rgb), 0.4);

    /* -- Typography (NC26 spec) -- */
    --font-face:                -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                                 Oxygen-Sans, Cantarell, Ubuntu, 'Helvetica Neue',
                                 Arial, sans-serif;
    --font-mono:                'Menlo', 'Consolas', 'DejaVu Sans Mono', monospace;
    --default-font-size:        15px;
    --default-line-height:      24px;

    /* -- Spacing scale (4px base) -- */
    --space-1:                  4px;
    --space-2:                  8px;
    --space-3:                  12px;
    --space-4:                  16px;
    --space-5:                  20px;
    --space-6:                  24px;
    --space-8:                  32px;
    --space-10:                 40px;
    --space-12:                 48px;
    --space-16:                 64px;

    /* -- Layout (NC26 spec) -- */
    --header-height:            50px;
    --navigation-width:         300px;
    --right-sidebar-width:      380px;
    --content-max-width:        1400px;

    /* -- NC26 item sizing -- */
    --default-clickable-area:   44px;
    --default-grid-baseline:    4px;

    /* -- Z-index layers -- */
    --z-base:                   1;
    --z-dropdown:               100;
    --z-sticky:                 150;
    --z-sidebar:                40;
    --z-overlay:                200;
    --z-context:                200;
    --z-upload:                 210;
    --z-dropzone:               250;
    --z-modal-backdrop:         300;
    --z-modal:                  301;
    --z-toast:                  500;
    --z-loading:                9999;

    /* -- Transitions (NC26: quick=100ms, slow=300ms) -- */
    --animation-quick:          100ms;
    --animation-slow:           300ms;
    --transition-quick:         100ms ease;
    --transition:               200ms ease;
    --transition-slow:          300ms ease;
}


/* ================================================================
   2.  RESET & BASE
   ================================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

[hidden] {
    display: none !important;
}

html {
    font-size: var(--default-font-size);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    tab-size: 4;
    scrollbar-width: thin;
    scrollbar-color: var(--color-background-darker) transparent;
}

body {
    font-family: var(--font-face);
    font-size: var(--default-font-size);
    line-height: var(--default-line-height);
    color: var(--color-main-text);
    background: var(--color-main-background);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Thin scrollbars (NC26 style) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-background-darker);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-maxcontrast);
}

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

a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--border-radius);
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
    font-size: inherit;
    color: inherit;
    line-height: inherit;
}

button:disabled {
    cursor: not-allowed;
}

input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    line-height: inherit;
}

input::placeholder,
textarea::placeholder {
    color: var(--color-text-maxcontrast);
    opacity: 1;
}

ul, ol {
    list-style: none;
}

img, svg {
    max-width: 100%;
    display: block;
}

img {
    height: auto;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.25;
    color: var(--color-main-text);
}

h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }
h5 { font-size: 14px; }
h6 { font-size: 13px; }

p {
    margin-bottom: var(--space-3);
}

p:last-child {
    margin-bottom: 0;
}

strong, b {
    font-weight: 600;
}

small {
    font-size: 12px;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 2px 6px;
    background: var(--color-background-dark);
    border-radius: var(--border-radius);
}

pre {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
}

hr {
    border: none;
    height: 1px;
    background: var(--border-color);
    margin: var(--space-4) 0;
}

::selection {
    background: rgba(var(--color-primary-rgb), 0.2);
    color: var(--color-main-text);
}

/* Focus ring utility */
.focus-ring:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}


/* ================================================================
   3.  LOADING SCREEN
   ================================================================ */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: var(--z-loading);
    background: linear-gradient(40deg, #000207 0%, #323438 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-5);
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: var(--space-6);
}

.loader-brand img {
    height: 56px;
    width: auto;
    animation: pulse 2s ease-in-out infinite;
}

.loader-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-inverse);
    letter-spacing: -0.3px;
    opacity: 0.95;
}


/* ================================================================
   4.  LOGIN VIEW  (NC26 exact match — dark bg + background image)
   ================================================================ */

/* NC26: body background = primary color + background image, fixed */
.login-view {
    position: fixed;
    inset: 0;
    z-index: var(--z-dropdown);
    background: url('background.png') center / cover no-repeat fixed, #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* No longer needed — background is on .login-view directly */
.login-bg { display: none; }

/* No overlay — NC26 has none */
.login-view::before { display: none; }

/* Container — wraps logo + card + footer, stands out from background */
.login-container {
    position: relative;
    z-index: 2;
    background: rgba(60, 60, 70, 0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 40px 36px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Logo wrap — inside the container */
.login-logo-wrap {
    margin-bottom: 20px;
    text-align: center;
}

.login-logo {
    display: block;
    width: 280px;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    margin: 0 auto;
}

/* Form card — white, contrasts against the dark container */
.login-card {
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius-large, 10px);
    padding: 20px;
    width: 300px;
    max-width: 90vw;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-align: center;
}

/* Form layout */
#login-form {
    text-align: left;
}

#login-form .form-group {
    margin-bottom: 0;
}

/* NC26 login inputs: 20px font, full-width, border-radius 3px, no labels */
#login-form input[type="text"],
#login-form input[type="password"],
#login-form input[type="email"] {
    width: 100%;
    padding: 12px 10px;
    border: 1px solid var(--border-color-dark, #dbdbdb);
    border-radius: 3px;
    background: var(--color-main-background, #fff);
    font-size: 20px;
    color: var(--color-main-text, #222);
    cursor: text;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}

/* NC26: stacked inputs share border — remove bottom radius on first, top on second */
#login-form .form-group:first-child input {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: 0;
}

#login-form .form-group:nth-child(2) input {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

#login-form input:focus {
    border-color: var(--color-primary, #000207);
    box-shadow: none;
}

#login-form input.error {
    border-color: var(--color-error);
}

/* Error message */
#login-error,
.login-error {
    color: var(--color-error, #DC3545);
    font-size: 13px;
    margin: 10px 0 0;
    min-height: 18px;
    text-align: center;
}

/* Login submit: pill, brand red background */
#login-form .btn-block {
    border-radius: 100px;
    font-size: 20px;
    padding: 14px 16px;
    margin-top: 16px;
    width: 100%;
    font-weight: 700;
    cursor: pointer;
    background-color: #AA1D2F;
    border-color: #AA1D2F;
    color: #fff;
}
#login-form .btn-block:hover {
    background-color: #8B1726;
    border-color: #8B1726;
}

/* Footer — sits below card, brand red text */
.login-footer {
    color: #AA1D2F;
    font-size: 13px;
    margin-top: 20px;
    text-align: center;
    font-weight: 500;
}

.login-footer p {
    margin: 4px 0;
}

.login-slogan {
    font-size: 14px;
    font-weight: 600;
}


/* ================================================================
   5.  MAIN APP LAYOUT (CSS Grid)
   ================================================================ */
.app-layout {
    display: grid;
    height: 100vh;
    width: 100vw;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-columns: var(--navigation-width) 1fr;
    grid-template-areas:
        "navbar  navbar"
        "sidebar content";
    overflow: hidden;
}

/* When right-sidebar is open */
.app-layout.details-open {
    grid-template-columns: var(--navigation-width) 1fr var(--right-sidebar-width);
    grid-template-areas:
        "navbar  navbar  navbar"
        "sidebar content rsidebar";
}


/* ================================================================
   6.  NAVBAR / HEADER  (NC26: primary color as background, 50px)
   ================================================================ */
.navbar {
    grid-area: navbar;
    height: var(--header-height);
    background: var(--color-header);
    display: flex;
    align-items: center;
    padding: 0 var(--space-2);
    gap: 0;
    flex-shrink: 0;
    z-index: var(--z-sticky);
    position: relative;
}

/* -- Navbar Left -- */
.navbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: var(--navigation-width);
    flex-shrink: 0;
    padding-left: var(--space-2);
    padding-right: var(--space-3);
}

.navbar-left .icon-btn {
    color: var(--color-header-text-dim);
    padding: 8px;
    border-radius: var(--border-radius-pill);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-left .icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-text-inverse);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text-inverse);
    text-decoration: none;
    transition: opacity var(--transition);
}

.navbar-brand:hover {
    color: var(--color-text-inverse);
    text-decoration: none;
    opacity: 0.90;
}

.navbar-brand img {
    height: 30px;
    width: auto;
    flex-shrink: 0;
}

.navbar-brand svg {
    color: var(--color-text-inverse);
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.navbar-brand span {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.3px;
    white-space: nowrap;
}

/* -- Navbar Center -- */
.navbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 var(--space-5);
    min-width: 0;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 480px;
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-header-text-dim);
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.search-box input {
    width: 100%;
    padding: 7px 14px 7px 40px;
    border: 2px solid transparent;
    border-radius: var(--border-radius-pill);
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-text-inverse);
    font-size: 14px;
    transition: all var(--transition);
    height: 36px;
}

.search-box input::placeholder {
    color: var(--color-header-text-dim);
}

.search-box input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

/* -- Navbar Right -- */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
    padding-right: var(--space-2);
}

.navbar-right .btn-primary {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius-pill);
    padding: 6px 16px;
    font-size: 13px;
    white-space: nowrap;
    color: var(--color-text-inverse);
}

.navbar-right .btn-primary:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.navbar-right .icon-btn {
    color: var(--color-header-text-dim);
    position: relative;
    padding: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-pill);
}

.navbar-right .icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-text-inverse);
}

/* Badge count on icon buttons */
.badge-count {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--color-error);
    color: var(--color-text-inverse);
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    pointer-events: none;
    animation: pulse 2s ease-in-out infinite;
}

/* Avatar button */
.avatar-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-rounded);
    background: rgba(255, 255, 255, 0.3);
    color: var(--color-text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--transition), background var(--transition);
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.avatar-btn svg {
    width: 18px;
    height: 18px;
}

.avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-btn:hover {
    background: rgba(255, 255, 255, 0.45);
}

/* -- User Dropdown (NC26: drop-shadow filter, border-radius 10px) -- */
.user-dropdown {
    position: absolute;
    top: calc(var(--header-height) - 4px);
    right: var(--space-2);
    background: var(--color-card-bg);
    border-radius: var(--border-radius-large);
    filter: drop-shadow(0 1px 5px rgba(77, 77, 77, 0.3));
    min-width: 220px;
    z-index: var(--z-dropdown);
    overflow: hidden;
    animation: fadeIn var(--animation-quick) ease;
}

.dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 14px;
    color: var(--color-main-text);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    color: var(--color-main-text);
    font-size: 14px;
    transition: background var(--transition-quick);
    text-decoration: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    height: var(--default-clickable-area);
    line-height: var(--default-clickable-area);
}

.dropdown-item:hover {
    background: var(--color-background-hover);
    color: var(--color-main-text);
    text-decoration: none;
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
    color: var(--color-text-maxcontrast);
    flex-shrink: 0;
}

.dropdown-item:hover svg {
    color: var(--color-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}


/* ================================================================
   7.  NOTIFICATION DROPDOWN
   ================================================================ */
.notif-dropdown {
    position: absolute;
    top: calc(var(--header-height) - 4px);
    right: 50px;
    background: var(--color-card-bg);
    border-radius: var(--border-radius-large);
    filter: drop-shadow(0 1px 5px rgba(77, 77, 77, 0.3));
    min-width: 320px;
    max-width: 400px;
    z-index: var(--z-dropdown);
    overflow: hidden;
    animation: fadeIn var(--animation-quick) ease;
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 14px;
}

.notif-list {
    max-height: 360px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.notif-list .notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-quick);
    cursor: pointer;
    font-size: 13px;
}

.notif-list .notif-item:last-child {
    border-bottom: none;
}

.notif-list .notif-item:hover {
    background: var(--color-background-hover);
}

.notif-list .notif-item.unread {
    background: var(--color-primary-lighter);
}

.notif-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--color-text-maxcontrast);
    font-size: 14px;
}


/* ================================================================
   8.  SIDEBAR  (NC26 app-navigation style)
   ================================================================ */
.sidebar {
    grid-area: sidebar;
    width: var(--navigation-width);
    background: var(--color-sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--color-sidebar-border);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: var(--z-sidebar);
    transition: width var(--transition-slow), transform var(--transition-slow);
    scrollbar-width: thin;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-2) var(--space-2);
    display: flex;
    flex-direction: column;
}

/* NC26 nav items: 44px height, simple text with icon, pill shape active/hover */
.sidebar-item,
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    color: var(--color-main-text);
    border-radius: var(--border-radius-pill);
    transition: background var(--animation-quick), color var(--animation-quick);
    margin-bottom: 2px;
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    position: relative;
    white-space: nowrap;
    height: var(--default-clickable-area);
    line-height: var(--default-clickable-area);
}

.sidebar-item:hover,
.nav-item:hover {
    background: var(--color-background-hover);
    text-decoration: none;
}

/* NC26 active: primary-light background */
.sidebar-item.active,
.nav-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}

.sidebar-item svg,
.nav-item svg,
.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity var(--transition-quick), color var(--transition-quick);
}

.sidebar-item:hover svg,
.sidebar-item.active svg,
.nav-item:hover svg,
.nav-item.active svg,
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
    opacity: 1;
    color: var(--color-primary);
}

/* Sidebar sections */
.sidebar-divider {
    height: 1px;
    background: var(--color-sidebar-border);
    margin: var(--space-2) var(--space-3);
}

.sidebar-section-label,
.sidebar-admin-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-maxcontrast);
    padding: var(--space-2) var(--space-4) var(--space-1);
    user-select: none;
}

/* Sidebar collapsed state */
.sidebar.collapsed {
    width: 0;
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border: none;
}

.sidebar.collapsed ~ .content {
    margin-left: 0;
}

.app-layout:has(.sidebar.collapsed) {
    grid-template-columns: 0 1fr;
}

.app-layout.details-open:has(.sidebar.collapsed) {
    grid-template-columns: 0 1fr var(--right-sidebar-width);
}

/* Sidebar quota (NC26 style: bottom of navigation) */
.sidebar-quota,
.storage-info {
    padding: 14px 16px;
    border-top: 1px solid var(--color-sidebar-border);
    flex-shrink: 0;
}

.quota-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--color-text-maxcontrast);
    margin-bottom: 6px;
}

.quota-bar,
.storage-bar {
    height: 6px;
    background: var(--color-background-dark);
    border-radius: 3px;
    overflow: hidden;
}

.quota-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.quota-fill.warning {
    background: var(--color-warning);
}

.quota-fill.danger {
    background: var(--color-error);
}


/* ================================================================
   9.  CONTENT AREA
   ================================================================ */
.content {
    grid-area: content;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-5) var(--space-8);
    background: var(--color-main-background);
    min-width: 0;
    position: relative;
    scrollbar-width: thin;
}

.main-content {
    grid-area: content;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5) var(--space-8);
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.2s ease;
}

.view:not([hidden]) {
    display: block;
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}

.view-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-main-text);
    margin: 0;
}

.view-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-main-text);
    margin-bottom: 18px;
}


/* ================================================================
   10.  BREADCRUMB
   ================================================================ */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 14px;
    font-size: 14px;
    flex-wrap: wrap;
    min-height: 32px;
}

.breadcrumb-item,
.breadcrumb a {
    color: var(--color-text-maxcontrast);
    padding: 4px 8px;
    border-radius: var(--border-radius-pill);
    transition: all var(--transition-quick);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    white-space: nowrap;
    font-size: 14px;
}

.breadcrumb-item:hover,
.breadcrumb a:hover {
    background: var(--color-background-hover);
    color: var(--color-primary);
    text-decoration: none;
}

.breadcrumb-item.current {
    color: var(--color-main-text);
    font-weight: 600;
    cursor: default;
}

.breadcrumb-item.current:hover {
    background: none;
    color: var(--color-main-text);
}

.breadcrumb-sep {
    color: var(--color-text-maxcontrast);
    font-size: 11px;
    margin: 0 2px;
    user-select: none;
}

.breadcrumb svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}


/* ================================================================
   11.  TOOLBAR
   ================================================================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: auto;
}

.toolbar-title {
    font-size: 18px;
    font-weight: 700;
}

.toolbar-spacer {
    flex: 1;
}

/* Select small (NC26: simple, border-radius 3px) */
.select-sm {
    padding: 6px 30px 6px 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-pill);
    background: var(--color-main-background);
    font-size: 13px;
    color: var(--color-main-text);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23767676'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    transition: border-color var(--transition-quick);
    min-height: 34px;
}

.select-sm:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* View toggle (grid/list) */
.layout-toggle,
.view-toggle {
    display: flex;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-pill);
    overflow: hidden;
}

.layout-toggle .icon-btn,
.view-toggle .icon-btn {
    border-radius: 0;
    padding: 5px 10px;
    border: none;
    color: var(--color-text-maxcontrast);
    background: transparent;
    height: 30px;
    width: 34px;
}

.layout-toggle .icon-btn.active,
.view-toggle .icon-btn.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.layout-toggle .icon-btn:hover,
.view-toggle .icon-btn:hover {
    background: var(--color-background-hover);
}

.layout-toggle .icon-btn + .icon-btn,
.view-toggle .icon-btn + .icon-btn {
    border-left: 1px solid var(--border-color);
}


/* ================================================================
   12.  BUTTONS  (NC26: very rounded, pill shape primary)
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: var(--border-radius-pill);
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
    border: 2px solid transparent;
    transition: background var(--animation-quick),
                border-color var(--animation-quick),
                color var(--animation-quick),
                opacity var(--animation-quick);
    cursor: pointer;
    user-select: none;
    position: relative;
    overflow: hidden;
    min-height: 36px;
}

.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Primary (NC26: pill, primary bg, white text) */
.btn-primary {
    background: var(--color-primary-element);
    color: var(--color-primary-text);
    border-color: var(--color-primary-element);
}

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

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

/* Secondary (NC26: border, background-dark) */
.btn-secondary {
    background: var(--color-main-background);
    color: var(--color-main-text);
    border: 2px solid var(--border-color-dark);
}

.btn-secondary:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-lighter);
}

/* Danger */
.btn-danger {
    background: var(--color-error);
    color: var(--color-text-inverse);
    border-color: var(--color-error);
}

.btn-danger:hover {
    background: var(--color-error-dark);
    border-color: var(--color-error-dark);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--color-text-maxcontrast);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--color-background-hover);
    color: var(--color-main-text);
}

/* Icon-only button variant */
.btn-icon {
    padding: 6px;
    min-width: 36px;
    min-height: 36px;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* Sizes */
.btn-sm {
    padding: 4px 14px;
    font-size: 13px;
    min-height: 32px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
    min-height: 44px;
}

/* Block */
.btn-block {
    width: 100%;
    padding: 10px;
    font-size: 15px;
    margin-top: 6px;
}

/* Button loading state */
.btn.loading {
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-secondary.loading::after {
    border-color: rgba(0, 0, 0, 0.15);
    border-top-color: var(--color-primary);
}

/* Disabled state */
.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button group */
.btn-group {
    display: inline-flex;
    border-radius: var(--border-radius-pill);
    overflow: hidden;
}

.btn-group .btn {
    border-radius: 0;
    margin: 0;
}

.btn-group .btn:first-child {
    border-radius: var(--border-radius-pill) 0 0 var(--border-radius-pill);
}

.btn-group .btn:last-child {
    border-radius: 0 var(--border-radius-pill) var(--border-radius-pill) 0;
}

.btn-group .btn + .btn {
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-group .btn-secondary + .btn-secondary {
    border-left-color: var(--border-color);
}

/* Icon button (standalone) */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-pill);
    color: var(--color-text-maxcontrast);
    font-size: 13px;
    font-weight: 500;
    transition: background var(--animation-quick), color var(--animation-quick);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    border: none;
    background: none;
}

.icon-btn:hover {
    background: var(--color-background-hover);
    color: var(--color-primary);
}

.icon-btn.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.icon-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}


/* ================================================================
   13.  FORM ELEMENTS
   ================================================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label,
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-main-text);
    margin-bottom: 6px;
    user-select: none;
}

.form-group label .required,
.form-label .required {
    color: var(--color-error);
    margin-left: 2px;
}

/* NC26 inputs: border 2px, border-radius 3px */
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="tel"],
.form-group input[type="search"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group textarea,
.form-group select,
.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color-dark);
    border-radius: var(--border-radius);
    background: var(--color-main-background);
    color: var(--color-main-text);
    font-size: 14px;
    transition: border-color var(--transition-quick), box-shadow var(--transition-quick);
    line-height: 1.5;
    min-height: 36px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-focus);
}

.form-group input::placeholder,
.form-input::placeholder {
    color: var(--color-text-maxcontrast);
}

.form-group input:read-only,
.form-input:read-only {
    background: var(--color-background-dark);
    color: var(--color-text-maxcontrast);
    cursor: default;
}

.form-group input:disabled,
.form-group select:disabled,
.form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-group input.error,
.form-input.error {
    border-color: var(--color-error);
    box-shadow: var(--shadow-focus-error);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23767676'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

.form-group select[multiple] {
    background-image: none;
    padding-right: 12px;
    min-height: 100px;
}

/* Form error message */
.form-error {
    color: var(--color-error);
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: fadeIn 0.2s ease;
}

.form-error svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Form hint */
.form-hint {
    color: var(--color-text-maxcontrast);
    font-size: 12px;
    margin-top: 4px;
}

/* Input with button */
.input-with-btn {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-with-btn input {
    flex: 1;
    min-width: 0;
}

/* Toggle switch */
.form-toggle,
.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
}

.form-toggle input[type="checkbox"],
.toggle-label input[type="checkbox"] {
    position: relative;
    width: 40px;
    height: 22px;
    appearance: none;
    -webkit-appearance: none;
    background: var(--color-background-darker);
    border-radius: 11px;
    cursor: pointer;
    transition: background var(--transition-quick);
    flex-shrink: 0;
    border: none;
    padding: 0;
}

.form-toggle input[type="checkbox"]::after,
.toggle-label input[type="checkbox"]::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform var(--transition);
    box-shadow: var(--shadow-sm);
}

.form-toggle input[type="checkbox"]:checked,
.toggle-label input[type="checkbox"]:checked {
    background: var(--color-primary);
}

.form-toggle input[type="checkbox"]:checked::after,
.toggle-label input[type="checkbox"]:checked::after {
    transform: translateX(18px);
}

.form-toggle input[type="checkbox"]:focus-visible,
.toggle-label input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Checkbox */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid var(--border-color-dark);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all var(--transition-quick);
    background: var(--color-card-bg);
}

.form-checkbox input[type="checkbox"]:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.form-checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.form-checkbox input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* File check (on file cards) */
.file-check {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color-dark);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-quick), background var(--transition-quick);
    z-index: 2;
}

.file-card:hover .file-check,
.file-card.selected .file-check {
    opacity: 1;
}

.file-card.selected .file-check {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.file-card.selected .file-check::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* File favorite */
.file-fav {
    position: absolute;
    top: 8px;
    right: 8px;
    color: var(--color-text-maxcontrast);
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-quick), color var(--transition-quick);
    z-index: 2;
}

.file-card:hover .file-fav,
.file-fav.active {
    opacity: 1;
}

.file-fav.active {
    color: var(--color-warning);
}

.file-fav:hover {
    color: var(--color-warning);
}

.file-fav svg {
    width: 16px;
    height: 16px;
}


/* ================================================================
   14.  FILE GRID  (NC26: 160px columns, square thumbs, minimal)
   ================================================================ */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding-bottom: var(--space-4);
}

.file-card {
    background: var(--color-card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    padding: 12px;
    cursor: pointer;
    transition: border-color var(--animation-quick), box-shadow var(--animation-quick);
    position: relative;
    user-select: none;
}

.file-card:hover {
    border-color: var(--color-background-darker);
    box-shadow: var(--shadow-md);
}

.file-card.selected {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.file-card.dragging {
    opacity: 0.5;
    transform: scale(0.96);
}

.file-card.drag-over {
    border-color: var(--color-primary);
    border-style: dashed;
    background: var(--color-dropzone-bg);
}

.file-card-thumb,
.file-thumb {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    background: var(--color-background-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
    position: relative;
}

.file-card-thumb img,
.file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.file-card:hover .file-thumb img {
    transform: scale(1.03);
}

.file-card-thumb svg,
.file-thumb svg {
    width: 40px;
    height: 40px;
    color: var(--color-text-maxcontrast);
    transition: color var(--animation-quick);
}

.file-card-thumb.folder svg,
.file-thumb.folder svg {
    color: var(--color-primary);
}

.file-card:hover .file-thumb svg {
    color: var(--color-primary);
}

/* NC26: name below, centered */
.file-card-name,
.file-name {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-main-text);
    line-height: 1.3;
    text-align: center;
}

.file-card-meta,
.file-meta {
    font-size: 11px;
    color: var(--color-text-maxcontrast);
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* File type color coding */
.file-thumb.image svg { color: var(--color-info); }
.file-thumb.video svg { color: #9b59b6; }
.file-thumb.audio svg { color: var(--color-warning); }
.file-thumb.document svg { color: var(--color-info); }
.file-thumb.spreadsheet svg { color: var(--color-success); }
.file-thumb.presentation svg { color: var(--color-warning); }
.file-thumb.archive svg { color: #8B5E3C; }
.file-thumb.code svg { color: #555555; }
.file-thumb.pdf svg { color: var(--color-error); }


/* ================================================================
   15.  FILE LIST  (NC26: rows 51px, subtle bottom borders #ededed)
   ================================================================ */
.file-list {
    background: var(--color-card-bg);
    border-radius: var(--border-radius-large);
    overflow: hidden;
}

.file-list-header {
    display: grid;
    grid-template-columns: 44px 1fr 100px 140px;
    padding: 0 16px;
    height: 44px;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-maxcontrast);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--color-main-background);
}

.file-list-header span {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
    transition: color var(--transition-quick);
}

.file-list-header span:hover {
    color: var(--color-main-text);
}

.file-list-header span.sorted {
    color: var(--color-primary);
}

.file-list-header span.sorted::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--color-primary);
}

.file-list-header span.sorted.asc::after {
    border-top: none;
    border-bottom: 5px solid var(--color-primary);
}

/* NC26: file rows 51px height, very subtle bottom borders */
.file-row,
.file-list-row {
    display: grid;
    grid-template-columns: 44px 1fr 100px 140px;
    padding: 0 16px;
    height: 51px;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--animation-quick);
    user-select: none;
}

.file-row:hover,
.file-list-row:hover {
    background: var(--color-background-hover);
}

.file-row:last-child,
.file-list-row:last-child {
    border-bottom: none;
}

/* NC26: selected = primary-light background */
.file-row.selected,
.file-list-row.selected {
    background: var(--color-primary-light);
}

.file-row.dragging,
.file-list-row.dragging {
    opacity: 0.5;
}

.file-row.drag-over,
.file-list-row.drag-over {
    background: var(--color-dropzone-bg);
    outline: 2px dashed var(--color-primary);
    outline-offset: -2px;
}

.file-list-icon,
.file-row-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-list-icon svg,
.file-row-icon svg {
    width: 22px;
    height: 22px;
    color: var(--color-text-maxcontrast);
}

.file-list-icon.folder svg,
.file-row-icon.folder svg {
    color: var(--color-primary);
}

.file-list-name,
.file-row-name {
    font-size: 14px;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: var(--space-2);
}

.file-list-size,
.file-row-size {
    font-size: 13px;
    color: var(--color-text-maxcontrast);
}

.file-list-date,
.file-row-date {
    font-size: 13px;
    color: var(--color-text-maxcontrast);
}

.file-list-owner {
    font-size: 13px;
    color: var(--color-text-maxcontrast);
}

.file-list-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
}

.file-list-actions button {
    width: 28px;
    height: 28px;
    border-radius: var(--border-radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-maxcontrast);
    opacity: 0;
    transition: all var(--transition-quick);
}

.file-row:hover .file-list-actions button,
.file-list-row:hover .file-list-actions button {
    opacity: 1;
}

.file-list-actions button:hover {
    background: var(--color-background-hover);
    color: var(--color-main-text);
}


/* ================================================================
   16.  RIGHT SIDEBAR (File Details Panel)
   ================================================================ */
.right-sidebar {
    grid-area: rsidebar;
    width: var(--right-sidebar-width);
    background: var(--color-card-bg);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInRight 0.25s ease;
}

.right-sidebar-header,
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    gap: var(--space-2);
    flex-shrink: 0;
    min-height: var(--header-height);
}

.right-sidebar-filename {
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.detail-preview {
    padding: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-background-hover);
    border-bottom: 1px solid var(--border-color);
    min-height: 180px;
    flex-shrink: 0;
}

.detail-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--border-radius);
}

.detail-preview svg {
    width: 64px;
    height: 64px;
    color: var(--color-text-maxcontrast);
}

/* Detail tabs (NC26 style: underline active) */
.detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.detail-tabs::-webkit-scrollbar {
    display: none;
}

.detail-tab,
.detail-tabs .tab {
    padding: 0 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-maxcontrast);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition-quick);
    white-space: nowrap;
    flex-shrink: 0;
    height: var(--default-clickable-area);
    line-height: var(--default-clickable-area);
    cursor: pointer;
}

.detail-tab:hover,
.detail-tabs .tab:hover {
    color: var(--color-main-text);
}

.detail-tab.active,
.detail-tabs .tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

.detail-tab-content,
.detail-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) var(--space-5);
    scrollbar-width: thin;
}

/* Detail info rows */
.detail-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.detail-info-row:last-child {
    border-bottom: none;
}

.detail-info-label {
    color: var(--color-text-maxcontrast);
    font-weight: 500;
    flex-shrink: 0;
    margin-right: var(--space-3);
}

.detail-info-value {
    text-align: right;
    word-break: break-all;
    color: var(--color-main-text);
}

/* Detail actions */
.detail-actions {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.detail-actions .btn {
    flex: 1;
    min-width: 0;
}


/* ================================================================
   17.  CONTEXT MENU  (NC26: drop-shadow filter, border-radius 10px)
   ================================================================ */
.context-menu {
    position: fixed;
    z-index: var(--z-context);
    background: var(--color-card-bg);
    border-radius: var(--border-radius-large);
    filter: drop-shadow(0 1px 5px rgba(77, 77, 77, 0.3));
    min-width: 200px;
    max-width: 280px;
    padding: var(--space-1) 0;
    animation: fadeIn var(--animation-quick) ease;
}

.context-item,
.ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    font-size: 14px;
    color: var(--color-main-text);
    transition: background var(--animation-quick);
    width: 100%;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    height: var(--default-clickable-area);
    line-height: var(--default-clickable-area);
    border-radius: 0;
}

.context-item:hover,
.ctx-item:hover {
    background: var(--color-background-hover);
}

.context-item svg,
.ctx-item svg {
    width: 16px;
    height: 16px;
    color: var(--color-text-maxcontrast);
    flex-shrink: 0;
}

.context-item:hover svg,
.ctx-item:hover svg {
    color: var(--color-primary);
}

.ctx-shortcut {
    margin-left: auto;
    font-size: 11px;
    color: var(--color-text-maxcontrast);
    font-family: var(--font-mono);
    padding-left: var(--space-4);
}

.context-danger,
.ctx-item.danger {
    color: var(--color-error);
}

.context-danger svg,
.ctx-item.danger svg {
    color: var(--color-error);
}

.context-danger:hover,
.ctx-item.danger:hover {
    background: var(--color-error-light);
}

.context-divider,
.ctx-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-1) 0;
}


/* ================================================================
   18.  MODALS  (NC26: border-radius 10px, subtle shadow)
   ================================================================ */
.modal {
    display: none;
}

.modal:not([hidden]) {
    display: block;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal-backdrop);
    background: var(--color-modal-backdrop);
    animation: fadeIn 0.15s ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.modal-dialog {
    position: fixed;
    z-index: var(--z-modal);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-card-bg);
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-xl);
    width: 480px;
    max-width: 92vw;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalSlide 0.2s ease;
    display: flex;
    flex-direction: column;
}

.modal-dialog.modal-sm { width: 400px; }
.modal-dialog.modal-md { width: 540px; }
.modal-dialog.modal-lg { width: 720px; }
.modal-dialog.modal-xl { width: 900px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-maxcontrast);
    transition: all var(--transition-quick);
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--color-background-hover);
    color: var(--color-main-text);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

/* Fullscreen modal (Preview) */
.modal.modal-fullscreen .modal-backdrop {
    background: rgba(0, 0, 0, 0.92);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.modal.modal-fullscreen .preview-container,
.preview-container {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.preview-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
    z-index: 2;
}

.preview-filename {
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.preview-actions .icon-btn {
    color: rgba(255, 255, 255, 0.8);
    width: 40px;
    height: 40px;
}

.preview-actions .icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.preview-content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--border-radius);
}

.preview-content video {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--border-radius);
}

.preview-content audio {
    width: 400px;
    max-width: 90vw;
}

.preview-content iframe {
    width: 80vw;
    height: 80vh;
    border: none;
    border-radius: var(--border-radius);
    background: #fff;
}

.preview-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 24px;
    border-radius: var(--border-radius-large);
    max-width: 80vw;
    max-height: 80vh;
    overflow: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
}

/* Preview navigation arrows */
.preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.7);
    padding: 12px;
    border-radius: var(--border-radius-rounded);
    transition: all var(--transition-quick);
    z-index: 3;
    background: rgba(0, 0, 0, 0.3);
}

.preview-nav:hover {
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
}

.preview-prev {
    left: var(--space-4);
}

.preview-next {
    right: var(--space-4);
}

.preview-nav svg {
    width: 32px;
    height: 32px;
}

/* Preview loading / unsupported */
.preview-loading {
    text-align: center;
    padding: 40px;
    color: #fff;
    font-size: 14px;
}

.preview-unsupported {
    text-align: center;
    padding: 40px;
    color: var(--color-text-maxcontrast);
}


/* ================================================================
   19.  UPLOAD COMPONENTS
   ================================================================ */

/* Drop zone overlay */
.dropzone,
.upload-overlay.drop-active {
    position: fixed;
    inset: 0;
    z-index: var(--z-dropzone);
    background: rgba(214, 51, 132, 0.08);
    border: 3px dashed var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.dropzone-content,
.upload-area {
    text-align: center;
    pointer-events: none;
}

.dropzone-content svg,
.upload-area svg {
    width: 64px;
    height: 64px;
    color: var(--color-primary);
    margin: 0 auto 16px;
    animation: pulse 2s ease-in-out infinite;
}

.dropzone-content p,
.upload-area p {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-primary);
}

.dropzone-content small {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--color-text-maxcontrast);
}

/* Upload panel (bottom-right corner) */
.upload-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: var(--z-upload);
    background: var(--color-card-bg);
    border-radius: var(--border-radius-large);
    filter: drop-shadow(0 2px 8px rgba(77, 77, 77, 0.3));
    width: 360px;
    max-height: 320px;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.upload-panel.minimized .upload-list {
    display: none;
}

.upload-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-background-hover);
}

.upload-panel-header span {
    font-size: 14px;
    font-weight: 600;
}

.upload-list {
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.upload-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.upload-item:last-child {
    border-bottom: none;
}

.upload-item svg {
    width: 18px;
    height: 18px;
    color: var(--color-text-maxcontrast);
    flex-shrink: 0;
}

.upload-name {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    min-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-progress {
    width: 100%;
    display: block;
}

.upload-progress-bar {
    height: 4px;
    background: var(--color-background-dark);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.upload-progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.upload-progress-fill.complete {
    background: var(--color-success);
}

.upload-progress-fill.error {
    background: var(--color-error);
}

.upload-progress-name {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-status {
    font-size: 12px;
    color: var(--color-text-maxcontrast);
    flex-shrink: 0;
    min-width: 40px;
    text-align: right;
}

.upload-item.done .upload-status { color: var(--color-success); }
.upload-item.error .upload-status { color: var(--color-error); }
.upload-item.done svg { color: var(--color-success); }
.upload-item.error svg { color: var(--color-error); }


/* ================================================================
   20.  DATA TABLES
   ================================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.data-table th {
    text-align: left;
    padding: 0 12px;
    height: 36px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-maxcontrast);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border-color);
    background: var(--color-main-background);
    white-space: nowrap;
    user-select: none;
}

.data-table th.sortable {
    cursor: pointer;
    transition: color var(--transition-quick);
}

.data-table th.sortable:hover {
    color: var(--color-primary);
}

.data-table td {
    padding: 0 12px;
    height: 40px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--color-background-hover);
}

.data-table tr.selected td {
    background: var(--color-primary-light);
}

/* Compact admin table cells */
.user-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}
.avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}
.user-cell-name { font-size: 13px; font-weight: 500; }
.user-cell-username { font-size: 11px; color: var(--color-text-maxcontrast); }
.col-check { width: 32px; }
.col-actions { white-space: nowrap; }

.table-header {
    display: grid;
    padding: 0 16px;
    height: var(--default-clickable-area);
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-maxcontrast);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table-row {
    display: grid;
    padding: 0 16px;
    height: 51px;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--animation-quick);
}

.table-row:hover {
    background: var(--color-background-hover);
}

.table-row:last-child {
    border-bottom: none;
}

/* Responsive table wrapper */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
}

.table-responsive .data-table {
    min-width: 600px;
}


/* ================================================================
   21.  SHARE DIALOG
   ================================================================ */
.share-section {
    margin-bottom: 24px;
}

.share-section:last-child {
    margin-bottom: 0;
}

.share-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--color-main-text);
}

.share-options {
    margin-top: 12px;
    font-size: 13px;
    color: var(--color-text-maxcontrast);
}

.share-options summary {
    cursor: pointer;
    padding: 8px 0;
    font-weight: 500;
    color: var(--color-primary);
    user-select: none;
    transition: color var(--transition-quick);
}

.share-options summary:hover {
    color: var(--color-primary-dark);
}

.share-options .form-group {
    margin-top: 12px;
}

.share-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-card-bg);
    border-radius: var(--border-radius-large);
    filter: drop-shadow(0 1px 5px rgba(77, 77, 77, 0.3));
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
}

.share-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    height: var(--default-clickable-area);
    cursor: pointer;
    transition: background var(--animation-quick);
    font-size: 14px;
}

.share-autocomplete-item:hover {
    background: var(--color-background-hover);
}

.share-people-list {
    margin-top: 10px;
}

.share-people-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    gap: var(--space-2);
}

.share-people-list li:last-child {
    border-bottom: none;
}

.share-people-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.share-people-info .avatar {
    flex-shrink: 0;
}

.share-people-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ================================================================
   22.  FOLDER TREE (Move/Copy dialogs)
   ================================================================ */
.folder-tree {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.folder-tree-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: var(--default-clickable-area);
    border-radius: var(--border-radius-pill);
    cursor: pointer;
    font-size: 14px;
    transition: background var(--animation-quick);
    user-select: none;
}

.folder-tree-item:hover {
    background: var(--color-background-hover);
}

.folder-tree-item.selected {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}

.folder-tree-item svg {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.folder-tree-item .indent {
    display: inline-block;
    width: 16px;
    flex-shrink: 0;
}

/* Folder permissions (admin) */
.folder-perms {
    padding: var(--space-4);
    background: var(--color-background-hover);
    border-radius: var(--border-radius-large);
    margin-top: var(--space-3);
}

.folder-perms h5 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.folder-perms .perm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
}

.folder-perms .perm-row:last-child {
    border-bottom: none;
}


/* ================================================================
   23.  ACTIVITY FEED
   ================================================================ */
.activity-feed {
    max-width: 700px;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-rounded);
    background: var(--color-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon svg {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
}

.activity-icon.upload { background: var(--color-info-light); }
.activity-icon.upload svg { color: var(--color-info); }
.activity-icon.delete { background: var(--color-error-light); }
.activity-icon.delete svg { color: var(--color-error); }
.activity-icon.share { background: var(--color-success-light); }
.activity-icon.share svg { color: var(--color-success); }
.activity-icon.download { background: var(--color-warning-light); }
.activity-icon.download svg { color: var(--color-warning); }

.activity-body {
    flex: 1;
    min-width: 0;
}

.activity-text,
.activity-action {
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-main-text);
}

.activity-text strong {
    font-weight: 600;
}

.activity-target {
    font-weight: 600;
    color: var(--color-primary);
}

.activity-time {
    font-size: 12px;
    color: var(--color-text-maxcontrast);
    margin-top: 3px;
}

/* Filter chips (NC26: pill-shaped) */
.filter-chips {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.chip {
    padding: 6px 16px;
    border-radius: var(--border-radius-pill);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-maxcontrast);
    background: var(--color-main-background);
    border: 2px solid var(--border-color);
    transition: all var(--animation-quick);
    cursor: pointer;
    user-select: none;
}

.chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.chip.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-color: var(--color-primary);
}


/* ================================================================
   24.  SEARCH LAYOUT
   ================================================================ */
.search-layout {
    display: flex;
    gap: 24px;
}

.search-filters {
    width: 200px;
    flex-shrink: 0;
}

.search-filters h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
}

.filter-group {
    margin-bottom: 16px;
}

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-maxcontrast);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.search-layout .file-list {
    flex: 1;
    min-width: 0;
}

/* Load more — hidden, replaced by scroll */
.load-more { display: none; }

/* Admin users scrollable container */
#admin-users-content {
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    scrollbar-width: thin;
}
#admin-users-content::-webkit-scrollbar { width: 6px; }
#admin-users-content::-webkit-scrollbar-thumb { background: var(--color-border-dark); border-radius: 3px; }


/* ================================================================
   25.  TOAST NOTIFICATIONS  (NC26 style: subtle, bottom-center or custom)
   ================================================================ */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
    max-width: 90vw;
}

.toast {
    background: var(--color-main-text);
    color: var(--color-text-inverse);
    padding: 10px 20px;
    border-radius: var(--border-radius-pill);
    font-size: 14px;
    font-weight: 500;
    pointer-events: auto;
    animation: slideUp 0.3s ease, fadeIn 0.3s ease;
    max-width: 500px;
    text-align: center;
    line-height: 1.4;
    filter: drop-shadow(0 2px 6px rgba(77, 77, 77, 0.3));
}

.toast.success {
    background: var(--color-success);
}

.toast.error {
    background: var(--color-error);
}

.toast.warning {
    background: var(--color-warning);
    color: var(--color-main-text);
}

.toast.info {
    background: var(--color-info);
}

.toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}


/* ================================================================
   26.  DASHBOARD
   ================================================================ */
.dashboard {
    max-width: var(--content-max-width);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    padding: 20px;
    text-align: center;
    transition: border-color var(--animation-quick);
}

.stat-card:hover {
    border-color: var(--color-background-darker);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-rounded);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    background: var(--color-primary-light);
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
}

.stat-icon.files-icon { background: var(--color-info-light); }
.stat-icon.files-icon svg { color: var(--color-info); }
.stat-icon.users-icon { background: var(--color-success-light); }
.stat-icon.users-icon svg { color: var(--color-success); }
.stat-icon.storage-icon { background: var(--color-warning-light); }
.stat-icon.storage-icon svg { color: var(--color-warning); }
.stat-icon.shares-icon { background: var(--color-primary-light); }
.stat-icon.shares-icon svg { color: var(--color-primary); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-main-text);
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--color-text-maxcontrast);
    font-weight: 500;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-card {
    background: var(--color-card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    overflow: hidden;
    margin-bottom: 16px;
}

.dashboard-card .card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-card .card-header h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.dashboard-card .card-body {
    padding: 16px 20px;
    max-height: 320px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.storage-widget {
    min-height: 120px;
}


/* ================================================================
   27.  SETTINGS LAYOUT
   ================================================================ */
.settings-layout {
    display: flex;
    gap: 24px;
    max-width: var(--content-max-width);
}

.settings-nav {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    height: var(--default-clickable-area);
    border-radius: var(--border-radius-pill);
    font-size: 14px;
    color: var(--color-main-text);
    transition: background var(--animation-quick);
    text-decoration: none;
    font-weight: 400;
}

.settings-nav-item:hover {
    background: var(--color-background-hover);
    text-decoration: none;
}

.settings-nav-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}

.settings-content {
    flex: 1;
    min-width: 0;
    max-width: 700px;
}

/* Settings card (tenant config, etc) */
.settings-card {
    background: var(--color-main-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    padding: 20px;
}
.settings-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px;
}
.settings-form .form-group {
    margin-bottom: 14px;
}
.settings-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-main-text);
    margin-bottom: 4px;
}
.settings-form label small {
    color: var(--color-text-maxcontrast);
    font-weight: 400;
}
.settings-form select.form-input {
    cursor: pointer;
}


/* ================================================================
   28.  ADMIN SEARCH
   ================================================================ */
.admin-search {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.admin-search svg {
    position: absolute;
    left: 12px;
    color: var(--color-text-maxcontrast);
    pointer-events: none;
    width: 16px;
    height: 16px;
}

.admin-search-input {
    padding: 6px 12px 6px 36px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-pill);
    background: var(--color-main-background);
    font-size: 13px;
    width: 260px;
    min-height: 34px;
    transition: border-color var(--transition-quick);
}

.admin-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.admin-search-input::placeholder {
    color: var(--color-text-maxcontrast);
}


/* ================================================================
   29.  BATCH ACTIONS BAR
   ================================================================ */
.batch-actions {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-overlay);
    background: var(--color-card-bg);
    border-radius: var(--border-radius-pill);
    filter: drop-shadow(0 2px 10px rgba(77, 77, 77, 0.3));
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideUp 0.2s ease;
    white-space: nowrap;
}

.batch-actions span {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-maxcontrast);
    padding-right: 8px;
    border-right: 1px solid var(--border-color);
    margin-right: 4px;
}


/* ================================================================
   30.  TABS (Generic)
   ================================================================ */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    gap: 0;
}

.tab {
    padding: 0 16px;
    height: var(--default-clickable-area);
    line-height: var(--default-clickable-area);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-maxcontrast);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition-quick);
    cursor: pointer;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover {
    color: var(--color-main-text);
}

.tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}


/* ================================================================
   31.  KEYFRAME ANIMATIONS
   ================================================================ */
@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes fadeOut {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes slideUp {
    0%   { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    0%   { opacity: 0; transform: translateX(20px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes modalSlide {
    0%   { opacity: 0; transform: translate(-50%, -48%); }
    100% { opacity: 1; transform: translate(-50%, -50%); }
}

@keyframes pulse {
    0%,
    100% { opacity: 1; }
    50%  { opacity: 0.6; }
}

@keyframes progressIndeterminate {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}


/* ================================================================
   32.  RESPONSIVE / MOBILE STYLES
   ================================================================ */

/* Tablet: navigation collapses */
@media (max-width: 1024px) {
    :root {
        --navigation-width: 0;
    }

    .app-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "navbar"
            "content";
    }

    .app-layout.details-open {
        grid-template-columns: 1fr;
        grid-template-areas:
            "navbar"
            "content";
    }

    .sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        z-index: var(--z-overlay);
        box-shadow: none;
        transition: transform var(--transition-slow), box-shadow var(--transition-slow);
    }

    .sidebar:not(.collapsed) {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .sidebar.collapsed {
        width: 0;
        transform: translateX(-100%);
    }

    .navbar-left {
        width: auto;
    }

    .navbar-brand span {
        display: none;
    }

    /* Right sidebar overlays on tablet */
    .right-sidebar {
        position: fixed;
        top: var(--header-height);
        right: 0;
        bottom: 0;
        z-index: var(--z-overlay);
        box-shadow: var(--shadow-xl);
        width: 340px;
        max-width: 90vw;
    }

    .content {
        padding: var(--space-4) var(--space-5);
    }

    /* Settings layout stacks */
    .settings-layout {
        flex-direction: column;
    }

    .settings-nav {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        gap: 4px;
        padding-bottom: var(--space-2);
        border-bottom: 1px solid var(--border-color);
        scrollbar-width: none;
    }

    .settings-nav::-webkit-scrollbar {
        display: none;
    }

    .settings-nav-item {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Search layout stacks */
    .search-layout {
        flex-direction: column;
    }

    .search-filters {
        width: 100%;
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
    }

    .filter-group {
        margin-bottom: 0;
        flex: 1;
        min-width: 140px;
    }

    /* Stats row: 2 columns on tablet */
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

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

/* Phone: compact layout */
@media (max-width: 600px) {
    :root {
        --header-height: 50px;
        --default-font-size: 14px;
    }

    .navbar {
        padding: 0 var(--space-2);
    }

    .navbar-center {
        display: none;
    }

    .navbar-brand img {
        height: 26px;
    }

    .navbar-right .btn-primary span {
        display: none;
    }

    .navbar-right .btn-primary {
        padding: 6px 10px;
        min-width: 36px;
    }

    .content {
        padding: var(--space-3) var(--space-3);
    }

    .sidebar {
        width: 100%;
        max-width: 280px;
    }

    .right-sidebar {
        width: 100%;
        max-width: 100vw;
    }

    /* File grid: 2 columns on phone */
    .file-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .file-card {
        padding: 10px;
    }

    /* File list: simplified columns */
    .file-list-header,
    .file-row,
    .file-list-row {
        grid-template-columns: 36px 1fr 80px;
    }

    .file-list-date,
    .file-row-date,
    .file-list-header span:last-child {
        display: none;
    }

    /* Stats: single column on phone */
    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 22px;
    }

    /* Toolbar wraps */
    .toolbar {
        gap: 8px;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .view-header .toolbar-right {
        margin-left: 0;
        flex-wrap: wrap;
    }

    /* Upload panel full width on phone */
    .upload-panel {
        left: 10px;
        right: 10px;
        width: auto;
    }

    /* Batch actions bar */
    .batch-actions {
        left: 10px;
        right: 10px;
        transform: none;
        border-radius: var(--border-radius-large);
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Modal: nearly full-width */
    .modal-dialog {
        width: 95vw;
        max-width: 95vw;
    }

    .modal-dialog.modal-sm,
    .modal-dialog.modal-md,
    .modal-dialog.modal-lg,
    .modal-dialog.modal-xl {
        width: 95vw;
    }

    /* Admin search */
    .admin-search-input {
        width: 180px;
    }

    /* Preview nav smaller */
    .preview-nav svg {
        width: 24px;
        height: 24px;
    }

    .preview-nav {
        padding: 8px;
    }

    .preview-prev {
        left: var(--space-2);
    }

    .preview-next {
        right: var(--space-2);
    }

    /* Toast container */
    .toast-container {
        left: 10px;
        right: 10px;
        transform: none;
    }

    .toast {
        max-width: 100%;
    }
}

/* Very small phones */
@media (max-width: 380px) {
    .file-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .file-card {
        padding: 8px;
    }

    .file-card-thumb svg,
    .file-thumb svg {
        width: 32px;
        height: 32px;
    }

    .file-card-name,
    .file-name {
        font-size: 12px;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .filter-chips {
        gap: 4px;
    }

    .chip {
        padding: 4px 12px;
        font-size: 12px;
    }
}


/* ================================================================
   33.  PRINT STYLES
   ================================================================ */
@media print {
    .navbar,
    .sidebar,
    .upload-panel,
    .dropzone,
    .toast-container,
    .batch-actions,
    .context-menu,
    .modal-backdrop,
    .modal-dialog {
        display: none !important;
    }

    .app-layout {
        display: block;
    }

    .content {
        padding: 0;
        overflow: visible;
    }

    body {
        overflow: visible;
        height: auto;
    }
}


/* ================================================================
   34.  UTILITY CLASSES
   ================================================================ */

/* Text alignment */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

/* Text colors */
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }
.text-muted { color: var(--color-text-maxcontrast); }

/* Display */
.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }

/* Flex utilities */
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* Margin */
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.ml-auto { margin-left: auto; }

/* Padding */
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Text overflow */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Visually hidden (accessible) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }

/* User select */
.select-none { user-select: none; }

/* Border radius */
.rounded { border-radius: var(--border-radius); }
.rounded-lg { border-radius: var(--border-radius-large); }
.rounded-full { border-radius: var(--border-radius-rounded); }

/* Width */
.w-full { width: 100%; }

/* Separator */
.separator {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-4) 0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-4);
    color: var(--color-text-maxcontrast);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-main-text);
    margin-bottom: var(--space-2);
}

.empty-state p {
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto;
}

/* ============================================================
   MODAL TABS (Edit User — General | Permisos)
   ============================================================ */
.modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--color-border);
    padding: 0 var(--space-4);
    margin: 0;
    background: var(--color-background-dark);
}

.modal-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-maxcontrast);
    transition: all 0.2s;
}

.modal-tab:hover {
    color: var(--color-main-text);
    background: rgba(0,0,0,0.03);
}

.modal-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

.eu-tab-content {
    min-height: 300px;
}

/* ============================================================
   FOLDER ASSIGNMENTS (Permissions Tab)
   ============================================================ */
.perm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.perm-info {
    font-size: 13px;
    color: var(--color-text-maxcontrast);
    margin: 0;
}

.folder-assignments-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-height: 400px;
    overflow-y: auto;
}

.folder-assignment-card {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--space-3);
    background: var(--color-background-dark);
}

.fa-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.fa-folder-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

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

.perm-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 16px;
    padding-top: var(--space-2);
}

.perm-checkboxes .toggle-label {
    font-size: 13px;
}

/* ============================================================
   EXTERNAL STORAGE (Mount Cards)
   ============================================================ */
.mount-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-4);
    padding: var(--space-4);
}

.mount-card {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-large);
    background: var(--color-main-background);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.mount-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mount-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mount-card-title strong {
    font-size: 15px;
}

.mount-type-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    text-transform: uppercase;
}

.mount-status {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
}

.mount-status.connected {
    background: #d1fae5;
    color: #065f46;
}

.mount-status.disconnected {
    background: #f3f4f6;
    color: #6b7280;
}

.mount-status.error {
    background: #fee2e2;
    color: #991b1b;
}

.mount-status.mounting {
    background: #fef3c7;
    color: #92400e;
}

.mount-card-details {
    font-size: 13px;
    color: var(--color-text-maxcontrast);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mount-card-details small {
    font-weight: 600;
    color: var(--color-main-text);
}

.mount-error {
    color: var(--color-error) !important;
}

.mount-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border);
}

/* ============================================================
   BROWSE EXTERNAL MOUNT
   ============================================================ */
.ext-browse-list {
    display: flex;
    flex-direction: column;
}

.ext-browse-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    transition: background 0.15s;
}

.ext-browse-item:hover {
    background: var(--color-background-hover);
}

.ext-browse-item.is-dir {
    cursor: pointer;
}

.ext-browse-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.ext-browse-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ext-browse-size {
    font-size: 12px;
    color: var(--color-text-maxcontrast);
    flex-shrink: 0;
    min-width: 60px;
    text-align: right;
}

.ext-browse-dl {
    flex-shrink: 0;
}

#browse-mount-breadcrumb {
    padding: 8px 0;
    margin-bottom: var(--space-2);
    font-size: 13px;
    color: var(--color-text-maxcontrast);
}

#browse-mount-breadcrumb .crumb {
    color: var(--color-primary);
    cursor: pointer;
}

#browse-mount-breadcrumb .crumb:hover {
    text-decoration: underline;
}

/* ============================================================
   ADMIN USER FILES
   ============================================================ */
.uf-clickable {
    cursor: pointer;
    color: var(--color-primary);
    font-weight: 500;
}

.uf-clickable:hover {
    text-decoration: underline;
}

.uf-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.uf-actions .btn {
    padding: 4px 6px;
}

.uf-icon {
    text-align: center;
}

#uf-breadcrumb {
    font-size: 14px;
    padding: 8px var(--space-4);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

#uf-breadcrumb .crumb {
    color: var(--color-primary);
}

#uf-breadcrumb .crumb:hover {
    text-decoration: underline;
}
