:root {
    --launcher-accent: #c92f62;
    --launcher-accent-dark: #a9234e;
    --launcher-ink: #20252b;
    --launcher-border: #dfe3e8;
    --launcher-surface: #ffffff;
    --launcher-bg: #f4f6f8;
    --launcher-radius: 0.75rem;
}

html { min-height: 100%; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--launcher-bg);
    color: var(--launcher-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a:not(.btn), a:not(.btn):visited {
    color: var(--launcher-accent);
    text-decoration: none;
}

a:not(.btn):hover, a:not(.btn):focus-visible {
    color: var(--launcher-accent-dark);
    text-decoration: underline;
}

.site-navbar {
    min-height: 3.75rem;
    background: #252b32;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-navbar .navbar-brand { font-weight: 650; letter-spacing: -0.01em; }
.site-navbar .nav-link { border-radius: 0.45rem; padding-inline: 0.75rem !important; }
.site-navbar .nav-link:hover, .site-navbar .nav-link.active {
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.site-footer {
    margin-top: 2.5rem;
    border-top: 1px solid var(--launcher-border);
    background: rgba(255, 255, 255, 0.45);
}

.auth-page {
    background: #f1f4f7;
}

.auth-shell {
    width: 100%;
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: safe center;
    padding: 3rem 1rem;
}

.auth-card {
    width: min(100%, 420px);
    padding: 2rem;
    background: var(--launcher-surface);
    border: 1px solid var(--launcher-border);
    border-radius: 0.9rem;
    box-shadow: 0 10px 30px rgba(23, 31, 40, 0.09);
}

.auth-card-header {
    margin-bottom: 1.75rem;
}

.auth-icon {
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.8rem;
    color: var(--launcher-accent);
    background: rgba(201, 47, 98, 0.1);
    border-radius: 50%;
}

.auth-title {
    margin: 0;
    color: var(--launcher-ink);
    font-size: 1.75rem;
    font-weight: 680;
    letter-spacing: -0.025em;
}

.auth-form .form-label {
    margin-bottom: 0.4rem;
    color: #4f5761;
    font-size: 0.9rem;
    font-weight: 600;
}

.auth-form .form-control-lg {
    min-height: 3rem;
    padding: 0.65rem 0.8rem;
    font-size: 1rem;
}

.auth-form .btn-lg {
    min-height: 3rem;
    font-size: 1rem;
}

.public-home { max-width: 1320px; }
.public-home .page-toolbar {
    padding-bottom: 1.15rem;
    border-bottom: 1px solid var(--launcher-border);
}
.public-home .search-input-group:focus-within {
    outline: 2px solid rgba(201, 47, 98, 0.45);
    outline-offset: 3px;
}
.public-home .category-image {
    border-radius: calc(var(--launcher-radius) - 1px) calc(var(--launcher-radius) - 1px) 0 0;
}

.home-favorites {
    padding: clamp(1rem, 2.5vw, 1.75rem);
    border: 1px solid #ecd6de;
    border-top: 3px solid var(--launcher-accent);
    border-radius: 1rem;
    background: linear-gradient(120deg, #fff5f8, #fff 75%);
}
.home-favorites-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 0.85rem; margin-bottom: 1.25rem; }
.home-favorites-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2.75rem;
    height: 2.75rem;
    color: var(--launcher-accent);
    background: #f9e3eb;
    border-radius: 0.8rem;
}
.home-favorites-description { color: #68606a; font-size: 0.88rem; }
.home-favorites-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.75rem; }
.home-favorites .top-link-tile {
    width: 100%;
    min-width: 0;
    padding: 1rem 0.5rem;
    background: #fff;
    border: 1px solid #e9e1e5;
    border-radius: 0.75rem;
}
.home-favorites .top-link-tile:hover, .home-favorites .top-link-tile:focus-visible {
    border-color: var(--launcher-accent);
    background: #fffafb;
}
.home-favorites .top-link-img { width: 68px; height: 68px; }
.home-favorites .top-link-label {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
    font-weight: 650;
}
.page-toolbar { min-height: 3rem; }

.page-title, .section-title {
    color: var(--launcher-ink);
    font-weight: 680;
    letter-spacing: -0.025em;
}

.page-title { font-size: clamp(1.55rem, 2vw, 1.9rem); }
.section-title { font-size: 1.25rem; }
.page-title i, .section-title i { color: var(--launcher-accent); font-size: 0.9em; }

.search-container { width: min(100%, 360px); }
.search-input-group {
    border-radius: 0.65rem;
    box-shadow: 0 1px 2px rgba(21, 29, 38, 0.06);
}

.search-input-group .input-group-text, .search-input-group .form-control {
    background: var(--launcher-surface);
    border-color: #d8dde3;
}

.search-input-group .input-group-text { border-radius: 0.65rem 0 0 0.65rem; }
.search-input-group .form-control:focus { border-color: #d8dde3; box-shadow: none; }
.search-input-group .btn:last-child { border-radius: 0 0.65rem 0.65rem 0; }

.btn-primary {
    --bs-btn-bg: var(--launcher-accent);
    --bs-btn-border-color: var(--launcher-accent);
    --bs-btn-hover-bg: var(--launcher-accent-dark);
    --bs-btn-hover-border-color: var(--launcher-accent-dark);
    --bs-btn-active-bg: #8e1d42;
    --bs-btn-active-border-color: #8e1d42;
    --bs-btn-focus-shadow-rgb: 201, 47, 98;
}

.btn { border-radius: 0.5rem; font-weight: 550; }

.category-card, .search-result-card {
    background: var(--launcher-surface);
    border: 1px solid var(--launcher-border);
    border-radius: var(--launcher-radius);
    box-shadow: 0 2px 6px rgba(23, 31, 40, 0.06);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.category-card { overflow: visible; }
.search-result-card { overflow: hidden; }
.category-card:has(.dropdown-menu.show) { z-index: 20; }

.category-card:hover, .search-result-card:hover {
    transform: translateY(-2px);
    border-color: #d0d5dc;
    box-shadow: 0 8px 20px rgba(23, 31, 40, 0.1);
}

.search-result-card:focus-visible,
.top-link-tile:focus-visible {
    outline: 3px solid rgba(201, 47, 98, 0.24);
    outline-offset: 3px;
}

.category-card .category-image, .search-result-card .category-image {
    position: relative;
    height: 168px;
    overflow: hidden;
    background-color: #606871;
    background-position: center;
    background-size: cover;
}

.category-card .category-image::after {
    content: "";
    position: absolute;
    inset: 35% 0 0;
    background: linear-gradient(to bottom, transparent, rgba(14, 18, 22, 0.72));
}

.category-card .category-title-overlay {
    position: absolute;
    z-index: 1;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 1.5rem 0.9rem 0.7rem;
    color: #fff;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.category-card .category-title-overlay h2 { font-size: 1.05rem; font-weight: 650; }
.category-card .no-image-fallback, .search-result-card .no-image-fallback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.category-card .card-body { min-height: 94px; padding: 1rem; }
.category-link-item { line-height: 1.35; }
.category-link-item > span {
    color: #9aa1aa;
    transition: color 150ms ease, transform 150ms ease;
}
.category-link-item:hover > span {
    display: inline-block;
    color: var(--launcher-accent);
    transform: translateX(2px);
}

.category-card .card-footer {
    min-height: 50px;
    padding: 0.65rem 1rem;
    border-top: 1px solid #eceff2;
}

.category-card .dropdown-menu {
    max-height: 320px;
    overflow-y: auto;
    border-color: var(--launcher-border);
    border-radius: 0.65rem;
    box-shadow: 0 10px 28px rgba(23, 31, 40, 0.14);
}

.category-card .dropdown-item { padding-block: 0.5rem; }
.search-result-card .card-body { padding: 1rem; }

.top-link-tile { width: 112px; color: inherit !important; }
.top-link-tile:hover { text-decoration: none !important; }
.top-link-img {
    width: 92px;
    height: 92px;
    overflow: hidden;
    background: var(--launcher-surface);
    border: 1px solid var(--launcher-border);
    border-radius: 1rem !important;
    transition: transform 160ms ease, box-shadow 160ms ease;
}
.top-link-tile:hover .top-link-img {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(23, 31, 40, 0.12) !important;
}
.top-link-label {
    max-width: 106px;
    overflow: hidden;
    color: var(--launcher-ink);
    font-size: 0.86rem;
    font-weight: 550;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-link-img.with-bg { position: relative; background-position: center; background-size: cover; }
.top-link-img.with-bg .bg-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(19, 24, 29, 0.58);
}
.top-link-img.with-bg .overlay-initials {
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.alert { border-radius: var(--launcher-radius); }
.form-control, .form-select { border-color: #d5dae0; border-radius: 0.55rem; }
.form-control:focus, .form-select:focus {
    border-color: rgba(201, 47, 98, 0.65);
    box-shadow: 0 0 0 0.2rem rgba(201, 47, 98, 0.12);
}

.table-responsive {
    overflow-x: auto;
    background: var(--launcher-surface);
    border: 1px solid var(--launcher-border);
    border-radius: var(--launcher-radius);
}
.table-responsive .table { margin-bottom: 0; }
.table > thead > tr > th {
    background: #f7f8fa;
    color: #5b636d;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.drag-handle { cursor: grab; user-select: none; }
.draggable-row.dragging { opacity: 0.6; }
.drag-disabled .drag-handle { cursor: not-allowed; opacity: 0.5; }
th.sorted-asc::after { content: " \2191"; font-size: 0.8em; }
th.sorted-desc::after { content: " \2193"; font-size: 0.8em; }

/* Administration */
.admin-page { background: #f4f6f8; }
.admin-subnav {
    position: sticky;
    top: 0;
    z-index: 1010;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--launcher-border);
    backdrop-filter: blur(10px);
}
.admin-nav { display: flex; min-width: max-content; gap: 0.25rem; padding-block: 0.55rem; }
.admin-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.75rem;
    color: #59616b;
    border-radius: 0.55rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}
.admin-nav-link:hover { color: var(--launcher-ink); background: #f2f4f6; }
.admin-nav-link.active { color: var(--launcher-accent); background: rgba(201, 47, 98, 0.09); }
.admin-container { padding-block: 2rem 3.5rem; }
.admin-form-container { max-width: 980px; }
.admin-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
.admin-page-header h1 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.2rem); letter-spacing: -0.025em; }
.admin-eyebrow {
    margin-bottom: 0.35rem;
    color: var(--launcher-accent);
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.admin-page-description { max-width: 700px; margin: 0.35rem 0 0; color: #68717b; }
.admin-alert { margin-bottom: 1rem; border: 1px solid rgba(0, 0, 0, 0.07); }
.admin-stats { margin-bottom: 1.5rem; }
.admin-stat-card, .admin-panel, .admin-form-card {
    background: var(--launcher-surface);
    border: 1px solid var(--launcher-border);
    border-radius: var(--launcher-radius);
    box-shadow: 0 4px 14px rgba(23, 31, 40, 0.04);
}
.admin-stat-card { display: flex; align-items: center; gap: 1rem; height: 100%; padding: 1.25rem; color: inherit; text-decoration: none; transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
.admin-stat-card:hover { color: inherit; border-color: #cbd1d7; box-shadow: 0 8px 20px rgba(23, 31, 40, 0.08); transform: translateY(-1px); }
.admin-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    color: var(--launcher-accent);
    background: rgba(201, 47, 98, 0.09);
    border-radius: 0.75rem;
}
.admin-stat-card strong { display: block; font-size: 1.55rem; line-height: 1.1; }
.admin-stat-card small { display: block; margin-top: 0.25rem; color: #727b85; }
.admin-stat-label { color: #69727c; font-size: 0.82rem; font-weight: 650; }
.admin-stat-value { margin-top: 0.15rem; font-size: 1.8rem; font-weight: 750; line-height: 1.1; }
.admin-stat-meta { margin-top: 0.35rem; color: #7a838d; font-size: 0.8rem; }
.admin-panel { padding: 1.35rem; }
.admin-panel-header { margin-bottom: 1rem; }
.admin-panel-header h2 { margin: 0; font-size: 1.05rem; }
.admin-panel-header p { margin: 0.25rem 0 0; color: #747d87; font-size: 0.9rem; }
.admin-quick-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.admin-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}
.admin-search { position: relative; width: min(100%, 360px); }
.admin-search > i { position: absolute; top: 50%; left: 0.85rem; z-index: 2; color: #87909a; transform: translateY(-50%); pointer-events: none; }
.admin-search .form-control { padding-left: 2.45rem; background: #fff; }
.admin-record-count { color: #717a84; font-size: 0.86rem; white-space: nowrap; }
.admin-save-status { min-height: 1.25rem; color: #717a84; font-size: 0.84rem; }
.admin-save-status[data-state="saving"]::before { content: ""; display: inline-block; width: 0.65rem; height: 0.65rem; margin-right: 0.4rem; border: 2px solid #b9c0c7; border-top-color: var(--launcher-accent); border-radius: 50%; animation: admin-spin 0.8s linear infinite; }
.admin-save-status[data-state="saved"] { color: #247348; }
.admin-save-status[data-state="error"] { color: #b42336; }
@keyframes admin-spin { to { transform: rotate(360deg); } }
.admin-table-wrap { box-shadow: 0 4px 14px rgba(23, 31, 40, 0.035); }
.admin-table > :not(caption) > * > * { padding: 0.8rem 0.75rem; }
.admin-table tbody td { color: #30363c; font-size: 0.9rem; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-group-row td { color: #47515b !important; background: #f4f6f8 !important; font-size: 0.84rem !important; letter-spacing: 0.01em; }
.admin-table-thumb { width: 38px; height: 38px; object-fit: cover; border: 1px solid var(--launcher-border); border-radius: 0.5rem; }
.admin-role-badge { margin-right: 0.25rem; color: #4f5963; background: #edf0f3; font-weight: 650; }
.admin-url { display: inline-block; max-width: 260px; overflow: hidden; color: #59616b; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.admin-empty-state { padding: 2.25rem !important; color: #747d87 !important; text-align: center; }
.admin-table-tip { margin: 0.7rem 0 0; color: #747d87; font-size: 0.82rem; }
.admin-form-card .card-body { padding: 1.5rem; }
.admin-form-card .form-label { color: #3f4851; font-size: 0.88rem; font-weight: 650; }
.admin-form-card .form-text { color: #7a838d; font-size: 0.8rem; }
.admin-form-actions { display: flex; justify-content: flex-end; gap: 0.65rem; padding: 1rem 1.5rem; background: #fafbfc; border-top: 1px solid var(--launcher-border); border-radius: 0 0 var(--launcher-radius) var(--launcher-radius); }
.admin-current-image { display: inline-flex; align-items: center; gap: 0.7rem; margin-top: 0.4rem; color: #747d87; font-size: 0.82rem; }
.admin-current-image img { width: 120px; height: 72px; object-fit: cover; border: 1px solid var(--launcher-border); border-radius: 0.65rem; }
.admin-check-field { display: flex; align-items: flex-end; padding-bottom: 0.4rem; }
.drag-handle { width: 38px; color: #8a929a; text-align: center; }
.analytics-filters .form-label { color: #4b545e; font-size: 0.82rem; font-weight: 650; }
.analytics-chart {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(2px, 0.35vw, 6px);
    min-height: 210px;
    padding: 1.75rem 0.5rem 0;
    overflow-x: auto;
    border-bottom: 1px solid var(--launcher-border);
    background: linear-gradient(to top, rgba(225, 229, 233, 0.42) 1px, transparent 1px) 0 0 / 100% 25%;
}
.analytics-chart-column { position: relative; display: flex; align-items: flex-end; width: clamp(12px, 2vw, 30px); min-width: 12px; max-width: 30px; height: 180px; flex: 0 0 clamp(12px, 2vw, 30px); }
.analytics-chart-bar { width: 100%; height: var(--bar-height); min-height: 0; background: var(--launcher-accent); border-radius: 4px 4px 0 0; opacity: 0.86; transition: opacity 140ms ease; }
.analytics-chart-column:hover .analytics-chart-bar { opacity: 1; }
.analytics-chart-value { position: absolute; bottom: min(calc(var(--bar-height) + 4px), 100%); left: 50%; color: #6e7680; font-size: 0.7rem; line-height: 1; transform: translateX(-50%); }
.analytics-chart-axis { display: flex; justify-content: space-between; gap: 1rem; padding-top: 0.55rem; color: #7a838d; font-size: 0.75rem; }
.analytics-count-badge { min-width: 2.5rem; color: #8d2147; background: rgba(201, 47, 98, 0.1); font-size: 0.85rem; }
.analytics-category-list { display: grid; gap: 1.05rem; }
.analytics-category-row { color: #46505a; font-size: 0.9rem; }
.analytics-category-row .progress { height: 6px; margin-top: 0.45rem; background: #edf0f2; }
.analytics-category-row .progress-bar { background: var(--launcher-accent); }

#cookie-consent {
    background: #252b32 !important;
    box-shadow: 0 -8px 28px rgba(15, 20, 25, 0.16);
}

@media (max-width: 767.98px) {
    .public-home { padding-inline: 1rem; }
    .search-container { width: 100%; }
    .category-card .category-image, .search-result-card .category-image { height: 155px; }
    .auth-shell { align-items: flex-start; padding-top: 2rem; }
    .auth-card { padding: 1.5rem; }
    .admin-container { padding-top: 1.35rem; }
    .admin-page-header { align-items: stretch; flex-direction: column; }
    .admin-page-header > .btn, .admin-page-header > div:last-child .btn { width: 100%; }
    .admin-list-toolbar { align-items: stretch; flex-direction: column; }
    .admin-search { width: 100%; }
    .admin-form-card .card-body { padding: 1.1rem; }
    .admin-form-actions { flex-direction: column-reverse; padding: 1rem 1.1rem; }
    .admin-form-actions .btn { width: 100%; }
    .analytics-chart { min-height: 170px; }
    .analytics-chart-column { height: 150px; }
}

@media (prefers-reduced-motion: reduce) {
    .category-card, .search-result-card, .top-link-img, .category-link-item > span { transition: none; }
}
