:root {
    --bg: #f4efe6;
    --ink: #1f2a1f;
    --accent: #2c6e49;
    --accent-soft: #dfe9d8;
    --card: #fffdf8;
    --line: #d6d0c4;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    background: radial-gradient(circle at top, #fffaf0 0%, var(--bg) 48%, #ece3d3 100%);
    color: var(--ink);
}

a {
    color: inherit;
    text-decoration: none;
}

.biotree-shell {
    min-height: 100vh;
    padding: 1.25rem;
}

.landing-grid,
.profile-layout {
    max-width: 1080px;
    margin: 0 auto;
    display: grid;
    gap: 1rem;
}

.panel {
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 1.25rem;
    box-shadow: 0 18px 40px rgba(44, 33, 10, 0.08);
}

.hero {
    background: linear-gradient(135deg, rgba(44, 110, 73, 0.12), rgba(255, 253, 248, 0.94));
}

.eyebrow {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #5c6e59;
}

.toolbar,
.toolbar-actions,
.stack,
.directory-list,
.link-stack,
.product-grid,
.stats-grid {
    display: grid;
    gap: 0.85rem;
}

.toolbar-actions a,
button,
.link-card,
.directory-card,
.product-card a {
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    padding: 0.8rem 1rem;
    text-align: center;
}

button {
    border: 0;
    cursor: pointer;
    font: inherit;
}

input {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
}

label span,
.muted,
.directory-card span,
.product-card span {
    display: block;
    color: #5f655c;
    margin-bottom: 0.35rem;
}

.alert {
    background: #fff1df;
    border: 1px solid #ebb979;
    border-radius: 14px;
    padding: 0.9rem 1rem;
}

.directory-card,
.link-card,
.product-card,
.stat-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1rem;
    background: var(--card);
}

.link-card {
    background: var(--accent-soft);
    color: var(--ink);
}

.product-grid,
.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.auth-panel {
    max-width: 460px;
    margin: 8vh auto;
}

@media (min-width: 768px) {
    .landing-grid {
        grid-template-columns: 1.1fr 0.9fr;
        align-items: start;
    }

    .profile-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profile-hero {
        grid-column: 1 / -1;
    }

    .toolbar {
        grid-template-columns: 1fr auto;
        align-items: start;
    }

    .toolbar-actions {
        grid-auto-flow: column;
    }
}

/* ── Admin Navigation ─────────────────────────────── */

.admin-nav {
    max-width: 1080px;
    margin: 0 auto 1rem;
    padding: 0.75rem 1.25rem;
}

.admin-nav-inner {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    transition: background 0.15s;
}

.nav-link:hover {
    background: var(--accent-soft);
}

.nav-link-muted {
    margin-left: auto;
    color: #8a8a7a;
    font-weight: 400;
}

.admin-content {
    max-width: 1080px;
    margin: 0 auto;
}

/* ── Admin Tables ─────────────────────────────────── */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 1rem;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--line);
}

.admin-table th {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #5c6e59;
    background: var(--accent-soft);
}

.admin-table tr:hover td {
    background: rgba(44, 110, 73, 0.04);
}

.action-cell {
    white-space: nowrap;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-cell a {
    font-size: 0.82rem;
    color: var(--accent);
    font-weight: 600;
}

.url-cell {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Admin Forms ──────────────────────────────────── */

.crud-form {
    max-width: 560px;
}

select,
textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    font: inherit;
}

textarea {
    resize: vertical;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

/* ── Buttons ──────────────────────────────────────── */

.btn-secondary {
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line);
}

.btn-danger {
    background: #c0392b;
    color: #fff;
    border: 0;
    cursor: pointer;
    font: inherit;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    font-size: 0.82rem;
}

.btn-danger:hover {
    background: #a5281b;
}

.inline-form {
    display: inline;
}

/* ── Status Badges ────────────────────────────────── */

.status-badge {
    display: inline-block;
    font-size: 0.78rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 600;
}

.status-published {
    background: #d5f5d5;
    color: #1a5c1a;
}

.status-draft {
    background: #f0e8d8;
    color: #7a6520;
}

/* ── Alerts ───────────────────────────────────────── */

.alert-success {
    background: #d5f5d5;
    border-color: #6dbb6d;
    max-width: 1080px;
    margin: 0 auto 0.75rem;
}

.alert-error {
    background: #fff1df;
    border-color: #ebb979;
    max-width: 1080px;
    margin: 0 auto 0.75rem;
}

code {
    font-size: 0.85em;
    background: var(--accent-soft);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

/* ── Social Icons ─────────────────────────────────── */

.social-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.social-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background: var(--accent-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s, transform 0.15s;
}

.social-icon-link:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
}

/* ── QR & Share ───────────────────────────────────── */

.qr-panel {
    text-align: center;
}

.qr-share-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.qr-image {
    border-radius: 12px;
    border: 1px solid var(--line);
}

.short-link-box {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: center;
}

.short-link-code {
    font-size: 0.95rem;
    user-select: all;
    cursor: text;
}

/* ── Analytics Stats ──────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-card {
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #666;
}