:root {
    --bg: #1f1f1f;
    --panel: #262626;
    --panel2: #242424;
    --card: #262626;
    --card2: #2b2b2b;
    --text: #e6e6e6;
    --muted: #b3b3b3;
    --line: #333333;
    --shadow: 0 12px 26px rgba(0, 0, 0, 0.40);
    --accent: #d0d0d0;
    --sel: rgba(255, 255, 255, 0.08);
    --sel2: rgba(255, 255, 255, 0.12);
    --danger: #ff6b6b;
    --radius: 8px;
    --font: system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #222222, #1b1b1b 65%, #171717);
    color: var(--text);
    font-family: var(--font);
}

.notes-app {
    height: 100vh;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 12px;
    padding: 12px;
}

.notes-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.10) 60%), var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.notes-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.08)), var(--panel2);
    border-bottom: 1px solid var(--line);
}

.toolbar-left {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.notes-search {
    width: min(560px, 100%);
    padding: 10px 12px;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    outline: none;
}

.notes-search:focus {
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.toolbar-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.order-controls {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.btn-order-dir {
    width: 36px;
    padding-left: 0;
    padding-right: 0;
    text-align: center;
}

.order-rating-null-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px;
}

.order-rating-null-label {
    font-size: 12px;
    color: rgba(230, 237, 246, 0.75);
}

.order-rating-null-btn {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(230, 237, 246, 0.90);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
}

.order-rating-null-btn.is-selected {
    border-color: rgba(90, 160, 255, 0.55);
    background: rgba(90, 160, 255, 0.16);
}

.scope-filter {
    position: relative;
    display: inline-flex;
}

.rating-filter {
    position: relative;
    display: inline-flex;
}

.rating-filter-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 320px;
    max-width: 420px;
    background: var(--panel2);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    padding: 10px;
    box-shadow: var(--shadow);
    z-index: 3000;
    display: none;
}

.rating-filter-menu.is-open {
    display: block;
}

.rating-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.rating-mode-row {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.rating-mode-btn,
.rating-clear-btn {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.18);
    color: rgba(230, 237, 246, 0.92);
    cursor: pointer;
    font-weight: 650;
}

.rating-mode-btn:hover,
.rating-clear-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.22);
}

.rating-mode-btn.is-selected {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.26);
}

.rating-clear-btn {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.90);
}

.rating-preview {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    margin: 10px 2px 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    color: rgba(230, 237, 246, 0.92);
}

.rating-preview-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.10);
}

.rating-controls {
    padding: 2px 2px 0;
}

.rating-range {
    position: relative;
    height: 28px;
    margin: 6px 0 6px;
    touch-action: none;
}

.rating-range-track {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.12);
    pointer-events: none;
    z-index: 0;
}

.rating-range-fill {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    border-radius: 999px;
    left: var(--min-pct, 0%);
    right: calc(100% - var(--max-pct, 100%));
    background: rgba(90, 160, 255, 0.18);
    border: 1px solid rgba(90, 160, 255, 0.22);
    box-shadow: 0 0 0 1px rgba(90, 160, 255, 0.04);
    pointer-events: none;
    z-index: 1;
}

.rating-range.is-range-active .rating-range-fill {
    background: rgba(90, 160, 255, 0.40);
    border-color: rgba(90, 160, 255, 0.45);
}

.rating-range-ticks {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(calc(-50% - 10px));
    height: 10px;
    pointer-events: none;
    z-index: 2;
}

.rating-range-tick {
    position: absolute;
    top: 0;
    width: 2px;
    height: 8px;
    background: rgba(255, 255, 255, 0.20);
    border-radius: 2px;
    transform: translateX(-1px);
}

.rating-range input[type="range"] {
    position: absolute;
    inset: 0;
    width: 100%;
    margin: 0;
    background: transparent;
    cursor: grab;
    z-index: 3;
}

/* WebKit slider */
.rating-range input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid transparent;
}

.rating-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    margin-top: -6px;
    background: rgba(255, 255, 255, 0.86);
    border: 2px solid rgba(0, 0, 0, 0.25);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

/* Firefox slider */
.rating-range input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid transparent;
}

