/* === Reset & Variables === */
:root {
    --accent: #39C5BB;
    --bg: #F6E8EA;
    --text: #241623;
    --sidebar-bg: #241623;
    --white: #ffffff;
}

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

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

/* === Login Page === */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg);
}

.login-box {
    background: var(--white);
    border: 1px solid var(--text);
    border-radius: 12px;
    padding: 48px 40px;
    width: 380px;
    text-align: center;
}

.login-logo img {
    height: 32px;
    margin-bottom: 8px;
    filter: brightness(0) saturate(100%);
}

.login-title {
    font-size: 14px;
    font-weight: 400;
    color: #888;
    margin-bottom: 32px;
    letter-spacing: 2px;
}

.login-form .form-group {
    margin-bottom: 16px;
    text-align: left;
}

.login-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
    transition: border-color 0.2s;
    outline: none;
}

.login-form input:focus {
    border-color: var(--accent);
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s;
}

.login-btn:hover {
    opacity: 0.85;
}

.login-error {
    background: #ffe0e0;
    color: #c00;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* === App Layout === */
.app-layout {
    display: flex;
    height: 100vh;
}

/* === Sidebar === */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    height: 24px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.nav-item:hover {
    color: var(--white);
    background: rgba(255,255,255,0.06);
}

.nav-item.active {
    color: var(--white);
    background: var(--accent);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.logout-item {
    color: rgba(255,255,255,0.4) !important;
}

.logout-item:hover {
    color: #ff6b6b !important;
    background: rgba(255,107,107,0.08) !important;
}

/* === Sidebar Toggle === */
.sidebar-logo-small { display: none; }

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s;
    margin-top: 4px;
}

.sidebar-toggle:hover {
    color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.06);
}

.sidebar-toggle svg { width: 16px; height: 16px; }

.toggle-icon-expand { display: none; }

/* Collapsed state */
.sidebar.collapsed {
    width: 64px;
    min-width: 64px;
}

.sidebar.collapsed .sidebar-header {
    padding: 16px 12px 12px;
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .sidebar-logo-full { display: none; }
.sidebar.collapsed .sidebar-logo-small {
    display: block;
    height: 28px;
    width: 28px;
    object-fit: contain;
}

.sidebar.collapsed .sidebar-nav { padding: 12px 6px; }

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px;
    gap: 0;
}

.sidebar.collapsed .nav-label { display: none; }

.sidebar.collapsed .nav-item svg {
    width: 20px;
    height: 20px;
}

.sidebar.collapsed .sidebar-footer { padding: 8px 6px; }

.sidebar.collapsed .toggle-icon-collapse { display: none; }
.sidebar.collapsed .toggle-icon-expand { display: block; }

.sidebar.collapsed .sidebar-toggle {
    padding: 10px;
    justify-content: center;
}

/* Transition */
.sidebar {
    transition: width 0.2s ease;
}

/* === Main Content === */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--white);
    border-bottom: 1px solid rgba(36,22,35,0.1);
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
}

.user-info svg {
    width: 18px;
    height: 18px;
}

.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* === Page Subtitle === */
.page-subtitle {
    font-size: 14px;
    color: rgba(36,22,35,0.5);
    margin-bottom: 28px;
}

/* === Dashboard Grid === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.dash-card {
    background: var(--white);
    border: 1px solid rgba(36,22,35,0.08);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.2s;
    cursor: default;
}

.dash-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(57,197,187,0.1);
    transform: translateY(-2px);
}

.dash-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-card-icon svg {
    width: 22px;
    height: 22px;
}

.dash-card-body h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.dash-card-body p {
    font-size: 13px;
    color: rgba(36,22,35,0.5);
}

.dash-card-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid rgba(36,22,35,0.06);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
}

.status-dot.connected {
    background: var(--accent);
}

.status-dot.waiting {
    background: #FDCB6E;
}

.status-text {
    font-size: 12px;
    color: rgba(36,22,35,0.4);
}

/* === Sub Page: Empty State === */
.page-header-section {
    margin-bottom: 8px;
}

