/* =======================================================
   Memos & Passwords – Premium Dark Navy Theme
   Based on axis-work-calendar.pages.dev design language
   ======================================================= */

/* ── Variables ────────────────────────────────────────── */
:root {
    /* Brand palette */
    --navy:       #121E31;
    --navy-light: #1a2841;
    --navy-mid:   #1e2f47;
    --navy-pale:  #253656;
    --gold:       #c9a763;
    --gold-2:     #D4AF37;
    --gold-light: #e8c97a;
    --gold-dim:   rgba(201,167,99,0.18);
    --gold-dim2:  rgba(201,167,99,0.08);

    /* Text */
    --text:   rgba(255,255,255,0.92);
    --text-2: rgba(255,255,255,0.55);
    --text-3: rgba(255,255,255,0.25);
    --text-4: rgba(255,255,255,0.12);

    /* Borders */
    --border:   rgba(201,167,99,0.12);
    --border-2: rgba(201,167,99,0.22);
    --border-3: rgba(255,255,255,0.06);

    /* Accent */
    --accent:   #4f7ef8;
    --accent-2: #7c9ffa;

    /* Layout */
    --sidebar-w: 220px;
    --r:         10px;
    --r-lg:      14px;
    --r-xl:      18px;
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}
html, body {
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none;
}
[x-cloak] { display: none !important; }

/* ── App Shell ───────────────────────────────────────── */
.app-shell {
    display: flex;
    height: 100dvh;
    width: 100%;
    /* corporate grid background like reference */
    background-color: var(--navy);
    background-image:
        linear-gradient(rgba(201,167,99,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(201,167,99,0.06) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: 100%;
    flex-direction: column;
    background: rgba(18,30,49,0.96);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 18px 16px 13px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}
.logo-icon {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, var(--gold), var(--gold-2));
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--navy);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* sidebar tab wrap */
.sidebar-tab-wrap {
    display: flex;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-3);
    border-radius: var(--r);
    padding: 2px;
    gap: 2px;
}
.sidebar-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}
.sidebar-tab--on {
    background: linear-gradient(135deg, var(--gold), var(--gold-2));
    color: var(--navy);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(201,167,99,0.3);
}

/* sidebar add btn */
.sidebar-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 10px;
    border-radius: var(--r);
    border: 1px dashed var(--border-2);
    color: var(--text-3);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
}
.sidebar-add-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-dim2);
}

/* nav items */
.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--r);
    color: var(--text-2);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.13s, color 0.13s;
    text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item--on {
    background: var(--gold-dim);
    color: var(--gold);
    font-weight: 600;
}
.nav-badge {
    font-size: 0.62rem;
    font-weight: 700;
    background: var(--gold-dim);
    color: var(--gold);
    border-radius: 100px;
    padding: 1px 6px;
    border: 1px solid var(--border);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--gold), var(--gold-2));
    color: var(--navy);
    font-weight: 700;
    border-radius: var(--r);
    padding: 8px 16px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.12s, box-shadow 0.15s;
    border: none;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(201,167,99,0.25);
}
.btn-gold:hover {
    opacity: 0.92;
    box-shadow: 0 4px 16px rgba(201,167,99,0.4);
}
.btn-gold:active { transform: scale(0.96); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-weight: 500;
    border-radius: var(--r);
    padding: 8px 16px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.btn-ghost:hover {
    background: rgba(255,255,255,0.07);
    color: var(--text);
    border-color: var(--border-2);
}
.btn-ghost:active { transform: scale(0.97); }

/* ── Inputs ──────────────────────────────────────────── */
.prm-input {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 8px 12px;
    color: var(--text);
    font-size: 0.8125rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.prm-input::placeholder { color: var(--text-3); }
.prm-input:focus {
    border-color: var(--gold);
    background: rgba(201,167,99,0.04);
    box-shadow: 0 0 0 3px rgba(201,167,99,0.1);
}
input[type="search"]::-webkit-search-cancel-button { display: none; }

.prm-select {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 7px 10px;
    color: var(--text-2);
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    font-family: inherit;
    transition: border-color 0.13s;
}
.prm-select:focus { border-color: var(--gold); color: var(--text); }
.prm-select option { background: var(--navy-light); color: var(--text); }

/* ── Headers ─────────────────────────────────────────── */
.mobile-header {
    height: calc(52px + env(safe-area-inset-top));
    padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(18,30,49,0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 20;
}

.desktop-header {
    height: 58px;
    padding: 0 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: rgba(18,30,49,0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-shrink: 0;
}

/* ── Icon Button ──────────────────────────────────────── */
.icon-btn {
    width: 38px; height: 38px;
    border-radius: var(--r);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-2);
    cursor: pointer;
    transition: background 0.13s, color 0.13s;
    flex-shrink: 0;
}
.icon-btn:hover { background: var(--gold-dim2); color: var(--gold); }
.icon-btn:active { transform: scale(0.91); }

/* ── View Toggle ──────────────────────────────────────── */
.view-btn { padding: 5px 9px; border-radius: 7px; cursor: pointer; transition: all 0.13s; }
.view-btn--on  { background: var(--gold-dim); color: var(--gold); }
.view-btn--off { color: var(--text-3); }
.view-btn--off:hover { color: var(--text-2); }

/* ── Main Content ─────────────────────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* ── Notes Area ───────────────────────────────────────── */
.notes-area {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* ── States ───────────────────────────────────────────── */
.state-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 55vh;
    padding: 40px 24px;
}
.empty-box {
    width: 64px; height: 64px;
    background: var(--gold-dim2);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    display: flex; align-items: center; justify-content: center;
}
.loader-ring {
    width: 32px; height: 32px;
    border: 2px solid rgba(201,167,99,0.15);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Grid ─────────────────────────────────────────────── */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
    padding: 13px;
}
@media (min-width: 640px) {
    .notes-grid { grid-template-columns: repeat(2,1fr); gap: 12px; padding: 16px 20px; }
}
@media (min-width: 1024px) { .notes-grid { grid-template-columns: repeat(3,1fr); } }
@media (min-width: 1280px) { .notes-grid { grid-template-columns: repeat(4,1fr); } }

.note-card {
    background: rgba(26,40,65,0.70);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 148px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.18s;
    animation: fadeUp 0.32s ease both;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
@keyframes fadeUp {
    from { opacity:0; transform:translateY(10px); }
    to   { opacity:1; transform:translateY(0); }
}
.note-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201,167,99,0.2), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}
.note-card:hover {
    border-color: var(--border-2);
    background: rgba(26,40,65,0.90);
    box-shadow: 0 6px 24px rgba(0,0,0,0.25), 0 0 0 1px rgba(201,167,99,0.08);
    transform: translateY(-2px);
}
.note-card:hover::before { opacity: 1; }
.note-card:active { transform: scale(0.98) translateY(0); }
.note-card--on { border-color: rgba(201,167,99,0.4) !important; box-shadow: 0 0 0 1px rgba(201,167,99,0.15); }

.note-pin-dot {
    position: absolute; top: 9px; right: 9px;
    width: 6px; height: 6px;
    background: var(--gold);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(201,167,99,0.6);
}

.note-card-body {
    flex: 1;
    padding: 13px 13px 9px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow: hidden;
}

.note-card-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.35;
    padding-right: 12px;
}
@media (min-width:768px) { .note-card-title { font-size: 0.875rem; } }

.note-card-preview {
    font-size: 0.70rem;
    color: var(--text-3);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.6;
    flex: 1;
    pointer-events: none;
}
@media (min-width:768px) { .note-card-preview { font-size: 0.75rem; -webkit-line-clamp:4; } }

.note-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    border-top: 1px solid var(--border-3);
}
.note-date { font-size: 0.62rem; color: var(--text-3); }

