:root {
    --honey-50: #FFFBEB;
    --honey-100: #FEF3C7;
    --honey-200: #FDE68A;
    --honey-300: #FCD34D;
    --honey-400: #FBBF24;
    --honey-500: #F59E0B;
    --honey-600: #D97706;
    --honey-700: #B45309;
    --honey-800: #92400E;
    --honey-900: #78350F;
    --hive-dark: #1F2937;
    --hive-darker: #111827;
    --hive-mid: #374151;
    --comb-pattern: rgba(245, 158, 11, 0.06);
    --bg: var(--honey-50);
    --surface: #FFFFFF;
    --text: #1F2937;
    --text-muted: #6B7280;
    --border: rgba(245, 158, 11, 0.2);
    --shadow-sm: 0 1px 2px rgba(180, 83, 9, 0.05);
    --shadow: 0 4px 12px rgba(180, 83, 9, 0.08);
    --shadow-lg: 0 12px 32px rgba(180, 83, 9, 0.15);
    --radius: 14px;
    --radius-sm: 8px;
    --sidebar-w: 240px;
    --header-h: 64px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1A1410;
        --surface: #251D17;
        --text: #FDE68A;
        --text-muted: #B7906A;
        --border: rgba(245, 158, 11, 0.18);
        --comb-pattern: rgba(245, 158, 11, 0.04);
    }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    background-image:
        radial-gradient(circle at 25% 25%, var(--comb-pattern) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, var(--comb-pattern) 0%, transparent 50%);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
a { color: var(--honey-700); }
.hidden { display: none !important; }
#auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}
#auth-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(252, 211, 77, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(245, 158, 11, 0.2) 0%, transparent 50%);
    z-index: -1;
}
.auth-container {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}
.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}
.bee-icon {
    font-size: 48px;
    display: inline-block;
    animation: bounce 2s ease-in-out infinite;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-8px) rotate(5deg); }
}
.auth-logo h1 {
    font-size: 32px;
    color: var(--honey-700);
    margin-top: 8px;
    letter-spacing: -0.5px;
}
.tagline {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}
.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--honey-100);
    padding: 4px;
    border-radius: var(--radius-sm);
}
.tab-btn {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    color: var(--honey-700);
    transition: all 0.2s;
}
.tab-btn.active {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
}
.auth-form label small { font-weight: normal; color: var(--text-muted); }
.auth-form input {
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.2s;
}
.auth-form input:focus {
    outline: none;
    border-color: var(--honey-500);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}
.btn {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
    background: var(--honey-100);
    color: var(--honey-800);
}
.btn:hover { background: var(--honey-200); transform: translateY(-1px); }
.btn-primary {
    background: linear-gradient(135deg, var(--honey-400), var(--honey-600));
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--honey-500), var(--honey-700));
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}
.btn-text { background: transparent; color: var(--honey-700); padding: 6px 10px; }
.btn-text:hover { background: var(--honey-100); }
.btn-text.danger { color: #DC2626; }
.auth-message {
    font-size: 13px;
    text-align: center;
    color: var(--text-muted);
    min-height: 20px;
}
.auth-message.error { color: #DC2626; }
.warning {
    background: var(--honey-100);
    border-left: 3px solid var(--honey-500);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--honey-900);
}
.hint {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}
#app-screen {
    min-height: 100vh;
    display: grid;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-areas:
        "header header"
        "sidebar main";
}
.app-header {
    grid-area: header;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.app-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--honey-700);
    display: flex; align-items: center; gap: 8px;
}
.header-search { flex: 1; max-width: 600px; }
.header-search input {
    width: 100%;
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: 24px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}
.header-search input:focus {
    outline: none;
    border-color: var(--honey-500);
    background: var(--surface);
}
.header-right { display: flex; gap: 8px; }
.icon-btn {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    font-size: 18px;
}
.icon-btn:hover { background: var(--honey-100); }
.icon-btn.active { background: var(--honey-200); color: var(--honey-800); }
.icon-btn.danger:hover { background: #FEE2E2; color: #DC2626; }
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--honey-400), var(--honey-600));
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 14px;
}
.sidebar {
    grid-area: sidebar;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 16px 12px;
    overflow-y: auto;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-btn {
    text-align: left;
    padding: 10px 14px;
    border-radius: 0 24px 24px 0;
    font-size: 14px;
    color: var(--text);
    transition: background 0.15s;
}
.nav-btn:hover { background: var(--honey-100); }
.nav-btn.active { background: var(--honey-200); color: var(--honey-800); font-weight: 600; }
.sidebar-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.sidebar-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding: 0 14px;
    letter-spacing: 0.5px;
}
.tag-cloud { padding: 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pill {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--honey-100);
    color: var(--honey-800);
    transition: all 0.2s;
}
.tag-pill:hover { background: var(--honey-200); }
.tag-pill.active { background: var(--honey-500); color: white; }
.app-main {
    grid-area: main;
    padding: 20px 24px 100px;
    overflow-y: auto;
}
.composer {
    max-width: 600px;
    margin: 0 auto 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}
