/* =======================================================
   Memos & Passwords – Light Theme (Calendar Design)
   Unified with axis-work-calendar 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.15);
    --gold-dim2:  rgba(201,167,99,0.08);

    /* Light theme backgrounds */
    --bg-page:    #F6F7FA;
    --bg-surface: #ffffff;
    --bg-hover:   #f1f5f9;
    --bg-active:  #F5EEDB;

    /* Text */
    --text:   #2B3550;
    --text-2: #5C667D;
    --text-3: #94a3b8;
    --text-4: #cbd5e1;

    /* Borders */
    --border:   #E7EBF1;
    --border-2: #cbd5e1;
    --border-3: #f1f5f9;

    /* Accent */
    --accent:   #4c6ef5;
    --accent-2: #748ffc;

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

    /* Timing functions */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-snap:   cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --dur-fast:    0.12s;
    --dur-normal:  0.2s;
    --dur-slow:    0.32s;
}

/* ── 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;
    text-rendering: optimizeLegibility;
}
[x-cloak] { display: none !important; }

/* ── Reduced motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── App Shell ───────────────────────────────────────── */
.app-shell {
    display: flex;
    height: 100dvh;
    width: 100%;
    background-color: var(--bg-page);
    background-image: none;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: 100%;
    flex-direction: column;
    background: var(--navy);
    border-right: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 18px 16px 13px;
    border-bottom: 1px solid rgba(201,167,99,0.2);
    margin-bottom: 6px;
}
.logo-icon {
    width: 30px; height: 30px;
    border-radius: 8px;
    flex-shrink: 0;
    display: block;
    object-fit: cover;
}

/* sidebar tab wrap */
.sidebar-tab-wrap {
    display: flex;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    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: rgba(255,255,255,0.6);
    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 rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.4);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
}
.sidebar-add-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(201,167,99,0.1);
}

/* nav items */
.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--r);
    color: rgba(255,255,255,0.6);
    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.06); color: rgba(255,255,255,0.9); }
.nav-item--on {
    background: rgba(201,167,99,0.15);
    color: var(--gold);
    font-weight: 600;
}
.nav-badge {
    font-size: 0.62rem;
    font-weight: 700;
    background: rgba(201,167,99,0.15);
    color: var(--gold);
    border-radius: 100px;
    padding: 1px 6px;
    border: 1px solid rgba(201,167,99,0.3);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--navy), #0b1324);
    color: var(--gold);
    font-weight: 700;
    border-radius: var(--r);
    padding: 8px 16px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: opacity var(--dur-fast) var(--ease-smooth),
                transform var(--dur-fast) var(--ease-smooth),
                box-shadow var(--dur-normal) var(--ease-smooth);
    border: 1px solid var(--gold);
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(18,30,49,0.2);
}
@media (hover: hover) {
    .btn-gold:hover {
        opacity: 0.92;
        box-shadow: 0 4px 18px rgba(201,167,99,0.3);
        transform: translateY(-1px);
    }
}
.btn-gold:active { transform: scale(0.95); transition-duration: 0.06s; }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--bg-surface);
    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: var(--bg-hover);
    color: var(--text);
    border-color: var(--border-2);
}
.btn-ghost:active { transform: scale(0.97); }

/* ── Inputs ──────────────────────────────────────────── */
.prm-input {
    background: var(--bg-surface);
    border: 1.5px 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(--accent);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px rgba(76,110,245,0.12);
    outline: none;
}
input[type="search"]::-webkit-search-cancel-button { display: none; }

.prm-select {
    background: var(--bg-surface);
    border: 1.5px 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(--accent); color: var(--text); }
.prm-select option { background: var(--bg-surface); 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: var(--bg-surface);
    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: var(--bg-surface);
    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(--bg-active); 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(--bg-active); 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;
    background: var(--bg-page);
}

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