.note-act-btn {
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 7px;
    cursor: pointer;
    transition: color 0.13s, background 0.13s;
}
.note-act-btn:hover { background: rgba(255,255,255,0.06); }

/* ── List ─────────────────────────────────────────────── */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 11px 13px;
}
@media (min-width:768px) { .notes-list { padding:15px 22px; gap:6px; max-width:840px; margin:0 auto; width:100%; } }

.note-list-item {
    display: flex;
    align-items: center;
    gap: 11px;
    background: rgba(26,40,65,0.60);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 11px 14px;
    cursor: pointer;
    transition: all 0.18s;
    animation: fadeUp 0.28s ease both;
    backdrop-filter: blur(8px);
}
.note-list-item:hover {
    border-color: var(--border-2);
    background: rgba(26,40,65,0.88);
    transform: translateX(3px);
}
.note-list-item:active { transform: scale(0.99); }
.note-list-item--on { border-color: rgba(201,167,99,0.35) !important; }

/* ── FAB ──────────────────────────────────────────────── */
.fab {
    position: fixed;
    bottom: max(24px, env(safe-area-inset-bottom, 24px));
    right: 18px;
    width: 54px; height: 54px;
    background: linear-gradient(135deg, var(--gold), var(--gold-2));
    color: var(--navy);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(201,167,99,0.45);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    z-index: 40;
    font-size: 1rem;
}
.fab:hover { box-shadow: 0 6px 26px rgba(201,167,99,0.6); }
.fab:active { transform: scale(0.90); }

/* ── Editor Panel ─────────────────────────────────────── */
.editor-panel {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--navy);
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width:768px) {
    .editor-panel {
        top:0; right:0; bottom:0; left:auto;
        width: 580px;
        border-left: 1px solid var(--border);
        box-shadow: -12px 0 40px rgba(0,0,0,0.4);
        padding-top:0; padding-bottom:0;
        background: rgba(18,30,49,0.98);
        backdrop-filter: blur(24px);
    }
}

.editor-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(26,40,65,0.95);
    min-height: 52px;
    flex-shrink: 0;
}

.editor-back-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: var(--r);
    color: var(--gold);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.13s;
    flex-shrink: 0;
    white-space: nowrap;
}
.editor-back-btn:hover { background: var(--gold-dim2); }
.editor-back-btn:active { transform: scale(0.95); }

.editor-icon-btn {
    width: 35px; height: 35px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--r);
    cursor: pointer;
    transition: all 0.13s;
}
.editor-icon-btn:active { transform: scale(0.88); }

/* ── Rich Toolbar ─────────────────────────────────────── */
.rich-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 2px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(26,40,65,0.9);
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}
.rich-toolbar::-webkit-scrollbar { height: 0; }

.tb-group {
    display: flex;
    align-items: center;
    gap: 1px;
    flex-shrink: 0;
}

.tb-sep {
    width: 1px;
    height: 20px;
    background: var(--border-2);
    flex-shrink: 0;
    margin: 0 3px;
}

