/* 
   AI Finance Assistant - The Ultimate Master Style (Zero-Mess Edition)
   UTF-8 Encoding Verified
*/

:root {
    --primary: #2563eb;
    --primary-light: #60a5fa;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-main: #f8fafc;
    --bg-sidebar: #1e293b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    width: 100vw;
}

/* Layout Core */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: white;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .sidebar { width: 100%; padding: 1rem; flex-direction: row; align-items: center; justify-content: space-between; }
}

.brand { display: flex; align-items: center; gap: 0.75rem; }
@media (min-width: 769px) { .brand { margin-bottom: 2.5rem; } }

.brand-icon { width: 32px; height: 32px; background: linear-gradient(135deg, var(--primary-light), var(--primary)); border-radius: 8px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 0.5rem; }
@media (max-width: 768px) { .sidebar-nav { flex-direction: row; } }

.nav-item {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem 1.2rem;
    color: #94a3b8; text-decoration: none; border-radius: 10px; transition: 0.2s;
}
.nav-item:hover, .nav-item.active { background: #334155; color: white; }
@media (max-width: 768px) { .nav-item span { display: none; } }

/* Main Content */
.main-content {
    flex: 1;
    padding: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}
@media (max-width: 768px) { .main-content { padding: 1.25rem; } }

.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}
@media (max-width: 768px) { .dashboard-grid { grid-template-columns: 1fr; } }

.card {
    background: white; padding: 1.5rem; border-radius: 18px;
    box-shadow: var(--shadow); border: 1px solid var(--border);
}

.upload-card {
    border: 2px dashed var(--border); display: flex; align-items: center; justify-content: center;
    cursor: pointer; min-height: 220px; text-align: center;
}
.upload-card:hover { border-color: var(--primary); background: #f0f9ff; }

/* Upload Text Toggling */
.upload-placeholder h3::before { content: "ファイルをドラッグ＆ドロップ"; }
.upload-placeholder p::before { content: "スキャンデータ(PDF)や明細(CSV)も対応"; }
.upload-placeholder h3, .upload-placeholder p { font-size: 0; }
.upload-placeholder h3::before { font-size: 1.15rem; display: block; margin-bottom: 0.5rem; font-weight: 700; color: var(--text-main); }
.upload-placeholder p::before { font-size: 0.95rem; display: block; color: var(--text-muted); }

@media (max-width: 768px) {
    .upload-placeholder h3::before { content: "撮影して取り込む"; font-size: 1.1rem; }
    .upload-placeholder p::before { content: "レシートをカメラでスキャナー"; font-size: 0.85rem; }
}

/* Results Table */
.results-table-container {
    background: white; border-radius: 18px; overflow: auto;
    box-shadow: var(--shadow); border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; min-width: 800px; }
th, td { padding: 1.2rem 1.5rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; font-weight: 700; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Badge Styles */
.badge {
    padding: 0.3rem 0.75rem; border-radius: 100px; font-size: 0.75rem; font-weight: 700;
}
.badge-塾 { background: #e0f2fe; color: #0369a1; }
.badge-WEB { background: #fef3c7; color: #92400e; }
.badge-共通 { background: #f3f4f6; color: #374151; }

/* Modals */
.modal {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.75);
    display: none; align-items: center; justify-content: center; z-index: 10000; padding: 1rem;
}
.modal.active { display: flex; }
.modal-content {
    background: white; width: 100%; max-width: 580px; padding: 2.5rem; border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

.form-group { margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: 0.6rem; }
.form-group label { font-size: 0.9rem; font-weight: 700; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 0.85rem 1.1rem; border: 1.5px solid var(--border); border-radius: 12px;
    font-size: 1rem; outline: none; transition: 0.2s; background: #fcfdfe;
}
.form-group input:focus { border-color: var(--primary); background: white; box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); }

/* Buttons Style */
.btn {
    display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.8rem 1.5rem;
    border-radius: 12px; font-weight: 700; cursor: pointer; transition: 0.2s; border: none; font-size: 0.95rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #1d4ed8; transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3); }
.btn-outline { background: white; border: 1.5px solid var(--border); color: var(--text-main); }
.btn-outline:hover { background: #f8fafc; border-color: var(--text-muted); }

/* Auth Screen */
.login-screen {
    position: fixed; inset: 0; background: var(--bg-sidebar); z-index: 999999999;
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    background: rgba(255,255,255,0.06); padding: 3.5rem 2.5rem; border-radius: 32px;
    backdrop-filter: blur(15px); width: 92%; max-width: 420px; text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
}
.login-card input {
    background: rgba(255,255,255,0.1); border: 2.5px solid rgba(255,255,255,0.15);
    color: white; font-size: 2.2rem; width: 100%; padding: 1.25rem; border-radius: 16px;
    text-align: center; letter-spacing: 0.8rem; margin-bottom: 2.5rem; outline: none;
}
.login-card input:focus { border-color: var(--primary-light); background: rgba(255,255,255,0.15); }
