@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,400&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0d0d12;
    --bg2: #13131a;
    --bg3: #1c1c26;
    --surface: #1e1e2a;
    --surface2: #252535;
    --border: #2a2a3a;
    --border2: #35354a;
    --text: #f0f0f5;
    --text2: #9898b0;
    --text3: #6060780;
    --accent: #6ee7b7;
    --accent2: #34d399;
    --accent-dim: rgba(110,231,183,0.12);
    --accent-glow: rgba(110,231,183,0.25);
    --red: #f87171;
    --red-dim: rgba(248,113,113,0.12);
    --amber: #fbbf24;
    --blue: #60a5fa;
    --blue-dim: rgba(96,165,250,0.12);
    --sidebar-w: 220px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
    --font-head: 'Syne', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --transition: 0.2s ease;
}

body.light-mode {
    --bg: #f4f6fb;
    --bg2: #eef0f7;
    --bg3: #e8ebf5;
    --surface: #ffffff;
    --surface2: #f0f2fa;
    --border: #e0e3f0;
    --border2: #d0d4e8;
    --text: #1a1a2e;
    --text2: #5a5a7a;
    --accent: #059669;
    --accent2: #047857;
    --accent-dim: rgba(5,150,105,0.1);
    --accent-glow: rgba(5,150,105,0.2);
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; }
input, textarea, select { font-family: var(--font-body); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: #0d0d12;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-primary:hover {
    background: var(--accent2);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary svg { width: 16px; height: 16px; }

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    letter-spacing: 0.02em;
}
.field-group input,
.field-group select {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 10px 14px;
    font-size: 15px;
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
}
.field-group input:focus,
.field-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.field-group input::placeholder { color: var(--text2); opacity: 0.6; }

.input-eye { position: relative; }
.input-eye input { padding-right: 44px; }
.eye-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text2);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color var(--transition);
}
.eye-btn:hover { color: var(--text); }
.eye-btn svg { width: 18px; height: 18px; }

.tag-chip {
    display: inline-flex;
    align-items: center;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(110,231,183,0.2);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
body.light-mode .tag-chip {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: rgba(5,150,105,0.2);
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent);
    color: #0d0d12;
    padding: 4px 10px 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}
.tag-remove {
    background: none;
    border: none;
    color: #0d0d12;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
    transition: opacity var(--transition);
}
.tag-remove:hover { opacity: 1; }

