:root {
    color-scheme: dark;
    --bg-1: #080a0f;
    --bg-2: #10131b;
    --surface: rgba(13, 16, 23, 0.76);
    --soft: rgba(255, 255, 255, 0.065);
    --border: rgba(255, 255, 255, 0.1);
    --text: #f7f8fb;
    --muted: #9ca3af;
    --accent: #8b5cf6;
}

[data-theme="light"] {
    color-scheme: light;
    --bg-1: #f7f8fb;
    --bg-2: #eef2f7;
    --surface: rgba(255, 255, 255, 0.8);
    --soft: rgba(15, 23, 42, 0.055);
    --border: rgba(15, 23, 42, 0.1);
    --text: #101827;
    --muted: #667085;
    --accent: #6d5dfc;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 16% 12%, rgba(139, 92, 246, 0.22), transparent 28rem),
        radial-gradient(circle at 78% 5%, rgba(6, 182, 212, 0.15), transparent 23rem),
        linear-gradient(135deg, var(--bg-1), var(--bg-2));
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    color: inherit;
    cursor: pointer;
}

.shell {
    height: 100vh;
    padding: 20px;
}

.workspace {
    display: flex;
    height: 100%;
    overflow: hidden;
    flex-direction: column;
    border-radius: 22px;
}

.glass {
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 18px 70px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(22px);
}

.soft {
    border: 1px solid var(--border);
    background: var(--soft);
}

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 60px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 210px;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0;
    text-align: left;
}

.brand:hover .brand-mark {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 35%, transparent);
}

.brand:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 70%, white);
    outline-offset: 4px;
    border-radius: 16px;
}

.brand span,
.section-head,
.content-head p,
.stat span,
.bookmark-description,
.bookmark-meta {
    color: var(--muted);
}

.role-pill {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--soft);
    color: var(--muted);
    padding: 8px 12px;
    white-space: nowrap;
    font-size: 13px;
}

.brand-mark {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 12px;
    background: var(--accent);
    color: white;
    transition: 160ms ease;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.search {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 12px;
    height: 38px;
    min-width: 0;
    padding: 0 13px;
    border-radius: 14px;
}

.search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
}

.search-engine {
    flex: 0 0 auto;
    max-width: 86px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: 0;
    background: color-mix(in srgb, var(--soft) 82%, var(--surface));
    color: var(--muted);
    padding: 0 24px 0 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, currentColor 50%),
        linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position:
        calc(100% - 13px) 12px,
        calc(100% - 8px) 12px;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}

.search-engine:focus {
    border-color: color-mix(in srgb, var(--accent) 70%, white);
    color: var(--text);
}

.btn,
.icon-btn,
.mini-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--border);
    background: var(--soft);
    transition: 160ms ease;
}

.btn {
    min-height: 38px;
    padding: 0 13px;
    border-radius: 12px;
}

.primary {
    border-color: transparent;
    background: var(--accent);
    color: white;
}

.danger {
    border-color: transparent;
    background: #fb4d2f;
    color: white;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
}

.mini-btn {
    width: 30px;
    height: 30px;
    border-radius: 10px;
}

.btn:hover,
.icon-btn:hover,
.mini-btn:hover,
.bookmark-card:hover,
.category-row:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
}

.layout {
    display: grid;
    min-height: 0;
    flex: 1;
    grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar,
.content {
    min-height: 0;
    padding: 14px;
}

.sidebar {
    display: flex;
    overflow: hidden;
    flex-direction: column;
    border-right: 1px solid var(--border);
}

.section-head,
.content-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.toolbar-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.readonly-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    border-radius: 16px;
    color: var(--muted);
    padding: 12px 14px;
    font-size: 13px;
}

.section-head {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.category-tree {
    display: grid;
    gap: 7px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: none;
}

.category-tree::-webkit-scrollbar {
    display: none;
}

.category-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 9px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--soft);
    padding: 10px;
    padding-left: calc(10px + var(--depth, 0) * 18px);
    text-align: left;
}

