@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root, [data-theme="linkvault"] {
    --bg-deep: #060D1A;
    --bg-surface: #0B1628;
    --bg-card: #112038;
    --bg-card-hover: #1A2E4A;
    --bg-elevated: #1E3050;
    --bg-input: #0E1E35;
    --border: #243445;
    --border-hover: #3A4E62;
    --border-focus: #4A6FA5;
    --text-primary: #E8EDF2;
    --text-secondary: #A8BAC8;
    --text-muted: #6B8096;
    --accent: #4A6FA5;
    --accent-hover: #6B91C0;
    --accent-glow: rgba(74, 111, 165, 0.25);
    --accent-subtle: rgba(74, 111, 165, 0.08);
    --green: #22c55e;
    --yellow: #eab308;
    --red: #8B1A2B;
    --pink: #ec4899;
    --gold: #C9A84C;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);
    --scrollbar: linear-gradient(180deg, #f59e0b, #d97706);
}

[data-theme="high-contrast"] {
    --bg-deep: #000000;
    --bg-surface: #111111;
    --bg-card: #000000;
    --bg-card-hover: #222222;
    --bg-elevated: #1a1a1a;
    --bg-input: #000000;
    --border: #ffffff;
    --border-hover: #ffff00;
    --border-focus: #00ffff;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #aaaaaa;
    --accent: #facc15;
    --accent-hover: #eab308;
    --accent-glow: rgba(250, 204, 21, 0.5);
    --accent-subtle: rgba(250, 204, 21, 0.15);
    --scrollbar: var(--accent);
}

[data-theme="bright"] {
    --bg-deep: #f0f4f8;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-elevated: #f1f5f9;
    --bg-input: #ffffff;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --border-focus: #3b82f6;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.25);
    --accent-subtle: rgba(59, 130, 246, 0.1);
    --scrollbar: var(--accent);
}

[data-theme="dark"] {
    --bg-deep: #121212;
    --bg-surface: #1e1e1e;
    --bg-card: #252525;
    --bg-card-hover: #2a2a2a;
    --bg-elevated: #2d2d2d;
    --bg-input: #1a1a1a;
    --border: #333333;
    --border-hover: #444444;
    --border-focus: #bb86fc;
    --text-primary: #e1e1e1;
    --text-secondary: #b3b3b3;
    --text-muted: #888888;
    --accent: #bb86fc;
    --accent-hover: #9965f4;
    --accent-glow: rgba(187, 134, 252, 0.25);
    --accent-subtle: rgba(187, 134, 252, 0.1);
    --scrollbar: var(--accent);
}

[data-theme="mediterranean"] {
    --bg-deep: #F5F2ED;
    --bg-surface: #CFC7CB;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F9F6F1;
    --bg-elevated: #E8E3DE;
    --bg-input: #FFFFFF;
    --border: #C2B9BD;
    --border-hover: #9C1014;
    --border-focus: #0586BE;
    --text-primary: #2C1E1F;
    --text-secondary: #4A3A3C;
    --text-muted: #8C7A75;
    --accent: #9C1014;
    --accent-hover: #BB7678;
    --accent-glow: rgba(156, 16, 20, 0.25);
    --accent-subtle: rgba(156, 16, 20, 0.08);
    --green: #22c55e;
    --yellow: #eab308;
    --red: #C72A2F;
    --pink: #BB7678;
    --gold: #C9A84C;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px var(--accent-glow);
    --scrollbar: linear-gradient(180deg, #0586BE, #6AB4D3);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

html {
    font-size: 15px;
    scroll-behavior: smooth
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99, 102, 241, 0.04) 0%, transparent 60%), radial-gradient(ellipse 60% 50% at 80% 80%, rgba(236, 72, 153, 0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color .2s
}

a:hover {
    color: var(--accent-hover)
}

input,
textarea,
button {
    font-family: inherit;
    font-size: inherit
}

.hidden {
    display: none !important
}

.text-muted {
    color: var(--text-muted);
    font-size: .85rem
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 6px
}

::-webkit-scrollbar-track {
    background: var(--bg-surface)
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover)
}

/* AUTH SCREENS */
.auth-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem
}

.auth-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg)
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem
}

