/* ============================================================
   1) DESIGN TOKENS
============================================================ */

:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #17191c;
    --muted: #747b85;
    --line: #e4e7eb;
    --soft: #eef1f4;
    --accent: #17191c;
    --danger: #b42318;
    --ok: #067647;
    --shadow: 0 10px 30px rgba(18, 24, 32, .08);
}


/* ============================================================
   2) BASE
============================================================ */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-size: 14px;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}


/* ============================================================
   3) MAIN LAYOUT
============================================================ */

.app {
    min-height: 100vh;
}

.top {
    height: 66px;
    padding: 0 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    position: sticky;
    top: 0;
    z-index: 20;

    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.page {
    max-width: 1280px;
    margin: auto;
    padding: 24px;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

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

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.action-field {
    align-content: end;
}


/* ============================================================
   4) TYPOGRAPHY
============================================================ */

.brand {
    font-size: 16px;
    font-weight: 800;
}

.title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.sub {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.status {
    color: var(--muted);
    font-size: 12px;
}

.ok {
    color: var(--ok);
}

.bad {
    color: var(--danger);
}

.feedback {
    margin-top: 8px;
}


/* ============================================================
   5) PANELS + FORMS
============================================================ */

.panel {
    padding: 18px;

    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .02);
}

.login {
    max-width: 420px;
    margin: 10vh auto;
}

.field {
    display: grid;
    gap: 6px;
    margin: 10px 0;
}

.field label {
    font-size: 12px;
    font-weight: 600;
}

.field input,
.field select {
    width: 100%;
    padding: 10px;

    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
}


/* ============================================================
   6) BUTTONS + NAVIGATION
============================================================ */

.topnav {
    display: flex;
    gap: 6px;
}

.topnav button,
.btn {
    padding: 9px 12px;

    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.topnav button.active,
.btn.primary {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.btn.danger {
    color: var(--danger);
}


/* ============================================================
   7) ALBUM CARDS
============================================================ */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.album-card {
    position: relative;

    padding: 0;
    overflow: hidden;
    aspect-ratio: 1.28 / 1;

    text-align: left;
    background: #dfe3e8;
    border: 0;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.album-card img {
    display: block;
    width: 100%;
    height: 100%;

    object-fit: cover;
    transition: transform .3s;
}

.album-card:hover img {
    transform: scale(1.035);
}

.album-caption {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;

    padding: 22px 14px 12px;

    color: #fff;
    background:
        linear-gradient(
            0deg,
            rgba(10, 12, 15, .72),
            rgba(10, 12, 15, .30) 62%,
            transparent
        );

    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.album-caption b {
    display: block;
    font-size: 15px;
    font-weight: 700;
}

.album-caption span {
    display: block;
    margin-top: 3px;

    font-size: 11px;
    opacity: .82;
}

.placeholder {
    height: 100%;

    display: grid;
    place-items: center;

    color: #fff;
    font-weight: 700;
    background: linear-gradient(135deg, #dfe4ea, #aeb7c4);
}


/* ============================================================
   8) UPLOAD
============================================================ */

.drop {
    padding: 28px;

    text-align: center;
    cursor: pointer;

    background: #fafbfc;
    border: 1.5px dashed #bbc1ca;
    border-radius: 14px;
}

.drop.dragover {
    background: #eef1f4;
    border-color: #17191c;
    box-shadow: inset 0 0 0 1px #17191c;
}

.progress {
    height: 7px;
    overflow: hidden;

    background: var(--soft);
    border-radius: 999px;
}

.progress i {
    display: block;
    width: 0;
    height: 100%;
    background: #17191c;
}


/* ============================================================
   9) MEMBERS + MEDIA TABLES
============================================================ */

.table-scroll {
    max-height: 360px;
    margin-top: 12px;
    overflow-y: auto;
    overflow-x: auto;

    border: 1px solid var(--line);
    border-radius: 10px;
}

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

.table th,
.table td {
    padding: 10px;

    text-align: left;
    font-size: 12px;
    border-bottom: 1px solid var(--line);
}

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

    background: #fff;
    box-shadow: 0 1px 0 var(--line);
}

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


/* ============================================================
   10) RECOVERY
============================================================ */

.recovery-panel {
    border-style: dashed;
}


/* ============================================================
   11) DEBUG
============================================================ */

.debug-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
}

.debug-item {
    padding: 12px;

    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.debug-item h4 {
    margin: 0 0 4px;
    font-size: 13px;
}

.debug-item p {
    margin: 0 0 10px;

    color: var(--muted);
    font-size: 11px;
}

.badge {
    display: inline-block;
    padding: 3px 6px;

    font-size: 10px;
    background: var(--soft);
    border-radius: 999px;
}

.log {
    min-height: 180px;
    max-height: 360px;
    padding: 12px;
    overflow: auto;

    color: #d9e0e7;
    background: #11151a;
    border-radius: 12px;

    white-space: pre-wrap;
    word-break: break-word;

    font:
        11px ui-monospace,
        SFMono-Regular,
        Consolas,
        monospace;
}


/* ============================================================
   12) MODAL
============================================================ */

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;

    display: grid;
    place-items: center;
    padding: 18px;

    background: rgba(10, 12, 15, .42);
}

.modalbox {
    width: min(520px, 100%);
    padding: 18px;

    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow);
}


/* ============================================================
   FIVE IMPROVEMENTS: SORT CONTROLS
============================================================ */
.list-controls{justify-content:flex-end;margin-top:8px}.sort-label{display:flex;align-items:center;gap:7px;font-size:12px;color:var(--muted)}.sort-label select{padding:6px 8px;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--text)}.wall-sort{position:absolute;right:14px;top:10px;z-index:8;background:rgba(255,255,255,.88);padding:5px 7px;border-radius:9px;box-shadow:0 2px 10px rgba(0,0,0,.06)}