/* ── 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(--bg-active);
    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: 2.5px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    will-change: transform;
}
@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: var(--bg-surface);
    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 var(--dur-normal) var(--ease-smooth),
                background var(--dur-normal) var(--ease-smooth),
                box-shadow var(--dur-normal) var(--ease-smooth),
                transform var(--dur-normal) var(--ease-smooth);
    animation: fadeUp var(--dur-slow) var(--ease-smooth) both;
    will-change: transform;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
@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.3), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}
@media (hover: hover) {
    .note-card:hover {
        border-color: var(--border-2);
        background: var(--bg-surface);
        box-shadow: 0 8px 28px rgba(0,0,0,0.08), 0 0 0 1px rgba(201,167,99,0.1);
        transform: translateY(-3px);
    }
    .note-card:hover::before { opacity: 1; }
}
.note-card:active { transform: scale(0.97); transition-duration: 0.08s; }
.note-card--on { border-color: rgba(201,167,99,0.5) !important; box-shadow: 0 0 0 1px rgba(201,167,99,0.2); }

.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.72rem; } }

.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: var(--bg-hover); }

/* ── List ─────────────────────────────────────────────── */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 11px 13px;
    overflow-x: hidden;
}
@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: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 11px 14px;
    cursor: pointer;
    transition: all 0.18s;
    animation: fadeUp 0.28s ease both;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.note-list-item:hover {
    border-color: var(--border-2);
    background: var(--bg-hover);
}
.note-list-item:active { transform: scale(0.99); }
.note-list-item--on { border-color: rgba(201,167,99,0.4) !important; }

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

/* ── Editor Panel ─────────────────────────────────────── */
.editor-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--app-vh, 100dvh);
    z-index: 50;
    background: var(--bg-surface);
    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.08);
        padding-top:0; padding-bottom:0;
        background: var(--bg-surface);
    }
}

.editor-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    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(--accent);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.13s;
    flex-shrink: 0;
    white-space: nowrap;
}
.editor-back-btn:hover { background: rgba(76,110,245,0.08); }
.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: var(--bg-page);
    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);
    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(76,110,245,0.08); color: var(--accent); }
.tb-btn:active { background: rgba(76,110,245,0.12); color: var(--accent); 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 var(--border);
    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(76,110,245,0.2); }
.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;
    min-height: 0;
}
@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(--accent);
    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(--accent);
    min-height: 0;
    overscroll-behavior: contain;
}
.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 {
    list-style: disc !important;
    padding-left: 1.6em;
    margin: 0.3em 0;
}
.rich-editor ol {
    list-style: decimal !important;
    padding-left: 1.6em;
    margin: 0.3em 0;
}
.rich-editor ul ul  { list-style: circle !important; }
.rich-editor ul ul ul { list-style: square !important; }
.rich-editor li {
    display: list-item !important;
    margin: 0.15em 0;
}
.rich-editor a { color: var(--accent); text-decoration: underline; }
.rich-editor a:hover { color: var(--accent-2); }
.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: var(--bg-surface);
    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: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 12px 14px;
    cursor: default;
    transition: border-color var(--dur-normal) var(--ease-smooth),
                background var(--dur-normal) var(--ease-smooth),
                box-shadow var(--dur-normal) var(--ease-smooth),
                transform var(--dur-normal) var(--ease-smooth);
    animation: fadeUp var(--dur-slow) var(--ease-smooth) both;
    will-change: transform;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.pwd-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);
    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: var(--bg-hover);
    box-shadow: 0 4px 18px rgba(0,0,0,0.06);
}
.pwd-card { position: relative; }
.pwd-card:hover::before { opacity: 1; }

.pwd-icon-wrap {
    width: 36px; height: 36px;
    background: var(--bg-active);
    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(--bg-active);
    border: 1px solid var(--border);
    color: var(--gold);
    white-space: nowrap;
    flex-shrink: 0;
}

.pwd-act-btn {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    color: var(--text-3);
    cursor: pointer;
    transition: all 0.13s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}
