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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background-color: #f5f6f8;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    width: 100%;
}

body > header {
    background: #1a2332;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    z-index: 100;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav .logo {
    font-size: 1.35rem;
    font-weight: 700;
    text-decoration: none;
    color: white;
    letter-spacing: -0.01em;
    font-family: Georgia, 'Times New Roman', serif;
}

nav .nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
}

nav .nav-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    transition: color 0.2s;
}

nav .nav-links a:hover {
    color: white;
}

.nav-btn-login,
.nav-btn-logout {
    padding: 0.4rem 1.1rem;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.nav-btn-login {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.nav-btn-login:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-btn-logout {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.nav-btn-logout:hover {
    background: rgba(255, 255, 255, 0.15);
}

.hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 5rem 2rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #1a2332;
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hero p {
    font-size: 1.15rem;
    color: #5a6a7a;
    max-width: 580px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.btn {
    display: inline-block;
    padding: 0.7rem 1.75rem;
    background: #1e3a5f;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    transition: background 0.2s, box-shadow 0.2s;
}

.btn:hover {
    background: #16304d;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.3);
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: white;
    color: #3c4043;
    border: 1px solid #dadce0;
    width: 100%;
    margin-top: 1rem;
}

.google-btn:hover {
    background: #f8f9fa;
    border-color: #d2d2d2;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.features {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: white;
    border-radius: 6px;
    padding: 2rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s;
    border: 1px solid #e8ecf0;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    color: #1a2332;
    font-family: Georgia, 'Times New Roman', serif;
}

.card p {
    color: #5a6a7a;
}

.card .icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.user-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.welcome-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #1e3a5f;
}

.dashboard-layout {
    display: flex;
    min-height: calc(100vh - 130px);
}

.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid #e0e4e8;
    padding: 1.5rem 0;
    flex-shrink: 0;
}

.sidebar-user {
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid #e0e4e8;
    text-align: center;
}

.sidebar-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #1e3a5f;
    margin-bottom: 0.75rem;
}

.avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1e3a5f;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin-bottom: 0.75rem;
}

.sidebar-user-name {
    font-weight: 600;
    color: #1a2332;
    font-size: 1rem;
}

.sidebar-user-email {
    color: #5a6a7a;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    word-break: break-all;
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: #f5f6f8;
    color: #1e3a5f;
}

.sidebar-link.active {
    background: #eef1f5;
    color: #1e3a5f;
    border-left-color: #1e3a5f;
    font-weight: 600;
}

.sidebar-icon {
    font-size: 1.25rem;
}

.dashboard-content {
    flex: 1;
    padding: 2.5rem 3rem;
}

.dashboard-content h2 {
    font-size: 1.6rem;
    color: #1a2332;
    margin-bottom: 0.5rem;
    font-family: Georgia, 'Times New Roman', serif;
}

.dashboard-subtitle {
    color: #5a6a7a;
    margin-bottom: 2rem;
}

