/* ============ DESIGN TOKENS ============ */
:root {
    --bg: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-hover: #f1f5f9;
    --surface-2: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --primary: #0f172a;
    --primary-hover: #1e293b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --error-bg: #fee2e2;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.18);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --topbar-h: 56px;
    --searchbar-h: 56px;
    --sidebar-w: 280px;
    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --bg-elevated: #1e293b;
        --bg-hover: #334155;
        --surface-2: #334155;
        --border: #334155;
        --border-strong: #475569;
        --text: #f1f5f9;
        --text-muted: #94a3b8;
        --text-dim: #64748b;
        --primary: #f1f5f9;
        --primary-hover: #e2e8f0;
        --accent: #60a5fa;
        --accent-hover: #3b82f6;
        --success-bg: #14532d;
        --error-bg: #7f1d1d;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
        --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
    }
}

/* Manual theme override — wins over prefers-color-scheme */
:root[data-theme="light"] {
    --bg: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-hover: #f1f5f9;
    --surface-2: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --primary: #0f172a;
    --primary-hover: #1e293b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success-bg: #dcfce7;
    --error-bg: #fee2e2;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.18);
}
:root[data-theme="dark"] {
    --bg: #0f172a;
    --bg-elevated: #1e293b;
    --bg-hover: #334155;
    --surface-2: #334155;
    --border: #334155;
    --border-strong: #475569;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --primary: #f1f5f9;
    --primary-hover: #e2e8f0;
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --success-bg: #14532d;
    --error-bg: #7f1d1d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Sarabun", "Noto Sans Thai", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

/* ============ TOPBAR ============ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-h);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    gap: 0.5rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.topbar h1 {
    flex: 1;
    text-align: center;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.icon-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    color: var(--text);
    transition: background var(--transition);
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn-accent {
    background: var(--accent);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 300;
}
.icon-btn-accent:hover { background: var(--accent-hover); }

.back-link, .logout-link {
    padding: 0.5rem 0.75rem;
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 500;
}

/* ============ SEARCH BAR ============ */
.search-bar {
    position: sticky;
    top: var(--topbar-h);
    z-index: 40;
    height: var(--searchbar-h);
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}
.search-input-wrap {
    position: relative;
    width: 100%;
}
.search-bar input {
    width: 100%;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 2.5rem 0 1rem;
    background: var(--bg-elevated);
    color: var(--text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.search-bar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
/* ซ่อนปุ่ม X ในตัวของ <input type="search"> */
.search-bar input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}
.search-bar input::-webkit-search-decoration { -webkit-appearance: none; }

.search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.search-clear:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.search-clear[hidden] { display: none; }

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    max-width: 85vw;
    height: 100vh;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
    height: var(--topbar-h);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-header h2 { margin: 0; font-size: 1.05rem; font-weight: 600; }

.folder-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.5rem;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    user-select: none;
    color: var(--text);
    font-size: 0.95rem;
}
.folder-item:hover { background: var(--bg-hover); }
.folder-item.active {
    background: var(--accent);
    color: #fff;
}
.folder-item.active .folder-name { font-weight: 500; }
.folder-icon { font-size: 1rem; flex-shrink: 0; }
.folder-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.folder-edit-btn {
    opacity: 0;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.folder-item:hover .folder-edit-btn,
.folder-item.active .folder-edit-btn {
    opacity: 1;
}
.folder-item.active .folder-edit-btn { color: rgba(255,255,255,0.85); }
.folder-edit-btn:hover { background: rgba(0,0,0,0.1); }

/* folder drag handle */
.folder-drag-handle {
    width: 20px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    cursor: grab;
    flex-shrink: 0;
    font-size: 0.85rem;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    margin-right: -0.25rem;
    opacity: 0.5;
}
.folder-drag-handle:active { cursor: grabbing; }
.folder-item:hover .folder-drag-handle { opacity: 1; }
.folder-item.active .folder-drag-handle { color: rgba(255,255,255,0.7); opacity: 1; }
.folder-item.dragging {
    opacity: 0.4;
    box-shadow: var(--shadow-lg);
}
.folder-item.drag-over-top { border-top: 2px solid var(--accent); }
.folder-item.drag-over-bottom { border-bottom: 2px solid var(--accent); }

.folder-children {
    padding-left: 1rem;
    border-left: 1px dashed var(--border);
    margin-left: 0.75rem;
}

.folder-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}
.overlay.active { opacity: 1; pointer-events: auto; }

/* ============ MAIN CONTENT ============ */
.main-content {
    padding: 0.5rem;
    min-height: calc(100vh - var(--topbar-h) - var(--searchbar-h));
}

.bookmark-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bookmark-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}
.bookmark-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}
.bookmark-item:active { transform: scale(0.98); }

