:root {
    --app-bg: #f6f7f9;
    --app-panel: #ffffff;
    --app-border: #e4e7ec;
    --app-text: #182230;
    --app-muted: #667085;
    --app-accent: #2563eb;
    --app-accent-soft: #dbeafe;
}

/* GLOBAL FIX */
* {
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    background: var(--app-bg);
    color: var(--app-text);
}

/* BRAND */

.brand-mark {
    display: inline-grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: .5rem;
    background: var(--app-accent);
    color: #fff;
}

/* ACCOUNT */

.account-chip {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
    color: var(--app-muted);
    font-size: .875rem;
}

.account-chip img,
.avatar-fallback {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
}

.avatar-fallback {
    display: inline-grid;
    place-items: center;
    background: var(--app-accent-soft);
    color: var(--app-accent);
}

/* LAYOUT */

.workspace {
    display: grid;
    grid-template-columns: 18rem minmax(0, 1fr);
    gap: 1rem;

    width: 100%;
    min-width: 0;
}

.side-panel,
.content-panel {
    background: var(--app-panel);
    border: 1px solid var(--app-border);
    border-radius: .75rem;

    min-width: 0;
    overflow: hidden;
}

.side-panel {
    align-self: start;
    padding: 1rem;
}

.panel-section {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--app-border);
}

/* METRIC */

.metric-label {
    color: var(--app-muted);
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.metric-value {
    margin-top: .25rem;
    font-size: 2rem;
    font-weight: 700;
}

.metric-value.small-value {
    font-size: .95rem;
    font-weight: 600;
}

/* FOLDER LIST */

.folder-list-wrap {
    width: 100%;
    min-width: 0;

    padding-top: 1rem;
    margin-top: 1rem;

    border-top: 1px solid var(--app-border);

    overflow: hidden;
}

.folder-list {
    display: flex;
    flex-direction: column;
    gap: 8px;

    width: 100%;
    min-width: 0;

    max-height: 350px;

    overflow-y: auto;
    overflow-x: auto;

    padding-right: 4px;
    padding-bottom: 4px;
}

/* ITEM */

.folder-link {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    width: max-content;
    min-width: 100%;

    padding: 10px 12px;

    border-radius: 10px;

    text-decoration: none;

    background: #f8fafc;
    border: 1px solid #e5e7eb;

    transition: all .2s ease;
}

.folder-link:hover {
    background: #eef4ff;
    border-color: #3b82f6;
}

.folder-link.active {
    background: var(--app-accent);
    color: #fff;
    border-color: var(--app-accent);
}

/* LEFT SIDE */

.folder-left {
    display: flex;
    align-items: center;
    gap: 8px;

    flex: 1;
    min-width: 0;
}

/* ICON */

.folder-link i {
    flex-shrink: 0;
    color: var(--app-muted);
    font-size: 15px;
}

.folder-link.active i {
    color: #fff;
}

/* NAME */

.folder-name {
    white-space: nowrap;

    min-width: 0;

    font-size: 14px;
    color: inherit;
}

/* COUNT */

.folder-link strong {
    flex-shrink: 0;

    font-size: 13px;
    font-weight: 700;

    color: var(--app-muted);
}

.folder-link.active strong {
    color: #fff;
}

/* CONTENT PANEL */

.content-panel {
    min-width: 0;
    padding: 1rem;
}

/* TOOLBAR */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: .5rem;

    width: min(34rem, 100%);
    min-width: 0;

    padding: .6rem .8rem;

    border: 1px solid var(--app-border);
    border-radius: .5rem;

    background: #fff;
    color: var(--app-muted);
}

.search-box input {
    width: 100%;
    min-width: 0;

    border: 0;
    outline: 0;
    background: transparent;
}

.view-toggle .btn {
    width: 2.5rem;
}

/* ACTIVE BAR */

.active-folder-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    padding: .6rem .75rem;
    margin-bottom: 1rem;

    border: 1px solid #bfdbfe;
    border-radius: .5rem;

    background: #eff6ff;

    color: #1e40af;
    font-size: .9rem;
    font-weight: 600;
}