.tb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 28px;
    padding: 0 5px;
    border-radius: 7px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    font-size: 0.8125rem;
    flex-shrink: 0;
    white-space: nowrap;
}
.tb-btn:hover { background: rgba(201,167,99,0.1); color: var(--gold-light); }
.tb-btn:active { background: var(--gold-dim); color: var(--gold); transform: scale(0.93); }

/* Color dots */
.tb-color-dot {
    width: 18px; height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
    border: 2px solid rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.tb-color-dot:hover { transform: scale(1.25); box-shadow: 0 0 0 2px rgba(201,167,99,0.3); }
.tb-color-dot:active { transform: scale(0.95); }
.tb-color-wheel {
    background: conic-gradient(red,orange,yellow,green,cyan,blue,violet,red) !important;
}

/* ── Editor Body ──────────────────────────────────────── */
.editor-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 18px 10px;
    overflow: hidden;
}
@media (min-width:768px) { .editor-body { padding: 22px 26px 12px; } }

.editor-title {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 1.3rem;
    font-weight: 700;
    width: 100%;
    caret-color: var(--gold);
    line-height: 1.3;
    padding: 0;
    font-family: inherit;
}
.editor-title::placeholder { color: var(--text-3); }
@media (min-width:768px) { .editor-title { font-size: 1.6rem; } }

.editor-sep {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
    flex-shrink: 0;
}

/* contenteditable rich editor */
.rich-editor {
    flex: 1;
    outline: none;
    color: var(--text-2);
    font-size: 0.9375rem;
    line-height: 1.8;
    overflow-y: auto;
    word-break: break-word;
    -webkit-overflow-scrolling: touch;
    caret-color: var(--gold);
}
.rich-editor:empty::before {
    content: attr(placeholder);
    color: var(--text-3);
    pointer-events: none;
    position: absolute;
}
.rich-editor h2 { font-size: 1.15em; font-weight: 700; margin: 0.6em 0 0.3em; color: var(--text); }
.rich-editor h3 { font-size: 1.0em; font-weight: 700; margin: 0.5em 0 0.2em; color: var(--text); }
.rich-editor ul, .rich-editor ol { padding-left: 1.5em; margin: 0.3em 0; }
.rich-editor li { margin: 0.15em 0; }
.rich-editor a { color: var(--gold); text-decoration: underline; }
.rich-editor a:hover { color: var(--gold-light); }
.rich-editor img {
    max-width: 100%;
    border-radius: 10px;
    margin: 6px 0;
    display: block;
    cursor: pointer;
    max-height: 280px;
    object-fit: contain;
    border: 1px solid var(--border);
}
.rich-editor img:hover { opacity: 0.9; }
.rich-editor p { margin: 0.15em 0; }
.rich-editor strong { color: var(--text); }
.rich-editor blockquote {
    border-left: 3px solid var(--gold);
    padding-left: 10px;
    color: var(--text-3);
    margin: 0.4em 0;
}

/* ── Editor Footer ────────────────────────────────────── */
.editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 18px;
    border-top: 1px solid var(--border);
    background: rgba(26,40,65,0.9);
    flex-shrink: 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}
@media (min-width:768px) { .editor-footer { padding: 8px 26px; } }

/* ── Form Group ───────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-3);
    display: flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.03em;
}

/* ── Password Card ────────────────────────────────────── */
.pwd-card {
    display: flex;
    align-items: center;
    background: rgba(26,40,65,0.65);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 12px 14px;
    cursor: default;
    transition: all 0.18s;
    animation: fadeUp 0.3s ease both;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.pwd-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201,167,99,0.15), transparent);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    opacity: 0;
    transition: opacity 0.2s;
}
.pwd-card:hover {
    border-color: var(--border-2);
    background: rgba(26,40,65,0.90);
    box-shadow: 0 4px 18px rgba(0,0,0,0.2);
}
.pwd-card { position: relative; }
.pwd-card:hover::before { opacity: 1; }