.page-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 240px);
}

.empty-state {
    text-align: center;
    max-width: 400px;
}

.empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: rgba(57,197,187,0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.empty-icon svg {
    width: 32px;
    height: 32px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 14px;
    color: rgba(36,22,35,0.45);
    line-height: 1.7;
    margin-bottom: 24px;
}

.empty-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.meta-badge svg {
    width: 14px;
    height: 14px;
}

.meta-badge.ready {
    background: rgba(57,197,187,0.12);
    color: var(--accent);
}

.meta-badge.waiting {
    background: rgba(253,203,110,0.15);
    color: #E17055;
}

/* === RSViewer Page === */
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.rs-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rs-search-input {
    padding: 7px 14px;
    border: 1px solid rgba(36,22,35,0.15);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    outline: none;
    width: 200px;
    transition: border-color 0.2s;
}

.rs-search-input:focus {
    border-color: var(--accent);
}

.rs-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.rs-btn svg {
    width: 15px;
    height: 15px;
}

.rs-btn-update {
    background: var(--accent);
    color: var(--white);
}

.rs-btn-update:hover {
    opacity: 0.85;
}

.rs-btn-update:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rs-btn-update.updating svg {
    animation: spin 1s linear infinite;
}

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

.rs-content {
    padding: 20px 28px !important;
}

.rs-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.rs-status-bar .page-subtitle {
    margin-bottom: 0;
}

.rs-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(36,22,35,0.5);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
}

.status-indicator.connected {
    background: var(--accent);
}

.status-indicator.loading {
    background: #FDCB6E;
    animation: pulse 1s ease-in-out infinite;
}

.status-indicator.error {
    background: #E17055;
}

.status-indicator.warning {
    background: #FDCB6E;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* RS Panels */
.rs-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    height: calc(100vh - 200px);
}

.rs-panel {
    background: var(--white);
    border: 1px solid rgba(36,22,35,0.08);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rs-panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(36,22,35,0.06);
    flex-shrink: 0;
}

.rs-panel-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.rs-panel-header h3 svg {
    width: 16px;
    height: 16px;
    color: var(--accent);
}

.rs-count {
    font-size: 12px;
    font-weight: 500;
    color: rgba(36,22,35,0.4);
    background: rgba(36,22,35,0.05);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 4px;
}

.rs-table-wrap {
    flex: 1;
    overflow-y: auto;
}

/* RS Table */
.rs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.rs-table thead {
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 1;
}

.rs-table th {
    padding: 9px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(36,22,35,0.45);
    border-bottom: 1px solid rgba(36,22,35,0.06);
    white-space: nowrap;
    user-select: none;
}

.rs-table th.sortable {
    cursor: pointer;
}

.rs-table th.sortable:hover {
    color: var(--accent);
}

.rs-table th.active-sort {
    color: var(--accent);
}

.rs-table th.active-sort::after {
    content: ' \u25BC';
    font-size: 9px;
}

.rs-table th.active-sort.asc::after {
    content: ' \u25B2';
}

.rs-table td {
    padding: 7px 14px;
    border-bottom: 1px solid rgba(36,22,35,0.03);
}

.rs-table tbody tr:hover {
    background: rgba(57,197,187,0.04);
}

.rs-table .col-ticker {
    font-weight: 600;
    font-size: 12px;
    color: var(--text);
    width: 80px;
}

.rs-table .col-name {
    color: var(--text);
}

.rs-table .col-return {
    text-align: right;
    font-variant-numeric: tabular-nums;
    width: 80px;
}

.rs-table .col-rs {
    text-align: center;
    width: 55px;
}

.ret-pos {
    color: #1B5E20;
}

.ret-neg {
    color: #B71C1C;
}

.rs-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: center;
}