.pwd-act-btn:hover { background: var(--bg-active); color: var(--gold); }
.pwd-act-btn:active { transform: scale(0.88); background: var(--bg-active); }

/* 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: var(--bg-surface);
}
.category-chip:hover { border-color: var(--accent); color: var(--accent); }
.category-chip--on {
    background: var(--bg-active);
    border-color: var(--gold);
    color: var(--gold);
    font-weight: 600;
}

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

/* ── Drawer ───────────────────────────────────────────── */
.drawer {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.08);
    height: auto;
    max-height: 80vh;
    min-height: 240px;
    display: flex;
    flex-direction: column;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    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;
}
.drawer.dragging {
    transition: none !important;
}
.drawer.drawer--fullscreen {
    border-radius: 0;
    max-height: 100dvh;
    height: 100dvh !important;
}
.drawer-handle {
    width: 44px; height: 4px;
    background: var(--border-2);
    border-radius: 100px;
    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: var(--gold);
    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;
    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.1);
    background: var(--bg-surface);
    color: var(--text);
}
@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: var(--border-2);
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Touch Overrides (tap-optimized) ──────────────────── */
@media (hover: none) {
    .note-act-btn { opacity: 1 !important; }
    .note-card:hover { background: var(--bg-surface); border-color: var(--border); transform: none; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
    .note-card:active { transform: scale(0.97); transition-duration: 0.06s; }
    .btn-gold:hover { opacity: 1; transform: none; }
    .note-list-item:hover { transform: none; }
    .note-list-item:active { transform: scale(0.99); transition-duration: 0.06s; }
    /* larger tap targets on mobile */
    .icon-btn { min-width: 44px; min-height: 44px; }
    .pwd-act-btn { min-width: 44px; min-height: 44px; }
    .note-act-btn { min-width: 36px; min-height: 36px; }
    .tb-btn { min-width: 36px; min-height: 36px; }
}

/* ── 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: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    overflow: hidden;
}
.gen-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-page);
}
.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: var(--border);
    outline: none;
    cursor: pointer;
}
.gen-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), #0b1324);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(18,30,49,0.3);
}
.gen-slider::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), #0b1324);
    cursor: pointer;
    border: none;
}
.gen-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(76,110,245,0.15), 0 0 8px rgba(18,30,49,0.3);
}

/* Length badge */
.gen-length-badge {
    min-width: 40px;
    height: 32px;
    background: var(--bg-active);
    border: 1px solid var(--border);
    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(--bg-active);
    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: var(--bg-surface);
    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: var(--bg-surface);
    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(--bg-active);
    border-color: var(--gold);
    color: var(--gold);
}

/* Single preview */
.gen-single-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    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(--bg-active);
    border: 1px solid var(--border);
    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.2); }
.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: var(--bg-hover); }
.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: var(--bg-page);
    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: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}
.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 var(--border-2);
    background: var(--bg-surface);
    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: var(--bg-active) !important;
    box-shadow: 0 0 0 2px rgba(201,167,99,0.2) !important;
}

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

/* ── Drag handle ── */
.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: grab;
    color: var(--text-4);
    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.2) !important;
}
.drag-over-after {
    box-shadow: 0 3px 0 var(--gold), inset 0 0 0 1px rgba(201,167,99,0.2) !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.12) 0%, transparent 60%);
    color: var(--gold);
}
.swipe-hint--del {
    justify-content: flex-end;
    background: linear-gradient(270deg, rgba(248,113,113,0.12) 0%, transparent 60%);
    color: #ef4444;
}

/* ── 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: var(--bg-surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 55;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
}

.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: var(--text-3);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: color var(--dur-normal) var(--ease-smooth),
                transform var(--dur-fast) var(--ease-smooth);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

/* サブナビ（ブックマーク・メール） */
.bottom-nav-sub {
    position: fixed;
    bottom: 64px;
    left: 0;
    right: 0;
    height: 40px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-3);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 16px;
    z-index: 54;
}
.bottom-nav-sub .bottom-nav-btn {
    font-size: 9px;
    padding: 4px 8px;
    gap: 1px;
}
.bottom-nav-btn:active { transform: scale(0.88); transition-duration: 0.06s; }
.bottom-nav-btn--on {
    color: var(--navy);
}
.bottom-nav-btn--on i {
    transition: filter var(--dur-normal) var(--ease-smooth);
}