/* ============ AUTH PAGE ============ */
.auth-page {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

.auth-wrap {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.auth-brand {
    flex: 1.1;
    background: linear-gradient(135deg, #0d1117 0%, #0a1628 50%, #071320 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.auth-brand::before {
    content: '';
    position: absolute;
    top: -120px;
    left: -120px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(110,231,183,0.12) 0%, transparent 70%);
    border-radius: 50%;
}
.auth-brand::after {
    content: '';
    position: absolute;
    bottom: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(96,165,250,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.brand-inner { position: relative; z-index: 1; }

.brand-logo {
    width: 64px;
    height: 64px;
    background: var(--accent);
    color: #0d0d12;
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 2rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(110,231,183,0.3);
}

.brand-name {
    font-family: var(--font-head);
    font-size: 2.8rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.brand-tagline {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.55);
    line-height: 1.6;
    margin-bottom: 32px;
    font-weight: 300;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 40px;
}

.feat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: rgba(255,255,255,0.65);
}

.feat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.brand-back {
    font-size: 13px;
    color: rgba(255,255,255,0.4);
    transition: color var(--transition);
}
.brand-back:hover { color: rgba(255,255,255,0.8); }

.auth-form-panel {
    flex: 0.9;
    background: var(--bg2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg3);
    padding: 4px;
    border-radius: var(--radius);
    margin-bottom: 32px;
    width: 100%;
    max-width: 360px;
}

.auth-tab {
    flex: 1;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text2);
    transition: all var(--transition);
}
.auth-tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.auth-tab-content { display: none; width: 100%; max-width: 360px; }
.auth-tab-content.active { display: block; }

.form-title {
    font-family: var(--font-head);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form .g-recaptcha { margin: 4px 0; }

/* ============ APP LAYOUT ============ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.sidebar-logo {
    width: 34px;
    height: 34px;
    background: var(--accent);
    color: #0d0d12;
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text2);
    transition: all var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
}

.nav-logout { color: var(--red); }
.nav-logout:hover { background: var(--red-dim); color: var(--red); }

.theme-btn .icon-sun,
.theme-btn .icon-moon { display: inline; }

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
}
.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text2);
    border-radius: 2px;
    transition: background var(--transition);
}
.hamburger:hover span { background: var(--text); }

.page-title-area h1 {
    font-family: var(--font-head);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.page-sub { font-size: 13px; color: var(--text2); }
.page-sub strong { color: var(--text); font-weight: 500; }

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.search-box svg { width: 16px; height: 16px; color: var(--text2); flex-shrink: 0; }
.search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    width: 200px;
}
.search-box input::placeholder { color: var(--text2); opacity: 0.6; }

.sort-select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color var(--transition);
    outline: none;
}
.sort-select:focus { border-color: var(--accent); }

.btn-new {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent);
    color: #0d0d12;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    transition: background var(--transition), transform var(--transition);
    white-space: nowrap;
}
.btn-new:hover { background: var(--accent2); transform: translateY(-1px); }
.btn-new svg { width: 16px; height: 16px; }

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-dim);
    border: 2px solid var(--accent);
    color: var(--accent);
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stats-row {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 16px;
}
.stat-label { font-size: 12px; color: var(--text2); font-weight: 500; }
.stat-val { font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; color: var(--accent); }

.notes-grid {
    flex: 1;
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    align-content: start;
    transition: opacity 0.3s ease;
}

.loading-state {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: 60px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text2);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 1rem; margin-bottom: 8px; }

.note-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    animation: cardIn 0.3s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.note-card:hover {
    border-color: var(--border2);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-date { font-size: 11px; color: var(--text2); }

.card-menu { position: relative; }
.card-menu-btn {
    background: none;
    border: none;
    color: var(--text2);
    padding: 4px 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: all var(--transition);
}
.card-menu-btn:hover { background: var(--surface2); color: var(--text); }

.card-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 200;
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
    pointer-events: none;
    transition: all 0.15s ease;
    overflow: hidden;
}
.card-dropdown.open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.drop-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    transition: all var(--transition);
    cursor: pointer;
}
.drop-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.drop-item:hover { background: var(--surface); color: var(--text); }
.drop-item.delete-item:hover { background: var(--red-dim); color: var(--red); }

.card-title {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-preview {
    font-size: 13px;
    color: var(--text2);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}

.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}
.pg-info { font-size: 13px; color: var(--text2); }
.pg-nav { display: flex; gap: 4px; }
.pg-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text2);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.pg-btn:hover:not(:disabled):not(.active) { border-color: var(--accent); color: var(--accent); }
.pg-btn.active { background: var(--accent); border-color: var(--accent); color: #0d0d12; font-weight: 700; }
.pg-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(4px);
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.2s ease;
}
.modal-overlay.active .modal-box { transform: none; }

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 {
    font-family: var(--font-head);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text2);
    font-size: 24px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    margin-left: 12px;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

.modal-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 10px 24px;
    border-bottom: 1px solid var(--border);
    min-height: 0;
}
.modal-tags-row:empty { display: none; }

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
}
.modal-body p { margin-bottom: 12px; }
.modal-body h1, .modal-body h2, .modal-body h3 { font-family: var(--font-head); margin-bottom: 10px; }
.modal-body ul, .modal-body ol { padding-left: 20px; margin-bottom: 12px; }
.modal-body blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--text2); margin: 12px 0; }
.modal-body code { background: var(--bg3); padding: 2px 6px; border-radius: 4px; font-size: 13px; }

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}
.btn-modal-edit {
    padding: 9px 18px;
    background: var(--blue-dim);
    color: var(--blue);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition);
}
.btn-modal-edit:hover { background: rgba(96,165,250,0.2); }
.btn-modal-delete {
    padding: 9px 18px;
    background: var(--red-dim);
    color: var(--red);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
}
.btn-modal-delete:hover { background: rgba(248,113,113,0.2); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ============ EDITOR LAYOUT ============ */
.editor-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
}

.editor-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text2);
    transition: color var(--transition);
}
.back-link:hover { color: var(--text); }
.back-link svg { width: 16px; height: 16px; }

