/* StreamHub v2.1 — 3D vibrant glass */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

@font-face { font-family: 'Outfit'; font-weight: 400; font-display: swap;
    src: url('fonts/outfit-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-weight: 600; font-display: swap;
    src: url('fonts/outfit-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-weight: 700; font-display: swap;
    src: url('fonts/outfit-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-weight: 800; font-display: swap;
    src: url('fonts/outfit-latin-800-normal.woff2') format('woff2'); }

:root {
    --accent: #38bdf8;
    --accent-glow: color-mix(in srgb, var(--accent) 60%, transparent);
    --blur: 18px;
    --bg-base: #020204;
    --glass: rgba(22, 22, 26, 0.90);
    --edge-top: rgba(255,255,255,0.55);
    --edge-side: rgba(255,255,255,0.10);
    --edge-bottom: rgba(0,0,0,1);
    --text: #ffffff;
    --text-dim: #cbd5e1;
    --radius-lg: 26px;
    --shadow-heavy: 0 30px 60px -15px rgba(0,0,0,0.9);
    --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.22);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --ok: #00ff88;
    --bad: #ff4757;
}

html { scrollbar-color: rgba(255,255,255,0.18) transparent; }
body {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 15px; line-height: 1.5;
    color: var(--text);
    background: var(--bg-base);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- background stack ---------- */
.aurora {
    position: fixed; inset: 0; z-index: -5;
    background: linear-gradient(-45deg, #020204, #0f172a, #1e1b4b, #312e81, #020204);
    background-size: 400% 400%;
    animation: aurora 22s ease infinite;
}
.aurora i { display: none; }
@keyframes aurora { 0%{background-position:0% 50%} 50%{background-position:100% 50%} 100%{background-position:0% 50%} }
body::before { /* optional user background image */
    content: ""; position: fixed; inset: 0; z-index: -3;
    background-size: cover; background-position: center;
    filter: blur(8px) brightness(0.5); transform: scale(1.05);
}
body::after { /* accent bloom + bottom fade */
    content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
    background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 75%),
                linear-gradient(to bottom, transparent 60%, var(--bg-base) 100%);
}
@keyframes slideUpFade { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 0% { transform: translateX(-150%) skewX(-15deg); } 100% { transform: translateX(150%) skewX(-15deg); } }
@keyframes floatIcon { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes floatLogo { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes pulseStatus { 0% { box-shadow: 0 0 0 0 var(--accent-glow); } 100% { box-shadow: 0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- glass slab ---------- */
.glass {
    background: var(--glass);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(150%);
    backdrop-filter: blur(var(--blur)) saturate(150%);
    border-top: 1.5px solid var(--edge-top);
    border-bottom: 1.5px solid var(--edge-bottom);
    border-left: 1px solid var(--edge-side);
    border-right: 1px solid var(--edge-side);
    box-shadow: var(--shadow-heavy), var(--shadow-inset);
    border-radius: var(--radius-lg);
}

/* ---------- layout ---------- */
.wrap { max-width: 1400px; margin: 0 auto; padding: 15px 20px 90px; }
@media (max-width: 640px) { .wrap { padding: 10px 12px 100px; } }

/* ---------- header ---------- */
.topbar {
    position: sticky; top: 15px; z-index: 40;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 24px;
    animation: slideUpFade 0.6s var(--smooth);
}
@media (max-width: 640px) { .topbar { top: 8px; padding: 10px 14px; } }
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1; overflow: hidden; }
.brand-text { min-width: 0; }
.brand-logo {
    width: 56px; height: 56px; border-radius: 18px; object-fit: cover; flex: 0 0 auto;
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 12px 26px rgba(0,0,0,0.5);
    animation: floatLogo 6s ease-in-out infinite;
}
@media (max-width: 640px) { .brand-logo { width: 44px; height: 44px; border-radius: 14px; } }
.brand-text h1 { font-size: 24px; font-weight: 800; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.6); line-height: 1.2; }
.brand-text p { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1.4px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .brand-text h1 { font-size: 18px; } .brand-text p { font-size: 10px; letter-spacing: 1px; } }
.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
    width: 46px; height: 46px; border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.35); border-bottom-color: rgba(0,0,0,0.6);
    color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px; transition: var(--smooth);
    box-shadow: 0 5px 15px rgba(0,0,0,0.35);
}
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn:hover { background: var(--accent); color: #000; box-shadow: 0 0 26px var(--accent-glow); transform: rotate(90deg); }
.icon-btn.active { background: var(--accent); color: #000; box-shadow: 0 0 26px var(--accent-glow); }
@media (max-width: 640px) { .icon-btn { width: 42px; height: 42px; } }

/* ---------- page tabs ---------- */
.page-tabs { display: flex; gap: 10px; padding: 16px 2px 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.page-tabs::-webkit-scrollbar { display: none; }
.tab {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 9px;
    padding: 12px 26px; border-radius: 50px; cursor: pointer; user-select: none;
    color: var(--text-dim); font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.6px;
    background: rgba(20,20,25,0.6);
    border-top: 1px solid rgba(255,255,255,0.4); border-bottom: 1px solid rgba(0,0,0,0.6);
    border-left: 1px solid transparent; border-right: 1px solid transparent;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: all 0.3s var(--spring); position: relative; overflow: hidden;
}
.tab::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.2) 50%, transparent);
    transform: translateX(-150%) skewX(-15deg); pointer-events: none;
}
.tab:hover::before { animation: shimmer 0.6s; }
.tab:hover { color: #fff; background: rgba(255,255,255,0.14); transform: translateY(-2px);
    border-top-color: rgba(255,255,255,0.8); box-shadow: 0 8px 20px rgba(0,0,0,0.5); }
.tab.active {
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 30%, transparent), color-mix(in srgb, var(--accent) 10%, transparent));
    border: 1px solid var(--accent); color: #fff;
    box-shadow: 0 5px 20px var(--accent-glow); text-shadow: 0 0 10px var(--accent-glow);
    transform: translateY(-2px);
}
.tab img { width: 18px; height: 18px; border-radius: 5px; }
.tab .tab-edit { display: none; opacity: .9; font-size: 13px; padding: 2px 4px; }
body.editing .tab .tab-edit { display: inline; }
.tab.tab-add { border-style: dashed; border-color: rgba(255,255,255,0.3); font-size: 16px; padding: 10px 18px; }

/* ---------- categories ---------- */
.board { display: block; }
.cat-card { margin-top: 42px; animation: slideUpFade 0.7s var(--spring) backwards; background: none; border: none; box-shadow: none; }
.cat-head {
    display: flex; align-items: center; gap: 12px; min-width: 0;
    padding: 11px 18px; margin-bottom: 22px;
    background: linear-gradient(90deg, rgba(40,40,45,0.95), rgba(25,25,30,0.9));
    border-top: 1.5px solid rgba(255,255,255,0.5);
    border-bottom: 1.5px solid rgba(0,0,0,0.9);
    border-left: 1px solid var(--edge-side); border-right: 1px solid var(--edge-side);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-heavy);
}
.cat-ic {
    width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
    background: var(--accent); box-shadow: 0 0 15px var(--accent-glow);
    display: flex; align-items: center; justify-content: center;
    color: #000; font-weight: 800; font-size: 14px; overflow: hidden;
}
.cat-ic img { width: 100%; height: 100%; object-fit: cover; }
.cat-head h2 {
    font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px;
    color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cat-count { font-size: 11px; font-weight: 700; color: var(--text-dim);
    background: rgba(255,255,255,0.07); border: 1px solid var(--edge-side);
    padding: 3px 11px; border-radius: 999px; }
.cat-tools { display: none; gap: 6px; }
body.editing .cat-tools { display: flex; }
body.editing .cat-count { display: none; }
body.editing .cat-head { cursor: grab; }

/* ---------- tiles grid ---------- */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(185px, 100%), 1fr));
    gap: 22px;
    align-items: stretch;
}
@media (max-width: 640px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
@media (max-width: 360px) { .tiles { grid-template-columns: minmax(0, 1fr); } }

.tile {
    position: relative; height: 232px; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; text-decoration: none; padding: 18px 14px;
    color: var(--text);
    background: linear-gradient(160deg, rgba(40,40,45,0.95), rgba(15,15,20,0.98));
    border-top: 1.5px solid var(--edge-top);
    border-bottom: 1.5px solid var(--edge-bottom);
    border-left: 1px solid var(--edge-side); border-right: 1px solid var(--edge-side);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-heavy);
    transition: transform 0.2s var(--spring), box-shadow 0.2s ease;
    overflow: hidden;
}
@media (max-width: 640px) { .tile { height: 190px; padding: 14px 10px; } }
.tile::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.1) 50%, transparent);
    transform: translateX(-150%) skewX(-15deg);
}
.tile::after {
    content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
    background: radial-gradient(circle at top left, rgba(255,255,255,0.1), transparent 60%);
}
.tile:hover::before { animation: shimmer 0.8s; }
.tile:hover {
    transform: translateY(-10px) scale(1.02);
    border-top-color: rgba(255,255,255,0.8);
    box-shadow: 0 40px 80px rgba(0,0,0,0.9), 0 0 40px color-mix(in srgb, var(--accent) 22%, transparent);
    z-index: 10;
    background: linear-gradient(160deg, rgba(50,50,55,0.98), rgba(25,25,30,1));
}