.category-row.depth-1 {
    border-color: color-mix(in srgb, var(--border) 70%, transparent);
    background: color-mix(in srgb, var(--soft) 78%, transparent);
}

.category-toggle {
    display: grid;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--muted);
    font-size: 10px;
}

.category-toggle.placeholder {
    opacity: 0;
}

.category-row.active {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
    background: color-mix(in srgb, var(--soft) 72%, var(--accent));
}

.category-row .name {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content {
    overflow-y: auto;
    scrollbar-width: none;
}

.content::-webkit-scrollbar {
    display: none;
}

.mobile-category {
    position: relative;
    display: none;
    margin-bottom: 12px;
}

.mobile-category-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 46px;
    border-radius: 16px;
    color: var(--text);
    padding: 0 14px;
}

.mobile-category-trigger span,
.mobile-category-option span {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.mobile-category-menu {
    position: absolute;
    z-index: 25;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    display: grid;
    max-height: min(380px, 58vh);
    overflow-y: auto;
    border-radius: 18px;
    padding: 8px;
}

.mobile-category-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: var(--text);
    padding: 12px;
    padding-left: calc(12px + var(--depth, 0) * 18px);
    text-align: left;
}

.mobile-category-option.active,
.mobile-category-option:hover {
    background: var(--soft);
}

.mobile-category-option strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-category-option em {
    color: var(--muted);
    font-style: normal;
    font-size: 12px;
}

.content-head h1 {
    margin: 0;
    font-size: 22px;
}

.content-head p {
    margin: 4px 0 0;
}

.segments {
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--soft);
}

.segments button {
    width: 38px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
}

.segments button.active {
    background: rgba(255, 255, 255, 0.14);
}

.bookmark-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.grouped-bookmarks {
    display: grid;
    gap: 18px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.bookmark-section {
    display: grid;
    gap: 10px;
}

.bookmark-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    padding: 0 2px;
}

.bookmark-section-head div {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.bookmark-section-head strong {
    color: var(--text);
    font-size: 15px;
}

.bookmark-section-head span {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--soft);
    padding: 3px 9px;
    font-size: 12px;
}

.section-grid {
    min-height: 46px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.empty-category {
    border-radius: 16px;
    color: var(--muted);
    padding: 18px;
    font-size: 13px;
}

.bookmark-grid.list,
.bookmark-grid.compact {
    grid-template-columns: 1fr;
}

.bookmark-card {
    position: relative;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--soft);
    padding: 15px;
    transition: 160ms ease;
}

.bookmark-card.compact {
    padding: 9px;
}

.bookmark-main {
    display: flex;
    gap: 12px;
}

.favicon,
.table-favicon {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    font-weight: 800;
    line-height: 1;
}

.favicon.is-fallback,
.table-favicon.is-fallback {
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.28), transparent 34%),
        linear-gradient(135deg, #8b5cf6, #06b6d4);
}

.favicon {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 13px;
    font-size: 16px;
}

.table-favicon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 13px;
}

.favicon img,
.table-favicon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.favicon > span,
.table-favicon > span {
    display: none;
}

.favicon.is-fallback > span,
.table-favicon.is-fallback > span {
    display: block;
}

.bookmark-body {
    min-width: 0;
    flex: 1;
}

.bookmark-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.bookmark-title strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-description {
    display: -webkit-box;
    overflow: hidden;
    margin: 6px 0 0;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 13px;
    line-height: 1.5;
}

.bookmark-notes {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 8px 0 0;
    border-left: 2px solid color-mix(in srgb, var(--accent) 56%, transparent);
    color: color-mix(in srgb, var(--muted) 82%, var(--text));
    padding-left: 9px;
    font-size: 12px;
    line-height: 1.45;
}

