/* ==========================================================================
   UNLOCK TOOL — FILE LIBRARY
   Modern glass UI · Amber brand · Light content on cinematic dark page
   ========================================================================== */

:root {
    --page-width: 1120px;

    color-scheme: light;

    --bg: #101319;
    --bg-soft: #f2f3f6;
    --panel: rgba(255, 255, 255, 0.86);
    --panel-strong: rgba(255, 255, 255, 0.97);
    --panel-soft: rgba(245, 180, 64, 0.08);

    --line: rgba(72, 76, 84, 0.14);
    --line-strong: rgba(72, 76, 84, 0.24);
    --border: rgba(72, 76, 84, 0.16);
    --border-strong-h: rgba(72, 76, 84, 0.32);

    --text: #262b33;
    --text-soft: #555c66;
    --text-muted: #82898f;
    --heading: #1d222a;

    --brand: #f0ad26;
    --brand-2: #f7c53d;
    --brand-3: #d98a12;
    --brand-4: #b96f08;
    --brand-1-soft: rgba(240, 173, 38, 0.1);
    --accent: #f0ad26;
    --warning: #f4b84b;
    --danger: #e25572;
    --success: #22c07f;

    --shadow: 0 24px 60px rgba(8, 10, 15, 0.45);
    --shadow-soft: 0 14px 34px rgba(39, 43, 49, 0.1);
    --shadow-pop: 0 10px 26px rgba(240, 173, 38, 0.28);

    --radius-xl: 7px;
    --radius-lg: 7px;
    --radius-md: 7px;
    --radius-sm: 7px;
    --radius-pill: 999px;

    --font: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    scroll-behavior: smooth;
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: clamp(18px, 4vh, 44px) 0 30px;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(1100px 500px at 50% -12%, rgba(240, 173, 38, 0.10), transparent 62%),
        radial-gradient(700px 420px at 100% 0%, rgba(247, 197, 61, 0.06), transparent 60%),
        radial-gradient(700px 500px at 0% 100%, rgba(56, 98, 158, 0.05), transparent 65%),
        linear-gradient(180deg, #f4f5f8 0%, #eef0f4 45%, #e9ecf1 100%);
    background-attachment: fixed;
    overflow-x: clip;
}

/* --- Scrollbars ---------------------------------------------------------- */
html,
body {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

body::-webkit-scrollbar {
    width: 10px;
}

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

body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

::selection {
    background: rgba(240, 173, 38, 0.32);
}

:focus-visible {
    outline: 2px solid rgba(240, 173, 38, 0.75);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ==========================================================================
   Animated backdrop
   ========================================================================== */

.page-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.backdrop-orb {
    position: absolute;
    display: block;
    border-radius: 999px;
    filter: blur(70px);
    opacity: 0.6;
    animation: orb-drift 18s var(--ease) infinite alternate;
}

.orb-a {
    width: 480px;
    height: 480px;
    top: -120px;
    left: -140px;
    background: radial-gradient(circle, rgba(240, 173, 38, 0.34), transparent 70%);
}

.orb-b {
    width: 560px;
    height: 560px;
    right: -180px;
    top: 30%;
    background: radial-gradient(circle, rgba(199, 122, 47, 0.26), transparent 72%);
    animation-delay: -8s;
    animation-duration: 24s;
}

@keyframes orb-drift {
    from {
        transform: translate3d(0, 0, 0) scale(1);
    }

    to {
        transform: translate3d(40px, 60px, 0) scale(1.12);
    }
}

.backdrop-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 72%);
    -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 72%);
}

/* ==========================================================================
   Shell
   ========================================================================== */