.tile-visual {
    width: 92px; height: 92px; border-radius: 50%; margin-bottom: 18px;
    display: flex; align-items: center; justify-content: center;
    position: relative; z-index: 2; flex: 0 0 auto;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.3), rgba(0,0,0,0.9));
    border: 1px solid rgba(255,255,255,0.25);
    box-shadow: 0 20px 40px rgba(0,0,0,0.8), inset 0 5px 10px rgba(255,255,255,0.3), inset 0 -10px 20px rgba(0,0,0,0.8);
    animation: floatIcon 6s ease-in-out infinite;
    transition: transform 0.25s var(--spring), box-shadow 0.25s ease;
    font-size: 38px; font-weight: 800; color: var(--accent);
}
@media (max-width: 640px) { .tile-visual { width: 74px; height: 74px; margin-bottom: 13px; font-size: 30px; } }
.tile:hover .tile-visual {
    transform: translateY(-10px) scale(1.13);
    border-color: rgba(255,255,255,0.7);
    box-shadow: 0 35px 70px rgba(0,0,0,1), inset 0 5px 20px rgba(255,255,255,0.4), inset 0 -10px 20px rgba(0,0,0,0.8);
    animation-play-state: paused;
}
.tile-visual img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
    opacity: 0; transition: opacity 0.4s ease-in-out;
}
.tile-visual img.img-loaded { opacity: 1; }