.pwd-icon-wrap {
    width: 36px; height: 36px;
    background: var(--gold-dim2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.pwd-category-badge {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 100px;
    background: var(--gold-dim2);
    border: 1px solid var(--border);
    color: var(--gold);
    white-space: nowrap;
    flex-shrink: 0;
}

.pwd-act-btn {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    color: var(--text-3);
    cursor: pointer;
    transition: all 0.13s;
    flex-shrink: 0;
}
.pwd-act-btn:hover { background: rgba(201,167,99,0.1); color: var(--gold); }
.pwd-act-btn:active { transform: scale(0.88); }

/* Category chip */
.category-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: var(--r);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
    background: rgba(255,255,255,0.03);
}
.category-chip:hover { border-color: var(--gold); color: var(--gold); }
.category-chip--on {
    background: var(--gold-dim);
    border-color: var(--gold);
    color: var(--gold);
    font-weight: 600;
}

/* ── Modals ───────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
}
.modal-box {
    background: var(--navy-light);
    border: 1px solid var(--border-2);
    border-radius: var(--r-xl);
    padding: 22px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* ── Drawer ───────────────────────────────────────────── */
.drawer {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: var(--navy-light);
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.45);
    /* 初期高さ: コンテンツ依存、最大80vh、最小は自動 */
    height: auto;
    max-height: 80vh;
    min-height: 240px;
    display: flex;
    flex-direction: column;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    /* ドラッグ中以外はtransition付き */
    transition: height 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                border-radius 0.28s ease;
    will-change: height;
    overflow: hidden;
}
/* ドラッグ中はtransitionを切る */
.drawer.dragging {
    transition: none !important;
}
/* フルスクリーン時は角丸を消す */
.drawer.drawer--fullscreen {
    border-radius: 0;
    max-height: 100dvh;
    height: 100dvh !important;
}
/* スナップ高さ: snap1=collapsed(初期)、snap2=full */
.drawer-handle {
    width: 44px; height: 4px;
    background: rgba(201,167,99,0.35);
    border-radius: 3px;
    margin: 12px auto 6px;
    flex-shrink: 0;
    cursor: grab;
    transition: background 0.2s, width 0.2s;
}
.drawer-handle:active { cursor: grabbing; }
.drawer:hover .drawer-handle,
.drawer.dragging .drawer-handle {
    background: rgba(201,167,99,0.65);
    width: 56px;
}
/* ドラッグ引き上げ中のビジュアルフィードバック */
.drawer-handle-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2px 0 4px;
    flex-shrink: 0;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
}
.drawer-handle-wrap:active { cursor: grabbing; }
/* ドラッグ中はオーバーレイを薄く */
.drawer.dragging ~ .drawer-backdrop {
    opacity: 0.4;
}
/* ドロワー内スクロール領域は高さが伸びた時に使えるように */
.drawer .overflow-y-auto {
    flex: 1 1 0;
    min-height: 0;       /* flex child がオーバーフローを正しくクリップするために必須 */
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
/* フルスクリーン時のタブ境界線を常に表示 */
.drawer--fullscreen .drawer-tab-border {
    border-bottom: 1px solid var(--border);
}

/* ── Toast ────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: max(88px, calc(env(safe-area-inset-bottom) + 88px));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 100px;
    border: 1px solid;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 200;
    white-space: nowrap;
    max-width: calc(100vw - 32px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.3);
    background: rgba(18,30,49,0.92);
}
@media (min-width:768px) { .toast { bottom: 28px; } }

/* ── Scrollbar ────────────────────────────────────────── */
.custom-scrollbar::-webkit-scrollbar { width: 4px; height: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(201,167,99,0.15);
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(201,167,99,0.28); }

/* ── Touch Overrides ──────────────────────────────────── */
@media (hover: none) {
    .note-act-btn { opacity: 1 !important; }
    .note-card:hover { background: rgba(26,40,65,0.70); border-color: var(--border); transform: none; }
    .note-card:active { transform: scale(0.97); }
    .btn-gold:hover { opacity: 1; }
    .note-list-item:hover { transform: none; }
    .note-list-item:active { transform: scale(0.99); }
}

/* ── Animations ───────────────────────────────────────── */
@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}
.gold-shimmer {
    background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold-2), var(--gold));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s linear infinite;
}

/* ── Utility classes for Tailwind overrides ───────────── */
.text-gold    { color: var(--gold) !important; }
.bg-gold\/8   { background: rgba(201,167,99,0.08); }
.bg-gold\/15  { background: rgba(201,167,99,0.15); }
.bg-gold\/10  { background: rgba(201,167,99,0.10); }
.border-gold\/25 { border-color: rgba(201,167,99,0.25); }
.gold-text    { color: var(--gold); }

/* ── Generator ────────────────────────────────────────── */
.gen-card {
    background: rgba(26,40,65,0.70);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.gen-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(18,30,49,0.6);
}
.gen-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Row inside card */
.gen-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.gen-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-3);
    min-width: 72px;
    flex-shrink: 0;
    letter-spacing: 0.04em;
}
@media (max-width: 480px) {
    .gen-row { flex-direction: column; align-items: flex-start; gap: 7px; }
    .gen-label { min-width: auto; }
}

/* Slider */
.gen-slider {
    -webkit-appearance: none;
    height: 4px;
    border-radius: 4px;
    background: rgba(255,255,255,0.08);
    outline: none;
    cursor: pointer;
}
.gen-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-2));
    cursor: pointer;
    box-shadow: 0 0 8px rgba(201,167,99,0.4);
}
.gen-slider::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-2));
    cursor: pointer;
    border: none;
}
.gen-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(201,167,99,0.2), 0 0 8px rgba(201,167,99,0.4);
}

/* Length badge */
.gen-length-badge {
    min-width: 40px;
    height: 32px;
    background: var(--gold-dim);
    border: 1px solid var(--border-2);
    border-radius: var(--r);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gold);
    flex-shrink: 0;
}

/* Charset chips */
.gen-check-chip { cursor: pointer; }
.gen-chip--on {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 100px;
    background: var(--gold-dim);
    border: 1px solid var(--gold);
    color: var(--gold);
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.15s;
    white-space: nowrap;
}
.gen-chip--off {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 100px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    color: var(--text-3);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
}
.gen-chip--off:hover { border-color: var(--border-2); color: var(--text-2); }

/* Count buttons */
.gen-count-btn {
    min-width: 32px;
    height: 32px;
    border-radius: var(--r);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-3);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    transition: all 0.13s;
    flex-shrink: 0;
}
.gen-count-btn:hover { border-color: var(--border-2); color: var(--text-2); }
.gen-count-btn--on {
    background: var(--gold-dim);
    border-color: var(--gold);
    color: var(--gold);
}