.editor-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-brand {
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: #0d0d12;
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 0.9rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.editor-page-title {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.autosave-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border2);
    transition: background var(--transition);
    flex-shrink: 0;
}
.autosave-dot.saving { background: var(--amber); animation: pulse 0.8s ease infinite alternate; }
.autosave-dot.saved { background: var(--accent); }
.autosave-dot.pending { background: var(--amber); }
@keyframes pulse { from { opacity: 0.5; } to { opacity: 1; } }

.editor-body {
    flex: 1;
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 80px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.title-input {
    background: none;
    border: none;
    border-bottom: 2px solid var(--border);
    color: var(--text);
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 700;
    padding: 8px 0;
    width: 100%;
    transition: border-color var(--transition);
    outline: none;
}
.title-input:focus { border-bottom-color: var(--accent); }
.title-input::placeholder { color: var(--text2); opacity: 0.4; }

.tag-row { padding: 4px 0; }
.tag-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    min-height: 44px;
    transition: border-color var(--transition), box-shadow var(--transition);
    cursor: text;
}
.tag-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
#tagInput {
    border: none;
    outline: none;
    background: none;
    color: var(--text);
    font-size: 14px;
    min-width: 180px;
    flex: 1;
}
#tagInput::placeholder { color: var(--text2); opacity: 0.5; }

.quill-wrap { flex: 1; }

.ql-toolbar.ql-snow {
    background: var(--surface);
    border-color: var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
}
.ql-container.ql-snow {
    background: var(--surface);
    border-color: var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text);
    min-height: 360px;
}
.ql-editor { min-height: 360px; padding: 16px 20px; }
.ql-editor.ql-blank::before { color: var(--text2); opacity: 0.5; font-style: normal; }
.ql-snow .ql-stroke { stroke: var(--text2); }
.ql-snow .ql-fill { fill: var(--text2); }
.ql-snow .ql-picker { color: var(--text2); }
.ql-snow .ql-picker-options { background: var(--bg2); border-color: var(--border); }
.ql-snow .ql-picker-item { color: var(--text); }
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--accent); }
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--accent); }
.ql-snow.ql-toolbar button:hover,
.ql-snow.ql-toolbar button.ql-active,
.ql-snow.ql-toolbar .ql-picker-label:hover,
.ql-snow.ql-toolbar .ql-picker-label.ql-active { color: var(--accent); }

/* ============ PROFILE ============ */
.profile-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
}

.profile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
}

.profile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    color: var(--text2);
}

.profile-content {
    max-width: 860px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    width: 100%;
}

.profile-avatar-block {
    text-align: center;
    margin-bottom: 40px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: var(--accent-dim);
    border: 3px solid var(--accent);
    border-radius: 50%;
    color: var(--accent);
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.profile-name {
    font-family: var(--font-head);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
}
.profile-email { font-size: 14px; color: var(--text2); margin-top: 4px; }

.profile-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.card-section-title {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
    .profile-cards { grid-template-columns: 1fr; }
    .search-box input { width: 140px; }
}

@media (max-width: 768px) {
    .auth-wrap { flex-direction: column; }
    .auth-brand { padding: 32px 24px; min-height: auto; }
    .brand-name { font-size: 2rem; }
    .auth-form-panel { padding: 32px 20px; }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        transform: translateX(-100%);
        z-index: 200;
    }
    .sidebar.open { transform: none; }
    .sidebar-overlay.active { display: block; }

    .hamburger { display: flex; }

    .notes-grid { padding: 16px; grid-template-columns: 1fr; }
    .top-bar { padding: 12px 16px; }
    .stats-row { padding: 12px 16px; gap: 8px; }
    .stat-pill { padding: 6px 12px; }
    .search-box { display: none; }
    .btn-new span { display: none; }
    .pagination-wrap { padding: 12px 16px; }

    .editor-body { padding: 24px 16px 60px; }
    .title-input { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .top-bar-right { gap: 8px; }
    .sort-select { display: none; }
    .auth-brand { display: none; }
    .auth-form-panel { padding: 32px 20px; min-height: 100vh; }
    .profile-topbar { padding: 12px 16px; }
    .profile-content { padding: 24px 16px 60px; }
}