.app-shell {
    position: relative;
    z-index: 1;
    width: min(var(--page-width), calc(100% - 28px));
    margin: 0 auto;
    animation: rise 0.7s var(--ease) both;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================================
   Header / hero
   ========================================================================== */

.site-header {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 30px 30px;
    background:
        radial-gradient(circle at 88% 10%, rgba(240, 173, 38, 0.2), transparent 34%),
        radial-gradient(circle at 0% 120%, rgba(240, 173, 38, 0.12), transparent 40%),
        linear-gradient(135deg, #232830 0%, #1c2129 55%, #171b22 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 0;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        0 -18px 50px rgba(240, 173, 38, 0.07);
}

.site-header::before,
.site-header::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.site-header::before {
    width: 320px;
    height: 320px;
    top: -190px;
    right: -80px;
    background: radial-gradient(circle, rgba(240, 173, 38, 0.2), transparent 68%);
}

.site-header::after {
    width: 260px;
    height: 260px;
    left: -120px;
    bottom: -160px;
    background: radial-gradient(circle, rgba(247, 197, 61, 0.14), transparent 74%);
}

.header-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    display: flex;
    align-items: center;
    min-width: 0;
}

.brand-home-link {
    display: inline-flex;
    align-items: center;
    padding: 4px;
    margin: -4px;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: transform 0.2s var(--ease), filter 0.2s var(--ease);
}

.brand-home-link:hover {
    transform: translateY(-2px);
    filter: brightness(1.06) drop-shadow(0 8px 18px rgba(240, 173, 38, 0.25));
}

.brand-logo {
    display: block;
    width: auto;
    max-width: min(320px, 46vw);
    height: 62px;
    object-fit: contain;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.35));
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-left: 16px;
    padding: 10px 16px;
    border-radius: var(--radius-pill);
    color: #ffd98a;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    background: rgba(240, 173, 38, 0.1);
    border: 1px solid rgba(240, 173, 38, 0.28);
    backdrop-filter: blur(8px);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s var(--ease), box-shadow 0.2s ease;
}

.brand-badge i {
    font-size: 11px;
    opacity: 0.9;
}

.brand-badge:hover {
    background: rgba(240, 173, 38, 0.18);
    border-color: rgba(240, 173, 38, 0.45);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(240, 173, 38, 0.18);
}

/* ==========================================================================
   Main card
   ========================================================================== */

.page-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 247, 250, 0.94));
    border: 1px solid rgba(30, 36, 48, 0.08);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}

.page-shell::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    z-index: 2;
    background: linear-gradient(90deg,
            rgba(240, 173, 38, 0) 0%,
            rgba(240, 173, 38, 0.9) 22%,
            rgba(247, 197, 61, 0.9) 55%,
            rgba(240, 173, 38, 0) 100%);
}

.toolbar-card,
.listing-card {
    position: relative;
    background: transparent;
    border: 0;
    box-shadow: none;
}

/* --- Toolbar -------------------------------------------------------------- */

.toolbar-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 26px 26px 22px;
    border-bottom: 1px solid var(--line);
    background:
        radial-gradient(circle at 100% 0%, rgba(240, 173, 38, 0.05), transparent 42%);
}

.toolbar-controls {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.search-field {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 18px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #ffffff, #fbfbfd);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 2px 8px rgba(39, 43, 49, 0.05);
    transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.search-field-large {
    flex: 1;
    height: 50px;
}

.search-field:focus-within {
    border-color: rgba(240, 173, 38, 0.6);
    box-shadow:
        0 0 0 4px rgba(240, 173, 38, 0.14),
        0 6px 18px rgba(240, 173, 38, 0.1);
    background: #ffffff;
}

.search-field svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s ease;
}

.search-field:focus-within svg {
    stroke: var(--brand-3);
}

.search-field input {
    width: 100%;
    height: 100%;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
    font-size: 14.5px;
    font-weight: 500;
}

.search-field input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* --- Buttons -------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    transition: transform 0.18s var(--ease), box-shadow 0.18s ease,
        filter 0.18s ease, background 0.18s ease, border-color 0.18s ease,
        color 0.18s ease;
}

.btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