.rs-badge.rs-high {
    background: rgba(27,94,32,0.1);
    color: #1B5E20;
}

.rs-badge.rs-mid {
    background: rgba(36,22,35,0.06);
    color: #555;
}

.rs-badge.rs-low {
    background: rgba(183,28,28,0.08);
    color: #B71C1C;
}

.rs-hidden {
    display: none;
}

.rs-highlight {
    background: rgba(255,241,118,0.3) !important;
}

/* Clickable rows */
.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: rgba(57,197,187,0.06) !important;
}

/* Last updated */
.rs-status-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.rs-status-left .page-subtitle {
    margin-bottom: 0;
}

.rs-last-updated {
    font-size: 11px;
    color: rgba(36,22,35,0.35);
    background: rgba(36,22,35,0.04);
    padding: 3px 10px;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
}

/* Outperformer button */
.rs-btn-outperformer {
    background: rgba(36,22,35,0.08);
    color: var(--text);
}

.rs-btn-outperformer:hover {
    background: rgba(36,22,35,0.14);
}

/* === Modal Overlay === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(36,22,35,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--white);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-chart {
    width: 860px;
    height: 600px;
}

.modal-outperformer {
    width: 1060px;
    height: 680px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(36,22,35,0.08);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: rgba(36,22,35,0.4);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.15s;
}

.modal-close:hover {
    background: rgba(36,22,35,0.06);
    color: var(--text);
}

.modal-body {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
}

.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: rgba(36,22,35,0.4);
    font-size: 14px;
}

/* Chart canvases */
#price-chart {
    width: 100% !important;
    height: 230px !important;
    margin-bottom: 16px;
}

#rs-chart {
    width: 100% !important;
    height: 200px !important;
}

/* === Outperformer === */
.outperformer-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    height: 100%;
}

.outperformer-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.outperformer-panel h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(36,22,35,0.08);
    margin-bottom: 8px;
    flex-shrink: 0;
}

.outperformer-table-wrap {
    flex: 1;
    overflow-y: auto;
}

.outperformer-table .col-rank {
    width: 30px;
    text-align: center;
    color: rgba(36,22,35,0.35);
    font-size: 11px;
}

.outperformer-table .col-mkt {
    width: 35px;
    text-align: center;
    font-size: 11px;
    color: rgba(36,22,35,0.45);
}

.outperformer-table .col-change {
    width: 60px;
    text-align: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* === Research Page === */
.research-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 800px;
}

.research-card {
    background: var(--white);
    border: 1px solid rgba(36,22,35,0.08);
    border-radius: 12px;
    padding: 28px;
    transition: all 0.2s;
}

.research-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(57,197,187,0.08);
}

.research-card-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.research-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.research-card-icon svg {
    width: 24px;
    height: 24px;
}

.research-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.research-card-desc {
    font-size: 13px;
    color: rgba(36,22,35,0.5);
    line-height: 1.5;
}

/* DRD Input */
.drd-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.drd-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(36,22,35,0.15);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.drd-input:focus {
    border-color: var(--accent);
}

.drd-input::placeholder {
    color: rgba(36,22,35,0.3);
}

/* DRD Status */
.drd-status-area {
    margin-top: 16px;
}

.drd-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(36,22,35,0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.drd-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.drd-status-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drd-status-text {
    font-size: 12px;
    color: rgba(36,22,35,0.5);
}

.drd-status-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.drd-result {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(57,197,187,0.08);
    border-radius: 8px;
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
}

.drd-result svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.drd-result-path {
    font-size: 11px;
    color: rgba(36,22,35,0.4);
    margin-left: auto;
    font-weight: 400;
}

/* Naver Finance */
.nf-error {
    margin-top: 14px;
    padding: 12px 16px;
    background: rgba(225,112,85,0.08);
    border: 1px solid rgba(225,112,85,0.15);
    border-radius: 8px;
    color: #B71C1C;
    font-size: 13px;
}

.nf-company-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 0;
}

