/* ============================================
   STOCKNOTE — Refined Investment Journal
   ============================================
   A sophisticated, elegant design system for personal stock tracking.
   Premium minimalism with editorial touches.
*/

:root {
    /* Color Palette — Light Theme */
    --bg-primary: #fafaf8;
    --bg-secondary: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-tertiary: #999999;
    --accent: #8B6F47;
    --accent-light: #d4af88;
    --border: #e8e8e6;
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.12);

    /* Typography Scale */
    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 15px;
    --text-lg: 18px;
    --text-xl: 24px;
    --text-2xl: 32px;
    --text-3xl: 48px;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #0f0f0d;
        --bg-secondary: #1a1a18;
        --text-primary: #f5f5f3;
        --text-secondary: #a8a8a6;
        --text-tertiary: #707070;
        --accent: #d4af88;
        --border: #2a2a28;
        --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.24);
        --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.32);
        --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.48);
    }
}

:root[data-theme="dark"] {
    --bg-primary: #0f0f0d;
    --bg-secondary: #1a1a18;
    --text-primary: #f5f5f3;
    --text-secondary: #a8a8a6;
    --text-tertiary: #707070;
    --accent: #d4af88;
    --border: #2a2a28;
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.48);
}

/* ============================================
   RESET & FOUNDATION
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Trebuchet MS", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* Typography */

h1, h2, h3, h4, h5, h6 {
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.2;
    font-weight: 400;
    letter-spacing: -0.5px;
}

h1 {
    font-size: var(--text-3xl);
    font-weight: 500;
}

h2 {
    font-size: var(--text-2xl);
    font-weight: 500;
}

h3 {
    font-size: var(--text-lg);
    font-weight: 500;
}

p {
    color: var(--text-secondary);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-light);
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: var(--spacing-md);
}

.login-box {
    background: var(--bg-secondary);
    padding: var(--spacing-2xl);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    animation: fadeIn 0.6s var(--transition-base);
}

.login-box h1 {
    font-size: 42px;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.tagline {
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-xl);
    font-size: var(--text-sm);
    letter-spacing: 0.5px;
}

.error-message {
    background: rgba(200, 50, 50, 0.08);
    color: var(--text-primary);
    padding: var(--spacing-md);
    border-radius: 8px;
    margin-bottom: var(--spacing-lg);
    font-size: var(--text-sm);
    border-left: 3px solid #c83232;
    animation: slideDown 0.3s var(--transition-base);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.form-group label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.form-group input {
    padding: var(--spacing-md) var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: var(--text-base);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 111, 71, 0.1);
}

.form-group input::placeholder {
    color: var(--text-tertiary);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.btn-primary {
    background: var(--accent);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    border-color: var(--text-secondary);
}

.btn-edit,
.btn-delete {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--text-xs);
    text-transform: capitalize;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    color: var(--accent);
    transition: all var(--transition-fast);
    border: 1px solid var(--border);
}

.btn-edit:hover {
    background: rgba(139, 111, 71, 0.1);
    border-color: var(--accent);
}

.btn-delete:hover {
    background: rgba(200, 50, 50, 0.1);
    border-color: #c83232;
    color: #c83232;
}

/* ============================================
   APP LAYOUT
   ============================================ */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* For notes view, hide sidebar and use full width with two-panel layout */
.app-wrapper:has(.notes-view) > .sidebar {
    display: none;
}

.app-wrapper:has(.notes-view) > .content {
    width: 100%;
}

/* Sidebar */

.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
}

.sidebar-header {
    padding: var(--spacing-lg) var(--spacing-lg);
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 28px;
    letter-spacing: -1px;
    font-weight: 500;
}

.tickers-section {
    flex: 1;
    padding: var(--spacing-lg);
    overflow-y: auto;
}

.tickers-section h3 {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-lg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 600;
}

.tickers-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.ticker-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    text-decoration: none;
    color: var(--text-primary);
    border-radius: 8px;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    cursor: pointer;
}

.ticker-item:hover {
    background: var(--bg-primary);
    border-color: var(--border);
    transform: translateX(2px);
}

.ticker-item.selected {
    background: rgba(139, 111, 71, 0.15);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.ticker-item .ticker-toggle {
    display: inline-block;
    margin-right: var(--spacing-xs);
    font-size: 10px;
    transition: transform var(--transition-fast);
    min-width: 12px;
    text-align: center;
}

.ticker-item.collapsed .ticker-toggle {
    transform: rotate(-90deg);
}

.ticker-notes-list {
    display: none;
    margin-left: var(--spacing-md);
    margin-top: var(--spacing-sm);
    border-left: 2px solid var(--border);
    padding-left: var(--spacing-md);
    flex-direction: column;
    gap: var(--spacing-xs);
}

.ticker-item.expanded + .ticker-notes-list {
    display: flex;
}

.ticker-note-item {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-xs);
    background: var(--bg-primary);
    border-radius: 6px;
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticker-note-item:hover {
    background: rgba(139, 111, 71, 0.1);
    color: var(--text-primary);
    border-color: var(--accent);
    transform: translateX(2px);
}

.ticker-note-item.active {
    background: rgba(139, 111, 71, 0.15);
    color: var(--accent);
    font-weight: 600;
    border-color: var(--accent);
}

.ticker-symbol {
    font-weight: 600;
    min-width: 60px;
    font-size: var(--text-sm);
    letter-spacing: 0.5px;
}

.ticker-name {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    flex: 1;
    margin-left: var(--spacing-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-count {
    font-size: var(--text-xs);
    background: var(--accent);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
    font-weight: 600;
}

.sidebar-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border);
}

.logout-link {
    font-size: var(--text-sm);
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.logout-link:hover {
    color: var(--accent-light);
}

/* Content Area */

.content {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
}

.notes-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: var(--spacing-2xl) var(--spacing-lg);
}

.ticker-view {
    max-width: 820px;
    margin: 0 auto;
    padding: var(--spacing-2xl) var(--spacing-lg);
}

/* Two-Panel Layout */
.two-panel-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--spacing-lg);
    flex: 1;
    overflow: hidden;
}