#refreshButton {
    min-height: 50px;
    padding: 0 20px;
    font-size: 13.5px;
    color: var(--text-soft);
    background: linear-gradient(180deg, #ffffff, #f4f5f8);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    box-shadow: 0 2px 8px rgba(39, 43, 49, 0.05);
    flex: 0 0 auto;
}

#refreshButton:hover {
    color: var(--brand-4);
    border-color: rgba(240, 173, 38, 0.4);
    background: linear-gradient(180deg, #fffdf7, #fdf6e6);
    box-shadow: 0 8px 20px rgba(240, 173, 38, 0.14);
}

#refreshButton:active {
    box-shadow: inset 0 2px 4px rgba(72, 76, 84, 0.08);
}

.btn-primary {
    min-height: 50px;
    padding: 0 24px;
    font-size: 14px;
    color: #23180a;
    background: linear-gradient(135deg, var(--brand-2), var(--brand) 55%, var(--brand-3) 130%);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-pop), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.btn-primary:hover {
    filter: brightness(1.05);
    box-shadow: 0 14px 32px rgba(240, 173, 38, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* ==========================================================================
   Card head · breadcrumb
   ========================================================================== */

.card-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 26px 18px;
    border-bottom: 1px solid var(--line);
}

.breadcrumb-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1 1 auto;
}

.back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    min-height: 34px;
    border-radius: var(--radius-pill);
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    flex: 0 0 auto;
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease,
        transform 0.16s var(--ease), box-shadow 0.16s ease;
}

.back-button i {
    font-size: 12px;
    transition: transform 0.16s var(--ease);
}

.back-button:hover,
.back-button:focus-visible {
    color: var(--brand-4);
    background: linear-gradient(180deg, #fffdf7, #fcf3dd);
    border-color: rgba(240, 173, 38, 0.45);
    box-shadow: 0 6px 16px rgba(240, 173, 38, 0.16);
    outline: none;
}

.back-button:hover i {
    transform: translateX(-2px);
}

.back-button:active {
    transform: translateY(1px);
}

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-width: 0;
}

.breadcrumb-link,
.breadcrumb-current {
    font-size: 14px;
    line-height: 1.5;
}

.breadcrumb-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    color: var(--brand-4);
    text-decoration: none;
    font-weight: 600;
    transition: background 0.16s ease, color 0.16s ease;
}

.breadcrumb-link:hover {
    background: var(--brand-1-soft);
    color: var(--brand-3);
}

.breadcrumb-link i {
    font-size: 13px;
}

.breadcrumb-separator {
    color: rgba(114, 131, 155, 0.55);
    font-size: 12px;
}

.breadcrumb-current {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    color: var(--heading);
    font-weight: 700;
    background: linear-gradient(135deg, rgba(240, 173, 38, 0.14), rgba(247, 197, 61, 0.08));
    border: 1px solid rgba(240, 173, 38, 0.22);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Meta ------------------------------------------------------------------ */

.meta-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.meta-count,
.meta-note {
    margin: 0;
    white-space: nowrap;
}

.meta-count {
    color: var(--heading);
    font-size: 15px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.meta-count::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand-2), var(--brand-3));
    box-shadow: 0 0 0 4px rgba(240, 173, 38, 0.14);
}

.meta-note {
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.06em;
}

/* ==========================================================================
   Table
   ========================================================================== */

.table-wrap {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(72, 76, 84, 0.3) transparent;
}

.table-wrap::-webkit-scrollbar {
    height: 8px;
}

.table-wrap::-webkit-scrollbar-thumb {
    background: rgba(72, 76, 84, 0.22);
    border-radius: 999px;
}

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

.file-table thead th {
    padding: 15px 26px;
    border-bottom: 1px solid var(--line);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
    background: linear-gradient(180deg, rgba(240, 173, 38, 0.04), transparent);
}

.file-table thead th.actions-col {
    text-align: center;
    min-width: 150px;
}

.file-table tbody td {
    padding: 15px 26px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.11);
    vertical-align: middle;
    font-size: 14px;
}