.tile-content { position: relative; z-index: 2; width: 100%; min-width: 0; overflow: hidden; }
.tile-name, .tile-meta { display: block; width: 100%; white-space: nowrap; overflow: hidden; text-align: center; }
.tile-name { font-size: 16px; font-weight: 700; margin-bottom: 5px; text-shadow: 0 2px 8px rgba(0,0,0,1); }
.tile-meta { font-size: 12.5px; color: #f1f5f9; font-weight: 500; opacity: 0.85; text-shadow: 0 1px 4px rgba(0,0,0,0.9); }
@media (max-width: 640px) { .tile-name { font-size: 14px; } .tile-meta { font-size: 11px; } }
/* Overflowing text: soft edge fade + continuous smooth loop */
.tile-name.has-overflow, .tile-meta.has-overflow {
    text-align: left;
    mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent);
}
.has-overflow > span {
    display: inline-block; width: max-content;
    animation: marquee var(--marq-dur, 8s) linear infinite;
}
.tile:hover .has-overflow > span { animation-play-state: paused; }
@keyframes marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

.status-indicator {
    position: absolute; top: 14px; right: 14px; width: 12px; height: 12px; z-index: 5;
    border-radius: 50%; background: #333;
    border: 1px solid rgba(0,0,0,0.5);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.3);
    transition: all 0.3s;
}
.status-indicator.ok { background: var(--ok); box-shadow: 0 0 15px var(--ok); animation: pulseStatus 2s infinite; }
.status-indicator.bad { background: var(--bad); }

