/* テーマ: ブルー（デフォルト - クリーン・爽やか） */
:root {
    --sidebar-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    --sidebar-text: #e2e8f0;
    --sidebar-hover: rgba(255,255,255,0.1);
    --main-bg: linear-gradient(135deg, #a5d8ff 0%, #74c0fc 100%);
    --card-bg: white;
    --card-text: #1e293b;
    --card-border: #e2e8f0;
    --table-header-bg: #1e293b;
    --table-header-text: white;
    --table-border: #e2e8f0;
    --input-bg: white;
    --input-border: #cbd5e1;
}
/* テーマ: ダーク（全体黒、白文字） */
body.theme-dark {
    --sidebar-bg: linear-gradient(180deg, #18181b 0%, #09090b 100%);
    --sidebar-text: #a1a1aa;
    --sidebar-hover: rgba(255,255,255,0.08);
    --main-bg: #18181b;
    --card-bg: #27272a;
    --card-text: #fafafa;
    --card-border: #3f3f46;
    --table-header-bg: #3f3f46;
    --table-header-text: #fafafa;
    --table-border: #3f3f46;
    --input-bg: #3f3f46;
    --input-border: #52525b;
}
/* テーマ: ライト（クリーンホワイト） */
body.theme-light {
    --sidebar-bg: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    --sidebar-text: #334155;
    --sidebar-hover: rgba(0,0,0,0.05);
    --main-bg: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    --card-bg: white;
    --card-text: #1e293b;
    --card-border: #cbd5e1;
    --table-header-bg: #e2e8f0;
    --table-header-text: #1e293b;
    --table-border: #cbd5e1;
    --input-bg: white;
    --input-border: #94a3b8;
    
    /* フォントサイズ統一 */
    --font-size-xs: 11px;
    --font-size-sm: 12px;
    --font-size-base: 13px;
    --font-size-md: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    
    /* テーブル用フォント */
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', monospace;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: var(--font-size-base);
    background: var(--main-bg);
    min-height: 100vh;
    overflow-x: auto;
}
.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--sidebar-bg);
    color: white;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}
.sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}
.sidebar-header {
    padding: 10px 20px 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-footer {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.sidebar-logo-img {
    max-width: 80px;
    height: auto;
    opacity: 0.4;
}
.sidebar-logo-img.logo-dark {
    display: none;
}
body.theme-light .sidebar-logo-img.logo-light {
    display: none;
}
body.theme-light .sidebar-logo-img.logo-dark {
    display: block;
}
.sidebar-logo {
    font-size: 18px;
    font-weight: 700;
    color: #74c0fc;
    white-space: nowrap;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar.collapsed .sidebar-logo {
    display: none;
}
.client-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
}
.company-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.company-selector:hover {
    background: rgba(255,255,255,0.1);
}
.company-dropdown-arrow {
    font-size: 10px;
    color: #74c0fc;
    transition: transform 0.2s;
}
.company-dropdown {
    position: absolute;
    top: 100%;
    left: 8px;
    right: 8px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 1000;
    overflow: hidden;
}
.company-dropdown-list {
    max-height: 200px;
    overflow-y: auto;
}
.company-dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #334155;
    transition: background 0.2s;
}
.company-dropdown-item:hover {
    background: #334155;
}
.company-dropdown-item.active {
    background: #3b82f6;
    color: #fff;
}
.company-dropdown-item .company-name {
    flex: 1;
    font-size: 13px;
}
.company-dropdown-item .company-type {
    font-size: 10px;
    color: #94a3b8;
    background: #475569;
    padding: 2px 6px;
    border-radius: 4px;
}
.company-dropdown-add {
    padding: 10px 14px;
    cursor: pointer;
    color: #60a5fa;
    font-size: 13px;
    transition: background 0.2s;
}
.company-dropdown-add:hover {
    background: #334155;
}
.sidebar-header {
    position: relative;
}
.header-client-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 8px;
    border-radius: 4px;
}
.logo-upload-area {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 2px dashed #cbd5e1;
}
.logo-preview img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 6px;
    background: #f1f5f9;
}
.logo-placeholder {
    text-align: center;
}
.btn-upload, .btn-upload-large {
    display: inline-block;
    padding: 6px 12px;
    background: #3b82f6;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.btn-upload:hover, .btn-upload-large:hover {
    background: #2563eb;
}
.btn-upload input, .btn-upload-large input {
    display: none;
}
.btn-delete-logo {
    padding: 6px 12px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.btn-delete-logo:hover {
    background: #dc2626;
}
.logo-actions {
    display: flex;
    gap: 6px;
}
.sidebar-toggle {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.sidebar-toggle:hover {
    background: rgba(255,255,255,0.2);
}
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-menu li {
    margin: 2px 10px;
}
.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
}
.sidebar-menu a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    filter: brightness(1.2);
}
.sidebar-menu a.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
/* ライトテーマ用のアクティブ調整 */
body.theme-light .sidebar-menu a.active {
    color: white;
}
/* メニューセクション区切り */
.menu-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.menu-section:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.menu-section-title {
    padding: 0 14px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
}
/* サブメニュー */
.has-submenu > a {
    position: relative;
}
.submenu-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s ease;
    color: #64748b;
}
.has-submenu.open .submenu-arrow {
    transform: rotate(90deg);
}
.submenu {
    display: none;
    list-style: none;
    padding: 4px 0;
    margin: 4px 0 0 0;
    background: rgba(0,0,0,0.15);
    border-radius: 6px;
}
.has-submenu.open .submenu {
    display: block;
}
.submenu li {
    margin: 0 6px;
}
.submenu li a {
    padding: 8px 12px 8px 32px;
    font-size: 12px;
    color: #94a3b8;
}
.submenu li a:hover {
    color: white;
    background: rgba(255,255,255,0.05);
}
.submenu li a.active {
    background: rgba(59, 130, 246, 0.3);
    color: white;
}
.submenu li a .menu-icon {
    font-size: 11px;
}
.sidebar-menu .menu-icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
    opacity: 0.9;
}
.sidebar-menu .menu-text {
    white-space: nowrap;
    overflow: hidden;
}
.sidebar.collapsed .menu-text {
    display: none;
}
.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
    padding: 12px;
}
.main-wrapper {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    max-height: 100vh;
}
.container, .page-container {
    max-width: 1800px;
    margin: 0 auto;
    margin-left: 280px;
    background: var(--card-bg);
    color: var(--card-text);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 40px;
    min-height: calc(100vh - 60px);
    border: 1px solid var(--card-border);
}
.sidebar.collapsed ~ .container,
.sidebar.collapsed ~ .page-container {
    margin-left: 80px;
}
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid #74c0fc;
    padding-bottom: 15px;
    margin-bottom: 30px;
}
h1 {
    color: var(--card-text);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
}
.scenario-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.scenario-selector label {
    font-weight: 600;
    color: #475569;
    font-size: 14px;
}
.scenario-selector select {
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 600;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}
.scenario-selector select:hover {
    border-color: #74c0fc;
}
.scenario-selector select:focus {
    outline: none;
    border-color: #74c0fc;
    box-shadow: 0 0 0 3px rgba(116, 192, 252, 0.2);
}
.scenario-optimistic {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%) !important;
    border-color: #22c55e !important;
    color: #166534 !important;
}
.scenario-pessimistic {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
    border-color: #ef4444 !important;
    color: #991b1b !important;
}
/* 基礎マスタページ用スタイル */
.page-header {
    margin-bottom: 30px;
}
.page-header h1 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 8px;
}
.page-description {
    color: var(--card-text);
    opacity: 0.7;
    font-size: 14px;
}
.master-section {
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}
.section-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}
.section-header:hover {
    background: linear-gradient(135deg, #e7f5ff 0%, #dbeafe 100%);
}
.section-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}
.section-toggle {
    color: #64748b;
    transition: transform 0.2s ease;
}
.section-content {
    padding: 20px;
    background: white;
    overflow-x: auto;
}
.section-content.collapsed {
    display: none;
}
.master-table {
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}
.master-table th {
    background: #1e293b;
    color: white;
    padding: 10px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}