.file-table tbody tr {
    transition: background 0.16s ease, box-shadow 0.16s ease;
    animation: row-in 0.4s var(--ease) both;
}

@keyframes row-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.file-table tbody tr:nth-child(1) { animation-delay: 0.015s; }
.file-table tbody tr:nth-child(2) { animation-delay: 0.03s; }
.file-table tbody tr:nth-child(3) { animation-delay: 0.045s; }
.file-table tbody tr:nth-child(4) { animation-delay: 0.06s; }
.file-table tbody tr:nth-child(5) { animation-delay: 0.075s; }
.file-table tbody tr:nth-child(6) { animation-delay: 0.09s; }
.file-table tbody tr:nth-child(7) { animation-delay: 0.105s; }
.file-table tbody tr:nth-child(n+8) { animation-delay: 0.12s; }

.file-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(240, 173, 38, 0.07), rgba(240, 173, 38, 0.02) 55%, transparent);
    box-shadow: inset 3px 0 0 rgba(240, 173, 38, 0.75);
}

.file-table tbody tr:last-child td {
    border-bottom: 0;
}

/* --- Name cell -------------------------------------------------------------- */

.name-cell {
    min-width: 340px;
}

.entry {
    display: flex;
    align-items: center;
    gap: 15px;
}

.entry-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: var(--radius-md);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        0 4px 12px rgba(39, 43, 49, 0.07);
    transition: transform 0.2s var(--ease);
}

.entry-icon__img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}


.file-table tbody tr:hover .entry-icon {
    transform: scale(1.06);
}

.entry-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke: currentColor;
}

.entry-icon.folder {
    color: #b9770a;
    background:
        linear-gradient(150deg, rgba(255, 214, 130, 0.55), rgba(250, 179, 60, 0.22));
    border: 1px solid rgba(240, 173, 38, 0.35);
}

.entry-icon.file {
    color: #6a7280;
    background: linear-gradient(150deg, rgba(148, 156, 168, 0.22), rgba(148, 156, 168, 0.08));
    border: 1px solid rgba(148, 156, 168, 0.28);
}

.entry-main {
    min-width: 0;
}

.entry-name {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s ease;
}

.entry-name:hover {
    color: var(--brand-3);
}

.entry-name .entry-number {
    flex: 0 0 auto;
    min-width: 24px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    overflow: visible;
    white-space: nowrap;
}

.entry-name .entry-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entry-name:hover .entry-title {
    text-decoration: underline;
    text-decoration-color: rgba(240, 173, 38, 0.55);
    text-underline-offset: 3px;
}

.entry-sub {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Cells ------------------------------------------------------------------ */

.cell-muted {
    color: var(--text-soft);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.actions-cell {
    width: 1%;
}

.actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.action-link,
.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 18px;
    border-radius: var(--radius-pill);
    text-decoration: none;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.16s var(--ease), filter 0.16s ease,
        box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.action-link svg,
.action-button svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.action-link {
    color: #23180a;
    background: linear-gradient(135deg, var(--brand-2), var(--brand) 60%, var(--brand-3) 140%);
    box-shadow: 0 6px 16px rgba(240, 173, 38, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.18s ease, transform 0.18s var(--ease), filter 0.18s ease;
}

.file-table tbody tr:hover .action-link,
.action-link:focus-visible {
    opacity: 1;
    transform: translateX(0);
}

.action-link:hover {
    filter: brightness(1.06);
    transform: translateY(-1px) !important;
    box-shadow: 0 10px 24px rgba(240, 173, 38, 0.4);
}

.action-button {
    color: var(--text-soft);
    background: #fff;
    border: 1px solid var(--border);
    cursor: pointer;
}

.action-button:hover {
    transform: translateY(-1px);
    color: var(--brand-3);
    border-color: rgba(240, 173, 38, 0.4);
}

/* ==========================================================================
   Status panels (loading / error / empty)
   ========================================================================== */

.status-panel {
    min-height: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 32px 26px;
    text-align: left;
    color: var(--text);
}

.status-panel strong {
    display: block;
    margin-bottom: 6px;
    font-size: 1.02rem;
    color: var(--heading);
    letter-spacing: -0.01em;
}

.status-panel p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.7;
    max-width: 620px;
    font-size: 13.5px;
}

.status-panel p:empty {
    display: none;
}

.status-panel > div {
    max-width: 640px;
}

/* Error prose inside boot hint keeps line breaks readable */
.status-panel.error p {
    white-space: pre-line;
}

.status-panel.error strong {
    color: var(--danger);
}

.status-panel.empty strong {
    color: var(--text-soft);
}

.spinner {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 999px;
    border: 3px solid rgba(72, 76, 84, 0.12);
    border-top-color: var(--brand);
    border-right-color: rgba(240, 173, 38, 0.35);
    animation: spin 0.8s linear infinite;
}

.status-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: var(--radius-md);
}

.status-icon.error {
    color: var(--danger);
    background: rgba(226, 85, 114, 0.1);
    border: 1px solid rgba(226, 85, 114, 0.25);
}

.status-icon.empty {
    color: var(--brand-3);
    background: var(--brand-1-soft);
    border: 1px solid rgba(240, 173, 38, 0.25);
}

.status-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.page-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px 18px;
    margin: 0 26px;
    padding: 18px 0 22px;
    border-top: 1px solid var(--line);
}

