:root {
    --bg-color: #f8f9fa;
    --text-color: #333;
    --panel-bg: #ffffff;
    --border-color: #e0e0e0;
    --accent-blue: #4a90e2;
    --accent-green: #d4edda;
    --header-green-text: #155724;
    --header-blue-bg: #cce5ff;
    --header-blue-text: #004085;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);

    /* Chart Colors */
    --color-a: #ff6384;
    --color-b: #36a2eb;
    --color-c: #4bc0c0;
}

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

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
}

.main-header {
    text-align: center;
    margin-bottom: 20px;
}

.main-header h1 {
    font-size: 1.5rem;
    font-weight: 500;
}

.content-wrapper {
    display: flex;
    gap: 30px;
    flex: 1;
    min-height: 0;
    /* Important for scroll */
}

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

/* Specific Panel widths based on image hint (~40% left, 60% right) */
.graph-panel {
    flex: 2;
}

.input-panel {
    flex: 3;
    background-color: #f0f8ff;
    /* Light blue background for the container */
}

.panel-header {
    padding: 10px 20px;
    text-align: center;
    font-weight: bold;
}

.section-header-green {
    background-color: #e8f5e9;
    color: var(--header-green-text);
    border-bottom: 3px solid #a5d6a7;
}

.section-header-blue {
    background-color: #e3f2fd;
    color: var(--header-blue-text);
    border-bottom: 3px solid #90caf9;
}

/* Graph Panel Controls */
.graph-controls {
    display: flex;
    justify-content: space-around;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.control-item .label {
    font-weight: 600;
    font-size: 0.9rem;
}

.status-text {
    font-size: 0.7rem;
    color: #666;
}

/* Select Dropdown */
.approx-select {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-family: inherit;
    font-size: 0.9rem;
    background-color: white;
    cursor: pointer;
}

.approx-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.canvas-container {
    flex: 1;
    padding: 20px 20px 20px 40px;
    /* Increase left padding for 'y' label */
    position: relative;
    min-height: 0;
    /* Allows canvas to resize properly */
}

.y-axis-label {
    position: absolute;
    top: 20px;
    /* Align with top padding */
    left: 15px;
    font-weight: bold;
    color: #666;
    font-size: 0.9rem;
    pointer-events: none;
}

.x-axis-label {
    position: absolute;
    bottom: 5px;
    /* Moved down to avoid overlap */
    right: 20px;
    font-weight: bold;
    color: #666;
    font-size: 0.9rem;
    pointer-events: none;
}

/* Input Panel Grid */
.data-grid {
    display: flex;
    flex: 1;
    gap: 15px;
    padding: 20px;
    overflow: hidden;
}

.data-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    background-color: #f1f8ff;
    /* Slight blue tint for column bg */
}

.group-header {
    text-align: center;
    padding: 8px;
    background-color: #e3f2fd;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.table-header {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding-right: 10px;
    /* Match scrollbar width */
}

.table-header .col {
    flex: 1;
    text-align: center;
    padding: 5px;
    font-size: 0.9rem;
    background-color: #fff;
    border-right: 1px solid var(--border-color);
}

.table-header .col:last-child {
    border-right: none;
}

.table-body {
    flex: 1;
    overflow-y: scroll;
    /* Always show scrollbar to ensure alignment */
    background-color: #fff;
}

/* Custom Scrollbar for alignment consistency */
.table-body::-webkit-scrollbar {
    width: 10px;
}

.table-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.table-body::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.data-row {
    display: flex;
    border-bottom: 1px solid #eee;
}

.data-row input {
    flex: 1;
    width: 100%;
    border: none;
    padding: 8px 5px;
    text-align: center;
    font-size: 1rem;
    outline: none;
    transition: background 0.2s;
}

.data-row input:focus {
    background-color: #e8f0fe;
}

.data-row input:first-child {
    border-right: 1px solid #eee;
}

/* Color matching for Data Headers */
.data-group:nth-child(1) .group-header {
    color: var(--color-a);
    font-weight: 700;
}

.data-group:nth-child(2) .group-header {
    color: var(--color-b);
    font-weight: 700;
}

.data-group:nth-child(3) .group-header {
    color: var(--color-c);
    font-weight: 700;
}