.master-table th:nth-child(1) {
    text-align: left;
    min-width: 100px;
}
.master-table th:nth-child(2) {
    text-align: left;
    min-width: 120px;
}
.master-table th:nth-child(3) {
    min-width: 50px;
}
.master-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    color: #1e293b;
}
.master-table tbody tr:hover {
    background: #f8fafc;
}
.master-table input[type="number"] {
    width: 80px;
    min-width: 80px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 12px;
    text-align: right;
    color: #1e293b !important;
    background: white !important;
    -moz-appearance: textfield;
}
.master-table input[type="number"]::-webkit-outer-spin-button,
.master-table input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
/* 全てのnumber inputのスピナーを非表示 */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}
.master-table input[type="number"]:focus {
    outline: none;
    border-color: #74c0fc;
    box-shadow: 0 0 0 2px rgba(116, 192, 252, 0.2);
}
.scenario-opt {
    background: #dcfce7;
    color: #166534;
    font-weight: 600;
    font-size: 11px;
}
.scenario-std {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
    font-size: 11px;
}
.scenario-pes {
    background: #fee2e2;
    color: #991b1b;
    font-weight: 600;
    font-size: 11px;
}
/* シナリオタグ（ページタイトル用） */
.scenario-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-left: 12px;
    vertical-align: middle;
}
.scenario-tag.optimistic {
    background: #dcfce7;
    color: #166534;
}
.scenario-tag.standard {
    background: #dbeafe;
    color: #1e40af;
}
.scenario-tag.pessimistic {
    background: #fee2e2;
    color: #991b1b;
}

/* シナリオタブ */
.scenario-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}
.scenario-tab {
    padding: 12px 28px;
    border: none;
    background: transparent;
    font-size: 15px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    color: #64748b;
    transition: all 0.2s;
}
.scenario-tab:hover {
    color: #1e293b;
    background: #f8fafc;
}
.scenario-tab.active {
    border-bottom-color: #10b981;
    color: #10b981;
    font-weight: 600;
}

/* 売上マスタ レイアウト */
.sales-master-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}
.sales-sidebar {
    width: 280px;
    min-width: 280px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    align-self: flex-start;
    position: sticky;
    top: 20px;
}
.sales-sidebar h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #1e293b;
    padding-bottom: 10px;
    border-bottom: 2px solid #74c0fc;
}
.sales-sidebar .sidebar-hint {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 15px;
}
.scenario-selectors {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.scenario-selector-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
}
.scenario-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
}
.scenario-item-label {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 2px;
}
.scenario-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 6px;
}
.scenario-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
}
.scenario-selector-item label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
}
.scenario-selector-item .item-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
    margin-bottom: 8px;
}
.scenario-selector-item select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    background: white;
}
.sales-main {
    flex: 1;
    min-width: 0;
}
.sales-calculated-section {
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.sales-base-section {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
}
.sales-base-section h3,
.sales-calculated-section h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #1e293b;
}
.sales-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}
.sales-table th,
.sales-table td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid #e2e8f0;
}
.sales-table th {
    background: #1e3a5f;
    color: #fff;
    font-weight: 500;
    position: sticky;
    top: 0;
}
.sales-table th:first-child,
.sales-table th:nth-child(2),
.sales-table td:first-child,
.sales-table td:nth-child(2) {
    text-align: left;
}
.sales-table tbody tr:hover {
    background: #f8fafc;
}
.sales-table .total-row {
    background: #dcfce7;
    font-weight: 600;
}
.sales-table .total-row td {
    border-top: 2px solid #86efac;
}
.table-scroll-wrapper {
    overflow-x: auto;
    max-width: 100%;
}
.section-description {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 15px 0;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid #74c0fc;
}
/* KPIテーブル（フラット表示） */
.kpi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: auto;
}
.kpi-table th {
    background: #1e293b;
    color: white;
    padding: 10px 12px;
    text-align: center;
    font-weight: 600;
    position: sticky;
    top: 0;
    white-space: nowrap;
}
.kpi-table th:first-child,
.kpi-table th:nth-child(2) {
    text-align: left;
}
.kpi-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    color: #1e293b;
    white-space: nowrap;
}
.kpi-table td:first-child {
    font-weight: 500;
    color: #64748b;
}
.kpi-table td:nth-child(2) {
    font-weight: 600;
}
.kpi-table tr:hover {
    background: #f8fafc;
}
.section-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.section-title-bar h3 {
    margin: 0;
}
.btn-formula {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-formula:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-1px);
}
.btn-formula-large {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: all 0.2s;
}
.btn-formula-large:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}
.calculated-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.calculated-table th {
    background: #16a34a;
    color: white;
    padding: 10px 12px;
    text-align: center;
    font-weight: 600;
    position: sticky;
    top: 0;
}
.calculated-table th:first-child,
.calculated-table th:nth-child(2) {
    text-align: left;
    white-space: nowrap;
}
.calculated-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #d1fae5;
    text-align: right;
    color: #1e293b;
}
.calculated-table td:first-child,
.calculated-table td:nth-child(2) {
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}
.calculated-table tr:hover {
    background: #dcfce7;
}
.calculated-table .total-row {
    background: #bbf7d0;
    font-weight: 700;
}
.calculated-table .total-row td {
    border-top: 2px solid #16a34a;
}