.composer:focus-within { box-shadow: var(--shadow); }
.composer input, .composer textarea {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text);
    padding: 6px 0;
    font-size: 15px;
    resize: none;
}
.composer input:focus, .composer textarea:focus { outline: none; }
.composer input { font-weight: 600; font-size: 16px; }
.composer textarea, .composer-actions { display: none; }
.composer.expanded textarea, .composer.expanded .composer-actions { display: flex; }
.composer.expanded textarea { display: block; }
.composer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
}
.note-card {
    background: var(--note-color, var(--surface));
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    color: #1F2937;
}
.note-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.note-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 60px; height: 60px;
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(255,255,255,0.3) 1px, transparent 1px);
    background-size: 12px 12px;
    opacity: 0.4;
    pointer-events: none;
}
.note-card h3 { font-size: 16px; margin-bottom: 6px; word-break: break-word; }
.note-text { font-size: 14px; line-height: 1.5; word-break: break-word; }
.note-badges {
    position: absolute;
    top: 8px; right: 8px;
    display: flex;
    gap: 4px;
}
.badge {
    background: rgba(255,255,255,0.7);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}
.note-checklist-preview {
    list-style: none;
    margin-top: 8px;
    font-size: 13px;
}
.note-checklist-preview li {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
}
.note-checklist-preview .done { text-decoration: line-through; opacity: 0.6; }
.note-checklist-preview .more { color: var(--text-muted); font-size: 12px; padding-left: 20px; }
.tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0,0,0,0.08);
    color: #1F2937;
}
.note-footer-meta {
    margin-top: 10px;
    font-size: 11px;
    color: rgba(0,0,0,0.5);
}
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.bee-large {
    font-size: 80px;
    animation: float 3s ease-in-out infinite;
    margin-bottom: 16px;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.empty-state h2 { color: var(--text); margin-bottom: 8px; }
.fab {
    position: fixed;
    bottom: 24px; right: 24px;
    width: 60px; height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--honey-400), var(--honey-600));
    color: white;
    font-size: 28px;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    z-index: 5;
    transition: transform 0.2s;
}
.fab:hover { transform: scale(1.1) rotate(90deg); }
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(31, 41, 55, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s;
}
.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    padding: 24px;
    animation: slideUp 0.25s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-content h2 { color: var(--honey-700); margin-bottom: 16px; }