.tile-tools { display: none; position: absolute; top: 10px; left: 10px; z-index: 6; gap: 4px; }
body.editing .tile-tools { display: flex; }
body.editing .tile { cursor: grab; }
.mini-btn {
    width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.25);
    cursor: pointer; background: rgba(10,10,14,0.75); color: #fff; font-size: 15px;
    display: inline-flex; align-items: center; justify-content: center; transition: all .15s;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.mini-btn:hover { background: var(--accent); color: #000; }
.mini-btn.danger:hover { background: var(--bad); color: #fff; }

.add-tile {
    height: 230px; border-radius: var(--radius-lg);
    border: 2px dashed rgba(255,255,255,0.22);
    display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    color: var(--text-dim); cursor: pointer; font-weight: 700; font-size: 14px;
    transition: all .2s var(--spring);
}
@media (max-width: 640px) { .add-tile { height: 190px; } }
.add-tile b { font-size: 34px; font-weight: 400; line-height: 1; }
.add-tile:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-4px);
    box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 18%, transparent); }
body.editing .add-tile { display: flex; }

.add-cat {
    margin-top: 42px; border: 2px dashed rgba(255,255,255,0.22); border-radius: var(--radius-lg);
    min-height: 90px; display: none; align-items: center; justify-content: center; gap: 8px;
    color: var(--text-dim); cursor: pointer; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    font-size: 13px; transition: all .2s;
}
.add-cat:hover { color: var(--accent); border-color: var(--accent); }
body.editing .add-cat { display: flex; }

.ghost { opacity: .35; }
.drag-item { box-shadow: 0 20px 45px rgba(0,0,0,0.8) !important; }

.empty-state { text-align: center; padding: 80px 20px; color: var(--text-dim); }
.empty-state b { color: #fff; font-size: 18px; display: block; margin-bottom: 8px; }

/* ---------- FAB + action sheet ---------- */
.fab {
    position: fixed; right: 20px; bottom: 20px; z-index: 45;
    width: 62px; height: 62px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.4);
    cursor: pointer; font-size: 30px; color: #000; line-height: 1;
    background: var(--accent);
    box-shadow: 0 10px 30px var(--accent-glow), inset 0 2px 0 rgba(255,255,255,0.5);
    transition: transform .2s var(--spring);
}
.fab:hover { transform: scale(1.1) rotate(90deg); }
@media (max-width: 640px) { .fab { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); } }

.sheet-backdrop {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(3,4,8,0.6);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    display: flex; align-items: flex-end; justify-content: center;
    animation: fadeIn .18s ease;
}
.sheet {
    width: 100%; max-width: 480px; margin: 0 10px calc(14px + env(safe-area-inset-bottom));
    border-radius: 24px; padding: 10px;
    animation: sheetUp .3s var(--spring);
}
@keyframes sheetUp { from { transform: translateY(70px); opacity: 0; } }
.sheet button {
    display: flex; align-items: center; gap: 14px; width: 100%;
    padding: 16px 18px; border: none; background: transparent; border-radius: 16px;
    color: #fff; font-family: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
    transition: background .15s;
}
.sheet button:hover, .sheet button:active { background: rgba(255,255,255,0.09); }
.sheet button i { font-style: normal; font-size: 20px; width: 30px; text-align: center; }
.sheet .cancel { color: var(--text-dim); justify-content: center; margin-top: 4px; }