.footer-copy {
    margin: 0;
    color: var(--text-muted);
    font-size: 12.5px;
    min-width: 0;
    justify-self: start;
}

.footer-credit {
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    justify-self: center;
    opacity: 0.85;
}

.footer-credit i {
    font-size: 10px;
    opacity: 0.9;
}

.page-footer p {
    margin: 0;
}

.page-footer a {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 16px;
    border-radius: var(--radius-pill);
    color: var(--text-soft);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    transition: color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease,
        transform 0.16s var(--ease);
}

.page-footer a:hover {
    color: var(--brand-4);
    border-color: rgba(240, 173, 38, 0.4);
    box-shadow: 0 6px 16px rgba(240, 173, 38, 0.14);
    transform: translateY(-1px);
}

.footer-back-button {
    justify-self: end;
}

/* ==========================================================================
   Toast (kept for compatibility)
   ========================================================================== */

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 40;
    min-width: 260px;
    max-width: min(420px, calc(100vw - 32px));
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    background: rgba(17, 21, 28, 0.96);
    color: #fff;
    border: 1px solid rgba(240, 173, 38, 0.25);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s var(--ease);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Utilities
   ========================================================================== */

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 960px) {
    .header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .brand {
        justify-content: center;
    }

    .brand-badge {
        margin-left: 0;
        align-self: center;
    }

    .meta-group {
        align-items: flex-start;
    }
}