.auth-logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.03em
}

.auth-logo h1 span {
    color: var(--accent)
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: .9rem;
    margin-top: .4rem
}

.form-group {
    margin-bottom: 1.2rem
}

.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: .4rem;
    letter-spacing: .02em
}

.form-input {
    width: 100%;
    padding: .75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: .95rem;
    transition: border-color .2s, box-shadow .2s;
    outline: none
}

.form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow)
}

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

.btn-primary {
    width: 100%;
    padding: .8rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background .2s, box-shadow .2s, transform .1s
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: var(--shadow-glow)
}

.btn-primary:active {
    transform: scale(0.98)
}

.btn-primary:disabled {
    opacity: .6;
    cursor: not-allowed
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    font-size: .9rem;
    color: var(--text-secondary)
}

.auth-switch a {
    font-weight: 500
}

/* UNLOCK SCREEN */
.unlock-wrapper {
    text-align: center
}

.unlock-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent)
}

.lock-icon {
    display: block;
    margin: 0 auto 1.5rem
}

/* DASHBOARD LAYOUT  */
.dashboard {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh
}

/*  NAVBAR */
.navbar {
    grid-column: 1/-1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 1.5rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50
}

.nav-brand {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: .6rem
}

.nav-brand span {
    color: var(--accent)
}

.nav-brand svg {
    color: var(--accent)
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem
}

.nav-user {
    font-size: .9rem;
    color: var(--text-secondary);
    font-family: var(--font-mono)
}

.btn-nav {
    padding: .45rem .9rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .4rem;
    transition: all .2s
}

.btn-nav:hover {
    border-color: var(--accent);
    color: var(--accent)
}

/* SIDEBAR */
.sidebar{background:var(--bg-surface);border-right:1px solid var(--border);padding:1.5rem;overflow-y:auto;overflow-x: hidden;}
#tag-list{max-height:45vh;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#d97706 transparent}
#tag-list::-webkit-scrollbar{width:4px}
#tag-list::-webkit-scrollbar-track{background:transparent}
#tag-list::-webkit-scrollbar-thumb{background:var(--scrollbar);border-radius:2px}
#tag-list::-webkit-scrollbar-thumb:hover{background:var(--scrollbar)}

.sidebar-section {
    margin-bottom: 2rem
}

.sidebar-title {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-muted);
    margin-bottom: .8rem
}

.tag-chip {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .75rem;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: .88rem;
    color: var(--text-secondary);
    transition: all .2s;
    margin-bottom: .35rem;
    border: 1px solid transparent
}

.tag-chip:hover {
    background: var(--bg-card);
    color: var(--text-primary)
}

.tag-chip.active {
    background: color-mix(in srgb, var(--tag-color) 15%, transparent);
    border-color: color-mix(in srgb, var(--tag-color) 40%, transparent);
    color: var(--text-primary)
}

.tag-count {
    opacity: 0.7;
    font-size: 0.85em;
    margin-left: 0.25rem;
    vertical-align: top;
    display: inline-block;
    line-height: inherit;
    position: relative;
    top: 1px;
}
.tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tag-color);
    flex-shrink: 0
}

.tag-delete {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 .2rem;
    opacity: 0;
    transition: opacity .2s, color .2s
}

.tag-chip:hover .tag-delete {
    opacity: 1
}

.tag-delete:hover {
    color: var(--red)
}

.tag-add-row {
    display: flex;
    gap: .4rem;
    margin-top: .6rem
}

.tag-add-row input {
    flex: 1;
    padding: .4rem .6rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: .85rem;
    outline: none;
    min-width: 0;
}

.tag-add-row input:focus {
    border-color: var(--border-focus)
}

.tag-add-row button {
    padding: .4rem .5rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background .2s
}