/* 計算式モーダル */
.modal-large {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}
.formula-section {
    margin-bottom: 30px;
}
.formula-section h3 {
    font-size: 16px;
    color: #1e293b;
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}
.formula-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.formula-table th {
    background: #f1f5f9;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}
.formula-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}
.formula-table code {
    background: #f8fafc;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #7c3aed;
}
.formula-table .btn-actions {
    white-space: nowrap;
}
.formula-form {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
}
.form-row {
    display: flex;
    gap: 20px;
}
.form-row .form-group {
    flex: 1;
}
.formula-builder {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}
.formula-items {
    flex: 2;
}
.formula-items select {
    width: 100%;
    margin: 8px 0;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}
.formula-operators {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.formula-operators label {
    color: #1e293b;
    font-weight: 600;
}
.operator-buttons {
    display: grid;
    grid-template-columns: repeat(2, 40px);
    gap: 8px;
    margin-top: 8px;
}
.operator-buttons button {
    width: 40px;
    height: 40px;
    font-size: 18px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
}
.operator-buttons button:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}
.btn-add-item {
    width: 100%;
    padding: 8px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}
.btn-add-item:hover {
    background: #2563eb;
}
.hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 5px;
}
/* 設定フォームのinputスピンボタン非表示 */
.settings-form input[type="number"] {
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
}
.settings-form input[type="number"]::-webkit-outer-spin-button,
.settings-form input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
/* テーマカラー選択 */
.theme-selector {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}
.theme-option {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
.theme-option:hover {
    transform: scale(1.05);
}
.theme-option.active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}
.theme-option.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
}
.theme-option.dark {
    background: linear-gradient(135deg, #27272a 0%, #18181b 100%);
}
.theme-option.light {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid #cbd5e1;
}
.btn-edit-sm, .btn-delete-sm {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 5px;
}
.btn-edit-sm {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}
.btn-delete-sm {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}
.btn-edit-sm:hover { background: #fde68a; }
.btn-delete-sm:hover { background: #fecaca; }
/* グループ行のスタイル（楽観・標準・悲観をまとめる） */
.row-group {
    background: #f8fafc;
}
.row-group-first td {
    border-top: 2px solid #94a3b8;
}
.row-group-last td {
    border-bottom: 2px solid #94a3b8;
}
.row-group td[rowspan] {
    font-weight: 600;
    background: #f1f5f9;
    vertical-align: middle;
    text-align: center;
    border-right: 1px solid #e2e8f0;
}
/* 単独行（シナリオなし）のスタイル */
.row-single {
    background: #fff;
}
.row-single td {
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}
.row-single td:first-child,
.row-single td:nth-child(2) {
    font-weight: 500;
}
.master-actions {
    margin-top: 30px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}
.btn-save {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}
.btn-reset {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-reset:hover {
    background: #e2e8f0;
}
.auto-save-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
    border: 1px solid #86efac;
    border-radius: 8px;
    color: #166534;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
}
.auto-save-icon {
    font-size: 16px;
}
.master-toolbar {
    margin-bottom: 20px;
    display: flex;
    gap: 16px;
    align-items: center;
}
.year-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}
.year-selector label {
    font-weight: 600;
    color: #1e293b;
}
.year-selector select {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background: white;
    cursor: pointer;
}
.year-selector select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
/* 行操作ボタン */
.actions-cell {
    vertical-align: middle;
    text-align: center;
}
.row-actions-vertical {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.btn-row-action {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.btn-apply-all {
    background: #dbeafe;
    color: #1e40af;
}
.btn-apply-all:hover {
    background: #3b82f6;
    color: white;
}
.btn-copy-year {
    background: #dcfce7;
    color: #166534;
}
.btn-copy-year:hover {
    background: #22c55e;
    color: white;
}
.btn-add {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
/* フォームスタイル */
.form-container {
    max-width: 600px;
    margin: 0 auto;
}
.form-group {
    margin-bottom: 24px;
}
.form-group > label {
    display: block;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}
.form-group .required {
    color: #ef4444;
}
.form-group select,
.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--card-text);
    background: var(--input-bg);
    transition: all 0.2s ease;
}
.form-group select:focus,
.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
}
/* 基礎情報ページ */
.info-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}
.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
}
.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab-btn:hover {
    color: #3b82f6;
}
.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    font-weight: 600;
}
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}
.form-row .form-group {
    flex: 1;
}
.info-form .form-group {
    margin-bottom: 20px;
}
.info-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #334155;
}
.info-form input, .info-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}
.info-form input:focus, .info-form select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.fiscal-period-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.period-input {
    display: flex;
    gap: 8px;
}
.period-input select {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    min-width: 90px;
}
.period-separator {
    color: #64748b;
    font-size: 16px;
}
.period-display {
    padding: 10px 16px;
    background: #f1f5f9;
    border-radius: 8px;
    color: #334155;
    font-weight: 500;
}
.fiscal-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.fiscal-warning .warn-icon {
    font-size: 16px;
}
.fiscal-info {
    background: #eff6ff;
    border: 1px solid #3b82f6;
    color: #1e40af;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 8px;
}
.section-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.section-header-bar h2 {
    margin: 0;
    font-size: 18px;
    color: var(--card-text);
}
.section-header-bar h3 {
    color: var(--card-text);
}
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}
.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    cursor: pointer;
}
.scenario-check {
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}
.btn-cancel {
    padding: 12px 24px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-cancel:hover {
    background: #f1f5f9;
}
.btn-submit {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}
/* サブアクションボタン */
.sub-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
}
.btn-sub-action {
    padding: 10px 16px;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    background: #f8fafc;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-sub-action:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #3b82f6;
}
/* モーダル */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active {
    display: flex;
}
.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalIn 0.2s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}
.modal-header h2 {
    font-size: 18px;
    margin: 0;
    color: #1e293b;
}
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.modal-close:hover {
    color: #64748b;
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
}
/* 項目編集テーブル */
.edit-table-container {
    overflow-x: auto;
}
.edit-table {
    width: 100%;
    border-collapse: collapse;
}
.edit-table th {
    background: var(--table-header-bg);
    color: var(--table-header-text);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}