/* 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(--navy), #0b1324);
    border: 1px solid var(--gold);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(18,30,49,0.25);
    transition: transform var(--dur-fast) var(--ease-bounce),
                box-shadow var(--dur-normal) var(--ease-smooth);
    margin-bottom: 4px;
    -webkit-tap-highlight-color: transparent;
    will-change: transform;
}
.bottom-nav-fab:active {
    transform: scale(0.85) rotate(-90deg);
    box-shadow: 0 2px 8px rgba(18,30,49,0.2);
    transition-duration: 0.15s;
}

/* メインコンテンツのボトムパディング調整 (2段ナビ分: 64+40=104px) */
@media (max-width: 767px) {
    .notes-area,
    .notes-grid,
    .notes-list {
        padding-bottom: calc(112px + 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));
    }
    .bottom-nav-sub {
        bottom: 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 Row UI  (v12 – 3カード横並びスライド方式)
   [ピン留め] [メモカード] [削除]  を横に並べて左右スワイプで操作
   ═══════════════════════════════════════════════════════════════ */

/* ── 外ラッパー ────────────────────────────────────────────── */
.sw-wrap {
    overflow: hidden;
    border-radius: 14px;
    animation: fadeUp 0.28s ease both;
    width: 100%;
    max-width: 100%;
    position: relative;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* ── トラック: 3セル横並び ──────────────────────────────────── */
.sw-track {
    display: flex;
    visibility: hidden;
    width: 300%;
    transform: translateX(calc(-1 * var(--sw-w, 33.333%)));
    will-change: transform;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    align-items: stretch;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.sw-track.sw-ready    { visibility: visible; }
.sw-track.sw-dragging { transition: none; }

/* ── 各セル ─────────────────────────────────────────────────── */
.sw-cell {
    width: 33.333%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    box-sizing: border-box;
}

/* ── ピン留めセル ───────────────────────────────────────────── */
.sw-cell--pin {
    flex-direction: column;
    gap: 2px;
    background: var(--gold);
    border-radius: 14px 0 0 14px;
    padding: 12px 24px;
    cursor: pointer;
    user-select: none;
    min-width: 0;
    overflow: visible;
    border-right: 2px solid var(--bg-page);
}
.sw-cell--pin:active { filter: brightness(0.9); }

/* ── メインカード ───────────────────────────────────────────── */
.sw-cell--main {
    width: 33.333% !important;
    border-radius: 0 !important;
    margin: 0 !important;
    animation: none !important;
}

/* ── 削除セル ───────────────────────────────────────────────── */
.sw-cell--del {
    flex-direction: column;
    gap: 2px;
    background: #ef4444;
    border-radius: 0 14px 14px 0;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    border-left: 2px solid var(--bg-page);
}
.sw-cell--del:active { filter: brightness(0.85); }

/* ── PC(768px+): スワイプ無効、カードをフル幅表示 ───────────── */
@media (min-width: 768px) {
    .sw-wrap {
        overflow: visible;
        -webkit-transform: none;
        transform: none;
    }
    .sw-track {
        visibility: visible !important;
        transform: none !important;
        transition: none !important;
        width: 100% !important;
    }
    .sw-cell--main {
        width: 100% !important;
        border-radius: 14px !important;
    }
    .pc-sw-btn {
        opacity: 0;
        transition: opacity 0.15s, color 0.15s;
    }
    .note-list-item.group:hover .pc-sw-btn {
        opacity: 1;
    }
}

/* ── 削除後の高さ収縮アニメーション ────────────────────────── */
@keyframes sw-collapse {
    from { max-height: 200px; opacity: 1; margin-bottom: 0; }
    to   { max-height: 0;     opacity: 0; margin-bottom: 0; }
}
.sw-wrap.sw-collapsing {
    animation: sw-collapse 0.32s ease-out forwards;
    pointer-events: none;
    overflow: hidden;
}

/* ── 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: var(--bg-hover) !important;
}

/* ドラッグ中に全体を微かにオーバーレイ */
.notes-grid.drag-in-progress,
.notes-list.drag-in-progress {
    background: rgba(0,0,0,0.02);
    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.4);
    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.3); }
    to   { opacity: 1.0; box-shadow: 0 0 16px rgba(201,167,99,0.6); }
}