/* Portfolio Performance Banner */
.performance-banner {
    margin: 2rem 0;
    background: linear-gradient(135deg, #1e3a5f, #2c3e50);
    color: white;
    border: none;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.performance-banner h3 {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.performance-banner .value-group {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.performance-banner .main-value {
    font-size: 2.5rem;
    font-weight: 700;
}

.performance-banner .perf-pct {
    font-size: 1.25rem;
    font-weight: 600;
}

.performance-banner .perf-positive {
    color: #4ade80;
}

.performance-banner .perf-negative {
    color: #fb7185;
}

.performance-banner .banner-note {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
}

/* Stale Data Styles */
.stale-price {
    color: #95a5a6;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.stale-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    background: #edf2f7;
    color: #718096;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
}

.info-icon {
    cursor: help;
    color: #a0aec0;
    font-size: 0.9rem;
    line-height: 1;
}

/* Portfolio Table */
.portfolio-table-wrapper {
    margin-top: 3rem;
}

.portfolio-table-wrapper h3 {
    margin-bottom: 1.5rem;
}

.portfolio-table-scroll {
    overflow-x: auto;
}

.sortable-row {
    cursor: pointer;
}

.gain-positive {
    color: #27ae60;
}

.gain-negative {
    color: #c0392b;
}

.momo-tag {
    background: #1e3a5f;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}


.content-card {
    background: white;
    border-radius: 6px;
    padding: 2rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid #e8ecf0;
}

.content-card p {
    color: #5a6a7a;
}

.letters-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.btn-sm {
    padding: 0.45rem 1.1rem;
    font-size: 0.85rem;
}

.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-group select,
.filter-group input[type="text"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #2c3e50;
    background: white;
    min-width: 140px;
    transition: border-color 0.2s;
}

.filter-group select {
    cursor: pointer;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus {
    outline: none;
    border-color: #1e3a5f;
    box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.12);
}

.filter-clear {
    font-size: 0.85rem;
    color: #c0392b;
    text-decoration: none;
    font-weight: 500;
    padding-bottom: 0.55rem;
    transition: color 0.2s;
}

.filter-clear:hover {
    color: #922b21;
}

.btn-secondary {
    background: #e0e4e8;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cdd3d9;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.table-wrapper {
    padding: 0;
    overflow-x: auto;
}

.letters-table {
    width: 100%;
    border-collapse: collapse;
}

.letters-table th {
    text-align: left;
    padding: 0.9rem 0.5rem;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e0e4e8;
    background: #f8f9fa;
}

.letters-table td {
    padding: 0.875rem 0.6rem;
    border-bottom: 1px solid #edf0f3;
    font-size: 0.85rem;
    vertical-align: middle;
}

/* Specific column adjustments */
.letters-table th:nth-child(3), 
.letters-table td:nth-child(3) { /* Company Name */
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.letters-table th:nth-child(2),
.letters-table td:nth-child(2) { /* Symbol */
    width: 80px;
}

.letters-table tbody tr:hover {
    background: #f8f9fa;
}

.letters-table tbody tr:last-child td {
    border-bottom: none;
}

.letter-title {
    font-weight: 600;
    color: #1a2332;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.letter-date {
    color: #5a6a7a;
    font-size: 0.9rem;
    white-space: nowrap;
}

.letter-tags-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tag {
    display: inline-block;
    background: #eef1f5;
    color: #1e3a5f;
    padding: 0.15rem 0.6rem;
    border-radius: 3px;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.75rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-published {
    background: #d5f5e3;
    color: #1e8449;
}

.status-draft {
    background: #fef9e7;
    color: #9a7d0a;
}

.letter-actions-inner {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    white-space: nowrap;
}

.inline-form {
    display: inline;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.9rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.2s;
    background: transparent;
    font-family: inherit;
    line-height: 1;
    height: 34px;
    box-sizing: border-box;
    white-space: nowrap;
}

button.action-btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    margin: 0;
}

.action-edit {
    color: #2980b9;
    border-color: #2980b9;
}

.action-edit:hover {
    background: #2980b9;
    color: white;
}

.action-pin {
    color: #8e44ad;
    border-color: #8e44ad;
}

.action-pin:hover {
    background: #8e44ad;
    color: white;
}

.action-unpin {
    color: #6c5b7b;
    border-color: #6c5b7b;
    background: #f0eaf2;
}

.action-unpin:hover {
    background: #6c5b7b;
    color: white;
}

.pin-icon {
    font-size: 0.85rem;
}

.letter-tile-pinned {
    border-left-color: #c5a55a;
    border-left-width: 4px;
    background: #fdfbf6;
}

.letter-tile-pinned:hover {
    box-shadow: 0 4px 14px rgba(197, 165, 90, 0.15);
}

.pinned-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #b8942e;
    margin-bottom: 0.35rem;
}

.action-publish {
    color: #27ae60;
    border-color: #27ae60;
}

.action-publish:hover {
    background: #27ae60;
    color: white;
}

.action-unpublish {
    color: #c5a55a;
    border-color: #c5a55a;
}

.action-unpublish:hover {
    background: #c5a55a;
    color: white;
}

.action-delete {
    color: #c0392b;
    border-color: #c0392b;
}

.action-delete:hover {
    background: #c0392b;
    color: white;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state p {
    font-size: 1.05rem;
}

.flash-message {
    padding: 0.75rem 1.25rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.flash-success {
    background: #d5f5e3;
    color: #1e8449;
    border: 1px solid #abebc6;
}

.flash-error {
    background: #fdedec;
    color: #922b21;
    border: 1px solid #f5c6cb;
}

.form-header {
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-block;
    color: #1e3a5f;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 0.75rem;
    transition: color 0.2s;
    font-size: 0.9rem;
}

.back-link:hover {
    color: #c5a55a;
}

.letter-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: #1a2332;
    font-size: 0.9rem;
}

.form-hint {
    font-weight: 400;
    color: #8b95a3;
    font-size: 0.85rem;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    padding: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #d1d5db;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}

.toolbar-group {
    display: flex;
    gap: 0.2rem;
}

.toolbar-sep {
    width: 1px;
    height: 1.5rem;
    background: #d1d5db;
    margin: 0 0.35rem;
    flex-shrink: 0;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.55rem;
    font-size: 0.78rem;
    font-family: inherit;
    font-weight: 600;
    color: #4a5568;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
    min-width: 1.8rem;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: #eef1f5;
    border-color: #1e3a5f;
    color: #1e3a5f;
}

.toolbar-btn:active {
    background: #dde3ea;
}

.toolbar-btn-ad {
    color: #8b6914;
    border-color: #c5a55a;
    background: #fdfbf6;
}

.toolbar-btn-ad:hover {
    background: #c5a55a;
    border-color: #c5a55a;
    color: white;
}

.editor-toolbar+textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.form-group input[type="text"],
.form-group textarea {
    padding: 0.7rem 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #2c3e50;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1e3a5f;
    box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 200px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 0.5rem;
}

.preview-section {
    margin-top: 2rem;
}

.preview-heading {
    font-size: 1.05rem;
    color: #1a2332;
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-family: Georgia, 'Times New Roman', serif;
}

.preview-placeholder {
    color: #8b95a3;
    font-style: italic;
}

.tile-read-time {
    color: #8b95a3;
    font-size: 0.82rem;
}

.tile-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tile-preview {
    color: #5a6a7a;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0.5rem 0;
}

.tile-read-more {
    display: block;
    text-align: right;
    color: #1e3a5f;
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

.letter-tile:hover .tile-read-more {
    color: #c5a55a;
}

.letters-section {
    width: 100%;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.letters-container {
    width: 80%;
    max-width: 1400px;
    margin: 0 auto;
}

@media (max-width: 1024px) {
    .letters-container {
        width: 100%;
    }
}

.section-title {
    font-size: 1.6rem;
    color: #1a2332;
    margin-bottom: 1.5rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
}

.letter-tiles {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.letter-tile {
    display: block;
    background: white;
    border-radius: 6px;
    padding: 1.5rem 2rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    text-decoration: none;
    transition: box-shadow 0.2s;
    border-left: 3px solid #1e3a5f;
    border-top: 1px solid #e8ecf0;
    border-right: 1px solid #e8ecf0;
    border-bottom: 1px solid #e8ecf0;
}

.letter-tile:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.tile-title {
    font-size: 1.15rem;
    color: #1a2332;
    margin-bottom: 0.5rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 600;
}

.tile-meta {
    margin-bottom: 0.5rem;
}

.tile-date {
    font-size: 0.85rem;
    color: #5a6a7a;
}

.tile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.no-letters {
    color: #5a6a7a;
    font-size: 1.05rem;
    text-align: center;
    padding: 2rem 0;
}

.letter-article {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.letter-article-header {
    margin-bottom: 2.5rem;
    background: transparent;
    padding: 0;
}

.letter-article-header h1 {
    font-size: 2.1rem;
    color: #1a2332;
    line-height: 1.3;
    margin-bottom: 1rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
}

.letter-article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.letter-article-date {
    color: #5a6a7a;
    font-size: 0.9rem;
}

.letter-article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

footer {
    background: #1a2332;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 2rem;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1.75rem;
}

.footer-divider {
    width: 1px;
    height: 1.25rem;
    background: rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
        padding-bottom: 2rem;
    }
    
    .footer-divider {
        display: none;
    }
}

.footer-social {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.social-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.social-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.auth-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 200px);
    align-items: flex-start;
}

.auth-card {
    background: white;
    border-radius: 6px;
    padding: 2.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid #e8ecf0;
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    font-size: 1.6rem;
    color: #1a2332;
    margin-bottom: 0.5rem;
    font-family: Georgia, 'Times New Roman', serif;
}

.auth-subtitle {
    color: #5a6a7a;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-form .form-group input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #2c3e50;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

.auth-form .form-group input:focus {
    outline: none;
    border-color: #1e3a5f;
    box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.12);
}

.form-group-inline {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.88rem;
    color: #4a5568;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: #1e3a5f;
    cursor: pointer;
}

.auth-btn {
    width: 100%;
    text-align: center;
    padding: 0.7rem 2rem;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
}

.qr-container {
    text-align: center;
    margin: 1.5rem 0;
}

.qr-code {
    max-width: 200px;
    border-radius: 4px;
    border: 1px solid #e0e4e8;
}

.secret-display {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e0e4e8;
}

.secret-label {
    font-size: 0.85rem;
    color: #5a6a7a;
    margin-bottom: 0.5rem;
}

.secret-key {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a2332;
    letter-spacing: 0.05em;
    word-break: break-all;
}

/* Editor Dual Pane Layout */
.editor-preview-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-top: 1rem;
}

.editor-column {
    flex: 1;
    min-width: 0;
    /* Prevent flex overflow */
}

.preview-column {
    flex: 1;
    min-width: 0;
    position: sticky;
    top: 2rem;
}

.preview-column .preview-heading {
    margin-top: 0;
}

.preview-column .content-card {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* Ensure textarea doesn't overflow */
.editor-column textarea {
    width: 100%;
}

@media (max-width: 1024px) {
    .editor-preview-container {
        flex-direction: column;
    }

    .preview-column {
        position: static;
        width: 100%;
    }
}

/* Portfolio History Cards */
.portfolio-history {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.portfolio-card {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e0e4e8;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.portfolio-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #1e3a5f;
}

.portfolio-card.active::before {
    content: 'ACTIVE';
    position: absolute;
    top: 10px;
    right: -25px;
    background: #27ae60;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 30px;
    transform: rotate(45deg);
}

.portfolio-card h4 {
    margin: 0;
    margin-bottom: 0.5rem;
    color: #1a2332;
    font-size: 1rem;
}

.portfolio-card-meta {
    font-size: 0.8rem;
    color: #5a6a7a;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #fefefe;
    margin: 3% auto;
    padding: 2rem;
    border: 1px solid #888;
    width: 90%;
    max-width: 1100px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.modal-body {
    overflow-y: auto;
    flex: 1;
}

.close-modal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: black;
}
/* Portfolio Loading Spinner */
.portfolio-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
    gap: 1.5rem;
    color: #7f8c8d;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    border: 1px dashed #e0e4e8;
    margin: 2rem 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(30, 58, 95, 0.1);
    border-radius: 50%;
    border-top-color: #1e3a5f;
    animation: spin 1s ease-in-out infinite;
}

.spinner-sm {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(148, 163, 184, 0.2);
    border-top-color: #64748b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

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

/* HTMX Revalidation State */
.revalidate-container {
    position: relative;
    transition: opacity 0.3s ease;
}

.revalidate-container.htmx-request {
    opacity: 0.9;
}

.revalidating-status {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e4e8;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: #1e3a5f;
    font-weight: 600;
    animation: slideDown 0.3s ease-out forwards;
}

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

.progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(30, 58, 95, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 30%;
    background: #1e3a5f;
    border-radius: 2px;
    animation: progressLoop 1.5s infinite ease-in-out;
}

@keyframes progressLoop {
    0% { left: -30%; }
    100% { left: 100%; }
}

/* Search Styles */
.search-form .spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(30, 58, 95, 0.1);
    border-top-color: #1e3a5f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
    pointer-events: none;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-request.htmx-indicator {
    opacity: 1;
}

#search-results-container {
    min-height: 200px;
}

/* Dropdown Navigation */
.nav-links li.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.arrow-down {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid rgba(255, 255, 255, 0.6);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.15);
    z-index: 1001;
    border-radius: 8px;
    margin-top: 0.5rem;
    overflow: visible; /* Allow pseudo-element to be visible outside */
    right: 0;
}

.dropdown-content::before {
    content: "";
    position: absolute;
    top: -0.5rem;
    left: 0;
    width: 100%;
    height: 0.5rem;
}

.dropdown-content a {
    color: #2c3e50 !important;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background-color: #f7fafc;
    color: #1e3a5f !important;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown:hover .dropbtn {
    color: white;
}

.dropdown:hover .arrow-down {
    border-top-color: white;
}

/* Heatmap Styles */
/* Heatmap Styles - Premium Analytics Look */
.heatmap-section {
    max-width: 1200px;
    margin: 0 auto 5rem;
    padding: 0 2rem;
}

.heatmap-grid-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    font-family: 'Inter', system-ui, sans-serif;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.gainer-text { color: #10b981; }
.loser-text { color: #ef4444; }

.heatmap-grid-title span {
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: rgba(0,0,0,0.05);
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
}

.heatmap-tile {
    padding: 2rem 1.25rem;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.heatmap-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    opacity: 0.8;
}

.tile-gain::before { background: #10b981; }
.tile-loss::before { background: #ef4444; }

.heatmap-tile:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.9);
}

.tile-gain {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(255, 255, 255, 0.7));
}

.tile-loss {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(255, 255, 255, 0.7));
}

.tile-ticker {
    font-weight: 800;
    font-size: 1.25rem;
    color: #1a2332;
    letter-spacing: -0.01em;
}

.tile-delta {
    font-weight: 700;
    font-size: 1.1rem;
    font-family: 'JetBrains Mono', monospace;
}

.tile-gain .tile-delta { color: #059669; }
.tile-loss .tile-delta { color: #dc2626; }

.tile-rank-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-top: 0.25rem;
}