.left-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.left-panel-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border);
}

.left-panel-header h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.ticker-search {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: var(--text-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.ticker-search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 111, 71, 0.1);
}

.tickers-panel {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-sm);
}

.ticker-item-panel {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
    background: var(--bg-primary);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--text-sm);
}

.ticker-item-panel:hover {
    background: var(--bg-secondary);
    border-color: var(--border);
}

.ticker-item-panel.selected {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.ticker-symbol-panel {
    font-weight: 600;
    display: block;
}

.ticker-note-count {
    font-size: var(--text-xs);
    opacity: 0.7;
    margin-top: var(--spacing-xs);
}

.right-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.right-panel-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border);
}

.right-panel-header h3 {
    font-size: var(--text-xl);
    margin: 0 0 var(--spacing-xs) 0;
    color: var(--text-primary);
}

.subtitle {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--spacing-2xl);
    gap: var(--spacing-lg);
}

.view-header h1 {
    flex: 1;
    font-size: var(--text-3xl);
}

/* ============================================
   COMPOSE SECTION
   ============================================ */

.right-panel .compose-section {
    flex-shrink: 0;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border);
    margin: 0;
}

.right-panel .filters-section {
    flex-shrink: 0;
    padding: 0 var(--spacing-lg) var(--spacing-lg);
    border-bottom: 1px solid var(--border);
}

.compose-section {
    margin-bottom: var(--spacing-xl);
}

.compose-box {
    background: var(--bg-secondary);
    padding: var(--spacing-lg);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition-base);
}

.compose-box:focus-within {
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

#compose-textarea {
    width: 100%;
    padding: var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: var(--text-base);
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
    min-height: 100px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    line-height: 1.6;
}

#compose-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 111, 71, 0.1);
}

#compose-textarea::placeholder {
    color: var(--text-tertiary);
}

.compose-meta {
    margin-top: var(--spacing-md);
    display: flex;
    gap: var(--spacing-md);
}

.category-select {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: var(--text-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.category-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 111, 71, 0.1);
}

.category-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.compose-actions {
    margin-top: var(--spacing-md);
    display: flex;
    justify-content: flex-end;
}

/* ============================================
   FILTERS
   ============================================ */

.filters-section {
    margin-bottom: var(--spacing-xl);
    background: var(--bg-secondary);
    padding: var(--spacing-lg);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.right-panel .notes-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
}

.filter-row {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.filter-input {
    flex: 1;
    min-width: 160px;
    padding: var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: var(--text-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.filter-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 111, 71, 0.08);
}

.filter-input::placeholder {
    color: var(--text-tertiary);
}

/* ============================================
   NOTES LIST & CARDS
   ============================================ */

.notes-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.note-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition-base);
    animation: slideUp 0.4s var(--transition-base);
    overflow: hidden;
}

.note-card:hover .note-header {
    cursor: pointer;
}

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

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    cursor: pointer;
    user-select: none;
    transition: background-color var(--transition-fast);
}

.note-header:hover {
    background: var(--bg-primary);
}

.note-body {
    padding: 0 var(--spacing-lg) var(--spacing-lg);
}

.note-content {
    font-size: var(--text-base);
    line-height: 1.7;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    max-height: 120px;
    overflow: hidden;
    position: relative;
}

.note-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--bg-secondary));
    pointer-events: none;
}

.note-card.expanded .note-content {
    max-height: none;
}

.note-card.expanded .note-content::after {
    display: none;
}

.read-more {
    display: inline-block;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--text-sm);
    margin-top: var(--spacing-sm);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.read-more:hover {
    color: var(--accent-light);
}

.note-tickers {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    flex: 1;
}

.note-ticker-tag {
    background: rgba(139, 111, 71, 0.1);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: var(--text-xs);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.note-ticker-tag:hover {
    background: rgba(139, 111, 71, 0.15);
    border-color: var(--accent);
}

.note-date {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-align: right;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.edited-indicator {
    font-style: italic;
    margin-left: var(--spacing-sm);
    opacity: 0.8;
}

.note-content {
    font-size: var(--text-base);
    line-height: 1.7;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.note-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border);
}

/* ============================================
   MARKDOWN STYLES
   ============================================ */

.note-content h1,
.note-content h2,
.note-content h3,
.note-content h4,
.note-content h5,
.note-content h6 {
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.3;
}

.note-content h1 {
    font-size: 28px;
    font-weight: 500;
    border-bottom: 2px solid var(--accent);
    padding-bottom: var(--spacing-sm);
}

.note-content h2 {
    font-size: 24px;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--spacing-sm);
}

