:root {
    --paper: 249 249 249;
    --mist: 255 255 255;
    --ink: 15 15 15;
    --muted: 96 96 96;
    --line: 229 229 229;
    --brand: 138 43 226;
    --ok: 16 185 129;
    --danger: 204 0 0;
    --hover: 0 0 0;
    --grad: linear-gradient(90deg, #8a2be2 0%, #a855f7 100%);
    --shadow: 0 1px 2px rgba(15, 15, 15, 0.05), 0 4px 14px rgba(15, 15, 15, 0.04);
    --shadow-pop: 0 4px 32px rgba(15, 15, 15, 0.14);
    color-scheme: light;
}

html.dark {
    --paper: 15 15 15;
    --mist: 33 33 33;
    --ink: 241 241 241;
    --muted: 170 170 170;
    --line: 48 48 48;
    --hover: 255 255 255;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-pop: 0 4px 32px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
}

[x-cloak],
[x-cloak] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    background: rgb(var(--paper));
    color: rgb(var(--ink));
    font-family: Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgb(var(--brand) / 0.28); }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
    background: rgb(var(--muted) / 0.35);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: rgb(var(--muted) / 0.6); }
*::-webkit-scrollbar-track { background: transparent; }

:focus-visible {
    outline: 2px solid rgb(var(--brand));
    outline-offset: 2px;
}

.icon-sm,
.lucide {
    width: 1.25rem;
    height: 1.25rem;
    stroke: currentColor;
    stroke-width: 1.75;
    flex-shrink: 0;
}

.icon-lg { width: 1.75rem; height: 1.75rem; }

.icon-badge {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
    border-radius: 0.75rem;
    background: rgb(var(--brand));
    color: #fff;
}

.icon-badge .lucide,
.icon-badge svg {
    width: 1.25rem;
    height: 1.25rem;
    stroke: #fff;
    color: #fff;
}

.field-wrap { position: relative; }
.field-wrap .field { padding-left: 2.65rem; }
.field-wrap .field.has-toggle { padding-right: 2.75rem; }

.field-leading {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgb(var(--muted));
    pointer-events: none;
    display: flex;
}

.password-toggle {
    position: absolute;
    right: 0.45rem;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    color: rgb(var(--muted));
    background: transparent;
}

.password-toggle:hover {
    color: rgb(var(--ink));
    background: rgb(var(--hover) / 0.08);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.heading-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

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

.icon-spin,
.lucide.icon-spin,
svg.icon-spin {
    animation: icon-spin 0.75s linear infinite;
    transform-origin: center;
}

button[aria-busy="true"],
a[aria-busy="true"] {
    cursor: wait;
    opacity: 0.88;
    pointer-events: none;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 999px;
    background: rgb(var(--brand));
    color: #fff;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
    background: rgb(var(--brand) / 0.88);
    box-shadow: 0 1px 6px rgb(var(--brand) / 0.35);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 999px;
    background: rgb(var(--hover) / 0.06);
    color: rgb(var(--ink));
    font-weight: 500;
    transition: background-color 0.15s ease;
}

.btn-secondary:hover { background: rgb(var(--hover) / 0.12); }

.card {
    border-radius: 0.75rem;
    border: 1px solid rgb(var(--line));
    background: rgb(var(--mist));
}

.card-pop {
    box-shadow: var(--shadow-pop);
}

.hover-card {
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.hover-card:hover {
    box-shadow: var(--shadow-pop);
    border-color: rgb(var(--muted) / 0.35);
}

.field {
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid rgb(var(--line));
    background: transparent;
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
    font-family: inherit;
    color: rgb(var(--ink));
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.field:hover:not(:focus) { border-color: rgb(var(--muted) / 0.5); }

.field:focus {
    border-color: rgb(var(--brand));
    box-shadow: 0 0 0 3px rgb(var(--brand) / 0.18);
}

.field::placeholder { color: rgb(var(--muted) / 0.75); }

select.field option { background: rgb(var(--mist)); color: rgb(var(--ink)); }

.nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    padding: 0.5rem 0.95rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(var(--muted));
    background: transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-pill:hover { background: rgb(var(--hover) / 0.06); color: rgb(var(--ink)); }

.nav-pill.is-active,
.nav-pill[aria-current="page"] {
    background: rgb(var(--ink));
    color: rgb(var(--paper));
    border-color: rgb(var(--ink));
}

.choice-tile {
    display: flex;
    cursor: pointer;
    align-items: flex-start;
    gap: 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid rgb(var(--line));
    background: rgb(var(--mist));
    padding: 0.9rem 1rem;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.choice-tile:hover { border-color: rgb(var(--muted) / 0.5); }

.choice-tile:has(:checked) {
    border-color: rgb(var(--brand));
    background: rgb(var(--brand) / 0.07);
}

.dropzone {
    border: 1.5px dashed rgb(var(--line));
    background: rgb(var(--paper));
    border-radius: 0.75rem;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
    border-color: rgb(var(--brand));
    background: rgb(var(--brand) / 0.06);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgb(var(--hover) / 0.08);
    color: rgb(var(--muted));
}

.badge-brand { background: rgb(var(--brand) / 0.13); color: rgb(var(--brand)); }
.badge-ok { background: rgb(var(--ok) / 0.15); color: rgb(var(--ok)); }

.media-card {
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
    border: 1px solid rgb(var(--line));
    background: rgb(var(--mist));
    transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.media-card:hover {
    box-shadow: var(--shadow-pop);
    border-color: rgb(var(--muted) / 0.35);
    transform: translateY(-2px);
}

.media-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.28) 55%, rgba(0, 0, 0, 0.08) 100%);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.media-card:hover .media-card-overlay,
.media-card:focus-within .media-card-overlay { opacity: 1; }

input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    padding: 0;
    width: 2.75rem;
    height: 2.75rem;
    cursor: pointer;
    background: transparent;
}

input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgb(var(--line));
    border-radius: 0.5rem;
}

.preview-frame { aspect-ratio: 1 / 1; }

@keyframes pulse-soft {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.busy-dot { animation: pulse-soft 1.2s ease-in-out infinite; }

.notyf { z-index: 80; }
.notyf__toast {
    border-radius: 10px;
    box-shadow: var(--shadow-pop);
    font-family: Roboto, system-ui, sans-serif;
    font-size: 0.9rem;
}
.notyf__toast--success { background: rgb(var(--brand)); }
.notyf__toast--error { background: rgb(var(--danger)); }


.app-topbar {
    background: rgb(var(--mist) / 0.96);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.topbar-btn {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    color: rgb(var(--ink));
    transition: background-color 0.15s ease;
}

.topbar-btn:hover { background: rgb(var(--hover) / 0.07); }

.topbar-avatar {
    display: grid;
    place-items: center;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 999px;
    background: rgb(var(--brand));
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    transition: box-shadow 0.15s ease, filter 0.15s ease;
}

.topbar-avatar:hover {
    filter: brightness(1.08);
    box-shadow: 0 0 0 4px rgb(var(--brand) / 0.18);
}

.avatar-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.6rem);
    min-width: 14rem;
    border-radius: 0.75rem;
    border: 1px solid rgb(var(--line));
    background: rgb(var(--mist));
    box-shadow: var(--shadow-pop);
    overflow: hidden;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(var(--ink));
    transition: background-color 0.12s ease;
}

.menu-item:hover { background: rgb(var(--hover) / 0.06); }


.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1.1rem;
    border-radius: 0.6rem;
    padding: 0.6rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(var(--ink) / 0.82);
    transition: background-color 0.14s ease, color 0.14s ease;
}