.nf-code {
    font-size: 12px;
    color: rgba(36,22,35,0.5);
    font-variant-numeric: tabular-nums;
}

.nf-market {
    font-size: 11px;
    color: rgba(36,22,35,0.35);
    padding: 2px 8px;
    background: rgba(36,22,35,0.04);
    border-radius: 4px;
}

.nf-market-cap {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
    margin-left: 4px;
    padding: 2px 10px;
    background: rgba(57,197,187,0.10);
    border-radius: 4px;
}

.nf-table-section {
    margin-top: 20px;
}

.nf-table-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.nf-table-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    padding-left: 2px;
    margin: 0;
}

.nf-col-toggle-btn {
    font-size: 11.5px;
    padding: 3px 10px;
    border: 1px solid rgba(36,22,35,0.15);
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
}
.nf-col-toggle-btn:hover {
    background: rgba(36,22,35,0.05);
}

.nf-col-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    background: rgba(36,22,35,0.02);
    border: 1px solid rgba(36,22,35,0.08);
    border-radius: 6px;
}
.nf-col-selector label {
    font-size: 11.5px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}
.nf-col-selector label input[type="checkbox"] {
    margin: 0;
    width: 13px;
    height: 13px;
}

.nf-col-hidden {
    display: none !important;
}

.nf-table-wrapper {
    overflow-x: auto;
    border: 1px solid rgba(36,22,35,0.08);
    border-radius: 8px;
}

.nf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    white-space: nowrap;
}

.nf-table thead th {
    background: rgba(36,22,35,0.03);
    padding: 8px 12px;
    text-align: right;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid rgba(36,22,35,0.10);
    position: sticky;
    top: 0;
}

.nf-table thead th:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 2;
    background: rgba(36,22,35,0.03);
}

.nf-table tbody td {
    padding: 7px 12px;
    text-align: right;
    color: var(--text);
    border-bottom: 1px solid rgba(36,22,35,0.04);
}

.nf-table tbody td.nf-row-label {
    text-align: left;
    font-weight: 500;
    color: var(--text);
    position: sticky;
    left: 0;
    background: var(--white);
    z-index: 1;
}

.nf-table tbody tr:hover td {
    background: rgba(57,197,187,0.04);
}

.nf-table tbody tr:hover td.nf-row-label {
    background: rgba(57,197,187,0.06);
}

/* (E) 추정치 열 음영 */
.nf-table th.nf-est {
    background: rgba(57,197,187,0.28);
}

.nf-table td.nf-est {
    background: rgba(57,197,187,0.12);
}

.nf-table tbody tr:hover td.nf-est {
    background: rgba(57,197,187,0.20);
}

/* 사업부별 세그먼트 행 */
.nf-segment-row td {
    font-size: 11px;
    font-style: italic;
    color: rgba(36,22,35,0.6);
    background: rgba(36,22,35,0.015);
    font-style: italic;
}

.nf-segment-label {
    padding-left: 28px !important;
    font-weight: 400 !important;
}

.nf-segment-row:hover td {
    background: rgba(36,22,35,0.04);
}

/* 매출액 / 영업이익 / 당기순이익 볼드 행 */
.nf-bold-row td,
.nf-table tbody .nf-bold-row td.nf-row-label {
    font-weight: 700;
}

/* === Account Management Page === */
.acct-card {
    background: var(--white);
    border: 1px solid rgba(36,22,35,0.08);
    border-radius: 12px;
    padding: 24px 28px;
    max-width: 720px;
}

.acct-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.acct-card-header svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.acct-card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.acct-count {
    font-size: 12px;
    font-weight: 500;
    color: rgba(36,22,35,0.4);
    background: rgba(36,22,35,0.05);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 4px;
}

.acct-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.acct-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(36,22,35,0.15);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.acct-input:focus {
    border-color: var(--accent);
}