.tag-add-row button:hover {
    background: var(--accent-hover)
}

.btn-clear-filter {
    display: block;
    width: 100%;
    padding: .4rem;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    cursor: pointer;
    font-size: .82rem;
    margin-top: .5rem;
    transition: all .2s
}

.btn-clear-filter:hover {
    border-color: var(--text-secondary);
    color: var(--text-secondary)
}

/* MAIN AREA */
.main-content {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    position: relative
}

/* ADD LINK BAR */
.add-link-bar {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem
}

.add-link-bar input {
    flex: 1;
    padding: .8rem 1.1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s
}

.add-link-bar input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow)
}

.add-link-bar input::placeholder {
    color: var(--text-muted)
}

#add-link-btn {
    width: 48px;
    height: 48px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, box-shadow .2s, transform .1s;
    flex-shrink: 0
}

#add-link-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: var(--shadow-glow)
}

#add-link-btn:active {
    transform: scale(0.95)
}

#add-link-btn:disabled {
    opacity: .6;
    cursor: not-allowed
}

/*  TOOLBAR  */
.toolbar {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative
}

.search-box input {
    width: 100%;
    padding: .55rem 1rem .55rem 2.4rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: .9rem;
    outline: none;
    transition: border-color .2s
}

.search-box input:focus {
    border-color: var(--border-focus)
}

.search-box svg {
    position: absolute;
    left: .8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none
}

.btn-toolbar {
    padding: .55rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .4rem;
    transition: all .2s;
    white-space: nowrap
}

.btn-toolbar:hover {
    border-color: var(--accent);
    color: var(--accent)
}

.btn-toolbar:disabled {
    opacity: .5;
    cursor: not-allowed
}

/* LINKS GRID */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    padding-bottom: 2rem
}

/* LINK CARD */
.link-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease,
                border-color 0.2s ease,
                background 0.2s ease,
                opacity 0.15s ease;
    position: relative;
    overflow: hidden
}

.link-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px)
}

.link-card[draggable="true"] {
    cursor: grab;
}

.link-card.drag-over {
    border-top: 3px solid var(--accent);
    box-shadow: 0 -6px 20px var(--accent-glow), var(--shadow-md);
    transform: translateY(3px);
    background: var(--bg-card-hover);
}
.link-card.dragging {
    opacity: 0.75;
    transform: scale(1.03) rotate(-0.8deg);
    cursor: grabbing;
    box-shadow: var(--shadow-lg), 0 0 0 2px var(--accent), 0 0 24px var(--accent-glow);
    z-index: 100;
}
.link-card.card-landed {
    animation: cardDrop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes cardDrop {
    0%   { transform: scale(1.03) rotate(-0.8deg); }
    55%  { transform: scale(1.015) rotate(0.2deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.link-card-header {
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    margin-bottom: .6rem
}

.link-favicon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center
}

.link-favicon img {
    width: 100%;
    height: 100%;
    object-fit: contain
}

.link-info {
    flex: 1;
    min-width: 0
}

.link-title {
    display: block;
    font-weight: 600;
    font-size: .95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .2s
}

.link-title:hover {
    color: var(--accent)
}

.link-domain {
    font-size: .78rem;
    color: var(--text-muted);
    font-family: var(--font-mono)
}

.health-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: .35rem
}

.health-dot.health-red {
    border-radius: 2px
}

.health-dot.health-green {
    background: var(--green);
    box-shadow: 0 0 6px var(--green)
}

.health-dot.health-yellow {
    background: var(--yellow);
    box-shadow: 0 0 6px var(--yellow)
}

.health-dot.health-red {
    background: var(--red);
    box-shadow: 0 0 6px var(--red)
}

.link-desc {
    font-size: .83rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: .6rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden
}

.link-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-bottom: .6rem;
    min-height: 22px
}

.tag-mini {
    font-size: .72rem;
    padding: .15rem .5rem;
    border-radius: 20px;
    background: color-mix(in srgb, var(--tag-color) 15%, transparent);
    color: color-mix(in srgb, var(--tag-color) 80%, white);
    font-weight: 500;
    letter-spacing: .01em
}

.link-actions {
    display: flex;
    gap: .3rem;
    opacity: 0;
    transition: opacity .2s;
    padding-top: .4rem;
    border-top: 1px solid var(--border)
}

.link-card:hover .link-actions {
    opacity: 1
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    cursor: pointer;
    transition: all .2s
}

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

.btn-icon.btn-danger:hover {
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.3)
}