@media (max-width: 720px) {
    .app-shell {
        width: calc(100% - 16px);
    }

    .site-header {
        padding: 20px 18px;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .page-shell {
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    }

    .brand-logo {
        max-width: min(240px, 66vw);
        height: 50px;
    }

    .brand-badge {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

    .toolbar-card,
    .card-head {
        padding-left: 16px;
        padding-right: 16px;
    }

    .toolbar-card {
        padding-top: 18px;
        padding-bottom: 16px;
    }

    .toolbar-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .search-field,
    #refreshButton {
        width: 100%;
    }

    .search-field-large {
        height: 54px;
    }

    #refreshButton {
        min-height: 48px;
    }

    .card-head {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding-top: 16px;
        padding-bottom: 14px;
    }

    .breadcrumb-wrap {
        flex-direction: row-reverse;
        align-items: center;
        justify-content: space-between;
    }

    .breadcrumb {
        gap: 6px;
    }

    .breadcrumb-link,
    .breadcrumb-current {
        font-size: 12.5px;
    }

    .meta-count,
    .meta-note {
        font-size: 12px;
    }

    /* Mobile card list */
    .table-wrap {
        padding: 12px 12px 4px;
    }

    .file-table,
    .file-table tbody,
    .file-table tr,
    .file-table td {
        display: block;
        width: 100%;
    }

    .file-table thead {
        display: none;
    }

    .file-table tbody {
        display: grid;
        gap: 10px;
    }

    .file-table tbody tr {
        overflow: hidden;
        border: 1px solid rgba(72, 76, 84, 0.13);
        border-radius: var(--radius-lg);
        background: linear-gradient(180deg, #ffffff, #fbfbfd);
        box-shadow: 0 8px 22px rgba(39, 43, 49, 0.07);
        animation: none;
    }

    .file-table tbody tr:hover {
        box-shadow: 0 10px 26px rgba(240, 173, 38, 0.14);
    }

    .file-table tbody td {
        padding: 12px 16px;
        border-bottom: 1px solid rgba(72, 76, 84, 0.08);
    }

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

    .file-table tbody td:not(.name-cell):not([colspan]) {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        text-align: right;
    }

    .file-table tbody td:not(.name-cell):not([colspan])::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 10.5px;
        font-weight: 700;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        text-align: left;
    }

    .file-table tbody td[colspan] {
        display: block;
        padding: 0;
        border-bottom: 0;
    }

    .file-table tbody td[colspan]::before {
        content: none !important;
    }

    .file-table tbody td.no-actions {
        display: none;
    }

    .file-table tbody tr.row-folder .actions-cell.no-actions {
        display: none;
    }

    .name-cell {
        min-width: 0;
    }

    .entry {
        gap: 12px;
        align-items: flex-start;
    }

    .entry-icon {
        width: 40px;
        height: 40px;
    }

    .entry-name {
        display: block;
        font-size: 15px;
        line-height: 1.4;
    }

    .entry-name .entry-sub,
    .entry-name .entry-title {
        white-space: normal;
        word-break: break-word;
    }

    .entry-sub {
        margin-top: 6px;
        white-space: normal;
        font-size: 11px;
    }

    .action-link {
        width: 100%;
        min-height: 42px;
        padding: 0 14px;
        justify-content: center;
        opacity: 1;
        transform: none;
    }

    .actions {
        width: 100%;
    }

    .actions-cell:not(.no-actions) {
        padding-top: 4px;
    }

    .status-panel {
        min-height: 170px;
        flex-direction: column;
        text-align: center;
        padding: 26px 16px;
    }

    .status-panel p {
        max-width: none;
    }

    .page-footer {
        margin-left: 16px;
        margin-right: 16px;
        grid-template-columns: 1fr;
        gap: 12px;
        justify-items: stretch;
        padding-top: 14px;
        padding-bottom: 16px;
    }

    .page-footer .footer-copy {
        justify-self: start;
    }

    .page-footer .footer-credit {
        justify-self: center;
        font-size: 11px;
    }

    .footer-back-button {
        justify-self: stretch;
        justify-content: center;
    }
}