/* Single preview */
.gen-single-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(18,30,49,0.7);
    border: 1px solid var(--border-2);
    border-radius: var(--r-lg);
    padding: 14px 16px;
}
.gen-single-pwd {
    flex: 1;
    font-family: 'SFMono-Regular', 'Consolas', 'Courier New', monospace;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text);
    word-break: break-all;
}
.gen-copy-btn {
    width: 36px; height: 36px;
    background: var(--gold-dim);
    border: 1px solid var(--border-2);
    border-radius: var(--r);
    display: flex; align-items: center; justify-content: center;
    color: var(--gold);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.13s;
}
.gen-copy-btn:hover { background: rgba(201,167,99,0.28); }
.gen-copy-btn:active { transform: scale(0.90); }

/* Multi list */
.gen-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 6px 0;
}
.gen-list-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    border-bottom: 1px solid var(--border-3);
    animation: fadeUp 0.22s ease both;
    transition: background 0.13s;
}
.gen-list-row:last-child { border-bottom: none; }
.gen-list-row:hover { background: rgba(201,167,99,0.04); }
.gen-idx {
    font-size: 0.65rem;
    color: var(--text-3);
    min-width: 22px;
    text-align: right;
    flex-shrink: 0;
}
.gen-pwd-text {
    flex: 1;
    font-family: 'SFMono-Regular', 'Consolas', 'Courier New', monospace;
    font-size: 0.82rem;
    color: var(--text);
    letter-spacing: 0.04em;
    word-break: break-all;
}

/* Export buttons */
.gen-export-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(18,30,49,0.5);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    cursor: pointer;
    transition: all 0.18s;
    text-align: left;
}
.gen-export-btn:hover {
    border-color: var(--border-2);
    background: rgba(26,40,65,0.8);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.gen-export-btn:active { transform: scale(0.97) translateY(0); }
.gen-export-icon {
    width: 42px; height: 42px;
    border-radius: var(--r);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ── Note-card inline export dropdown ── */
.note-card-export-menu.open-menu { display: block !important; }

/* ══════════════════════════════════════════════════════════════
   Multi-Select & Drag-Drop Reorder
   ══════════════════════════════════════════════════════════════ */

/* ── Select checkbox ── */
.select-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(18,30,49,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.select-checkbox--on {
    background: var(--gold);
    border-color: var(--gold);
}
.select-checkbox:hover {
    border-color: var(--gold);
}

/* ── Note card selected state ── */
.note-card--selected {
    border-color: var(--gold) !important;
    background: rgba(201,167,99,0.1) !important;
    box-shadow: 0 0 0 2px rgba(201,167,99,0.3) !important;
}

/* ── Note list item selected state ── */
.note-list-item--selected {
    background: rgba(201,167,99,0.1) !important;
    border-color: rgba(201,167,99,0.35) !important;
}

/* ── Drag handle ── */
.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: grab;
    color: rgba(255,255,255,0.2);
    transition: color 0.15s;
    flex-shrink: 0;
    position: absolute;
    top: 8px;
    left: 8px;
}
.drag-handle:hover { color: var(--gold); }
.drag-handle:active { cursor: grabbing; }

/* list view drag handle (inline flow) */
.note-list-item .drag-handle {
    position: static;
    margin-right: 4px;
}

/* ── Draggable cursor ── */
.note-card--draggable { cursor: grab; }
.note-card--draggable:active { cursor: grabbing; }
.note-list-item--draggable { cursor: grab; }
.note-list-item--draggable:active { cursor: grabbing; }

/* ── Drag over indicators ── */
.drag-over-before {
    box-shadow: 0 -3px 0 var(--gold), inset 0 0 0 1px rgba(201,167,99,0.3) !important;
}
.drag-over-after {
    box-shadow: 0 3px 0 var(--gold), inset 0 0 0 1px rgba(201,167,99,0.3) !important;
}

/* list view drag indicator */
.note-list-item.drag-over-before {
    box-shadow: none !important;
    border-top: 2px solid var(--gold) !important;
}
.note-list-item.drag-over-after {
    box-shadow: none !important;
    border-bottom: 2px solid var(--gold) !important;
}

/* ── Select move menu ── */
.select-move-wrap { position: relative; }

/* ── Selection mode: note card relative positioning for checkbox ── */
.note-card { position: relative; }

/* ═══════════════════════════════════════════════════════════════
   PWA / Touch / Swipe / Bottom Nav  (v6)
   ═══════════════════════════════════════════════════════════════ */

/* ── Swipe hint overlay ─────────────────────────────────────── */
.swipe-hint-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    border-radius: inherit;
    pointer-events: none;
    font-size: 13px;
    font-weight: 600;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.15s;
}
.swipe-hint-overlay[style*="display: flex"],
.swipe-hint-overlay[style=""] {
    opacity: 1;
}
.swipe-hint--pin {
    justify-content: flex-start;
    background: linear-gradient(90deg, rgba(201,167,99,0.18) 0%, transparent 60%);
    color: var(--gold);
}
.swipe-hint--del {
    justify-content: flex-end;
    background: linear-gradient(270deg, rgba(248,113,113,0.18) 0%, transparent 60%);
    color: #f87171;
}

/* ── Note card: contain swipe overlay ───────────────────────── */
.note-card, .note-list-item { overflow: hidden; }

/* ── Touch ripple on tap ─────────────────────────────────────── */
.note-card, .note-list-item, .bottom-nav-btn, .sidebar-tab {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.note-card:active, .note-list-item:active {
    transform: scale(0.985);
    transition: transform 0.08s ease !important;
}

/* ── Bottom Navigation Bar ───────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(16, 26, 42, 0.97);
    border-top: 1px solid rgba(201, 167, 99, 0.12);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 55;  /* drawer(50) < bottom-nav(55) < ctx-menu(91) */
    box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
}

.bottom-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 100%;
    padding: 8px 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.35);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: color 0.18s, transform 0.12s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.bottom-nav-btn:active { transform: scale(0.88); }