/* ドロップ前・後のカードへのハイライト */
.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.15) !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.15) !important;
}

/* ドラッグハンドル強化 */
.drag-handle {
    cursor: grab;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-4);
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    touch-action: none;
}
.drag-handle:hover {
    color: var(--gold);
    background: var(--bg-active);
}
.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 var(--border);
    background: var(--bg-surface);
    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.04) 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: var(--text-3);
    cursor: pointer;
    padding: 2px 5px;
    font-size: 11px;
    border-radius: 4px;
    transition: color 0.15s;
}
.gesture-hint-close:hover { color: var(--text); }

/* アニメーション付きスワイプデモ矢印 */
@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: var(--bg-active);
    border: 1px solid rgba(201,167,99,0.3);
    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.15); }
    to   { box-shadow: 0 0 12px rgba(201,167,99,0.3); }
}

/* ── タッチフィードバック強化 ─────────────────────────────────
   スワイプ操作中に 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.15); }
}
.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.2) !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.5) !important;
    box-shadow: 0 4px 20px rgba(201,167,99,0.1) !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.15), 0 0 0 1px rgba(201,167,99,0.2) !important;
    transform: scale(1.04) rotate(1.5deg) !important;
    filter: brightness(1.02);
    border-radius: 14px !important;
}

/* ═══════════════════════════════════════════════════════════
   長押しコンテキストメニュー
   ══════════════════════════════════════════════════════════ */
.ctx-menu {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    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.12), 0 0 0 1px rgba(0,0,0,0.04);
}
.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: var(--bg-hover);
    color: var(--text);
}
.ctx-item > span {
    color: inherit;
    line-height: 1.3;
}
.ctx-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--gold);
    padding: 2px 16px 4px;
    text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════
   ゴミ箱タブ – アイテム・ボタン
   ══════════════════════════════════════════════════════════ */
.trash-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    transition: background 0.15s;
}
.trash-item:hover {
    background: var(--bg-hover);
}
.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(--accent);
    background: rgba(76,110,245,0.08);
    border: 1px solid rgba(76,110,245,0.2);
    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(76,110,245,0.15);
    color: var(--accent);
    border-color: rgba(76,110,245,0.4);
}
.trash-del-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 12px;
    color: #ef4444;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.15);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.trash-del-btn:hover,
.trash-del-btn:active {
    background: rgba(239,68,68,0.15);
    color: #dc2626;
}

/* ═══════════════════════════════════════════════════════════
   汎用ドロップダウンメニュー（フォルダ移動・各種メニュー）
   ══════════════════════════════════════════════════════════ */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    max-width: 240px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 6px 0;
    z-index: 80;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.03);
    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: var(--gold);
    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: var(--bg-hover);
    color: var(--text);
}

/* モバイルで右側に溢れる場合の防止 */
@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.4);
    color: var(--gold);
}

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