[data-theme="dark"] {
    --bg: #101319;
    --bg-soft: #f2f3f6;
    --panel: rgba(255, 255, 255, 0.86);
    --panel-strong: rgba(255, 255, 255, 0.97);
    --panel-soft: rgba(245, 180, 64, 0.08);
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.22);
    --border: rgba(255, 255, 255, 0.1);
    --border-strong-h: rgba(255, 255, 255, 0.24);
    --text: #eef1f6;
    --text-soft: #b6bdc7;
    --text-muted: #8b93a0;
    --heading: #ffffff;
    --shadow: 0 24px 60px rgba(8, 10, 15, 0.45);
    --shadow-soft: 0 14px 34px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] body {
    background:
        radial-gradient(1100px 500px at 50% -12%, rgba(240, 173, 38, 0.16), transparent 62%),
        radial-gradient(700px 420px at 100% 0%, rgba(247, 197, 61, 0.09), transparent 60%),
        radial-gradient(700px 500px at 0% 100%, rgba(56, 98, 158, 0.12), transparent 65%),
        linear-gradient(180deg, #10131a 0%, #12161d 45%, #0e1116 100%);
    background-attachment: fixed;
}

[data-theme="dark"] .site-header {
    background:
        radial-gradient(circle at 88% 10%, rgba(240, 173, 38, 0.2), transparent 34%),
        radial-gradient(circle at 0% 120%, rgba(240, 173, 38, 0.12), transparent 40%),
        linear-gradient(135deg, #232830 0%, #1c2129 55%, #171b22 100%);
    border-color: rgba(255, 255, 255, 0.08);
}


/* --- Theme toggle -------------------------------------------------------- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(240, 173, 38, 0.4);
    background: linear-gradient(150deg, rgba(255, 214, 130, 0.35), rgba(250, 179, 60, 0.15));
    color: var(--brand-3);
    cursor: pointer;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.theme-toggle:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-pop);
}

.theme-toggle:active {
    transform: translateY(0);
}

.theme-toggle__icon {
    font-size: 18px;
    position: absolute;
    transition: opacity 0.25s var(--ease), transform 0.35s var(--ease);
}

.theme-toggle__icon--sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-toggle__icon--moon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.4);
}

[data-theme="dark"] .theme-toggle__icon--sun {
    opacity: 0;
    transform: rotate(90deg) scale(0.4);
}

[data-theme="dark"] .theme-toggle__icon--moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-toggle {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--brand-2);
}

/* --- Dark theme overrides for core shell ---------------------------------- */
[data-theme="dark"] .page-shell {
    background:
        linear-gradient(180deg, rgba(20, 24, 31, 0.98), rgba(16, 19, 25, 0.96));
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] body {
    color: #eef1f6;
}

/* --- Dark theme overrides for components ---------------------------------- */
[data-theme="dark"] .search-field {
    background: linear-gradient(180deg, #1b2028, #171c23);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

[data-theme="dark"] .search-field:focus-within {
    background: linear-gradient(180deg, #1e242d, #191f27);
    border-color: rgba(240, 173, 38, 0.45);
}

[data-theme="dark"] .search-field svg {
    stroke: var(--text-muted);
}

[data-theme="dark"] .search-field input {
    color: var(--text);
}

[data-theme="dark"] .search-field input::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] #refreshButton {
    background: linear-gradient(180deg, #1b2028, #171c23);
    color: var(--text-soft);
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] #refreshButton:hover {
    background: linear-gradient(180deg, #232a34, #1c222b);
    color: var(--brand-2);
    border-color: rgba(240, 173, 38, 0.4);
}

[data-theme="dark"] .back-button {
    background: #1b2028;
    color: var(--text-soft);
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .back-button:hover,
[data-theme="dark"] .back-button:focus-visible {
    background: #232a34;
    color: var(--brand-2);
}

[data-theme="dark"] .breadcrumb-current {
    color: var(--text);
}

[data-theme="dark"] .file-table thead th {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border-bottom-color: var(--line);
}

[data-theme="dark"] .file-table tbody tr {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
    color: var(--text);
}

[data-theme="dark"] .file-table tbody tr:hover {
    background: rgba(240, 173, 38, 0.07);
}

[data-theme="dark"] .file-table tbody tr:hover .entry-icon {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .entry-name {
    color: var(--text);
}

[data-theme="dark"] .entry-sub {
    color: var(--text-muted);
}

[data-theme="dark"] .cell-muted {
    color: var(--text-soft);
}

[data-theme="dark"] .action-button {
    background: #1b2028;
    color: var(--text-soft);
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .action-button:hover {
    background: #232a34;
    color: var(--brand-2);
    border-color: rgba(240, 173, 38, 0.4);
}

[data-theme="dark"] .status-panel {
    color: var(--text);
}

[data-theme="dark"] .page-footer,
[data-theme="dark"] .page-footer a {
    color: var(--text-muted);
}

[data-theme="dark"] .toast {
    background: #1b2028;
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .btn {
    color: var(--text);
}