.active-folder-bar span {
    display: flex;
    align-items: center;
    gap: .45rem;

    min-width: 0;
}

.active-folder-bar a {
    flex: 0 0 auto;

    color: #1d4ed8;
    font-size: .85rem;
    text-decoration: none;
}

/* PHOTO GRID */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1rem;
}

.photo-card {
    overflow: hidden;

    border: 1px solid var(--app-border);
    border-radius: .75rem;

    background: #fff;
}

.photo-preview {
    display: block;

    width: 100%;
    aspect-ratio: 4 / 3;

    padding: 0;
    border: 0;

    background: #eef2f7;
}

.photo-preview img,
.table-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;

    min-height: 5rem;

    padding: .85rem;
}

.photo-meta h2 {
    display: -webkit-box;

    margin: 0;

    overflow: hidden;

    color: var(--app-text);
    font-size: .95rem;
    font-weight: 700;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.folder-badge {
    display: flex;
    align-items: center;
    gap: .35rem;

    max-width: 100%;

    margin-bottom: .25rem;

    overflow: hidden;

    color: var(--app-muted);
    font-size: .76rem;
    font-weight: 600;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-meta p {
    margin: .25rem 0 0;

    color: var(--app-muted);
    font-size: .8rem;
}

/* TABLE */

.photo-table-wrap {
    border: 1px solid var(--app-border);
    border-radius: .5rem;
}

.photo-table {
    margin-bottom: 0;
}

.photo-table thead th {
    color: var(--app-muted);
    font-size: .78rem;
    text-transform: uppercase;
}

.table-thumb {
    width: 4rem;
    height: 3rem;

    border-radius: .4rem;

    background: #eef2f7;
}

/* EMPTY */

.empty-state {
    display: grid;

    min-height: 24rem;

    place-items: center;
    align-content: center;

    padding: 2rem;

    text-align: center;
}

.empty-state > i {
    margin-bottom: 1rem;
    color: var(--app-accent);
    font-size: 3rem;
}

.empty-state h1 {
    margin-bottom: .5rem;
    font-size: 1.35rem;
}

.empty-state p {
    max-width: 34rem;
    color: var(--app-muted);
}

/* MODAL */

.modal-image-body {
    display: grid;
    min-height: 60vh;
    place-items: center;
    background: #101828;
}

.modal-image-body img {
    max-width: 100%;
    max-height: 72vh;
    object-fit: contain;
}

/* PAGER */

.pager-wrap {
    margin-top: 1rem;
}

.pager-wrap ul {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;

    padding-left: 0;
    margin-bottom: 0;

    list-style: none;
}

.pager-wrap a,
.pager-wrap li.active a,
.pager-wrap li.active span,
.pager-wrap li.disabled span {
    display: inline-flex;

    min-width: 2.25rem;
    height: 2.25rem;

    align-items: center;
    justify-content: center;

    padding: 0 .65rem;

    border: 1px solid var(--app-border);
    border-radius: .45rem;

    color: var(--app-text);
    text-decoration: none;
}

.pager-wrap li.active a,
.pager-wrap li.active span {
    border-color: var(--app-accent);
    background: var(--app-accent);
    color: #fff;
}

.pager-wrap li.disabled span {
    color: #98a2b3;
}

/* TABLET */

@media (max-width: 992px) {

    .workspace {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        width: 100%;
    }

    .view-toggle {
        align-self: flex-end;
    }
}

/* MOBILE */

@media (max-width: 576px) {

    .workspace {
        gap: .75rem;
    }

    .content-panel,
    .side-panel {
        padding: .75rem;
        border-radius: .6rem;
    }

    .photo-grid {
        grid-template-columns: 1fr;
    }

    .folder-link {
        padding: 10px;
    }

    .folder-name {
        font-size: 13px;
    }

    .folder-link strong {
        font-size: 12px;
    }

    .toolbar {
        gap: .5rem;
    }

    .active-folder-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}