.bookmark-notes i {
    flex: 0 0 auto;
    margin-top: 2px;
}

.bookmark-notes span {
    display: -webkit-box;
    min-width: 0;
    max-height: calc(12px * 1.45 * 2);
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.bookmark-grid.compact .bookmark-notes,
.bookmark-grid.list .bookmark-notes {
    max-width: min(520px, 100%);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.tag {
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    font-size: 11px;
}

.private-lock {
    color: #fb7185;
    font-size: 12px;
}

.bookmark-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 11px;
}

.context-menu {
    position: fixed;
    z-index: 80;
    min-width: 160px;
    border-radius: 14px;
    padding: 6px;
}

.context-menu button {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 9px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    padding: 10px;
    text-align: left;
}

.context-menu button:hover {
    background: var(--soft);
}

.context-menu .danger {
    color: #fb7185;
}

.confirm-layer {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.48);
    padding: 18px;
    backdrop-filter: blur(10px);
}

.confirm-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    width: min(440px, 100%);
    border-radius: 22px;
    padding: 18px;
    animation: confirmIn 160ms ease;
}

.confirm-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 14px;
    background: rgba(251, 113, 133, 0.14);
    color: #fb7185;
}

.confirm-card h3 {
    margin: 0;
    font-size: 18px;
}

.confirm-card p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    grid-column: 1 / -1;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

@keyframes confirmIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

mark {
    border-radius: 5px;
    background: rgba(139, 92, 246, 0.32);
    color: inherit;
}

.skeleton-card {
    height: 130px;
    overflow: hidden;
    position: relative;
    border-radius: 18px;
    background: var(--soft);
}

.skeleton-card::after {
    position: absolute;
    inset: 0;
    animation: shimmer 1.3s infinite;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    content: "";
    transform: translateX(-100%);
}

@keyframes shimmer {
    to {
        transform: translateX(100%);
    }
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.stat {
    border-radius: 16px;
    padding: 14px;
}

.stat strong {
    display: block;
    margin-top: 5px;
    font-size: 26px;
}

.chart {
    margin: 12px 0 18px;
    border-radius: 18px;
    padding: 12px;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
    gap: 12px;
    margin-top: 12px;
}

.admin-card {
    border-radius: 18px;
    padding: 14px;
}

.admin-card h3 {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.io-actions {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.settings-form {
    display: grid;
    max-width: 720px;
    gap: 13px;
    border-radius: 18px;
    padding: 14px;
}

.settings-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
}

.settings-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
}

.settings-preview > span {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    border-radius: 14px;
    background: var(--accent);
    color: white;
}

.settings-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.settings-preview strong,
.settings-preview em {
    display: block;
}

.settings-preview em {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.maintenance-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.maintenance-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    border-radius: 18px;
    padding: 14px;
}

.admin-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    border-radius: 16px;
    padding: 6px;
}

.admin-tabs button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    padding: 0 14px;
}

.admin-tabs button span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--muted) 36%, transparent);
}

.admin-tabs button.active {
    background: var(--soft);
    color: var(--text);
}

.admin-tabs button.active span {
    background: #22c55e;
}

.admin-filters {
    display: grid;
    grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1.4fr) minmax(140px, 0.5fr);
    gap: 10px;
    margin-bottom: 12px;
    border-radius: 18px;
    padding: 12px;
}

.admin-filters label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
}