/* ---------- modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 60; padding: 18px;
    background: rgba(3,4,8,0.65);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
    width: 100%; max-width: 560px; max-height: 90vh; max-height: 90dvh; overflow: auto;
    border-radius: 24px;
    animation: slideUpFade .3s var(--spring);
}
/* bottom-sheet style on phones */
@media (max-width: 640px) {
    .modal-backdrop { padding: 0; align-items: flex-end; }
    .modal { max-width: none; max-height: 94dvh; border-radius: 24px 24px 0 0; animation: sheetUp .3s var(--spring); }
}
.modal-head {
    position: sticky; top: 0; z-index: 2;
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px 12px;
    background: rgba(18,20,28,0.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--edge-side);
    border-radius: 24px 24px 0 0;
}
.modal-head h2 { font-size: 17px; font-weight: 800; }
.modal-head .icon-btn { width: 38px; height: 38px; font-size: 20px; }
.modal-head .icon-btn:hover { transform: none; }
.modal-body { padding: 18px 20px calc(24px + env(safe-area-inset-bottom)); }

.field { display: block; margin-bottom: 15px; }
.field span { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: 1px;
    text-transform: uppercase; color: var(--text-dim); margin-bottom: 7px; }
.field input[type=text], .field input[type=url], .field input[type=password],
.field select, .field textarea {
    width: 100%; padding: 13px 15px; font-size: 16px; font-family: inherit;
    background: rgba(255,255,255,0.06); color: var(--text);
    border: 1px solid var(--edge-side); border-radius: 14px; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.field select option { background: #14161f; }
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.field input[type=color] { width: 58px; height: 42px; border: none; background: none; cursor: pointer; }

.check { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--text-dim);
    margin: 4px 0 16px; cursor: pointer; user-select: none; min-height: 44px; }
.check input { width: 19px; height: 19px; accent-color: var(--accent); flex: 0 0 auto; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }

.btn {
    padding: 13px 22px; border-radius: 14px; min-height: 46px;
    border: 1px solid rgba(255,255,255,0.25); border-bottom-color: rgba(0,0,0,0.6);
    background: rgba(255,255,255,0.08); color: var(--text);
    font-family: inherit; font-size: 14.5px; font-weight: 700;
    cursor: pointer; transition: all .16s;
}
.btn:hover { background: rgba(255,255,255,0.15); }
.btn-primary {
    border-color: var(--accent); color: #000; background: var(--accent);
    box-shadow: 0 6px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.5);
}
.btn-primary:hover { filter: brightness(1.12); background: var(--accent); }
.btn-danger { color: #ffb3bc; border-color: color-mix(in srgb, var(--bad) 45%, transparent);
    background: color-mix(in srgb, var(--bad) 12%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 26%, transparent); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.btn-row .left { margin-right: auto; }
.btn[disabled] { opacity: .55; cursor: wait; }

.icon-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.icon-pick img { width: 50px; height: 50px; border-radius: 14px; object-fit: cover;
    background: rgba(255,255,255,.06); border: 1px solid var(--edge-side); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.seg { display: flex; border: 1px solid var(--edge-side); border-radius: 14px; overflow: hidden; margin-bottom: 15px; }
.seg button { flex: 1; padding: 12px; border: none; background: transparent; color: var(--text-dim);
    font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: all .15s; min-height: 44px; }
.seg button.on { background: var(--accent); color: #000; }

.tabs2 { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs2 button { padding: 10px 18px; border-radius: 999px; border: 1px solid var(--edge-side);
    background: transparent; color: var(--text-dim); font-family: inherit;
    font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px;
    cursor: pointer; min-height: 42px; }
.tabs2 button.on { background: var(--accent); color: #000; border-color: var(--accent);
    box-shadow: 0 0 18px var(--accent-glow); }

/* pages manager */
.pm-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    background: rgba(255,255,255,0.05); border: 1px solid var(--edge-side);
    border-radius: 14px; margin-bottom: 10px; }
.pm-row .handle { cursor: grab; color: var(--text-dim); font-size: 18px; padding: 4px; }
.pm-row img { width: 30px; height: 30px; border-radius: 8px; }
.pm-row b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }

.qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 0 14px; }
.qr-wrap #qrBox { background: #fff; padding: 12px; border-radius: 16px; }
.secret-code { font-family: ui-monospace, monospace; font-size: 13px; letter-spacing: 1px;
    background: rgba(255,255,255,.07); border: 1px solid var(--edge-side);
    padding: 9px 13px; border-radius: 11px; word-break: break-all; text-align: center; }
.codes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 14px; }
.codes-grid code { font-family: ui-monospace, monospace; font-size: 14px; text-align: center;
    background: rgba(255,255,255,.07); border: 1px solid var(--edge-side);
    padding: 11px; border-radius: 11px; letter-spacing: 1px; }