.sidebar-link:hover {
    color: rgb(var(--ink));
    background: rgb(var(--hover) / 0.06);
}

.sidebar-link.is-active {
    color: rgb(var(--ink));
    font-weight: 600;
    background: rgb(var(--hover) / 0.09);
}

.sidebar-link.is-active .lucide { color: rgb(var(--brand)); stroke-width: 2.1; }

.sidebar-section {
    padding: 0.5rem 0.95rem 0.4rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgb(var(--muted));
}

.app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease, width 0.2s ease;
    background: rgb(var(--mist));
    color: rgb(var(--ink));
}

.app-sidebar.is-open { transform: translateX(0); }
.app-shell { transition: padding-left 0.2s ease; }

html.dark .app-topbar { border-bottom-color: transparent; }
html.dark .app-sidebar { border-right-color: transparent; }
html.dark .avatar-menu { box-shadow: 0 0 0 1px rgb(255 255 255 / 0.06), var(--shadow-pop); }

@media (min-width: 1024px) {
    .app-sidebar,
    .app-sidebar.is-open { transform: translateX(0); }

    html.sidebar-collapsed .app-sidebar { width: 4.75rem; }
    html.sidebar-collapsed .app-shell { padding-left: 4.75rem !important; }
    html.sidebar-collapsed .sidebar-label,
    html.sidebar-collapsed .sidebar-copy,
    html.sidebar-collapsed .sidebar-section { display: none; }
    html.sidebar-collapsed .sidebar-link {
        flex-direction: column;
        gap: 0.35rem;
        justify-content: center;
        padding-left: 0.4rem;
        padding-right: 0.4rem;
        font-size: 0.62rem;
        border-radius: 0.75rem;
    }
    html.sidebar-collapsed .sidebar-link .lucide { width: 1.4rem; height: 1.4rem; }
    html.sidebar-collapsed .sidebar-brand {
        justify-content: center;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}


.share-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    border: 1px solid rgb(var(--line));
    background: rgb(var(--mist));
    color: rgb(var(--ink));
    padding: 0.25rem 0.75rem 0.25rem 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.share-chip:hover {
    border-color: rgb(var(--brand) / 0.45);
    background: rgb(var(--brand) / 0.06);
}

.share-chip.is-active {
    border-color: rgb(var(--brand));
    background: rgb(var(--brand) / 0.12);
}

.share-chip-avatar {
    display: grid;
    place-items: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 999px;
    background: rgb(var(--brand) / 0.16);
    color: rgb(var(--brand));
    font-size: 0.68rem;
    font-weight: 800;
}

.share-chip-remove {
    display: grid;
    place-items: center;
    width: 1.15rem;
    height: 1.15rem;
    margin-left: 0.1rem;
    border-radius: 999px;
    color: rgb(var(--muted));
    font-size: 0.95rem;
    line-height: 1;
}

.share-chip-remove:hover {
    color: rgb(var(--ink));
    background: rgb(var(--ink) / 0.08);
}

.share-people {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.85rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(var(--line));
    background: transparent;
    padding: 0.4rem 0.55rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.share-people:hover { border-color: rgb(var(--muted) / 0.5); }

.share-people:focus-within {
    border-color: rgb(var(--brand));
    box-shadow: 0 0 0 3px rgb(var(--brand) / 0.18);
}

.share-people-list {
    display: contents;
}

.share-people-input {
    flex: 1 1 8rem;
    min-width: 8rem;
    border: 0;
    background: transparent;
    padding: 0.35rem 0.2rem;
    font-size: 0.9rem;
    font-family: inherit;
    color: rgb(var(--ink));
    outline: none;
}

.share-people-input::placeholder {
    color: rgb(var(--muted) / 0.75);
}
