:root {
    --bg: #07100e;
    --panel: rgba(13, 32, 29, 0.86);
    --panel-2: rgba(18, 43, 38, 0.9);
    --line: rgba(186, 255, 212, 0.13);
    --line-strong: rgba(186, 255, 212, 0.24);
    --text: #f3fff7;
    --muted: rgba(232, 255, 241, 0.62);
    --subtle: rgba(232, 255, 241, 0.42);
    --lime: #a8ff46;
    --mint: #2fd0bf;
    --yellow: #f7c948;
    --red: #ff6177;
    --radius: 8px;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
    --font: Inter, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); letter-spacing: 0; }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
input, textarea, select { width: 100%; min-height: 38px; border: 1px solid var(--line); border-radius: 7px; background: rgba(2, 13, 12, 0.62); color: var(--text); outline: none; padding: 0 11px; transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
textarea { min-height: 92px; padding: 11px; resize: vertical; }
select { color-scheme: dark; }
input:focus, textarea:focus, select:focus { border-color: rgba(168, 255, 70, 0.72); box-shadow: 0 0 0 3px rgba(168, 255, 70, 0.11); }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 600; }
.muted { color: var(--muted); line-height: 1.55; }
.eyebrow { margin: 0 0 7px; color: var(--lime); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.btn, .icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; border: 1px solid var(--line); border-radius: 7px; background: rgba(22, 54, 48, 0.78); color: var(--text); transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.btn { padding: 0 13px; font-weight: 700; }
.btn:hover, .icon-btn:hover { border-color: var(--line-strong); background: rgba(34, 80, 69, 0.9); transform: translateY(-1px); }
.btn.primary { border-color: rgba(168, 255, 70, 0.42); background: var(--lime); color: #06110f; }
.btn.google { margin-top: 10px; }
.btn.full { width: 100%; }
.btn.danger, .icon-btn.danger { border-color: rgba(255, 97, 119, 0.34); background: rgba(255, 97, 119, 0.12); color: #ff9dad; }
.icon-btn { width: 36px; height: 36px; padding: 0; flex: 0 0 auto; }
.icon-btn svg, .btn svg { width: 16px; height: 16px; }
.auth-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 16% 0, rgba(47, 208, 191, .18), transparent 28%), radial-gradient(circle at 85% 10%, rgba(168, 255, 70, .12), transparent 25%), linear-gradient(135deg, #9db39f 0%, #5f7868 34%, #10241f 52%, #07100e 100%); }
.auth-shell { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(340px, 440px); gap: 18px; width: min(1040px, 100%); align-items: stretch; }
.auth-shell.compact { grid-template-columns: minmax(320px, 460px); justify-content: center; }
.auth-hero, .auth-card, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, rgba(12, 33, 30, .95), rgba(5, 18, 17, .98)); box-shadow: var(--shadow); }
.auth-hero { padding: 34px; display: grid; align-content: center; min-height: 520px; }
.auth-card { padding: 24px; align-self: center; }
.brand-row { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 800; }
.brand-mark { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 8px; background: linear-gradient(135deg, var(--lime), var(--mint)); color: #06110f; font-weight: 900; }
.brand-mark.small { width: 34px; height: 34px; font-size: 13px; }
.auth-hero h1 { max-width: 560px; margin: 38px 0 14px; font-size: clamp(38px, 6vw, 68px); line-height: .95; }
.auth-hero p { max-width: 520px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.65; }
.auth-card h2, .panel h2 { margin: 0 0 14px; font-size: 24px; }
.stack-form { display: grid; gap: 12px; }
.check-row { display: flex; align-items: center; gap: 9px; }
.check-row input { width: 16px; min-height: 16px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 13px; }
.auth-links a:hover { color: var(--lime); }
.notice { border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.045); padding: 11px; margin-bottom: 12px; color: var(--muted); }
.notice.danger { border-color: rgba(255, 97, 119, .34); background: rgba(255, 97, 119, .1); color: #ffc1ca; }
.notice.success { border-color: rgba(47, 208, 191, .34); background: rgba(47, 208, 191, .1); color: #b8fff4; }
.hero-preview { display: grid; grid-template-columns: 1.35fr 1fr; gap: 12px; margin-top: 36px; }
.hero-preview span { min-height: 96px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.045); }
.hero-preview span:first-child { grid-row: span 2; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 28px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.check span { width: 9px; height: 9px; border-radius: 99px; background: var(--red); }
.check.ok span { background: var(--lime); }
.form-divider { height: 1px; background: var(--line); margin: 4px 0; }
.app-page { background: linear-gradient(135deg, #8fa892 0%, #496657 28%, #10251f 44%, #07100e 100%); overflow-x: hidden; }
.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); width: min(1480px, calc(100% - 32px)); min-height: calc(100vh - 32px); margin: 16px auto; overflow: hidden; border: 1px solid rgba(255,255,255,.1); border-radius: 8px; background: #06110f; box-shadow: var(--shadow); }
.sidebar { border-right: 1px solid var(--line); background: rgba(4, 13, 12, .98); padding: 22px 18px; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-weight: 800; }
.user-card { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 11px; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.045); padding: 10px; margin-bottom: 18px; }
.user-card img, .avatar-fallback { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; }
.avatar-fallback { display: grid; place-items: center; background: linear-gradient(135deg, var(--mint), var(--lime)); color: #06110f; font-weight: 900; }
.user-card strong, .user-card span { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.sidebar-nav { display: grid; gap: 7px; }
.sidebar-nav button, .sidebar-nav a { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 40px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); padding: 0 10px; text-align: left; font-weight: 600; }
.sidebar-nav button:hover, .sidebar-nav a:hover, .sidebar-nav .current, .sidebar-nav .active { border-color: rgba(168,255,70,.22); background: rgba(168,255,70,.09); color: var(--text); }
.sidebar-nav em { font-style: normal; color: var(--subtle); font-size: 11px; }
.main-area { min-width: 0; padding: 28px; background: linear-gradient(180deg, rgba(8, 24, 22, .98), rgba(3, 11, 10, .98)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.topbar h1 { margin: 0; font-size: 30px; line-height: 1.1; }
.top-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.mobile-menu { display: none; }
.view { display: none; }
.view.active { display: block; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.search-box { position: relative; flex: 1 1 260px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--muted); }
.search-box input { padding-left: 38px; }
.segmented { display: flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.segmented button { width: 38px; height: 36px; border: 0; background: transparent; color: var(--muted); }
.segmented button.active { background: var(--lime); color: #06110f; }
.bookmark-grid.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.bookmark-card, .bookmark-list-row { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.bookmark-card:hover, .bookmark-list-row:hover { transform: translateY(-2px); border-color: rgba(168,255,70,.3); background: var(--panel-2); }
.bookmark-image { position: relative; min-height: 150px; background: linear-gradient(135deg, rgba(47,208,191,.18), rgba(168,255,70,.1)), #091a17; background-size: cover; background-position: center; }
.bookmark-image .favicon { position: absolute; left: 12px; bottom: 12px; width: 28px; height: 28px; border-radius: 6px; background: rgba(0,0,0,.35); }
.status { display: inline-flex; align-items: center; min-height: 24px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; background: rgba(0,0,0,.42); color: var(--muted); padding: 0 9px; font-size: 11px; font-weight: 800; }
.bookmark-image .status { position: absolute; top: 10px; left: 10px; }
.status.available { color: #b9ffd2; border-color: rgba(47,208,191,.45); background: rgba(47,208,191,.18); }
.status.unavailable { color: #ffc2cb; border-color: rgba(255,97,119,.45); background: rgba(255,97,119,.16); }
.card-actions { position: absolute; inset: auto 10px 10px auto; display: flex; gap: 7px; opacity: 0; transform: translateY(6px); transition: opacity .16s ease, transform .16s ease; }
.bookmark-card:hover .card-actions { opacity: 1; transform: translateY(0); }
.bookmark-body { padding: 14px; }
.bookmark-body h2 { margin: 0; font-size: 15px; line-height: 1.3; }
.bookmark-body p { min-height: 38px; margin: 7px 0 11px; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { border: 1px solid color-mix(in srgb, var(--tag) 48%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--tag) 10%, transparent); color: var(--tag); padding: 4px 8px; font-size: 11px; font-weight: 700; }
.bookmark-grid.list { display: grid; gap: 10px; }
.bookmark-list-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px; }
.list-thumb { display: grid; place-items: center; width: 54px; height: 42px; border-radius: 7px; background: rgba(255,255,255,.055); color: var(--mint); overflow: hidden; }
.list-thumb img { width: 100%; height: 100%; object-fit: cover; }
.list-main { min-width: 0; }
.list-main strong, .list-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main span { margin: 4px 0 7px; color: var(--muted); font-size: 12px; }
.list-actions { display: flex; gap: 6px; }
.empty-state { display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 8px; padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-state svg { width: 42px; height: 42px; color: var(--lime); }
.load-row { display: flex; justify-content: center; margin-top: 18px; }
.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 14px; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 8px; font-size: 28px; }
.stat-card.success strong { color: var(--mint); }
.stat-card.danger strong { color: var(--red); }
.panel { padding: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.panel-head h2 { margin: 0; font-size: 18px; }
.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 40px; align-items: center; gap: 10px; color: var(--muted); }
.bar-row div { height: 8px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; }
.bar-row em { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), var(--lime)); }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(1, 8, 7, .72); backdrop-filter: blur(10px); padding: 18px; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 36px); overflow: auto; border: 1px solid var(--line-strong); border-radius: 8px; background: #0b211e; box-shadow: var(--shadow); padding: 16px; }
.modal.wide { width: min(900px, 100%); }
.modal.small { width: min(420px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.bookmark-form-grid { display: grid; grid-template-columns: minmax(240px, .85fr) minmax(300px, 1.15fr); gap: 14px; }
.image-picker { display: grid; gap: 10px; align-content: start; }
.preview { position: relative; display: grid; place-items: center; min-height: 240px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(135deg, rgba(47,208,191,.16), rgba(168,255,70,.1)), #071513; background-size: cover; background-position: center; color: var(--subtle); font-weight: 800; }
.preview .status { position: absolute; top: 10px; left: 10px; }
.replace-image { position: relative; display: grid; place-items: center; min-height: 38px; border: 1px dashed var(--line-strong); border-radius: 7px; color: var(--muted); }
.replace-image input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.inline-field { display: grid; grid-template-columns: minmax(0, 1fr) 38px; gap: 8px; }
.drop-zone { display: grid; place-items: center; min-height: 150px; border: 1px dashed var(--line-strong); border-radius: 8px; background: rgba(255,255,255,.04); text-align: center; cursor: pointer; }
.drop-zone input { width: auto; }
.import-progress { display: grid; gap: 8px; margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.045); padding: 11px; }
.import-progress div { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.import-progress strong { color: var(--lime); }
.import-progress progress { width: 100%; height: 9px; overflow: hidden; border: 0; border-radius: 999px; background: rgba(255,255,255,.08); }
.import-progress progress::-webkit-progress-bar { background: rgba(255,255,255,.08); }
.import-progress progress::-webkit-progress-value { background: linear-gradient(90deg, var(--mint), var(--lime)); border-radius: 999px; }
.import-progress progress::-moz-progress-bar { background: linear-gradient(90deg, var(--mint), var(--lime)); border-radius: 999px; }
.is-busy .btn.primary svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toggle-row { display: grid; grid-template-columns: 1px 46px minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 12px; }
.toggle-row input { opacity: 0; width: 1px; min-height: 1px; }
.toggle-row span { position: relative; width: 46px; height: 26px; border: 1px solid var(--line); border-radius: 99px; background: rgba(255,255,255,.08); }
.toggle-row span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 2px; top: 2px; border-radius: 50%; background: var(--muted); transition: transform .16s ease, background .16s ease; }
.toggle-row input:checked + span { background: rgba(168,255,70,.18); border-color: rgba(168,255,70,.42); }
.toggle-row input:checked + span::before { transform: translateX(20px); background: var(--lime); }
.toast-zone { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; gap: 10px; width: min(360px, calc(100vw - 36px)); }
.toast { border: 1px solid var(--line); border-left: 4px solid var(--lime); border-radius: 8px; background: #102b26; color: var(--text); padding: 12px 13px; box-shadow: var(--shadow); font-weight: 700; }
.toast.bad { border-left-color: var(--red); }
.admin-table { overflow-x: auto; }
.admin-table table { width: 100%; border-collapse: collapse; min-width: 720px; }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--line); padding: 12px 10px; text-align: left; vertical-align: middle; }
.admin-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.admin-table td span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.mini-list { display: grid; gap: 8px; }
.mini-list span, .mini-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.04); padding: 10px; color: var(--text); }
.mini-list em { color: var(--muted); font-style: normal; font-size: 12px; }
@media (max-width: 1200px) {
    .bookmark-grid.cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-hero { min-height: auto; }
    .app-shell { grid-template-columns: 1fr; width: 100%; min-height: 100vh; margin: 0; border: 0; border-radius: 0; }
    .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(290px, calc(100vw - 44px)); transform: translateX(-100%); transition: transform .18s ease; }
    .sidebar.open { transform: translateX(0); }
    .mobile-menu { display: inline-flex; }
    .bookmark-grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topbar { align-items: flex-start; }
}
@media (max-width: 640px) {
    .auth-page { padding: 12px; background: var(--bg); }
    .main-area { padding: 16px; }
    .topbar { display: grid; grid-template-columns: auto minmax(0, 1fr); }
    .top-actions { grid-column: 1 / -1; justify-content: stretch; }
    .top-actions .btn { flex: 1; }
    .bookmark-grid.cards, .stats-grid, .bookmark-form-grid { grid-template-columns: 1fr; }
    .bookmark-list-row { grid-template-columns: 44px minmax(0, 1fr); }
    .bookmark-list-row > .status, .list-actions { grid-column: 1 / -1; }
    .bar-row { grid-template-columns: 1fr; }
}