/* ─── スクロールバー統一 ──────────────────────────────────── */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-2) transparent;
}
*::-webkit-scrollbar { width: 4px; height: 4px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Todo check animation ───────────────────────────── */
.todo-completing .todo-checkbox {
    animation: todo-check-pop 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes todo-check-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}
.todo-fade-out {
    animation: todoFadeOut 0.4s ease-out forwards;
}
@keyframes todoFadeOut {
    0%   { opacity: 1; transform: translateX(0) scale(1); max-height: 100px; margin-bottom: 8px; }
    60%  { opacity: 0.3; transform: translateX(30px) scale(0.97); }
    100% { opacity: 0; transform: translateX(60px) scale(0.95); max-height: 0; margin-bottom: 0; padding:0; overflow:hidden; }
}

/* ── Todo D&D drag indicators (drop zone hover style) ── */
.todo-drag-over-before,
.todo-drag-over-after {
    border-color: var(--gold) !important;
    background: var(--bg-active) !important;
    box-shadow: 0 0 0 2px rgba(201,167,99,0.2),
                0 8px 24px rgba(201,167,99,0.08),
                inset 0 0 20px rgba(201,167,99,0.03) !important;
    transform: scale(1.015);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    position: relative;
    z-index: 2;
}
.todo-drag-over-before::after,
.todo-drag-over-after::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 16px;
    border: 2px dashed rgba(201,167,99,0.3);
    pointer-events: none;
    animation: todo-drop-pulse 1s ease-in-out infinite alternate;
}
@keyframes todo-drop-pulse {
    0%   { opacity: 0.4; border-color: rgba(201,167,99,0.2); }
    100% { opacity: 1;   border-color: rgba(201,167,99,0.5); }
}

/* ── Todo D&D ドラッグクローン (掴んだアイテム) ────────── */
#todo-drag-clone {
    pointer-events: none;
    will-change: transform, left, top;
    border: 1.5px solid var(--gold) !important;
    box-shadow: 0 16px 48px rgba(0,0,0,0.12),
                0 0 0 1px rgba(201,167,99,0.2),
                0 0 24px rgba(201,167,99,0.08) !important;
    transform: scale(1.05) rotate(1deg) !important;
    filter: brightness(1.02);
    border-radius: 14px !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* ═══════════════════════════════════════════════════════════
   PC Desktop Enhancements
   ══════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
    /* Sidebar hover refinement */
    .sidebar-tab:hover:not(.sidebar-tab--on) {
        background: rgba(255,255,255,0.08);
        color: rgba(255,255,255,0.9);
    }
    /* Smoother card grid gaps */
    .notes-grid { gap: 14px; }
    /* Editor panel wider on large screens */
    @media (min-width: 1280px) {
        .editor-panel { width: 640px; }
    }
    /* Password card hover lift */
    .pwd-card:hover {
        transform: translateY(-1px);
    }
    /* Focus visible for keyboard nav */
    *:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
        border-radius: 4px;
    }
    button:focus-visible { outline-offset: 1px; }
}

/* ═══════════════════════════════════════════════════════════
   Mobile Smartphone Enhancements
   ══════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    /* Smooth momentum scrolling */
    .notes-area,
    .drawer .overflow-y-auto {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }
    /* Optimized card grid for small screens */
    .notes-grid {
        gap: 8px;
        padding: 10px;
    }
    /* Prevent text selection on interactive elements */
    button, .icon-btn, .nav-item, .sidebar-tab, .bottom-nav-btn, .category-chip {
        -webkit-user-select: none;
        user-select: none;
    }
    /* Todo checkbox bigger touch target */
    .todo-checkbox {
        min-width: 32px;
        min-height: 32px;
    }
    /* Form panel full width */
    .modal-box {
        max-width: calc(100vw - 32px);
    }
    /* Smoother drawer entry */
    .drawer {
        transition: height 0.32s var(--ease-smooth),
                    max-height 0.32s var(--ease-smooth),
                    border-radius 0.32s ease;
    }
}

/* ═══════════════════════════════════════════════════════════
   PWA Standalone Mode Enhancements
   ══════════════════════════════════════════════════════════ */