.rating-range input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    border: 2px solid rgba(0, 0, 0, 0.25);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}


.scope-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.scope-selected-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.scope-selected-none {
    color: var(--muted);
    font-weight: 600;
}

.scope-filter-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 240px;
    max-width: 360px;
    background: var(--panel2);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    padding: 8px;
    box-shadow: var(--shadow);
    z-index: 3000;
    display: none;
}

.scope-filter-menu.is-open {
    display: block;
}

.scope-filter-sep {
    height: 1px;
    background: rgba(255, 255, 255, 0.10);
    margin: 6px 0;
}

.scope-filter-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.scope-filter-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.scope-filter-item.is-selected {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.20);
}

.scope-filter-check {
    font-weight: 800;
    opacity: 0.95;
    width: 18px;
    text-align: center;
    color: rgba(230, 237, 246, 0.95);
}

.btn {
    padding: 8px 10px;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.22);
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

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

.btn-ghost:hover {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.05);
}

.notes-status {
    font-size: 12px;
    color: var(--muted);
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.18);
}

.notes-grid-wrap {
    min-height: 0;
    flex: 1;
}

.notes-grid {
    position: relative;
    height: 100%;
    overflow: auto;
    padding: 12px;
    display: grid;

    /* ✅ Más columnas: objetivo ~7 por hilera a 2560x1440 con panel derecho abierto */
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;

    align-content: start;

    /* Scrollbar styling (panel de tarjetas) */
    scrollbar-width: thin;
    /* Firefox */
    scrollbar-color: rgba(255, 255, 255, 0.18) rgba(0, 0, 0, 0.10);
}

/* WebKit/Blink scrollbar */
.notes-grid::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.notes-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.10);
}

.notes-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    border: 2px solid rgba(0, 0, 0, 0.10);
    /* creates a slimmer thumb */
}

.notes-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.24);
}

.notes-sentinel {
    grid-column: 1 / -1;
    height: 1px;
    width: 100%;
    pointer-events: none;
}

/* ✅ En pantallas muy anchas, fuerza 7 columnas estables */
@media (min-width: 2200px) {
    .notes-grid {
        grid-template-columns: repeat(7, 1fr);
    }
}

.note-card {
    position: relative;
    height: calc(168px + 56px + 112px + 56px);
    border-radius: 8px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.10) 60%), var(--card);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    user-select: none;
    cursor: default;
    display: grid;
    grid-template-rows: 168px 56px 112px 56px;
}

.note-head {
    padding: 12px 12px 8px;
    display: grid;
    grid-template-rows: 26px auto;
    gap: 6px;
    min-height: 0;
}

.note-card.is-skeleton {
    pointer-events: none;
    filter: saturate(0.9);
}

.skeleton {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.10),
            transparent);
    transform: translateX(-60%);
    animation: shimmer 1.1s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-60%);
    }

    100% {
        transform: translateX(60%);
    }
}

.skeleton-thumb {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.skeleton-line {
    height: 14px;
    margin-top: 8px;
}

.skeleton-line.short {
    width: 72%;
}

.skeleton-chip {
    height: 20px;
    width: 80px;
    border-radius: 999px;
}

.note-card:hover {
    border-color: rgba(255, 255, 255, 0.20);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.10) 60%), var(--card2);
}

.note-card.is-selected {
    border-color: rgba(255, 255, 255, 0.38);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.10), 0 10px 22px rgba(0, 0, 0, 0.25);
}

.note-card.is-selected::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--sel), transparent 60%);
    pointer-events: none;
}

.note-thumb {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.12));
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}

.note-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: saturate(1.05) contrast(1.05);
}

/* ✅ Sin icono al centro: solo bloque gris */
.note-thumb .thumb-placeholder {
    width: 100%;
    height: 100%;
    display: block;
    background: rgba(255, 255, 255, 0.04);
}

.note-overlay {
    position: absolute;
    top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
}

.note-overlay.left {
    left: 8px;
}

.note-overlay.right {
    right: 8px;
}

.note-parent-icon {
    font-size: 14px;
    opacity: 0.95;
}

