/* ---------- Variables & Typography ---------- */
:root {
    --bg-color: #F4F5F7;
    --card-bg: #FFFFFF;
    --text-main: #1B263B;
    --text-muted: #7C8B9E;
    --primary-color: #415A77;
    --primary-hover: #2C3E52;
    --accent-color: #E0A96D;
    --accent-hover: #C58F55;
    --border-color: #E2E8F0;
    --sidebar-bg: #0D141F;
    --sidebar-text: #A0AABF;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- App Layout ---------- */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-color);
}

/* ---------- Sidebar Navigation ---------- */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0,0,0,0.05);
    z-index: 10;
    flex-shrink: 0;
}

.brand {
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-color), #F3C38E);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-bg);
    font-size: 1.3rem;
    box-shadow: 0 4px 15px rgba(224, 169, 109, 0.25);
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: 0.5px;
}

.nav-menu {
    flex: 1;
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.nav-item {
    padding: 1rem 2rem;
    text-decoration: none;
    color: var(--sidebar-text);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    border-left: 4px solid transparent;
    font-size: 0.95rem;
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    opacity: 0.7;
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #FFFFFF;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: #FFFFFF;
    border-left-color: var(--accent-color);
}

.nav-item.active i {
    opacity: 1;
    color: var(--accent-color);
}

.user-profile {
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-size: 1.2rem;
}

.user-profile .info {
    display: flex;
    flex-direction: column;
}

.user-profile .name {
    font-weight: 600;
    color: #FFFFFF;
    font-size: 0.95rem;
}

.user-profile .role {
    font-size: 0.8rem;
    color: var(--sidebar-text);
}

/* ---------- Main Content Area ---------- */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem 3rem;
    display: flex;
    flex-direction: column;
}

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

.header-title h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.3rem;
    letter-spacing: -0.5px;
}

.header-title p {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
}

.icon-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
}

.icon-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* ---------- Dashboard Grid & Cards ---------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.glass-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition);
}

.glass-card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.card-header.flex-between {
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.badge {
    background: rgba(224, 169, 109, 0.15);
    color: var(--accent-hover);
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.card-body {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-body.p-0 {
    padding: 0;
}

/* ---------- Forms & Inputs ---------- */
.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.6rem;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 1rem;
    transition: var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(65, 90, 119, 0.1);
    background: #FFFFFF;
}

.input-wrapper i {
    color: var(--text-muted);
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

input[type="text"],
input[type="number"] {
    flex: 1;
    border: none;
    outline: none;
    padding: 1rem 0.8rem;
    background: transparent;
    font-size: 0.95rem;
    color: var(--text-main);
    font-family: inherit;
    font-weight: 500;
}

input::placeholder,
textarea::placeholder {
    color: #A0AABF;
    font-weight: 400;
}

textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-main);
    background: var(--bg-color);
    outline: none;
    resize: vertical;
    transition: var(--transition);
}

textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(65, 90, 119, 0.1);
    background: #FFFFFF;
}

/* ---------- Buttons ---------- */
button {
    font-family: inherit;
    border: none;
    outline: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: var(--transition);
}

.btn-primary {
    width: 100%;
    background: var(--primary-color);
    color: #FFFFFF;
    font-size: 1rem;
    font-weight: 600;
    padding: 1.1rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(65, 90, 119, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(65, 90, 119, 0.35);
}

.btn-accent {
    width: 100%;
    background: var(--accent-color);
    color: #FFFFFF;
    font-size: 1rem;
    font-weight: 600;
    padding: 1.1rem;
    border-radius: var(--radius-md);
    margin-top: 2rem;
    box-shadow: 0 4px 15px rgba(224, 169, 109, 0.3);
}

.btn-accent:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(224, 169, 109, 0.45);
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-text:hover {
    color: var(--primary-color);
}

/* ---------- Preview Section (WASM Target) ---------- */
.preview-canvas {
    background: linear-gradient(160deg, #F8FAFC 0%, #F1F5F9 100%);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    flex: 1;
    border: 1px dashed #CBD5E1;
    display: flex;
    flex-direction: column;
}

.report-header {
    text-align: center;
    margin-bottom: 2rem;
}

.report-header h4 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
}

.report-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.result-highlight {
    text-align: center;
    margin-bottom: 2.5rem;
    background: #FFFFFF;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(226, 232, 240, 0.6);
}

.highlight-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.highlight-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: -1px;
    text-shadow: 0 2px 10px rgba(224, 169, 109, 0.15);
}

/* ---------- Bar Chart Simulation ---------- */
.visual-placeholder {
    margin-bottom: 2.5rem;
    height: 150px;
    display: flex;
    justify-content: center;
}

.bar-chart {
    height: 100%;
    width: 70%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2.5rem;
    border-bottom: 2px solid var(--border-color);
}

.bar {
    width: 65px;
    border-radius: 6px 6px 0 0;
    position: relative;
    transition: height 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.principal-bar {
    background: linear-gradient(180deg, #94A3B8 0%, #64748B 100%);
    box-shadow: 0 -4px 15px rgba(100, 116, 139, 0.1);
}

.interest-bar {
    background: linear-gradient(180deg, var(--accent-color) 0%, #C88A4A 100%);
    box-shadow: 0 -4px 20px rgba(224, 169, 109, 0.3);
}

.tooltip {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-main);
    color: #FFFFFF;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.bar:hover .tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

/* ---------- Report Message Box ---------- */
.report-message-box {
    background: #FFFFFF;
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem 1.8rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    position: relative;
    box-shadow: var(--shadow-soft);
}

.quote-icon {
    position: absolute;
    top: -0.5rem;
    right: 1.5rem;
    font-size: 3rem;
    color: rgba(65, 90, 119, 0.04);
}

.message-content {
    font-size: 0.95rem;
    color: var(--text-main);
    font-style: italic;
    position: relative;
    z-index: 1;
    line-height: 1.7;
}

/* ---------- History Table ---------- */
.history-section {
    margin-top: 0;
}

.table-responsive {
    overflow-x: auto;
}

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

.history-table th, 
.history-table td {
    padding: 1.2rem 2rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.history-table th {
    background: #F8FAFC;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 700;
}

.history-table td {
    font-size: 0.95rem;
    color: var(--text-main);
    vertical-align: middle;
    font-weight: 500;
}

.history-table tbody tr {
    transition: background 0.2s ease;
}

.history-table tbody tr:hover {
    background: rgba(244, 245, 247, 0.6);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem !important;
}

.empty-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
}

.empty-content i {
    font-size: 3.5rem;
    opacity: 0.3;
}

.empty-content p {
    font-size: 1rem;
    font-weight: 500;
}

/* ---------- Responsive Design ---------- */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: center;
        padding: 0.5rem 1rem;
        z-index: 100;
    }

    .brand {
        padding: 0.5rem;
        border: none;
    }
    
    .brand-name {
        display: none;
    }

    .nav-menu {
        flex-direction: row;
        padding: 0;
        overflow-x: auto;
        margin-left: 1rem;
    }

    .nav-item {
        padding: 0.8rem;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .nav-item.active {
        border-left: none;
        border-bottom-color: var(--accent-color);
    }

    .user-profile {
        display: none;
    }

    .main-content {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}
```