.bookmark-favicon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    flex-shrink: 0;
    background: var(--surface-2);
    object-fit: contain;
    padding: 4px;
}

.bookmark-body {
    flex: 1;
    min-width: 0;
}
.bookmark-title {
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}
.bookmark-url {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.125rem;
}

/* Compact display — ซ่อน URL, ลด padding */
body.display-compact .bookmark-item,
html.preload-compact body .bookmark-item {
    padding: 0.5rem 0.75rem;
    gap: 0.625rem;
}
body.display-compact .bookmark-favicon,
html.preload-compact body .bookmark-favicon {
    width: 24px;
    height: 24px;
    padding: 3px;
}
body.display-compact .bookmark-url,
html.preload-compact body .bookmark-url {
    display: none;
}
body.display-compact .bookmark-list,
html.preload-compact body .bookmark-list {
    gap: 0.3rem;
}
body.display-compact .folder-group-bookmarks,
html.preload-compact body .folder-group-bookmarks {
    gap: 0.25rem;
}

.bookmark-edit-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 1.1rem;
}
.bookmark-edit-btn:hover { background: var(--bg-hover); color: var(--text); }

/* Drag & drop */
.drag-handle {
    width: 32px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    cursor: grab;
    flex-shrink: 0;
    font-size: 1.1rem;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.drag-handle:active { cursor: grabbing; }
.drag-handle:hover { color: var(--text); }

.bookmark-item.dragging {
    opacity: 0.4;
    transform: scale(0.98);
    box-shadow: var(--shadow-lg);
    z-index: 10;
}
.bookmark-item.drag-over-top {
    border-top: 2px solid var(--accent);
}
.bookmark-item.drag-over-bottom {
    border-bottom: 2px solid var(--accent);
}

/* Hide drag handle in search mode */
.bookmark-list.no-drag .drag-handle {
    display: none;
}

/* ============ GROUPED VIEW (โหมด "ทั้งหมด") ============ */
.bookmark-list.grouped-view {
    gap: 0.25rem;
}

/* Toolbar above grouped view (collapse all / expand all) */
.group-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem 0.5rem;
    flex-wrap: wrap;
}
.group-toolbar .btn { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

/* Preference setting cards */
.pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
}
.pref-row:first-of-type { border-top: 0; padding-top: 0; }
.pref-row label {
    font-weight: 500;
    margin: 0;
    flex: 1;
}
.pref-row .pref-control {
    display: flex;
    gap: 0.25rem;
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 0.25rem;
}
.pref-row .pref-control button {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}
.pref-row .pref-control button.active {
    background: var(--bg-elevated);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    font-weight: 500;
}

.folder-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.folder-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background var(--transition);
    font-weight: 600;
    color: var(--text);
}
.folder-group-header:hover { background: var(--bg-hover); }
.folder-group-header.collapsed { opacity: 0.85; }
.folder-group-header.empty {
    cursor: default;
    opacity: 0.5;
}
.folder-group-header.empty:hover { background: transparent; }