/* ✅ Títulos más legibles + sin padding (lo controla .note-head) */
.note-title {
    padding: 0;
    font-weight: 650;
    line-height: 22px;
    height: 22px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);

    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-desc {
    padding: 15px 12px;
    color: var(--muted);
    line-height: 19px;
    font-size: 13px;
    display: -webkit-box;
    line-clamp: 5;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-tags {
    padding: 8px 12px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
    overflow: hidden;
}

.tag-chip {
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.22);
    color: rgba(230, 237, 246, 0.90);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scope-badge {
    display: inline-flex;
    align-items: center;
    /* icon + text vertically centered */
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    /* less rounded as requested */
    border: 1px solid transparent;
    font-size: 13px;
    line-height: 1;
    font-family: inherit;
    font-weight: 700;
    /* badge text bold */
    color: inherit;
    vertical-align: middle;
    white-space: nowrap;
    flex: none;
    /* do not stretch; only occupy content width */
}

.scope-badge.is-compact {
    padding: 4px 8px;
    gap: 6px;
    font-size: 12px;
}

.scope-badge.is-compact .scope-icon,
.scope-badge.is-compact .scope-label {
    font-size: 12px;
}

.scope-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
}

.scope-label {
    display: inline-block;
    font-size: 13px;
    line-height: 1;
    color: inherit;
    font-weight: 700;
    /* ensure label is bold */
}

/* Per-scope exact palette (no shadows, no gradients) */
.scope-badge[data-scope="episode"] {
    background: #dec0f3;
    border-color: rgb(219, 187, 247);
    color: #6e3f8a;
}

.scope-badge[data-scope="act"] {
    background: #cabaf7;
    border-color: #D6C9FF;
    color: #4f31af;
}

.scope-badge[data-scope="sequence"] {
    background: #bacff7;
    border-color: #BFD3FF;
    color: #2F5FB3;
}

.scope-badge[data-scope="scene"] {
    background: #E9F7EF;
    border-color: #BFE3CF;
    color: #166A43;
}

.scope-badge[data-scope="note"] {
    background: #F2F2F2;
    border-color: #D6D6D6;
    color: #555555;
}

.scope-badge[data-scope="unassigned"] {
    background: #2b2b2b;
    border-color: rgba(255, 255, 255, 0.20);
    color: rgba(255, 255, 255, 0.85);
}

.scope-badge[data-scope="episode"],
.scope-badge[data-scope="act"] {
    border-width: 2px;
}

.scope-badge[data-scope="sequence"],
.scope-badge[data-scope="scene"],
.scope-badge[data-scope="note"] {
    border-width: 1px;
}

.rating-stars {
    display: inline-flex;
    gap: 1px;
    font-size: 13px;
    line-height: 1;
}

.rating-stars .star {
    opacity: 0.35;
}

.rating-stars .star.on {
    opacity: 1;
}

.notes-right {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.10) 60%), var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.right-header {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.08)), var(--panel2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.right-title {
    font-weight: 700;
}

.btn-create-note {
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 650;
}

/* Create mode (Nueva Nota) visual hint */
.notes-right.is-create-mode {
    border-color: rgba(90, 160, 255, 0.65);
    box-shadow: 0 0 0 1px rgba(90, 160, 255, 0.10), var(--shadow);
}

.notes-right.is-create-mode .right-header {
    border-bottom-color: rgba(90, 160, 255, 0.35);
    background: linear-gradient(180deg, rgba(90, 160, 255, 0.18), rgba(0, 0, 0, 0.08)), var(--panel2);
}

.new-note-banner {
    border: 1px solid rgba(90, 160, 255, 0.45);
    background: rgba(90, 160, 255, 0.10);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 0 0 12px 0;
}

.new-note-banner .title {
    font-weight: 800;
    color: rgba(185, 216, 255, 0.95);
    margin-bottom: 4px;
}

.new-note-banner .body {
    color: rgba(230, 237, 246, 0.88);
    font-size: 13px;
    line-height: 1.35;
}

.right-body {
    padding: 12px;
    overflow: auto;
    min-height: 0;
}

.empty-hint {
    color: var(--muted);
    font-size: 13px;
}

.details-title {
    font-size: 16px;
    font-weight: 750;
    margin: 6px 0 10px;
}

.details-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin: 10px 0;
}