.admin-filters .field {
    min-height: 42px;
    border-radius: 12px;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.admin-table-wrap {
    max-height: calc(100vh - 310px);
    overflow: auto;
    border-radius: 18px;
}

.admin-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th,
.admin-table td {
    border-bottom: 1px solid var(--border);
    padding: 11px 12px;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.admin-table th {
    position: sticky;
    z-index: 1;
    top: 0;
    background: color-mix(in srgb, var(--surface) 92%, var(--bg-2));
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.admin-table tr.selected,
.admin-table tbody tr:hover {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.admin-link-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
}

.admin-link-title > span {
    min-width: 0;
}

.admin-table td strong {
    display: block;
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-table td span,
.admin-table td em {
    display: block;
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-style: normal;
}

.row-actions {
    display: flex;
    gap: 6px;
}

.table-flags {
    min-width: 54px;
}

.table-flag {
    margin-right: 8px;
    color: #facc15;
}

@media (max-width: 1280px) {
    .admin-table {
        min-width: 760px;
        font-size: 12px;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 9px;
    }

    .admin-link-title {
        min-width: 240px;
        max-width: 320px;
    }

    .admin-table td strong,
    .admin-table td em {
        max-width: 260px;
    }
}

.row-actions .danger {
    background: rgba(251, 77, 47, 0.14);
    color: #fb7185;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: none;
    overflow: visible;
    min-width: 52px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--muted);
    padding: 0 10px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
}

.status-pill.active {
    border-color: transparent;
    background: color-mix(in srgb, #10b981 76%, transparent);
    color: white;
}

.category-indent {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-left: calc(var(--depth) * 18px);
}

.drag-handle {
    color: var(--muted);
    cursor: grab;
    font-size: 12px;
}

.drag-handle:active {
    cursor: grabbing;
}

.table-flag {
    color: #fbbf24;
}

.muted,
.admin-foot {
    color: var(--muted);
}

.admin-foot {
    margin: 12px 4px 0;
    font-size: 13px;
}

.overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    background: rgba(0, 0, 0, 0.42);
}

.overlay.open {
    display: block;
}

.drawer {
    position: fixed;
    z-index: 30;
    top: 12px;
    right: 12px;
    width: min(520px, calc(100vw - 24px));
    height: calc(100vh - 24px);
    overflow-y: auto;
    padding: 20px;
    border-radius: 22px;
    transform: translateX(112%);
    transition: transform 220ms ease;
}

.drawer.open {
    transform: translateX(0);
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.drawer-head h2 {
    margin: 0;
}

.form {
    display: grid;
    gap: 13px;
}

.hidden {
    display: none;
}

.field {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: 14px;
    outline: 0;
    background: var(--soft);
    color: var(--text);
    padding: 11px 13px;
}

textarea.field {
    min-height: 104px;
    resize: vertical;
}

.icon-picker {
    display: grid;
    gap: 8px;
    border-radius: 14px;
    padding: 10px;
}

.icon-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
}

.icon-picker-head strong {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 15px;
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 2px;
}

.icon-choice {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-size: 14px;
    transition: 140ms ease;
}

.icon-choice:hover,
.icon-choice.active {
    border-color: color-mix(in srgb, var(--accent) 70%, white);
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: var(--text);
}

@media (max-width: 520px) {
    .icon-picker-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }
}

.inline-field,
.checks {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.checks {
    grid-template-columns: 1fr 1fr;
}

.checks label,
.checkline {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    border-radius: 14px;
    padding: 0 13px;
}

.toggle-line {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    border-radius: 14px;
    padding: 0 13px;
}

.toggle-line input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-line .switch {
    position: relative;
    width: 58px;
    height: 34px;
    border: 2px solid color-mix(in srgb, var(--muted) 42%, transparent);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    transition: 160ms ease;
}

.toggle-line .switch span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--muted) 64%, white);
    transition: 180ms ease;
}

.toggle-line input:checked + .switch {
    border-color: color-mix(in srgb, var(--accent) 72%, white);
    background: color-mix(in srgb, var(--accent) 62%, transparent);
}

.toggle-line input:checked + .switch span {
    left: 27px;
    background: white;
}

.toggle-line strong {
    min-width: 1.5em;
    color: var(--muted);
    font-weight: 600;
}

.full {
    width: 100%;
}