.folder-group-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    color: var(--text-muted);
    font-size: 0.7rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.folder-group-icon {
    font-size: 1rem;
    flex-shrink: 0;
}
.folder-group-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.folder-group-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface-2);
    border-radius: 10px;
    padding: 0.125rem 0.5rem;
    min-width: 1.5rem;
    text-align: center;
}

.folder-group-bookmarks {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-bottom: 0.5rem;
}

/* Favicon row in modal */
.favicon-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface-2);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.favicon-row-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}
.favicon-preview {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-elevated);
    object-fit: contain;
    padding: 4px;
    flex-shrink: 0;
}
.favicon-row .btn { margin-left: auto; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95rem;
    transition: background var(--transition), transform var(--transition), border-color var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

/* ============ MODAL ============ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    animation: fadeIn 0.2s ease;
    /* Use viewport height that accounts for on-screen keyboard if available.
       svh = small viewport height (excludes keyboard on mobile) */
    height: 100vh;
    height: 100svh;
}
.modal.active { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-content {
    width: 100%;
    max-width: 500px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    max-height: 90svh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    /* JS will set --vv-bottom-offset when keyboard pushes content */
    transform: translateY(calc(-1 * var(--vv-bottom-offset, 0px)));
    transition: transform 0.2s ease;
}

.modal-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.modal-header h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }

.modal-content form {
    padding: 1.25rem;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}
.modal-actions .btn { flex: 1; min-width: 80px; }
.modal-actions .btn-danger { flex: 0 0 auto; }

/* ============ FORM ============ */
form label {
    display: block;
    margin-bottom: 1rem;
}
form label > span {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}
form input, form select, form textarea,
input[type="text"]:not([class]), input[type="password"]:not([class]),
input[type="url"]:not([class]), input[type="email"]:not([class]),
input[type="search"]:not([class]), select:not([class]), textarea:not([class]) {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-size: 1rem;
}
form input:focus, form select:focus, form textarea:focus,
input[type="text"]:not([class]):focus, input[type="password"]:not([class]):focus,
input[type="url"]:not([class]):focus, input[type="email"]:not([class]):focus,
input[type="search"]:not([class]):focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-with-button {
    display: flex;
    gap: 0.5rem;
}
.input-with-button input { flex: 1; }
.input-with-button .btn { flex-shrink: 0; }

/* ============ AUTH PAGES ============ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--bg) 0%, var(--surface-2) 100%);
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow-lg);
}
.auth-card .logo {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    text-align: center;
}
.auth-card .muted {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.muted { color: var(--text-muted); }

/* ============ ALERTS ============ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-error { background: var(--error-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }

/* ============ SETTINGS ============ */
.settings-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}
.card h2 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}
.card p { margin: 0.5rem 0; }
.card code {
    background: var(--surface-2);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
}

/* ============ TOAST ============ */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(calc(100% + 3rem));
    background: var(--text);
    color: var(--bg);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 300;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s ease, visibility 0s linear 0.3s;
    max-width: 90%;
    text-align: center;
    font-size: 0.9rem;
}
.toast.show {
    transform: translateX(-50%) translateY(0);
    visibility: visible;
    opacity: 1;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s ease, visibility 0s linear 0s;
}
.toast.error { background: var(--danger); color: #fff; }

/* ============ DESKTOP ============ */
@media (min-width: 768px) {
    .modal {
        align-items: center;
        padding: 1rem;
    }
    .modal-content {
        border-radius: var(--radius-lg);
    }
    .main-content {
        padding: 1rem;
        max-width: 800px;
        margin: 0 auto;
    }
    .bookmark-list {
        gap: 0.625rem;
    }
}

@media (min-width: 1024px) {
    .sidebar {
        transform: translateX(0);
        position: fixed;
        top: 0;
        left: 0;
    }
    .overlay { display: none !important; }
    body {
        padding-left: var(--sidebar-w);
    }
    #menu-btn { display: none; }
    #close-sidebar { display: none; }
    .main-content { max-width: 900px; margin: 0 auto; width: 100%; padding: 1.5rem; }
}