.modal-footer { margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px; }
.note-editor { background: var(--note-color, var(--surface)); }
#editor-title {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 22px;
    font-weight: 600;
    color: #1F2937;
    padding: 4px 0;
    margin-bottom: 8px;
}
#editor-content {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 15px;
    line-height: 1.6;
    color: #1F2937;
    padding: 4px 0;
    resize: vertical;
    min-height: 200px;
}
#editor-title:focus, #editor-content:focus { outline: none; }
.editor-checklist { margin-top: 16px; }
.editor-checklist h4, .editor-tags h4 { font-size: 13px; color: var(--honey-800); margin-bottom: 8px; }
#checklist-items { list-style: none; }
#checklist-items li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}
#checklist-items input[type=text] {
    flex: 1;
    border: none;
    background: transparent;
    color: #1F2937;
    padding: 4px;
    border-bottom: 1px solid transparent;
}
#checklist-items input[type=text]:focus {
    outline: none;
    border-bottom-color: var(--honey-500);
}
.editor-tags { margin-top: 16px; }
#editor-tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag.editable {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.remove-tag {
    background: rgba(0,0,0,0.1);
    width: 16px; height: 16px;
    border-radius: 50%;
    font-size: 10px;
}
#editor-tag-input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 0;
    border-top: 1px solid rgba(0,0,0,0.08);
    margin-top: 16px;
    flex-wrap: wrap;
}
.color-picker {
    display: flex;
    gap: 4px;
    margin-left: auto;
    flex-wrap: wrap;
}
.color-swatch {
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.1);
    transition: transform 0.15s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: #1F2937; transform: scale(1.15); }
.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.08);
}
.meta { font-size: 12px; color: rgba(0,0,0,0.5); }
.share-section { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.share-section:last-of-type { border-bottom: none; }
.share-section h3 { color: var(--honey-700); margin-bottom: 8px; font-size: 16px; }
.share-input-row, #public-link-row {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}
.share-input-row input, #public-link {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}
.shared-list, .invites-list {
    list-style: none;
    margin-top: 8px;
}
.shared-list li, .invites-list li {
    padding: 8px 12px;
    background: var(--honey-50);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.invites-list code {
    background: var(--honey-200);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: ui-monospace, monospace;
    color: var(--honey-900);
    font-weight: 600;
}
.invite-create-row { display: flex; gap: 8px; margin: 12px 0; }
.invite-create-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
}
.switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 8px 0;
}
.switch input { width: 18px; height: 18px; cursor: pointer; }
.user-menu {
    position: fixed;
    top: 60px; right: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 50;
    min-width: 220px;
}
.user-menu-header {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
}
.menu-item:hover { background: var(--honey-100); }
.menu-item.danger:hover { background: #FEE2E2; color: #DC2626; }
.toast-container {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--hive-dark);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: linear-gradient(135deg, #059669, #047857); }
.toast-error { background: linear-gradient(135deg, #DC2626, #B91C1C); }
.unlock-modal { max-width: 400px; text-align: center; }
.unlock-modal form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.unlock-modal input {
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--bg);
    color: var(--text);
}
.public-view {
    background: var(--bg);
    min-height: 100vh;
}
.public-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.public-header .logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--honey-700);
    text-decoration: none;
}
.public-main {
    max-width: 700px;
    margin: 40px auto;
    padding: 0 16px;
}
.public-note {
    background: var(--note-color, var(--surface));
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.public-note h1 { color: #1F2937; margin-bottom: 16px; }
.public-note .note-content { color: #1F2937; line-height: 1.7; white-space: pre-wrap; }
.public-note .checklist { list-style: none; margin: 16px 0; }
.public-note .checklist li { padding: 4px 0; color: #1F2937; }
.public-note .note-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(0,0,0,0.1);
    color: rgba(0,0,0,0.6);
    font-size: 13px;
}
@media (max-width: 768px) {
    #app-screen {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }
    .sidebar {
        position: fixed;
        top: var(--header-h);
        left: 0; bottom: 0;
        width: var(--sidebar-w);
        z-index: 20;
        transform: translateX(-100%);
        transition: transform 0.25s;
    }
    .sidebar.open { transform: translateX(0); }
    .app-title { font-size: 18px; }
    .app-title .bee-icon { font-size: 24px; }
    .header-search { display: none; }
    .app-main { padding: 16px 12px 100px; }
    .notes-grid { grid-template-columns: 1fr; gap: 12px; }
    .modal-content { padding: 20px 16px; max-height: 95vh; }
    .fab { bottom: 16px; right: 16px; }
}
@media (max-width: 480px) {
    .auth-container { padding: 24px 20px; }
    .auth-logo h1 { font-size: 26px; }
    .editor-toolbar { gap: 4px; }
    .color-picker { margin-left: 0; width: 100%; justify-content: center; margin-top: 8px; }
}