.form-hint {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.toast-host {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 50;
    display: grid;
    gap: 8px;
}

.toast {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    padding: 12px 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(18px);
}

.mobile-bottom-bar {
    position: fixed;
    z-index: 70;
    right: 10px;
    bottom: 10px;
    left: 10px;
    display: none;
    grid-template-columns: repeat(4, 1fr);
    border-radius: 18px;
    padding: 6px;
}

.mobile-bottom-bar button {
    display: grid;
    gap: 3px;
    place-items: center;
    min-height: 46px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
}

.mobile-bottom-bar i {
    color: var(--text);
    font-size: 15px;
}

.sortable-ghost {
    opacity: 0.5;
}

@media (max-width: 1180px) {
    .stat-grid,
    .admin-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .shell {
        padding: 5px 5px 76px;
    }

    .mobile-bottom-bar {
        display: grid;
        bottom: max(10px, env(safe-area-inset-bottom));
    }

    .workspace {
        border-radius: 16px;
    }

    .topbar {
        flex-wrap: nowrap;
        height: 48px;
        gap: 6px;
        padding: 6px;
    }

    .brand {
        flex: 0 0 auto;
        min-width: 0;
        gap: 0;
    }

    .brand > div:not(.brand-mark) {
        display: none;
    }

    .brand-mark {
        width: 32px;
        height: 32px;
        border-radius: 10px;
    }

    .role-pill {
        display: none;
    }

    .search {
        order: 0;
        flex: 1 1 auto;
        flex-basis: auto;
        height: 34px;
        gap: 6px;
        min-width: 0;
        padding: 0 9px;
        border-radius: 11px;
    }

    .search input {
        min-width: 48px;
        font-size: 16px;
    }

    .topbar .btn,
    .topbar .icon-btn {
        flex: 0 0 auto;
        min-width: 32px;
        min-height: 32px;
        width: 32px;
        height: 32px;
        border-radius: 10px;
        padding: 0;
    }

    .layout {
        overflow: hidden;
        grid-template-columns: 1fr;
    }

    .content {
        padding: 8px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #bookmarkView {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 8px;
    }

    #bookmarkView .content-head {
        display: contents;
    }

    #bookmarkView .content-head > div:first-child {
        display: none;
    }

    #bookmarkView .content-head .segments {
        grid-column: 2;
        grid-row: 1;
    }

    .content-head h1 {
        font-size: 18px;
    }

    .content-head p {
        margin-top: 1px;
        font-size: 12px;
    }

    .segments {
        padding: 3px;
        border-radius: 12px;
    }

    .segments button {
        width: 32px;
        height: 30px;
        border-radius: 9px;
    }

    .stat-grid,
    .admin-grid,
    .maintenance-grid,
    .maintenance-actions {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .mobile-category {
        grid-column: 1;
        grid-row: 1;
        display: block;
        min-width: 0;
        margin-bottom: 0;
    }

    .mobile-category-trigger {
        min-height: 36px;
        border-radius: 13px;
        padding: 0 11px;
    }

    .readonly-notice {
        display: none;
    }

    .btn span {
        display: none;
    }

    .search-engine {
        max-width: 72px;
        height: 28px;
        padding-left: 7px;
        padding-right: 20px;
        font-size: 11px;
    }

    .bookmark-grid,
    .grouped-bookmarks {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        min-height: 0;
        grid-template-columns: 1fr;
        max-height: none;
        overflow: visible;
        gap: 10px;
    }

    .section-grid {
        grid-row: auto;
        max-height: none;
        overflow: visible;
    }

    #skeleton {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
    }

    .bookmark-section {
        gap: 8px;
    }

    .bookmark-section-head strong {
        font-size: 14px;
    }

    .bookmark-card {
        border-radius: 15px;
        padding: 12px;
    }

    .admin-tabs,
    .admin-actions {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .admin-filters {
        grid-template-columns: 1fr;
    }

    .admin-table-wrap {
        max-height: calc(100vh - 340px);
    }
}