.acct-input::placeholder {
    color: rgba(36,22,35,0.3);
}

.acct-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.acct-btn svg {
    width: 15px;
    height: 15px;
}

.acct-btn-add {
    background: var(--accent);
    color: var(--white);
}

.acct-btn-add:hover {
    opacity: 0.85;
}

.acct-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
}

.acct-msg-ok {
    background: rgba(57,197,187,0.1);
    color: var(--accent);
}

.acct-msg-error {
    background: rgba(225,112,85,0.08);
    color: #B71C1C;
}

.acct-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(36,22,35,0.08);
    border-radius: 8px;
}

.acct-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.acct-table thead th {
    background: rgba(36,22,35,0.03);
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(36,22,35,0.45);
    border-bottom: 1px solid rgba(36,22,35,0.08);
}

.acct-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(36,22,35,0.04);
    color: var(--text);
}

.acct-table tbody tr:hover td {
    background: rgba(57,197,187,0.04);
}

.acct-col-username {
    font-weight: 600;
}

.acct-col-date {
    font-size: 12px;
    color: rgba(36,22,35,0.5);
    font-variant-numeric: tabular-nums;
}

.acct-col-action {
    width: 50px;
    text-align: center;
}

.acct-role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.role-admin {
    background: rgba(57,197,187,0.12);
    color: var(--accent);
}

.role-user {
    background: rgba(36,22,35,0.06);
    color: rgba(36,22,35,0.5);
}

.acct-btn-delete {
    background: none;
    border: none;
    color: rgba(36,22,35,0.3);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.acct-btn-delete svg {
    width: 15px;
    height: 15px;
}

.acct-btn-delete:hover {
    color: #E17055;
    background: rgba(225,112,85,0.08);
}

/* === Conference Call / Earnings Call Page === */
.ec-search-card {
    background: var(--white);
    border: 1px solid rgba(36,22,35,0.08);
    border-radius: 12px;
    padding: 20px 24px;
    max-width: 800px;
}

.ec-search-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ec-search-icon {
    width: 20px;
    height: 20px;
    color: rgba(36,22,35,0.3);
    flex-shrink: 0;
}

.ec-search-input {
    flex: 1;
    padding: 10px 0;
    border: none;
    font-size: 15px;
    color: var(--text);
    outline: none;
    background: transparent;
}

.ec-search-input::placeholder {
    color: rgba(36,22,35,0.3);
}

.ec-status-area {
    margin-top: 16px;
    max-width: 800px;
}

.ec-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(36,22,35,0.5);
    padding: 10px 0;
}

.ec-error {
    margin-top: 16px;
    max-width: 800px;
    padding: 14px 18px;
    background: rgba(225,112,85,0.08);
    border: 1px solid rgba(225,112,85,0.15);
    border-radius: 8px;
    color: #B71C1C;
    font-size: 13px;
}

/* EC Result */
.ec-result {
    margin-top: 16px;
    max-width: 900px;
    background: var(--white);
    border: 1px solid rgba(36,22,35,0.08);
    border-radius: 12px;
    overflow: hidden;
}

.ec-result-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(36,22,35,0.06);
}

.ec-result-meta h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    line-height: 1.4;
}

.ec-result-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ec-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(57,197,187,0.12);
    color: var(--accent);
}

.ec-source-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
}

.ec-source-link svg {
    width: 13px;
    height: 13px;
}

.ec-source-link:hover {
    text-decoration: underline;
}

.ec-saved {
    font-size: 11px;
    color: rgba(36,22,35,0.35);
}