.bottom-nav-btn--on {
    color: var(--gold);
}
.bottom-nav-btn--on i {
    filter: drop-shadow(0 0 6px rgba(201,167,99,0.5));
}

/* FAB (中央の新規作成ボタン) */
.bottom-nav-fab-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}
.bottom-nav-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-light, #e8c97a), var(--gold, #c9a763));
    border: none;
    color: var(--navy, #121E31);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(201,167,99,0.4), 0 0 0 1px rgba(201,167,99,0.2);
    transition: transform 0.12s, box-shadow 0.12s;
    margin-bottom: 4px;
    -webkit-tap-highlight-color: transparent;
}
.bottom-nav-fab:active {
    transform: scale(0.88);
    box-shadow: 0 2px 8px rgba(201,167,99,0.3);
}

/* メインコンテンツのボトムパディング調整 */
@media (max-width: 767px) {
    .notes-area,
    .notes-grid,
    .notes-list {
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    }
    /* トーストをボトムナビの上に */
    .bottom-nav ~ * { z-index: 70; }
}

/* ── Safe area insets (notch対応) ────────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(64px + env(safe-area-inset-bottom));
    }
}

/* ── Touch D&D drag clone styling ────────────────────────────── */
#touch-drag-clone {
    pointer-events: none;
    will-change: transform;
}

/* ── Offline indicator ───────────────────────────────────────── */
.offline-badge {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(248, 113, 113, 0.9);
    color: white;
    padding: 4px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    z-index: 200;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

/* ── Smooth page transitions ─────────────────────────────────── */
[x-show] { backface-visibility: hidden; }

/* ═══════════════════════════════════════════════════════════════
   Axis-Note  ─  Swipe / Drag-Drop UX  (v8 – 視認性強化)
   ═══════════════════════════════════════════════════════════════ */

/* ── ラッパー ─────────────────────────────────────────────── */
.note-swipe-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    margin-bottom: 8px;
    background: transparent;
}

/* ── 背景パネル共通 ────────────────────────────────────────── */
.note-swipe-bg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    border-radius: 14px;
    pointer-events: none;
    z-index: 0;
    /* 初期状態: 完全に非表示。JS の bgEl.style.opacity で制御 */
    opacity: 0;
}

/* ── 右スワイプ背景（ピン留め → 金） ──────────────────────── */
.note-swipe-bg-left {
    justify-content: flex-start;
    padding-left: 20px;
    gap: 12px;
    background: linear-gradient(
        90deg,
        rgba(201,167,99,1)   0%,
        rgba(201,167,99,0.9) 55%,
        rgba(201,167,99,0.3) 100%
    );
}

/* ── 左スワイプ背景（削除 → 赤） ──────────────────────────── */
.note-swipe-bg-right {
    justify-content: flex-end;
    padding-right: 20px;
    gap: 12px;
    background: linear-gradient(
        270deg,
        rgba(220,50,50,1)   0%,
        rgba(220,50,50,0.9) 55%,
        rgba(220,50,50,0.3) 100%
    );
}

/* ── アイコン丸バッジ ─────────────────────────────────────── */
.note-swipe-bg-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    color: #fff;
    /* 初期: 縮小状態。スワイプ開始で scale(1) へ */
    transform: scale(0.55);
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.note-swipe-bg-left .note-swipe-bg-icon {
    background: rgba(0,0,0,0.18);
}
.note-swipe-bg-right .note-swipe-bg-icon {
    background: rgba(0,0,0,0.18);
}