.note-content h3 {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
}

.note-content h4,
.note-content h5,
.note-content h6 {
    font-size: 16px;
    font-weight: 500;
}

.note-content p {
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    white-space: normal;
}

.note-content strong,
.note-content b {
    font-weight: 600;
    color: var(--text-primary);
}

.note-content em,
.note-content i {
    font-style: italic;
    color: var(--text-secondary);
}

.note-content ul,
.note-content ol {
    margin-bottom: var(--spacing-md);
    margin-left: var(--spacing-lg);
    color: var(--text-primary);
}

.note-content li {
    margin-bottom: var(--spacing-sm);
    line-height: 1.6;
}

.note-content ul li {
    list-style-type: disc;
}

.note-content ol li {
    list-style-type: decimal;
}

.note-content ul ul,
.note-content ol ul {
    margin-left: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

.note-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.note-content th {
    background: rgba(139, 111, 71, 0.08);
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
}

.note-content td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.note-content tr:last-child td {
    border-bottom: none;
}

.note-content tbody tr:nth-child(even) {
    background: rgba(139, 111, 71, 0.03);
}

.note-content tbody tr:hover {
    background: rgba(139, 111, 71, 0.06);
}

.note-content code {
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "Courier New", monospace;
    font-size: 13px;
    color: var(--accent);
    border: 1px solid var(--border);
}

.note-content pre {
    background: var(--bg-primary);
    padding: var(--spacing-md);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow-x: auto;
    margin-bottom: var(--spacing-md);
    line-height: 1.5;
}

.note-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-primary);
    font-size: 13px;
}

.note-content blockquote {
    border-left: 4px solid var(--accent);
    padding-left: var(--spacing-md);
    margin-left: 0;
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    font-style: italic;
}

.note-content hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: var(--spacing-lg) 0;
}

.note-content a {
    color: var(--accent);
    text-decoration: underline;
    transition: color var(--transition-fast);
}

.note-content a:hover {
    color: var(--accent-light);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: var(--spacing-2xl) var(--spacing-lg);
    color: var(--text-tertiary);
    animation: fadeIn 0.4s var(--transition-base);
}

.empty-state p {
    font-size: var(--text-base);
}

/* ============================================
   MODAL
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    animation: fadeIn var(--transition-base);
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: var(--spacing-2xl);
    max-width: 640px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: slideUp 0.3s var(--transition-base);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: var(--text-xl);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-tertiary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

#edit-textarea {
    width: 100%;
    padding: var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: var(--text-base);
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
    margin-bottom: var(--spacing-lg);
    min-height: 180px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#edit-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 111, 71, 0.1);
}

.edit-meta {
    margin-bottom: var(--spacing-lg);
}

.modal-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    :root {
        --text-3xl: 32px;
        --text-2xl: 24px;
        --text-xl: 18px;
        --spacing-2xl: 24px;
        --spacing-xl: 16px;
    }

    .app-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 200px;
        overflow-x: auto;
    }

    .tickers-section {
        padding: var(--spacing-md);
    }

    .tickers-section h3 {
        margin-bottom: var(--spacing-md);
    }

    .tickers-list {
        flex-direction: row;
        gap: var(--spacing-md);
        overflow-x: auto;
        padding-bottom: var(--spacing-sm);
    }

    .ticker-item {
        flex-shrink: 0;
        min-width: fit-content;
    }

    .ticker-name {
        display: none;
    }

    .sidebar-footer {
        display: none;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: var(--spacing-lg);
    }

    .notes-view,
    .ticker-view {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .note-header {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-input {
        min-width: auto;
    }

    .compose-box,
    .filters-section {
        padding: var(--spacing-md);
    }

    .modal-content {
        padding: var(--spacing-lg);
        width: 95%;
    }

    .note-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    :root {
        --text-3xl: 28px;
        --text-2xl: 20px;
        --spacing-lg: 16px;
        --spacing-md: 12px;
    }

    .login-box {
        padding: var(--spacing-lg);
    }

    .view-header h1 {
        font-size: var(--text-2xl);
    }

    .note-card {
        padding: var(--spacing-md);
    }

    .note-tickers {
        gap: var(--spacing-xs);
    }

    .note-ticker-tag {
        font-size: 10px;
        padding: 3px 8px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .sidebar,
    .compose-section,
    .filters-section,
    .note-actions {
        display: none;
    }

    .note-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}

/* ---- cloud: logged-in user box in the sidebar ---- */
.user-bar { font-size: var(--text-xs, 12px); line-height: 1.6; }
.user-bar-email { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-bar a { color: var(--accent, #8B6F47); text-decoration: none; }
.user-bar a:hover { text-decoration: underline; }