.edit-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--table-border);
    vertical-align: middle;
    color: var(--card-text);
}
.edit-table tbody tr:hover {
    background: var(--sidebar-hover);
}
.edit-table .drag-handle {
    cursor: grab;
    color: #94a3b8;
    font-size: 18px;
}
.edit-table .drag-handle:active {
    cursor: grabbing;
}
.edit-table .scenario-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.edit-table .scenario-badge.yes {
    background: #dbeafe;
    color: #1e40af;
}
.edit-table .scenario-badge.no {
    background: #f1f5f9;
    color: #64748b;
}
.edit-table .rc-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.edit-table .rc-badge.yes {
    background: #fef3c7;
    color: #92400e;
}
.edit-table .rc-badge.no {
    background: #f1f5f9;
    color: #94a3b8;
}
.edit-table .btn-edit {
    padding: 6px 12px;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    background: white;
    color: #3b82f6;
    font-size: 12px;
    cursor: pointer;
    margin-right: 6px;
}
.edit-table .btn-edit:hover {
    background: #3b82f6;
    color: white;
}
.edit-table .btn-delete {
    padding: 6px 12px;
    border: 1px solid #ef4444;
    border-radius: 6px;
    background: white;
    color: #ef4444;
    font-size: 12px;
    cursor: pointer;
}
.edit-table .btn-delete:hover {
    background: #ef4444;
    color: white;
}
.dragging {
    opacity: 0.5;
    background: #e0f2fe !important;
}
.edit-business-group {
    margin-bottom: 24px;
}
.edit-group-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 2px solid #e2e8f0;
}
.controls {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.controls-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}
.controls-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.control-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.control-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}
label {
    font-weight: bold;
    color: #555;
}
select, button {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    color: #475569;
}
select:hover, button:hover {
    border-color: #74c0fc;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(116, 192, 252, 0.2);
}
select:focus, button:focus {
    outline: none;
    border-color: #74c0fc;
    box-shadow: 0 0 0 3px rgba(116, 192, 252, 0.1);
}
button {
    background: linear-gradient(135deg, #74c0fc 0%, #4dabf7 100%);
    color: white;
    border: none;
    font-weight: 600;
}
button:hover {
    background: linear-gradient(135deg, #4dabf7 0%, #339af0 100%);
    box-shadow: 0 6px 12px rgba(116, 192, 252, 0.3);
}
.view-toggle {
    display: flex;
    gap: 8px;
    background: white;
    padding: 6px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.view-toggle button {
    padding: 10px 20px;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    font-weight: 500;
}
.view-toggle button.active {
    background: linear-gradient(135deg, #74c0fc 0%, #4dabf7 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(116, 192, 252, 0.3);
}
.financial-statement {
    margin-bottom: 40px;
}
.statement-header {
    background: linear-gradient(135deg, #74c0fc 0%, #4dabf7 100%);
    color: white;
    padding: 16px 20px;
    font-weight: 700;
    font-size: var(--font-size-lg);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    letter-spacing: 0.3px;
}
.statement-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    table-layout: auto;
}
.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    width: 100%;
    max-height: calc(100vh - 250px);
    margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
}
.table-wrapper::-webkit-scrollbar {
    height: 8px;
}
.table-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
.statement-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}
.statement-table th {
    background: #1e293b;
    color: white;
    padding: 14px 16px;
    text-align: left;
    border: none;
    border-bottom: 3px solid #0f172a;
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.statement-table th:first-child {
    width: 40px;
    text-align: center;
}
.statement-table th:nth-child(2) {
    min-width: 400px;
    width: 400px;
}
.statement-table th.month-column {
    min-width: 120px;
    width: 120px;
    text-align: right;
    white-space: nowrap;
}
.statement-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}
.statement-table tbody tr {
    transition: all 0.2s ease;
}
.statement-table tbody tr:hover {
    background: #e7f5ff;
    transform: translateX(2px);
}
.statement-table tbody tr:last-child td {
    border-bottom: none;
}
.item-name {
    font-weight: 500;
    color: #2d3748;
    font-size: var(--font-size-base);
    white-space: nowrap;
    overflow: visible;
    min-width: 400px;
    padding-right: 12px;
}
.item-value {
    text-align: right;
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    font-weight: 500;
    white-space: nowrap;
    min-width: 120px;
    width: 120px;
    padding-right: 12px;
}
.positive {
    color: #10b981;
    font-weight: 600;
}
.negative {
    color: #ef4444;
    font-weight: 600;
}
.subtotal {
    background: linear-gradient(90deg, #f0f9ff 0%, #e0f2fe 100%);
    font-weight: 600;
    border-left: 4px solid #0ea5e9;
}
.subtotal .item-name {
    color: #0369a1;
}
.subtotal .item-value {
    color: #0369a1;
}
.total {
    background: linear-gradient(90deg, #dbeafe 0%, #bfdbfe 100%);
    font-weight: 700;
    border-left: 4px solid #3b82f6;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}
.total .item-name {
    color: #1e40af;
    font-size: var(--font-size-md);
}
.total .item-value {
    color: #1e40af;
    font-size: var(--font-size-md);
    font-weight: 700;
}
.title-row {
    font-weight: 700;
}
.title-row .item-name {
    color: #64748b;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.title-row .item-value {
    display: none;
}
.important-item {
    background: #fefce8;
    font-weight: 600;
    font-size: 14px;
    border-left: 2px solid #eab308;
}
.important-item .item-name {
    color: #713f12;
    font-size: 14px;
}
.important-item .item-value {
    color: #713f12;
    font-size: 14px;
    font-weight: 600;
}
/* DB版PLテーブル用スタイル */
.statement-table .title-row td {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    font-weight: 700;
    font-size: 13px;
    padding: 10px 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.statement-table .parent-row {
    background: #f8fafc;
    cursor: pointer;
}
.statement-table .parent-row:hover {
    background: #e2e8f0;
}
.statement-table .parent-row td {
    white-space: nowrap;
    padding: 10px 12px;
}
.statement-table .parent-row td:first-child {
    font-weight: 600;
    color: #1e293b;
}
.statement-table .expand-toggle {
    display: inline-block;
    width: 16px;
    color: #64748b;
    font-size: 10px;
    margin-right: 4px;
}
.statement-table .child-row {
    background: #ffffff;
}
.statement-table .child-row td {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 13px;
}
.statement-table .child-row td:first-child {
    color: #64748b;
}
.statement-table .indent-1 {
    padding-left: 36px !important;
}
.statement-table .subtotal-row td {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    font-weight: 600;
    border-top: 2px solid #94a3b8;
    white-space: nowrap;
    padding: 10px 12px;
}
.statement-table .important-item td {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    font-weight: 700;
    border-top: 3px solid #eab308;
    border-bottom: 3px solid #eab308;
    white-space: nowrap;
    padding: 12px;
    font-size: 14px;
}
.statement-table .important-item.highlight td {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: #22c55e;
    color: #166534;
}
.statement-table .amount {
    text-align: right;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 13px;
}
.statement-table .negative {
    color: #ef4444;
    font-weight: 600;
}
.statement-table tbody .total-column {
    background: rgba(241, 245, 249, 0.8) !important;
    font-weight: 700;
    border-left: 2px solid #cbd5e1;
}
.statement-table thead th.total-column {
    background: #0f172a !important;
    color: white !important;
    border-left: 2px solid #334155;
    min-width: 110px;
}
.statement-table .month-column {
    min-width: 90px;
    width: 90px;
}
.rate-item .item-name {
    color: #713f12;
}
.rate-item .item-value {
    color: #713f12;
    font-weight: 600;
}
.month-column {
    min-width: 120px;
    width: 120px;
    text-align: right;
    white-space: nowrap;
}
.expand-toggle {
    cursor: pointer;
    user-select: none;
    padding: 4px 8px;
    color: #74c0fc;
    font-weight: bold;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    transition: all 0.2s ease;
    background: #e7f5ff;
}
.expand-toggle:hover {
    background: #74c0fc;
    color: white;
    transform: scale(1.1);
}
.parent-item {
    cursor: pointer;
    position: relative;
}
.parent-item:hover {
    background: #e7f5ff;
}
.parent-item .item-name {
    font-weight: 600;
    color: #1e293b;
}
.sub-item {
    background: linear-gradient(90deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 3px solid #93c5fd;
}
.sub-item .item-name {
    font-weight: 400;
    color: #64748b;
    font-size: 13px;
    padding-left: 24px;
    position: relative;
}
.sub-item .item-name::before {
    content: '└';
    position: absolute;
    left: 8px;
    color: #94a3b8;
    font-weight: 300;
}
.sub-item .item-value {
    color: #64748b;
    font-weight: 500;
}
.sub-items-row {
    display: none;
}
.sub-items-row.expanded {
    display: table-row;
}
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
}
.tab-button {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #64748b;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    bottom: -2px;
}
.tab-button:hover {
    color: #74c0fc;
    background: #e7f5ff;
}
.tab-button.active {
    color: #74c0fc;
    border-bottom-color: #74c0fc;
    background: #e7f5ff;
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}
.month-range-selector {
    flex: 1;
    min-width: 0;
}
.year-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 24px;
    flex-shrink: 0;
}
.year-selector label {
    font-weight: 600;
    color: #475569;
    font-size: 14px;
}
.year-selector select {
    padding: 8px 12px;
    font-size: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
}
.year-selector select:hover {
    border-color: #74c0fc;
}
.year-selector select:focus {
    outline: none;
    border-color: #74c0fc;
    box-shadow: 0 0 0 3px rgba(116, 192, 252, 0.1);
}
.btn-apply-filter-mini {
    padding: 8px 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: 12px;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}
.btn-apply-filter-mini:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(59, 130, 246, 0.4);
}
.month-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
}
.month-range-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.month-range-label {
    font-weight: 600;
    color: #475569;
    font-size: 13px;
}
.month-range-display {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    padding: 0;
    background: transparent;
    border: none;
}
.month-slider-container {
    position: relative;
    padding: 8px 0 0 0;
}
.month-bar {
    position: relative;
    height: 36px;
    background: #f1f5f9;
    border-radius: 18px;
    display: flex;
    align-items: center;
    padding: 0 6px;
    gap: 3px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    min-width: 420px;
}
.month-item {
    flex: 1;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    color: #64748b;
    border-radius: 14px;
    transition: background 0.1s ease, color 0.1s ease;
    cursor: pointer;
    padding: 0 4px;
    white-space: nowrap;
    overflow: visible;
    user-select: none;
    -webkit-user-select: none;
}
.month-item:hover {
    background: #e0f2fe;
}
.month-item.selected {
    background: linear-gradient(135deg, #74c0fc 0%, #4dabf7 100%);
    color: white;
    box-shadow: 0 1px 4px rgba(116, 192, 252, 0.3);
}
.range-inputs {
    display: none;
}
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}
.loading-spinner .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loading-spinner .loading-text {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}
.loading-spinner .loading-subtext {
    font-size: 12px;
    color: #9ca3af;
    margin-top: -8px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-progress {
    width: 200px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}
.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    animation: progress 1.5s ease-in-out infinite;
}
@keyframes progress {
    0% { width: 0%; margin-left: 0%; }
    50% { width: 30%; margin-left: 35%; }
    100% { width: 0%; margin-left: 100%; }
}
.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}
.balance-check {
    background: #fff3cd;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
    border-left: 4px solid #ffc107;
}
.balance-ok {
    color: #28a745;
    font-weight: bold;
}
.balance-error {
    color: #dc3545;
    font-weight: bold;
}
.sheet-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}
.sheet-tab {
    padding: 14px 28px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
    color: #64748b;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    bottom: -2px;
    margin-bottom: -2px;
}
.sheet-tab:hover {
    background: #e7f5ff;
    color: #74c0fc;
    border-color: #74c0fc;
}
.sheet-tab.active {
    background: white;
    color: #1e293b;
    border-color: #74c0fc;
    border-bottom-color: white;
    box-shadow: 0 -4px 12px rgba(116, 192, 252, 0.15);
}
.sheet-content {
    display: none;
}
.sheet-content.active {
    display: block;
}
.charts-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e2e8f0;
}
.charts-section h3 {
    color: #1e293b;
    font-size: 18px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 24px;
}
.chart-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.chart-card h4 {
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}
.chart-toggle {
    display: flex;
    gap: 4px;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 6px;
}
.chart-toggle button {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}
.chart-toggle button:hover {
    color: #1e293b;
}
.chart-toggle button.active {
    background: white;
    color: #3b82f6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.chart-container {
    position: relative;
    height: 280px;
}