/* ── ラベルテキスト ───────────────────────────────────────── */
.note-swipe-bg-left > span,
.note-swipe-bg-right > span {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 1px 6px rgba(0,0,0,0.4);
    /* 初期: 非表示 & 少しオフセット */
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.note-swipe-bg-right > span {
    transform: translateX(8px);
}

/* ── フェーズ1: スワイプ開始 → アイコン出現 ──────────────── */
.note-swipe-wrap.swiping-right .note-swipe-bg-left  .note-swipe-bg-icon,
.note-swipe-wrap.swiping-left  .note-swipe-bg-right .note-swipe-bg-icon {
    transform: scale(1);
}

/* ── フェーズ2: しきい値超え → アイコン拡大 + ラベル出現 ─── */
.note-swipe-wrap.swipe-threshold-right .note-swipe-bg-left  .note-swipe-bg-icon,
.note-swipe-wrap.swipe-threshold-left  .note-swipe-bg-right .note-swipe-bg-icon {
    animation: swipe-icon-bounce 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes swipe-icon-bounce {
    0%   { transform: scale(1); }
    55%  { transform: scale(1.4); }
    100% { transform: scale(1.22); }
}

.note-swipe-wrap.swipe-threshold-right .note-swipe-bg-left  > span,
.note-swipe-wrap.swipe-threshold-left  .note-swipe-bg-right > span {
    opacity: 1;
    transform: translateX(0);
}

/* ── カード本体 ─────────────────────────────────────────────── */
.note-swipe-wrap > .note-card,
.note-swipe-wrap > .note-list-item {
    position: relative;
    z-index: 1;
    will-change: transform;
    transition: transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.2s;
}

/* しきい値超え → カードにカラーボーダー発光 */
.note-swipe-wrap.swipe-threshold-right > .note-card,
.note-swipe-wrap.swipe-threshold-right > .note-list-item {
    box-shadow: 0 0 0 2px rgba(201,167,99,0.9),
                4px 4px 20px rgba(201,167,99,0.4);
}
.note-swipe-wrap.swipe-threshold-left  > .note-card,
.note-swipe-wrap.swipe-threshold-left  > .note-list-item {
    box-shadow: 0 0 0 2px rgba(220,50,50,0.9),
               -4px 4px 20px rgba(220,50,50,0.4);
}

/* ── フライアウトアニメーション ─────────────────────────── */
@keyframes swipe-out-left {
    to { transform: translateX(-120%); opacity: 0; }
}
@keyframes swipe-out-right {
    to { transform: translateX( 120%); opacity: 0; }
}
.note-swipe-wrap.fly-out-left  > .note-card,
.note-swipe-wrap.fly-out-left  > .note-list-item {
    animation: swipe-out-left 0.22s ease-in forwards;
}
.note-swipe-wrap.fly-out-right > .note-card,
.note-swipe-wrap.fly-out-right > .note-list-item {
    animation: swipe-out-right 0.22s ease-in forwards;
}

/* ── 削除後の高さ収縮 ────────────────────────────────────── */
@keyframes collapse-row {
    from { max-height: 200px; opacity: 1; margin-bottom: 8px; }
    to   { max-height: 0;     opacity: 0; margin-bottom: 0;   }
}
.note-swipe-wrap.collapsing {
    overflow: hidden;
    animation: collapse-row 0.3s ease-out 0.12s forwards;
    pointer-events: none;
}

/* ── Drag & Drop UX ────────────────────────────────────────────
   ドラッグ中のゴーストとドロップ線を強化                       */

/* ドラッグ中のソース要素 */
.note-card.is-dragging-src,
.note-list-item.is-dragging-src {
    opacity: 0.3;
    transform: scale(0.97);
    border: 1.5px dashed rgba(201,167,99,0.5) !important;
    background: rgba(26,40,65,0.4) !important;
}

/* ドラッグ中に全体を微かにダークオーバーレイ */
.notes-grid.drag-in-progress,
.notes-list.drag-in-progress {
    background: rgba(0,0,0,0.04);
    border-radius: 16px;
}

/* ドロップ位置マーカー */
.drop-line {
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold) 80%, transparent);
    border-radius: 100px;
    margin: -2px 8px;
    box-shadow: 0 0 10px rgba(201,167,99,0.6);
    animation: drop-line-pulse 0.8s ease-in-out infinite alternate;
    position: relative;
    z-index: 10;
}
@keyframes drop-line-pulse {
    from { opacity: 0.7; box-shadow: 0 0  6px rgba(201,167,99,0.4); }
    to   { opacity: 1.0; box-shadow: 0 0 16px rgba(201,167,99,0.8); }
}

/* ドロップ前・後のカードへのハイライト */
.note-card.drag-over-before,
.note-list-item.drag-over-before {
    border-top: 2.5px solid var(--gold) !important;
    box-shadow: 0 -6px 16px rgba(201,167,99,0.25) !important;
}
.note-card.drag-over-after,
.note-list-item.drag-over-after {
    border-bottom: 2.5px solid var(--gold) !important;
    box-shadow: 0  6px 16px rgba(201,167,99,0.25) !important;
}

/* ドラッグハンドル強化 */
.drag-handle {
    cursor: grab;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(201,167,99,0.35);
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    touch-action: none;
}
.drag-handle:hover {
    color: var(--gold);
    background: rgba(201,167,99,0.12);
}
.drag-handle:active { cursor: grabbing; }

/* ── チュートリアル / ヒントバナー ────────────────────────────
   初回訪問時のスワイプ・D&D操作ガイド                          */
.gesture-hint-banner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.45;
    margin: 0 0 12px 0;
    border: 1px solid rgba(201,167,99,0.2);
    background: rgba(26,40,65,0.6);
    backdrop-filter: blur(8px);
    animation: hint-slide-in 0.4s ease both;
    overflow: hidden;
}
@keyframes hint-slide-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.gesture-hint-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(201,167,99,0.06) 0%, transparent 60%);
    pointer-events: none;
}
.gesture-hint-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}
.gesture-hint-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.25);
    cursor: pointer;
    padding: 2px 5px;
    font-size: 11px;
    border-radius: 4px;
    transition: color 0.15s;
}
.gesture-hint-close:hover { color: rgba(255,255,255,0.6); }

/* アニメーション付きスワイプデモ矢印 */
@keyframes swipe-arrow-left {
    0%   { transform: translateX(8px);  opacity: 0; }
    30%  { opacity: 1; }
    70%  { opacity: 1; }
    100% { transform: translateX(-8px); opacity: 0; }
}
@keyframes swipe-arrow-right {
    0%   { transform: translateX(-8px); opacity: 0; }
    30%  { opacity: 1; }
    70%  { opacity: 1; }
    100% { transform: translateX(8px);  opacity: 0; }
}
.swipe-arrow-anim-l { animation: swipe-arrow-left  1.8s ease-in-out infinite; }
.swipe-arrow-anim-r { animation: swipe-arrow-right 1.8s ease-in-out infinite 0.2s; }