/* FLOATING CARDS */
.floating-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 320px;
    max-height: 80vh;
    overflow-y: auto;
    animation: fadeSlideIn .2s ease-out
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px)
    }

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

.floating-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--border)
}

.floating-card-header h4 {
    font-size: .95rem;
    font-weight: 600
}

.btn-close-card {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color .2s
}

.btn-close-card:hover {
    color: var(--text-primary)
}

/* Notes */
.notes-textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    background: var(--bg-input);
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: .9rem;
    resize: vertical;
    outline: none;
    font-family: var(--font-body)
}

.notes-textarea:focus {
    background: var(--bg-card)
}

.btn-save-notes {
    display: block;
    width: calc(100% - 2rem);
    margin: 1rem;
    padding: .55rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-xs);
    font-weight: 600;
    cursor: pointer;
    font-size: .88rem;
    transition: background .2s
}

.btn-save-notes:hover {
    background: var(--accent-hover)
}

/* Peek */
.peek-content {
    padding: 1rem
}

.peek-row {
    margin-bottom: .7rem
}

.peek-label {
    display: block;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: .15rem
}

.peek-value {
    font-size: .88rem;
    color: var(--text-primary);
    word-break: break-all
}

.peek-url {
    font-family: var(--font-mono);
    font-size: .8rem;
    color: var(--accent)
}

.peek-image {
    width: 100%;
    border-radius: var(--radius-xs);
    margin-top: .5rem
}

.btn-refetch-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    width: calc(100% - 2rem);
    margin: 0 1rem 1rem;
    padding: .52rem;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: .82rem;
    font-weight: 500;
    font-family: inherit;
    transition: all .2s;
}
.btn-refetch-meta:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-refetch-meta:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn-refresh-peek {
    display: block;
    width: calc(100% - 2rem);
    margin: 1rem;
    padding: .55rem;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: .85rem;
    transition: all .2s
}

.btn-refresh-peek:hover {
    border-color: var(--accent);
    color: var(--accent)
}

/* Smart Agent generated content */
.agent-generated {
    color: #ff8c42;
}

.agent-badge {
    color: #ff8c42;
    font-size: .75em;
}

.agent-legend {
    padding: .6rem 1rem;
    font-size: .78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* Smart Agent */
.agent-generated {
    color: #ff8c42
}

.agent-badge {
    color: #ff8c42;
    font-size: .75rem
}

.agent-legend {
    padding: .6rem 1rem;
    font-size: .78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border)
}

.btn-agent-fill {
    display: block;
    width: calc(100% - 2rem);
    margin: .8rem 1rem 1rem;
    padding: .6rem;
    background: linear-gradient(135deg, #ff8c42, #f97316);
    color: #fff;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    transition: all .2s;
    box-shadow: 0 2px 8px rgba(255, 140, 66, 0.25)
}

.btn-agent-fill:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(255, 140, 66, 0.4);
    transform: translateY(-1px)
}

.btn-agent-fill:active {
    transform: scale(0.98)
}

.btn-agent-fill:disabled {
    opacity: .6;
    cursor: not-allowed
}

.btn-agent-fill.agent-off {
    background: linear-gradient(135deg, var(--bg-elevated), var(--bg-card));
    color: var(--text-secondary);
    box-shadow: none;
    border: 1px solid var(--border)
}

.btn-agent-fill.agent-off:hover:not(:disabled) {
    border-color: var(--text-muted);
    color: var(--text-primary);
    box-shadow: none;
    transform: none
}