@media (display-mode: standalone) {
    /* Extra padding for status bar area */
    .mobile-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }
    /* Prevent overscroll bounce in PWA */
    html, body {
        overscroll-behavior: none;
        overflow: hidden;
        width: 100%;
        height: 100%;
    }
    /* Hide scrollbars in PWA mode */
    .notes-area::-webkit-scrollbar { width: 0; }
    /* Disable pull-to-refresh */
    body { overscroll-behavior-y: none; }
}

/* ═══════════════════════════════════════════════════════════
   Loading Skeleton Placeholder
   ══════════════════════════════════════════════════════════ */
.skeleton {
    background: linear-gradient(90deg,
        var(--border-3) 25%,
        var(--border) 50%,
        var(--border-3) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease infinite;
    border-radius: var(--r);
}
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-card {
    height: 148px;
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
}
.skeleton-row {
    height: 56px;
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   Micro-interactions & Polish
   ══════════════════════════════════════════════════════════ */
/* Smooth tab switch transition */
[x-show].notes-area { will-change: opacity; }

/* Checkbox check animation */
.todo-checkbox {
    transition: background var(--dur-fast) var(--ease-smooth),
                border-color var(--dur-fast) var(--ease-smooth),
                transform var(--dur-fast) var(--ease-bounce);
}
.todo-checkbox:active {
    transform: scale(0.85);
}

/* Category chip press feedback */
.category-chip:active {
    transform: scale(0.95);
    transition-duration: 0.06s;
}

/* Dropdown menu smooth exit */
.dropdown-menu {
    animation: dropdown-in 0.18s var(--ease-smooth) both;
}

/* Context menu entrance */
.ctx-menu {
    animation: ctx-in 0.15s var(--ease-bounce) both;
}
@keyframes ctx-in {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

/* Ripple-like active feedback on list items */
.nav-item:active,
.trash-item:active,
.gen-list-row:active {
    background: var(--bg-active);
    transition-duration: 0.06s;
}

/* Gold gradient text animation on logo */
.gold-shimmer {
    animation: shimmer 3s linear infinite;
}

/* Smooth icon transitions */
.fa-solid, .fa-regular, .fa-brands {
    transition: transform var(--dur-fast) var(--ease-smooth);
}
.bottom-nav-btn--on .fa-solid,
.bottom-nav-btn--on .fa-regular {
    transform: scale(1.1);
}

/* ── Force portrait on mobile (CSS transform) ────────── */
.landscape-blocker { display: none; }
@media (max-width: 932px) and (orientation: landscape) {
    html {
        transform: rotate(-90deg);
        transform-origin: left top;
        width: 100vh;
        height: 100vw;
        overflow-x: hidden;
        position: absolute;
        top: 100%;
        left: 0;
    }
}

/* ── Password Accordion ──────────────────────────────── */
.pwd-accordion-group { margin-bottom: 8px; }
.pwd-accordion-header {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    -webkit-user-select: none; user-select: none;
}
.pwd-accordion-header:hover {
    background: var(--bg-hover);
    border-color: var(--border-2);
}
.pwd-accordion-header:active {
    transform: scale(0.99);
}
.pwd-accordion-chevron {
    font-size: 0.7rem;
    color: var(--text-3);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
    width: 16px; text-align: center;
}
.pwd-accordion-chevron.open {
    transform: rotate(90deg);
}
.pwd-accordion-cat-icon {
    width: 28px; height: 28px;
    background: var(--bg-active);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem; color: var(--gold);
}
.pwd-accordion-cat-name {
    flex: 1; font-size: 0.85rem; font-weight: 600; color: var(--text);
}
.pwd-accordion-count {
    font-size: 0.7rem; font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    background: var(--bg-active);
    color: var(--gold);
}
.pwd-accordion-body {
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
    will-change: max-height, opacity;
}
.pwd-accordion-body.collapsed {
    max-height: 0 !important; opacity: 0;
}
.pwd-accordion-body.expanded {
    max-height: 5000px;
    opacity: 1;
}
.pwd-accordion-items {
    padding: 6px 0 2px 0;
    display: flex; flex-direction: column; gap: 6px;
}
