:root {
    --bg: #fdf6ff;
    --card-bg: #ffffff;
    --accent: #ffb6c1;
    --accent-2: #b3e5fc;
    --accent-3: #c8e6c9;
    --text-main: #333333;
    --text-soft: #666666;
    --border-soft: #e0d7ff;
    --shadow-soft: 0 12px 30px rgba(0,0,0,0.06);
    --radius-lg: 18px;
    --radius-pill: 999px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #ffe4f3 0, #fdf6ff 34%, #f4f9ff 100%);
    color: var(--text-main);
}

.app-shell {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 24px 12px;
}

.container {
    width: 100%;
    max-width: 1100px;
    background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(255,247,253,0.98));
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    padding: 22px 18px 20px;
    border: 1px solid rgba(255,255,255,0.9);
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border-soft);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 40%;
    background: conic-gradient(from 180deg, #ffb6c1, #b3e5fc, #c8e6c9, #ffb6c1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.brand-text h1 {
    margin: 0;
    font-size: 20px;
    letter-spacing: 0.02em;
}

.brand-text p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--text-soft);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chip {
    border-radius: var(--radius-pill);
    padding: 6px 10px;
    font-size: 11px;
    border: 1px solid rgba(0,0,0,0.04);
    background: rgba(255,255,255,0.9);
    color: var(--text-soft);
}

.badge-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    margin-right: 4px;
}

/* Search & filter */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 6px;
}

.search-box {
    flex: 1 1 180px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 9px 32px 9px 30px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-soft);
    background: rgba(255,255,255,0.9);
    outline: none;
    font-size: 13px;
}

.search-box input:focus {
    border-color: #ffb6c1;
    box-shadow: 0 0 0 2px rgba(255,182,193,0.35);
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.6;
}

.clear-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    font-size: 16px;
    opacity: 0.4;
    cursor: pointer;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    border-radius: var(--radius-pill);
    padding: 6px 10px;
    font-size: 11px;
    border: 1px solid var(--border-soft);
    background: rgba(255,255,255,0.9);
    cursor: pointer;
    transition: all .18s ease;
}

.filter-chip span {
    margin-left: 2px;
    font-size: 10px;
    opacity: 0.7;
}

.filter-chip.active {
    border-color: var(--accent);
    background: rgba(255,182,193,0.16);
    color: #d81b60;
}

/* Category cards */
.grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
}

.category-card {
    background: radial-gradient(circle at top left, #fff7fb 0, #ffffff 60%);
    border-radius: 18px;
    padding: 12px 13px 10px;
    border: 1px solid var(--border-soft);
    box-shadow: 0 10px 22px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    min-height: 110px;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.category-title {
    font-size: 14px;
    font-weight: 600;
}

.category-count {
    font-size: 11px;
    color: var(--text-soft);
}

.category-badge {
    font-size: 10px;
    border-radius: 99px;
    padding: 3px 7px;
    background: rgba(179, 229, 252, 0.4);
    border: 1px solid rgba(179,229,252,0.8);
}

/* links inside card */
.link-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.link-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 5px 9px;
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(224,215,255,0.8);
    font-size: 11px;
    text-decoration: none;
    color: var(--text-main);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
    white-space: nowrap;
}

.link-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-chip .fav-star {
    font-size: 11px;
    color: #ff9800;
}

.link-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
    border-color: rgba(255,182,193,0.7);
    background: #ffffff;
}

/* Footer */
.footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-soft);
    font-size: 11px;
    color: var(--text-soft);
    display: flex;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.footer a {
    color: inherit;
}

/* Admin area */
.admin-wrapper {
    max-width: 950px;
    margin: 32px auto;
    padding: 20px;
}

.admin-card {
    background: rgba(255,255,255,0.97);
    border-radius: 18px;
    padding: 18px 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(238,230,255,0.9);
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.admin-header h2 {
    margin: 0;
    font-size: 18px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    padding: 7px 14px;
    font-size: 13px;
    cursor: pointer;
    background: linear-gradient(135deg, #ffb6c1, #ffccde);
    color: #5b1431;
    font-weight: 600;
    text-decoration: none;
}

.btn-outline {
    background: rgba(255,255,255,0.9);
    border-color: var(--border-soft);
    color: var(--text-main);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.table th,
.table td {
    padding: 7px 6px;
    border-bottom: 1px solid rgba(238,230,255,0.9);
}

.table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-soft);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 7px 9px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    font-size: 13px;
}

.form-group textarea {
    min-height: 50px;
    resize: vertical;
}

/* Login */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #ffe4f3 0, #fdf6ff 34%, #f4f9ff 100%);
    padding: 20px 12px;
}

.login-card {
    width: 100%;
    max-width: 340px;
    background: rgba(255,255,255,0.98);
    border-radius: 18px;
    padding: 18px 16px 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(238,230,255,0.9);
}

.login-card h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

.login-card p {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--text-soft);
}

.login-card .form-group {
    margin-bottom: 10px;
}

.alert {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    margin-bottom: 10px;
}

.alert-error {
    background: #ffebee;
    color: #b71c1c;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 16px 14px 14px;
        border-radius: 18px;
    }
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
    .toolbar {
        flex-direction: column;
    }
    .admin-wrapper {
        margin: 18px auto;
        padding: 12px;
    }
    .admin-card {
        padding: 14px 12px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
}