/* Share */
.share-content {
    padding: 0.5rem;
}

.theme-submenu {
    position: absolute;
    top: -1px;
    right: 100%;
    margin-right: 0.2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 101;
    min-width: 150px;
    padding: 0.5rem;
}

.theme-option {
    margin-bottom: 1.2rem
}

.share-option {
    margin-bottom: 1.2rem
}

.share-option h5 {
    font-size: .88rem;
    font-weight: 600;
    margin-bottom: .3rem
}

.share-note {
    font-size: .78rem;
    color: var(--text-muted);
    margin-bottom: .5rem
}

.btn-generate-short,
.btn-generate-qr {
    padding: .45rem .8rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    transition: background .2s
}

.btn-generate-short:hover,
.btn-generate-qr:hover {
    background: var(--accent-hover)
}

.short-link-result {
    display: flex;
    gap: .4rem;
    margin-top: .5rem
}

.short-link-input {
    flex: 1;
    padding: .4rem .6rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: .82rem;
    outline: none
}

.btn-copy-short {
    padding: .4rem .7rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: .82rem;
    transition: all .2s
}

.btn-copy-short:hover {
    border-color: var(--accent);
    color: var(--accent)
}

.qr-canvas {
    display: none;
    margin: .5rem auto;
    border-radius: var(--radius-xs);
    border: 4px solid #fff
}

.qr-note {
    text-align: center;
    margin-top: .3rem
}

/* ───────────────────────────────── MODALS ───────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn .15s
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    max-width: 460px;
    width: 90%;
    box-shadow: var(--shadow-lg)
}

.modal-box h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem
}

.tag-checkboxes {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-bottom: 1rem;
    max-height: 240px;
    overflow-y: auto
}

.tag-checkbox-label {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .4rem .6rem;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: .9rem;
    transition: background .15s
}

.tag-checkbox-label:hover {
    background: var(--bg-card)
}

.tag-checkbox-label input {
    accent-color: var(--accent)
}

.btn-save-tags {
    display: block;
    width: 100%;
    padding: .6rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-xs);
    font-weight: 600;
    cursor: pointer;
    transition: background .2s
}

.btn-save-tags:hover {
    background: var(--accent-hover)
}

#confirm-msg {
    font-size: .95rem;
    color: var(--text-secondary);
    margin-bottom: 1.2rem
}

.confirm-btns {
    display: flex;
    gap: .6rem;
    justify-content: flex-end
}

.confirm-btns button {
    padding: .5rem 1.2rem;
    border-radius: var(--radius-xs);
    font-weight: 600;
    cursor: pointer;
    font-size: .9rem;
    border: 1px solid var(--border);
    transition: all .2s
}

#confirm-yes {
    background: var(--red);
    color: #fff;
    border-color: var(--red)
}

#confirm-yes:hover {
    background: #dc2626
}

#confirm-no {
    background: transparent;
    color: var(--text-secondary)
}

#confirm-no:hover {
    background: var(--bg-card)
}

/* ─ EMPTY STATE */
.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted)
}

.empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-subtle);
    color: var(--accent);
    margin-bottom: 1rem
}

.empty-state p {
    font-size: 1rem
}

/* TOASTS  */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    pointer-events: none
}

.toast {
    padding: .7rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 500;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: all .3s ease;
    box-shadow: var(--shadow-md);
    max-width: 360px
}

.toast.visible {
    opacity: 1;
    transform: translateY(0) scale(1)
}

.toast-success {
    background: var(--bg-card);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: var(--green)
}

.toast-error {
    background: var(--bg-card);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: var(--red)
}

.toast-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary)
}

/* SPINNER */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite
}

