:root {
    --bg: #1a1a2e;
    --surface: #16213e;
    --surface2: #0f3460;
    --accent: #e94560;
    --accent2: #533483;
    --text: #eee;
    --text-dim: #999;
    --quote-bg: #1e2a47;
    --note-bg: #2a1e3e;
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.page-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.page-body.scrollable {
    overflow-y: auto;
    padding-bottom: 70px;
}

.container {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Header */
.header {
    background: var(--surface);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--surface2);
}
.header h1 {
    font-size: 1.3rem;
    font-weight: 600;
}
.header a { color: var(--text-dim); text-decoration: none; font-size: 0.85rem; }

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 12px;
    border-top: 1px solid var(--surface2);
    z-index: 100;
}
.bottom-nav a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.75rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 4px 12px;
}
.bottom-nav a.active { color: var(--accent); }
.bottom-nav .nav-icon { font-size: 1.4rem; }

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.card.quote { border-left: 3px solid var(--accent); }
.card.note { border-left: 3px solid var(--accent2); }

.card-content {
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-wrap;
}
.card-meta {
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-dim);
}
.card-meta .source { font-style: italic; }

/* Topic pills */
.topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill {
    background: var(--surface2);
    color: var(--text);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    text-decoration: none;
    white-space: nowrap;
}
.pill:hover { background: var(--accent); }
.pill .count {
    color: var(--text-dim);
    margin-left: 4px;
    font-size: 0.7rem;
}

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 6px;
}
textarea, input[type="text"], input[type="password"] {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--surface2);
    border-radius: 8px;
    color: var(--text);
    padding: 12px;
    font-size: 1rem;
    font-family: inherit;
}
textarea { min-height: 150px; resize: vertical; }
textarea:focus, input:focus { outline: none; border-color: var(--accent); }

/* Type toggle */
.type-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.type-toggle a {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-dim);
    background: var(--surface);
    font-size: 0.9rem;
}
.type-toggle a.active {
    background: var(--accent);
    color: white;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    width: 100%;
    font-family: inherit;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { opacity: 0.9; }
.btn-danger { background: #8b0000; color: white; font-size: 0.85rem; padding: 8px 16px; width: auto; }
.btn-danger:hover { background: #a00; }

/* Checkbox grid for topics */
.topic-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.topic-check {
    display: flex;
    align-items: center;
    gap: 4px;
}
.topic-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}
.topic-check label {
    font-size: 0.9rem;
    margin: 0;
    color: var(--text);
}

/* Search */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.search-bar input { flex: 1; }
.search-bar button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

/* Stats */
.stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}
.stat {
    background: var(--surface);
    padding: 12px 16px;
    border-radius: var(--radius);
    flex: 1;
    text-align: center;
}
.stat-num { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.75rem; color: var(--text-dim); }

/* Login */
.login-box {
    max-width: 320px;
    margin: 80px auto;
    padding: 32px;
    background: var(--surface);
    border-radius: var(--radius);
    text-align: center;
}
.login-box h2 { margin-bottom: 20px; }
.login-box .error { color: var(--accent); font-size: 0.85rem; margin-bottom: 12px; }

/* Section headers */
.section-header {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 20px 0 10px;
}

/* Entry actions */
.entry-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: flex-end;
}

/* Empty state */
.empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-dim);
}
.empty .icon { font-size: 2.5rem; margin-bottom: 12px; }

.card-content strong {
    color: #f0d060;
}

/* Type badge */
.badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
}
.badge.quote { background: var(--accent); color: white; }
.badge.note { background: var(--accent2); color: white; }


/* Fixed top section (stats + sort bar) */
.fixed-top-section {
    flex-shrink: 0;
    padding-top: 16px;
    padding-bottom: 8px;
}

/* Scrollable notes list */
.scroll-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}