.ec-transcript-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.ec-transcript-body pre {
    font-family: 'Pretendard', -apple-system, sans-serif;
    font-size: 13px;
    line-height: 1.8;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

/* === Notes Page === */
.notes-app {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.notes-sidebar {
    width: 260px;
    min-width: 200px;
    background: var(--white);
    border-right: 1px solid rgba(36,22,35,0.08);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
}

.notes-sidebar-header {
    padding: 16px 14px 12px;
    border-bottom: 1px solid rgba(36,22,35,0.08);
}

.notes-sidebar-title {
    font-size: 11px;
    font-weight: 700;
    color: rgba(36,22,35,0.4);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 10px;
}

.notes-new-btn {
    width: 100%;
    padding: 8px 12px;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    transition: opacity 0.15s;
}

.notes-new-btn:hover { opacity: 0.85; }

.notes-new-btn svg { width: 14px; height: 14px; }

.notes-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(36,22,35,0.08);
}

.notes-search-icon { width: 14px; height: 14px; color: rgba(36,22,35,0.3); flex-shrink: 0; }

.notes-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--text);
    outline: none;
    font-family: inherit;
}

.notes-search-input::placeholder { color: rgba(36,22,35,0.3); }

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0 16px;
}

.notes-folder-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(36,22,35,0.45);
    cursor: pointer;
    user-select: none;
}

.notes-folder-row:hover { color: var(--text); }

.notes-folder-arrow {
    font-size: 9px;
    transition: transform 0.15s;
    display: inline-block;
    width: 10px;
}

.notes-folder-arrow.open { transform: rotate(90deg); }

.notes-folder-children { display: none; }
.notes-folder-children.open { display: block; }

.notes-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 14px 6px 28px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    border-radius: 5px;
    margin: 1px 6px;
    transition: background 0.1s;
    white-space: normal;
    word-break: break-word;
}

.notes-item.root-note { padding-left: 14px; }
.notes-item:hover { background: rgba(36,22,35,0.04); }
.notes-item.active { background: rgba(57,197,187,0.12); font-weight: 500; }

/* Notes Main Area */
.notes-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--white);
}

.notes-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 32px;
    border-bottom: 1px solid rgba(36,22,35,0.08);
    min-height: 52px;
    flex-shrink: 0;
}