.note { font-size: 13px; color: var(--text-dim); margin: 8px 0 14px; }
.note.warn { color: #ffcf6b; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.media-item { position: relative; border-radius: 14px; overflow: hidden; border: 2px solid transparent;
    cursor: pointer; aspect-ratio: 1; background: rgba(255,255,255,.05); }
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-item:hover { border-color: var(--accent); }
.media-item .badge { position: absolute; left: 5px; top: 5px; font-size: 9.5px; font-weight: 800;
    padding: 2px 7px; border-radius: 999px; background: rgba(0,0,0,.7); color: var(--ok); }
.media-item .badge.orphan { color: #ffcf6b; }

/* ---------- toasts ---------- */
.toast-stack { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
    z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { padding: 12px 22px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
    background: rgba(18,20,28,.95); border: 1px solid rgba(255,255,255,0.3); border-bottom-color: rgba(0,0,0,0.7);
    color: var(--text); box-shadow: var(--shadow-heavy); animation: toastIn .25s var(--spring); text-align: center; }
.toast.err { border-color: color-mix(in srgb, var(--bad) 55%, transparent); color: #ffb3c0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } }

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 20px; }
.login-card { width: 100%; max-width: 410px; padding: 36px 30px; text-align: center;
    animation: slideUpFade 0.55s var(--spring); }
.login-logo { width: 78px; height: 78px; border-radius: 22px; object-fit: cover; margin-bottom: 16px;
    border: 1px solid rgba(255,255,255,0.3); box-shadow: 0 14px 30px rgba(0,0,0,0.55);
    animation: floatLogo 6s ease-in-out infinite; }
.login-title { font-size: 27px; font-weight: 800; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,0.7); }
.login-slogan { color: var(--text-dim); font-size: 12px; margin: 8px 0 24px;
    text-transform: uppercase; letter-spacing: 1.6px; font-weight: 600; }
.login-card form { text-align: left; }
.login-error { background: color-mix(in srgb, var(--bad) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent);
    color: #ffb3c0; border-radius: 13px; padding: 11px 15px; font-size: 13.5px; margin-bottom: 16px; }
.login-hint { font-size: 12.5px; color: var(--text-dim); text-align: center; margin-top: 15px; }


/* ================= ADMIN DASHBOARD ================= */
.admin-body { min-height: 100vh; }
.admin-shell { display: grid; grid-template-columns: 240px 1fr; gap: 22px;
    max-width: 1280px; margin: 0 auto; padding: 18px 20px 60px; }
@media (max-width: 860px) { .admin-shell { grid-template-columns: 1fr; padding: 12px 12px 60px; gap: 14px; } }

.admin-side { position: sticky; top: 18px; align-self: start; padding: 14px; }
@media (max-width: 860px) { .admin-side { position: static; display: flex; overflow-x: auto;
    gap: 6px; padding: 8px; scrollbar-width: none; } .admin-side::-webkit-scrollbar { display: none; } }
.admin-side .side-brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 16px; }
.admin-side .side-brand img { width: 34px; height: 34px; border-radius: 10px; }
.admin-side .side-brand b { font-size: 16px; font-weight: 800; }
@media (max-width: 860px) { .admin-side .side-brand { display: none; } }
.admin-nav { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 860px) { .admin-nav { flex-direction: row; } }
.admin-nav button {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 13px 14px; border: none; border-radius: 13px; background: transparent;
    color: var(--text-dim); font-family: inherit; font-size: 14px; font-weight: 700;
    cursor: pointer; transition: all .15s; text-align: left; white-space: nowrap;
}
.admin-nav button i { font-style: normal; font-size: 17px; width: 24px; text-align: center; }
.admin-nav button:hover { background: rgba(255,255,255,0.08); color: #fff; }
.admin-nav button.on { background: var(--accent); color: #000; box-shadow: 0 0 20px var(--accent-glow); }
.admin-nav .back { margin-top: 10px; border-top: 1px solid var(--edge-side); border-radius: 0 0 13px 13px; padding-top: 14px; }
@media (max-width: 860px) { .admin-nav .back { margin-top: 0; border-top: none; padding-top: 13px; } }

.admin-main { padding: 22px; min-width: 0; }
@media (max-width: 640px) { .admin-main { padding: 16px 14px; } }
.admin-main h2.sec-title { font-size: 19px; font-weight: 800; margin-bottom: 4px; }
.admin-main p.sec-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 20px; }

.a-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.a-toolbar select { flex: 1; min-width: 180px; padding: 12px 14px; font-family: inherit; font-size: 15px;
    background: rgba(255,255,255,.06); color: var(--text); border: 1px solid var(--edge-side);
    border-radius: 13px; outline: none; }
.a-toolbar select option { background: #14161f; }

.a-cat { border: 1px solid var(--edge-side); border-radius: 16px; margin-bottom: 14px; overflow: hidden;
    background: rgba(255,255,255,0.03); }
.a-cat-head { display: flex; align-items: center; gap: 11px; padding: 12px 14px;
    background: rgba(255,255,255,0.05); cursor: pointer; user-select: none; }
.a-cat-head .cat-ic { width: 26px; height: 26px; font-size: 12px; border-radius: 8px; }
.a-cat-head b { flex: 1; min-width: 0; font-size: 14px; text-transform: uppercase; letter-spacing: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-cat-head .cnt { font-size: 11px; color: var(--text-dim); }
.a-cat-head .chev { transition: transform .2s; color: var(--text-dim); }
.a-cat.open .chev { transform: rotate(90deg); }
.a-cat-body { display: none; padding: 10px; }
.a-cat.open .a-cat-body { display: block; }

.a-row { display: flex; align-items: center; gap: 11px; padding: 9px 10px;
    border-radius: 12px; transition: background .12s; }
.a-row:hover { background: rgba(255,255,255,0.06); }
.a-row .handle { cursor: grab; color: var(--text-dim); font-size: 16px; flex: 0 0 auto; }
.a-row img.ric { width: 32px; height: 32px; border-radius: 9px; object-fit: cover;
    background: rgba(255,255,255,0.06); flex: 0 0 auto; }
.a-row .ric-l { width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent); font-weight: 800; font-size: 14px; }
.a-row .meta { flex: 1; min-width: 0; }
.a-row .meta b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-row .meta span { display: block; font-size: 11.5px; color: var(--text-dim);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-row .dotmini { width: 8px; height: 8px; border-radius: 50%; background: #333; flex: 0 0 auto; }
.a-row .dotmini.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.a-row .dotmini.bad { background: var(--bad); }
.a-add-row { display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px; margin-top: 4px; border: 1.5px dashed rgba(255,255,255,0.2); border-radius: 12px;
    color: var(--text-dim); font-size: 13px; font-weight: 700; cursor: pointer; transition: all .15s; }
.a-add-row:hover { color: var(--accent); border-color: var(--accent); }

.a-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.a-stat { padding: 16px; border-radius: 16px; background: rgba(255,255,255,0.04); border: 1px solid var(--edge-side); }
.a-stat b { display: block; font-size: 24px; font-weight: 800; color: var(--accent); }
.a-stat span { font-size: 11.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.has-overflow .sep { font-style: normal; opacity: .45; }
