:root {
    --bg: #09111f;
    --bg-soft: rgba(11, 21, 38, 0.72);
    --card: rgba(15, 23, 42, 0.78);
    --stroke: rgba(255, 255, 255, 0.12);
    --text: #f8fafc;
    --muted: #aab7cf;
    --accent: #8b5cf6;
    --accent-2: #22d3ee;
    --danger: #ef4444;
    --success: #22c55e;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(139, 92, 246, 0.22), transparent 30%),
        radial-gradient(circle at top right, rgba(34, 211, 238, 0.16), transparent 30%),
        linear-gradient(180deg, #08101c 0%, #0f172a 100%);
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.public-body, .admin-body {
    position: relative;
    overflow-x: hidden;
}
.background-glow {
    position: fixed;
    width: 320px;
    height: 320px;
    border-radius: 999px;
    filter: blur(90px);
    opacity: 0.6;
    pointer-events: none;
}
.glow-1 { background: rgba(139, 92, 246, 0.35); top: -80px; left: -80px; }
.glow-2 { background: rgba(34, 211, 238, 0.25); bottom: -90px; right: -60px; }

.profile-shell, .admin-shell {
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: 40px 20px 60px;
}
.profile-card, .card, .login-card {
    background: var(--bg-soft);
    border: 1px solid var(--stroke);
    backdrop-filter: blur(18px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}
.profile-card {
    width: min(100%, 720px);
    margin: 5vh auto 0;
    padding: 28px;
}
.profile-head {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 22px;
    align-items: center;
    margin-bottom: 28px;
}
.avatar {
    width: 110px;
    height: 110px;
    border-radius: 28px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 14px 35px rgba(0,0,0,0.3);
}
.eyebrow {
    margin: 0 0 8px;
    color: var(--accent-2);
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: 12px;
    font-weight: 700;
}
h1, h2 { margin: 0; }
h1 { font-size: clamp(30px, 4vw, 42px); line-height: 1.05; }
.bio, .muted {
    color: var(--muted);
    margin: 12px 0 0;
    line-height: 1.6;
}
.links-grid {
    display: grid;
    gap: 14px;
}
.link-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.link-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.18);
    box-shadow: 0 18px 35px rgba(0,0,0,0.18);
}
.link-content {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}
.link-thumb, .link-thumb.placeholder {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    object-fit: cover;
    flex-shrink: 0;
}
.link-thumb.placeholder, .item-placeholder {
    display: grid;
    place-items: center;
    background: rgba(255,255,255,0.08);
    color: white;
    font-weight: 800;
    font-size: 24px;
}
.link-card h2 { font-size: 18px; margin-bottom: 6px; }
.link-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}
.open-label {
    padding: 12px 16px;
    border-radius: 999px;
    background: var(--button-color, #111827);
    color: var(--text-color, #fff);
    font-weight: 700;
    white-space: nowrap;
}
.empty-state {
    padding: 24px;
    border-radius: 22px;
    border: 1px dashed rgba(255,255,255,0.15);
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
}
.empty-state.small { padding: 18px; }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}
.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}
.card, .login-card {
    padding: 24px;
}
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}
.section-head .muted {
    margin-top: 8px;
}
.login-card {
    width: min(100%, 480px);
    margin: 9vh auto 0;
}
.form-grid {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}
label span {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}
input[type="text"], input[type="password"], input[type="url"], input[type="file"], textarea, input[type="color"] {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    border-radius: 14px;
    padding: 14px 16px;
    font: inherit;
}
textarea { resize: vertical; min-height: 110px; }
input[type="color"] { padding: 6px; height: 52px; }
.two-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.checkbox-row span { margin: 0; }
.current-image {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
}
.current-image > span {
    font-size: 14px;
    font-weight: 600;
}
.current-image-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.current-image-row img {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.1);
}
.primary-btn, .ghost-btn, .danger-btn {
    appearance: none;
    border: 0;
    cursor: pointer;
    padding: 13px 18px;
    border-radius: 14px;
    font: inherit;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .18s ease, opacity .18s ease;
}
.primary-btn:hover, .ghost-btn:hover, .danger-btn:hover { transform: translateY(-1px); }
.primary-btn {
    background: linear-gradient(135deg, var(--accent), #6d28d9);
    color: white;
}
.ghost-btn {
    background: rgba(255,255,255,0.06);
    color: white;
    border: 1px solid rgba(255,255,255,0.12);
}
.danger-btn {
    background: rgba(239,68,68,0.14);
    color: #fecaca;
    border: 1px solid rgba(239,68,68,0.25);
}
.small { padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.alert {
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert.error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239,68,68,0.26);
    color: #fecaca;
}
.alert.success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34,197,94,0.26);
    color: #bbf7d0;
}
.items-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}
.item-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.09);
    background: rgba(255,255,255,0.03);
}
.item-preview {
    display: flex;
    gap: 14px;
    min-width: 0;
}
.item-preview img, .item-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    object-fit: cover;
    flex-shrink: 0;
}
.item-preview p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
    overflow-wrap: anywhere;
}
.item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.position-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.16);
    color: var(--accent-2);
    font-size: 12px;
    font-weight: 700;
}
.item-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.sort-actions {
    display: flex;
    gap: 8px;
}
.disabled-btn {
    opacity: 0.45;
    pointer-events: none;
}
.badge-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
}
.badge.neutral {
    background: rgba(255,255,255,0.08);
    color: white;
}

@media (max-width: 860px) {
    .admin-header, .item-row, .section-head, .current-image-row { flex-direction: column; align-items: stretch; }
    .item-actions { align-items: stretch; }
    .sort-actions { display: flex; flex-wrap: wrap; }
}

@media (max-width: 640px) {
    .profile-card { padding: 20px; margin-top: 16px; }
    .profile-head { grid-template-columns: 1fr; text-align: center; }
    .avatar { margin: 0 auto; }
    .link-card { flex-direction: column; align-items: stretch; }
    .open-label { text-align: center; }
    .two-cols { grid-template-columns: 1fr; }
    .profile-shell, .admin-shell { padding: 20px 14px 40px; }
}