/* Export Modal Responsive */
#export-modal .modal-box{max-height:85vh;overflow-y:auto;scrollbar-width:thin}
@media(max-width:500px){
    #export-modal .modal-box{width:95%;padding:1rem 1.2rem;max-height:90vh}
    .export-options,.export-tag-filter,.export-format{font-size:.85rem}
    #export-modal .confirm-btns{flex-direction:column;gap:.4rem}
    #export-modal .confirm-btns button{width:100%}
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

/* Responsive as poume */
@media(max-width:860px) {
    .dashboard {
        grid-template-columns: 1fr
    }

    .sidebar {
        display: none
    }

    .links-grid {
        grid-template-columns: 1fr
    }
}

@media(max-width:500px) {
    .main-content {
        padding: 1rem
    }

    .link-card {
        padding: .9rem
    }

    .auth-box {
        padding: 1.5rem
    }

    .navbar {
        padding: .6rem 1rem
    }

    .link-actions {
        opacity: 1
    }
    .sidebar {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 100;
        width: 100%;
        max-width: 100%;
        border-right: none;
        background: var(--bg-deep);
    }
    .sidebar.mobile-open {
        display: block;
    }
    #btn-mobile-filter {
        display: flex !important;
    }
    .link-tags-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
    }
    .link-tags-row::-webkit-scrollbar {
        height: 2px;
    }
}

.theme-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    min-width: 150px;
}
.theme-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.theme-option:hover {
    background: var(--bg-elevated);
}
.theme-option.active {
    color: var(--accent);
    font-weight: 600;
}

/* ── POLICY MODALS ── */
.policy-modal-box {
    max-width: 680px;
    max-height: 82vh;
    width: 92%;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.policy-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.policy-modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.btn-close-policy {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color .2s;
}

.btn-close-policy:hover {
    color: var(--text-primary);
}

.policy-content {
    padding: 1.4rem 1.6rem;
    overflow-y: auto;
    flex: 1;
    line-height: 1.75;
    color: var(--text-secondary);
    font-size: .88rem;
}

.policy-content h4 {
    color: var(--text-primary);
    font-size: .95rem;
    font-weight: 600;
    margin: 1.3rem 0 .45rem;
}

.policy-content h4:first-child {
    margin-top: .2rem;
}

.policy-content p {
    margin-bottom: .75rem;
}

.policy-content ul {
    padding-left: 1.4rem;
    margin-bottom: .75rem;
}

.policy-content ul li {
    margin-bottom: .3rem;
}

.policy-content code {
    font-family: var(--font-mono);
    font-size: .82em;
    background: var(--bg-elevated);
    padding: .1em .35em;
    border-radius: 4px;
}

.link-card.pinned {
    border-color: var(--accent);
}
.btn-icon.active {
    color: var(--accent);
    background: var(--accent-subtle);
}

.tag-chip[data-count="0"] {
    opacity: 0.5;
    filter: grayscale(1);
}
.tag-count {
    display: none;
    margin-left: 0.3rem;
    font-size: 0.8em;
    opacity: 0.7;
}
.tag-chip:hover .tag-count {
    display: inline;
}
/* ── Cover Overlay ── */
/* ── Cover Overlay ── */
#cover-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-deep);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    user-select: none;
}
#cover-overlay.slide-up {
    transform: translateY(-100%);
}
.cover-content {
    text-align: center;
    padding: 2rem;
}
.cover-title {
    font-size: 3.8rem;           /* bigger */
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.04em;
    text-shadow: 0 0 30px var(--accent-glow);
    margin-bottom: 0.5rem;
}
.cover-subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.02em;
}
.cover-hint {
    margin-top: 3.5rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
.cover-footer {
    position: absolute;
    bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}
.cover-logo {
    width: 60px;
    height: auto;
    opacity: 0.85;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.cover-created {
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    margin: 0;
}

/* ── Auth Footer (compact) ── */
.auth-footer {
    margin-top: 1.2rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
    font-size: 0.72rem; 
    color: var(--text-muted);
    line-height: 1.5;
    text-align: left;
}
.auth-footer a {
    color: var(--accent);
    text-decoration: underline;
}
.auth-footer a:hover {
    color: var(--accent-hover);
}