.details-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.details-label {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.details-text {
    white-space: pre-wrap;
    color: rgba(230, 237, 246, 0.92);
    line-height: 1.5;
}

.tooltip {
    position: fixed;
    z-index: 9999;
    max-width: min(520px, 92vw);
    padding: 10px 12px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.82);
    color: var(--text);
    box-shadow: var(--shadow);
    pointer-events: none;
    opacity: 0;
    transform: translate3d(0, 6px, 0);
    transition: opacity 80ms linear, transform 80ms ease;
}

.tooltip.is-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.tooltip .tooltip-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.tooltip .tooltip-body {
    color: rgba(230, 237, 246, 0.92);
    line-height: 1.35;
    white-space: pre-wrap;
}

.selection-rect {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.10);
    border-radius: 5px;
    pointer-events: none;
    z-index: 10;
}

@media (max-width: 980px) {
    .notes-app {
        grid-template-columns: 1fr;
    }

    .notes-right {
        display: none;
    }
}

/* Editor styles */
.editor-field {
    margin-bottom: 16px;
}

/* Right panel note image */
.note-image-section {
    margin-bottom: 10px;
}

.note-image-frame {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.22);
    overflow: hidden;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
}

.note-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.note-image-placeholder {
    display: none;
    width: 100%;
    aspect-ratio: 16 / 9;
    place-items: center;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.2px;
}

.note-image-controls {
    margin-top: 10px;
}

.editor-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 6px;
}

.editor-input,
.editor-textarea,
.editor-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--card2);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    transition: border-color 0.2s;
}

.editor-input:focus,
.editor-textarea:focus,
.editor-select:focus {
    outline: none;
    border-color: var(--accent);
}

.editor-textarea {
    resize: vertical;
    min-height: 80px;
}

.editor-static {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-hint {
    font-size: 12px;
    color: var(--muted);
}

.editor-file {
    padding: 8px;
}

.editor-buttons {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text);
}

.btn-primary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.22);
}

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

.btn-ghost {
    background: transparent;
    color: var(--muted);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

/* Editable rating stars */
.rating-stars.editable {
    display: flex;
    gap: 2px;
}

.rating-stars.editable .star {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 20px;
    color: rgba(255, 255, 255, 0.25);
    transition: all 0.15s;
}

.rating-stars.editable .star:hover {
    color: rgba(255, 255, 255, 0.45);
    transform: scale(1.1);
}

.rating-stars.editable .star.on {
    color: #ffd700;
}

/* Tag editor */
.tag-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-chip.editable {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text);
}

.tag-chip.batch {
    background: rgba(100, 150, 255, 0.15);
}

.tag-chip.batch.removed {
    background: rgba(255, 100, 100, 0.15);
    text-decoration: line-through;
    opacity: 0.6;
}

.tag-remove {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.tag-remove:hover {
    color: var(--danger);
}

.tag-input-wrap {
    display: flex;
}

/* Search tag suggestions (dropdown shown under `#notesTagSearch`) */
.search-tag-suggestions {
    position: absolute;
    /* positioned by JS; keep here for fallback */
    top: 100%;
    left: 0;
    z-index: 2000;
    margin-top: 8px;
    min-width: 320px;
    /* expand so +/− buttons stay on same row */
    max-width: 420px;
    background: var(--card2);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    padding: 6px 6px;
    overflow: auto;
}

.search-tag-suggestions .search-tag-sugg {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: default;
}

.search-tag-suggestions .search-tag-sugg+.search-tag-sugg {
    margin-top: 4px;
}

.search-tag-suggestions .sugg-label {
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
    font-size: 13px;
}

.search-tag-suggestions .btn {
    flex: none;
    /* do not grow, keep buttons on same row */
    padding: 6px 8px;
}

.search-tag-suggestions .btn.btn-ghost {
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.tag-input {
    flex: 1;
    padding: 6px 10px;
    background: var(--card2);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
}

.tag-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Batch tag editor */
.batch-tag-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tag-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tag-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
}