/* ── ドラッグモード時の操作ガイドラベル ─────────────────────── */
.drag-mode-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--gold);
    background: rgba(201,167,99,0.1);
    border: 1px solid rgba(201,167,99,0.25);
    animation: drag-label-pulse 1.2s ease-in-out infinite alternate;
    white-space: nowrap;
}
@keyframes drag-label-pulse {
    from { box-shadow: 0 0  4px rgba(201,167,99,0.2); }
    to   { box-shadow: 0 0 12px rgba(201,167,99,0.5); }
}

/* ── タッチフィードバック強化 ─────────────────────────────────
   スワイプ操作中に micro-vibration 感を出す ripple             */
@keyframes card-ripple {
    from { box-shadow: 0 0  0   rgba(201,167,99,0.0); }
    to   { box-shadow: 0 0 24px rgba(201,167,99,0.3); }
}
.note-swipe-wrap.swiping-right > .note-card { animation: card-ripple 0.3s ease forwards; }

/* ── 手動ソートモード中のカード ──────────────────────────────── */
.note-card--draggable,
.note-list-item--draggable {
    border: 1px solid rgba(201,167,99,0.18) !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.note-card--draggable:hover,
.note-list-item--draggable:hover {
    border-color: rgba(201,167,99,0.45) !important;
    box-shadow: 0 4px 20px rgba(201,167,99,0.15) !important;
}

/* ── タッチゴーストクローン ──────────────────────────────────── */
#touch-drag-clone {
    pointer-events: none;
    will-change: transform, left, top;
    border: 1.5px solid var(--gold) !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(201,167,99,0.3) !important;
    transform: scale(1.04) rotate(1.5deg) !important;
    filter: brightness(1.1);
    border-radius: 14px !important;
}

/* ═══════════════════════════════════════════════════════════
   長押しコンテキストメニュー
   ══════════════════════════════════════════════════════════ */
.ctx-menu {
    background: rgba(14, 22, 40, 0.98);
    border: 1px solid rgba(201,167,99,0.28);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    box-shadow: 0 8px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(201,167,99,0.08);
    /* z-index は HTML の z-[91] クラスで管理 */
}
.ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);           /* ← 明るいテキストカラー */
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.12s;
    text-align: left;
}
.ctx-item:hover,
.ctx-item:active {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.ctx-item > span {
    color: inherit;
    line-height: 1.3;
}
.ctx-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(201,167,99,0.55);
    padding: 2px 16px 4px;
    text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════
   ゴミ箱タブ – アイテム・ボタン
   ══════════════════════════════════════════════════════════ */
.trash-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    transition: background 0.15s;
}
.trash-item:hover {
    background: rgba(255,255,255,0.06);
}
.trash-restore-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gold);           /* ← ゴールドカラー */
    background: rgba(201,167,99,0.12);
    border: 1px solid rgba(201,167,99,0.25);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.trash-restore-btn:hover,
.trash-restore-btn:active {
    background: rgba(201,167,99,0.22);
    color: #f0d898;
    border-color: rgba(201,167,99,0.5);
}
.trash-del-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 12px;
    color: rgba(248,113,113,0.55);
    background: rgba(248,113,113,0.08);
    border: 1px solid rgba(248,113,113,0.15);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.trash-del-btn:hover,
.trash-del-btn:active {
    background: rgba(248,113,113,0.2);
    color: #f87171;
}

/* ═══════════════════════════════════════════════════════════
   汎用ドロップダウンメニュー（フォルダ移動・各種メニュー）
   ══════════════════════════════════════════════════════════ */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    max-width: 240px;
    background: rgba(14, 22, 40, 0.98);
    border: 1px solid rgba(201,167,99,0.22);
    border-radius: 14px;
    padding: 6px 0;
    z-index: 80;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(201,167,99,0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
    animation: dropdown-in 0.15s ease both;
}
@keyframes dropdown-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
.dropdown-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(201,167,99,0.5);
    padding: 4px 14px 6px;
    text-transform: uppercase;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s, color 0.1s;
    white-space: nowrap;
}
.dropdown-item:hover,
.dropdown-item:active {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

/* モバイルで右側に溢れる場合の防止 */
@media (max-width: 480px) {
    .dropdown-menu {
        right: 0;
        left: auto;
        max-width: calc(100vw - 48px);
    }
    /* デスクトップヘッダーの移動メニューは左寄せに */
    .select-move-wrap .dropdown-menu {
        right: auto;
        left: 0;
    }
}

/* ─── ジェスチャーヒントバナー 補強 ───────────────────────── */
/* ダークテーマで確実に白文字になるよう */
.gesture-hint-banner,
.gesture-hint-banner * {
    color: inherit;
}
.gesture-hint-banner {
    color: var(--text);
}

/* ─── トースト通知 type=gold ──────────────────────────────── */
.toast[data-type="gold"] {
    border-color: rgba(201,167,99,0.5);
    color: var(--gold);
}

/* ─── モバイルヘッダー safe-area 対応 ────────────────────── */
.mobile-header {
    padding-top: max(0px, env(safe-area-inset-top));
}

/* ─── スクロールバー統一 ──────────────────────────────────── */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(201,167,99,0.2) transparent;
}
*::-webkit-scrollbar { width: 4px; height: 4px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(201,167,99,0.2); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(201,167,99,0.4); }