.notes-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.notes-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Notes Toolbar */
.notes-toolbar {
    display: none;
    align-items: center;
    gap: 3px;
    padding: 8px 32px;
    border-bottom: 1px solid rgba(36,22,35,0.08);
    background: var(--bg);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.notes-toolbar.active { display: flex; }

.ntb-btn {
    padding: 5px 9px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
    transition: background 0.1s;
}

.ntb-btn:hover { background: rgba(36,22,35,0.06); border-color: rgba(36,22,35,0.1); }

.ntb-sep { width: 1px; height: 18px; background: rgba(36,22,35,0.1); margin: 0 3px; flex-shrink: 0; }

/* Notes Content Pane */
.notes-content-pane {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notes-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(36,22,35,0.3);
    text-align: center;
    padding: 40px;
}

.notes-welcome-icon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: rgba(57,197,187,0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.notes-welcome-icon svg { width: 28px; height: 28px; }

.notes-welcome h2 { font-size: 18px; font-weight: 600; color: rgba(36,22,35,0.35); margin-bottom: 6px; }
.notes-welcome p { font-size: 14px; color: rgba(36,22,35,0.3); }

/* Notes Meta (author / created) */
.notes-meta {
    display: none;
    align-items: center;
    gap: 16px;
    padding: 0 0 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(36,22,35,0.06);
}

.notes-meta-author, .notes-meta-date {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: rgba(36,22,35,0.45);
    background: rgba(36,22,35,0.04);
    padding: 3px 10px;
    border-radius: 4px;
}

/* Notes View Area */
.notes-view {
    flex: 1;
    overflow-y: auto;
    padding: 36px 64px;
    display: none;
}

/* Notes TOC */
.notes-toc {
    background: var(--bg);
    border: 1px solid rgba(36,22,35,0.08);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 24px;
    display: none;
}

.notes-toc.show { display: block; }

.notes-toc h4 {
    font-size: 11px;
    font-weight: 700;
    color: rgba(36,22,35,0.4);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.notes-toc ul { list-style: none; padding: 0; }
.notes-toc li { padding: 2px 0; }
.notes-toc a { color: var(--accent); font-size: 13px; text-decoration: none; }
.notes-toc a:hover { text-decoration: underline; }
.notes-toc-h2 { padding-left: 14px; }
.notes-toc-h3 { padding-left: 28px; }

/* Markdown Styles for Notes View */
.md-styles { line-height: 1.78; font-size: 15px; }
.md-styles h1 { font-size: 1.8em; font-weight: 700; margin: 1.2em 0 0.5em; border-bottom: 1px solid rgba(36,22,35,0.08); padding-bottom: 0.25em; }
.md-styles h2 { font-size: 1.4em; font-weight: 600; margin: 1em 0 0.4em; }
.md-styles h3 { font-size: 1.15em; font-weight: 600; margin: 0.9em 0 0.35em; }
.md-styles p { margin: 0.55em 0; }
.md-styles ul, .md-styles ol { margin: 0.5em 0 0.5em 1.5em; }
.md-styles li { margin: 0.28em 0; }
.md-styles blockquote { border-left: 3px solid rgba(36,22,35,0.1); padding: 4px 16px; margin: 0.8em 0; color: rgba(36,22,35,0.5); }
.md-styles code { background: var(--bg); border-radius: 4px; padding: 2px 5px; font-family: 'Fira Code', 'Courier New', monospace; font-size: 0.87em; }
.md-styles pre { background: var(--bg); border-radius: 8px; padding: 16px; overflow-x: auto; margin: 1em 0; }
.md-styles pre code { background: none; padding: 0; }
.md-styles a { color: var(--accent); text-decoration: none; }
.md-styles a:hover { text-decoration: underline; }
.md-styles img { max-width: 100%; border-radius: 6px; margin: 10px 0; display: block; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.md-styles table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 14px; }
.md-styles th, .md-styles td { border: 1px solid rgba(36,22,35,0.1); padding: 7px 12px; text-align: left; }
.md-styles th { background: var(--bg); font-weight: 600; }
.md-styles hr { border: none; border-top: 1px solid rgba(36,22,35,0.1); margin: 1.5em 0; }
.obs-link { color: var(--accent); cursor: pointer; }
.obs-link:hover { text-decoration: underline; }

/* Rich Editor */
.notes-editor {
    flex: 1;
    overflow-y: auto;
    padding: 36px 64px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.85;
    background: var(--white);
    color: var(--text);
    outline: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    display: none;
}

.notes-editor.active { display: block; }

.notes-editor .img-block {
    margin: 12px 0;
    padding: 0;
    user-select: none;
    border-radius: 8px;
    display: block;
    max-width: 100%;
    cursor: default;
    position: relative;
}

.notes-editor .img-block img {
    max-width: 100%;
    display: block;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.notes-editor .img-block .img-label {
    font-size: 11px;
    color: rgba(36,22,35,0.4);
    margin-top: 4px;
    font-family: -apple-system, sans-serif;
}

.notes-editor .img-block .img-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    display: none;
}

.notes-editor .img-block:hover .img-delete { display: block; }

/* Upload Indicator */
.notes-upload-indicator {
    position: fixed;
    top: 60px;
    right: 20px;
    background: var(--sidebar-bg);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    z-index: 300;
    display: none;
}

.notes-upload-indicator.show { display: block; }

/* Notes scrollbar */
.notes-list::-webkit-scrollbar,
.notes-view::-webkit-scrollbar,
.notes-editor::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.notes-list::-webkit-scrollbar-track,
.notes-view::-webkit-scrollbar-track,
.notes-editor::-webkit-scrollbar-track {
    background: transparent;
}

.notes-list::-webkit-scrollbar-thumb,
.notes-view::-webkit-scrollbar-thumb,
.notes-editor::-webkit-scrollbar-thumb {
    background: rgba(36,22,35,0.15);
    border-radius: 3px;
}
