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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    position: relative;
}

header h1 {
    font-size: 2em;
    margin-bottom: 5px;
    text-align: center;
}

header p {
    font-size: 1em;
    opacity: 0.9;
    text-align: center;
}

main {
    padding: 30px;
}

section {
    margin-bottom: 40px;
}

/* API設定セクション */
.api-settings-section {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
}

.api-settings-section.hidden {
    display: none;
}

.api-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.api-settings-header h2 {
    margin: 0;
    border: none;
    padding: 0;
    color: #856404;
}

.api-settings-content {
    display: block;
}

.api-settings-content.collapsed {
    display: none;
}

.api-info {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #333;
}

.api-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.api-input-group label {
    font-weight: 600;
    color: #856404;
}

.api-input-wrapper {
    display: flex;
    gap: 10px;
}

.api-input-wrapper input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
}

.api-input-wrapper input:focus {
    outline: none;
    border-color: #ffc107;
}

.api-status {
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    display: none;
}

.api-status.success {
    background: #d4edda;
    color: #155724;
    display: block;
}

.api-status.error {
    background: #f8d7da;
    color: #721c24;
    display: block;
}

.api-help {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.api-help ol {
    margin: 10px 0 0 20px;
    padding: 0;
}

.api-help li {
    margin: 5px 0;
}

.api-help a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.api-help a:hover {
    text-decoration: underline;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

/* アップロードエリア */
.upload-section {
    text-align: center;
}

.upload-area {
    position: relative;
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 40px;
    background: #f8f9ff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    background: #e8eaff;
    border-color: #764ba2;
}

.upload-area.dragover {
    background: #e8eaff;
    border-color: #764ba2;
    transform: scale(1.02);
}

#fileInput {
    display: none;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    cursor: pointer;
}

.upload-icon {
    font-size: 4em;
}

.upload-label span:last-child {
    font-size: 1.1em;
    color: #555;
}

.preview-area {
    margin-top: 20px;
    text-align: center;
}

.preview-area img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* ローディング */
.loading {
    margin-top: 30px;
    text-align: center;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* フォーム */
.form-section {
    background: #f8f9ff;
    padding: 30px;
    border-radius: 15px;
}

.form-section.hidden {
    display: none;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* ヒントテキスト */
.form-group .hint {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #888;
}

/* 入力が必要な項目のハイライト */
.form-group.needs-input label {
    color: #e53935;
}

.form-group.needs-input label::after {
    content: " ← 入力してください";
    font-size: 0.85em;
    color: #e53935;
    font-weight: normal;
}

.form-group.needs-input input,
.form-group.needs-input select {
    border-color: #e53935;
    background-color: #fff5f5;
}

.form-group.needs-input input:focus,
.form-group.needs-input select:focus {
    border-color: #e53935;
    box-shadow: 0 0 5px rgba(229, 57, 53, 0.3);
}

/* 入力済みの項目 */
.form-group.filled label {
    color: #2e7d32;
}

.form-group.filled label::after {
    content: " ✓";
    color: #2e7d32;
}

.form-group.filled input,
.form-group.filled select {
    border-color: #4caf50;
    background-color: #f1f8e9;
}

.form-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

/* ボタン */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-success:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.btn-danger {
    background: #f44336;
    color: white;
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn-danger:hover {
    background: #da190b;
}

/* リストセクション */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.list-header h2 {
    margin-bottom: 0;
    border-bottom: none;
}

.header-controls {
    display: flex;
    gap: 10px;
}

/* フィルターセクション */
.filter-section {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.9em;
    color: #555;
}

.filter-group select,
.filter-group input[type="text"] {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
    min-width: 120px;
}

.filter-group input[type="text"] {
    min-width: 200px;
}

.filter-summary {
    margin-top: 15px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    font-weight: 600;
}

.filter-summary.hidden {
    display: none;
}

.transaction-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px;
    font-size: 1.1em;
}

.transaction-item {
    background: #f8f9ff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
    transition: all 0.3s ease;
}

.transaction-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.transaction-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
    border: 3px solid #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    background: #f0f0f0;
}

.transaction-image:hover {
    transform: scale(1.05);
    border-color: #764ba2;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
}

.transaction-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.transaction-details strong {
    font-size: 1.3em;
    color: #333;
}

.transaction-details p {
    margin: 0;
    color: #666;
}

.transaction-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge-payment {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-detail {
    background: #f3e5f5;
    color: #7b1fa2;
}

.badge-type-outgoing {
    background: #ffebee;
    color: #c62828;
}

.badge-type-incoming {
    background: #e8f5e9;
    color: #2e7d32;
}

.transaction-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* アクションメニュー（⋮ボタン） */
.action-menu {
    position: relative;
}

.btn-menu {
    background: transparent;
    border: none;
    font-size: 1.5em;
    padding: 5px 10px;
    cursor: pointer;
    color: #666;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-menu:hover {
    background: #e0e0e0;
    color: #333;
}

.action-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 100px;
    z-index: 100;
}

.action-dropdown.show {
    display: block;
}

.action-dropdown .btn {
    width: 100%;
    text-align: center;
    margin-bottom: 5px;
}

.action-dropdown .btn:last-child {
    margin-bottom: 0;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 2em;
    }

    main {
        padding: 20px;
    }

    .upload-area {
        padding: 30px 20px;
    }

    .upload-icon {
        font-size: 3em;
    }

    .form-buttons {
        flex-direction: column;
    }

    .list-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .header-controls {
        flex-direction: column;
    }

    .header-controls .btn {
        width: 100%;
    }

    .api-input-wrapper {
        flex-direction: column;
    }

    .api-input-wrapper button {
        width: 100%;
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group select,
    .filter-group input[type="text"] {
        width: 100%;
        min-width: auto;
    }

    .transaction-item {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .transaction-image {
        width: 100%;
        height: 200px;
    }

    .transaction-actions {
        flex-direction: row;
    }
}

/* メモ候補 */
.memo-suggestion {
    background: #e8f4fd;
    border: 1px solid #b3d9f7;
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.memo-suggestion .suggestion-label {
    color: #1565c0;
    font-size: 0.9em;
    font-weight: bold;
}

.memo-suggestion .btn-suggestion {
    background: #1565c0;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
}

.memo-suggestion .btn-suggestion:hover {
    background: #0d47a1;
}

/* 認証セクション */
.header-top {
    position: absolute;
    top: 15px;
    right: 20px;
    display: flex;
    justify-content: flex-end;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-prompt {
    display: flex;
    align-items: center;
}

.login-prompt.hidden {
    display: none;
}

.btn-google {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
}

.btn-google:hover {
    background: #f5f5f5;
    border-color: #ccc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-google img {
    width: 20px;
    height: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 15px;
    border-radius: 25px;
}

.user-info.hidden {
    display: none;
}

.user-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
}

#userName {
    font-weight: 600;
    color: white;
}

.user-role {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.role-admin {
    background: #ff6b6b;
    color: white;
}

.role-staff {
    background: #4ecdc4;
    color: white;
}

.role-pending {
    background: #ffd93d;
    color: #333;
}

.btn-logout {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 承認待ち画面 */
.pending-approval {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    margin: 30px;
}

.pending-approval.hidden {
    display: none;
}

.pending-approval h2 {
    color: #856404;
    border: none;
    margin-bottom: 15px;
}

.pending-approval p {
    color: #856404;
    margin: 10px 0;
}

/* 管理者パネル */
/* 管理者トグルボタン（歯車） */
.btn-admin-toggle {
    position: relative;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.4em;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-admin-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(45deg);
}

.btn-admin-toggle.hidden {
    display: none;
}

/* 承認待ちバッジ */
.pending-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e53935;
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

.pending-badge.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* 管理者パネル オーバーレイ */
.admin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.admin-overlay.hidden {
    display: none;
}

/* 管理者パネル */
.admin-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.admin-panel.hidden {
    display: none;
}

.admin-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px 16px 0 0;
}

.admin-panel-header h3 {
    color: white;
    margin: 0;
    font-size: 1.3em;
}

.btn-close-admin {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5em;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
}

.btn-close-admin:hover {
    background: rgba(255, 255, 255, 0.3);
}

.admin-section {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.admin-section h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1em;
}

.admin-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 管理者パネル内API設定 */
.admin-api-status {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
}

.admin-api-status.has-key {
    background: #e8f5e9;
    color: #2e7d32;
}

.admin-api-status.no-key {
    background: #fff3e0;
    color: #e65100;
}

.admin-api-input {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.admin-api-input input {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9em;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* 管理者パネル：ガイドリンク */
.admin-guide-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-guide-links .btn {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* 管理者用危険操作セクション */
.admin-danger-section {
    margin: 0;
    border: none;
    border-radius: 0;
    padding: 15px 20px;
    background: #fafafa;
}

.admin-danger-toggle {
    cursor: pointer;
    color: #999;
    font-size: 0.85em;
    padding: 5px;
    user-select: none;
}

.admin-danger-toggle:hover {
    color: #666;
}

.admin-danger-content {
    margin-top: 15px;
    padding: 15px;
    background: #fff5f5;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
}

.danger-warning {
    color: #c62828;
    font-size: 0.9em;
    margin-bottom: 15px;
    font-weight: 500;
}

.danger-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-danger-outline {
    padding: 8px 16px;
    border: 2px solid #e57373;
    background: transparent;
    color: #c62828;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.btn-danger-outline:hover {
    background: #ffebee;
    border-color: #c62828;
}

.pending-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.pending-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pending-user-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.pending-user-name {
    font-weight: 600;
}

.pending-user-email {
    font-size: 0.85em;
    color: #666;
}

.btn-approve {
    padding: 8px 20px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.btn-approve:hover {
    background: #45a049;
}

.no-pending {
    color: #666;
    text-align: center;
    padding: 15px;
    font-style: italic;
}

/* ストレージ使用状況 */
.storage-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9ff;
    padding: 15px;
    border-radius: 8px;
}

.storage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
}

.storage-label {
    color: #666;
    font-weight: 500;
}

.storage-value {
    color: #333;
    font-weight: 600;
    font-family: monospace;
}

.storage-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.storage-bar {
    flex: 1;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.storage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    border-radius: 10px;
    transition: width 0.3s ease, background 0.3s ease;
}

.storage-bar-fill.warning {
    background: linear-gradient(90deg, #ff9800, #ffc107);
}

.storage-bar-fill.danger {
    background: linear-gradient(90deg, #f44336, #e91e63);
}

.storage-percent {
    font-size: 0.9em;
    font-weight: 600;
    color: #666;
    min-width: 45px;
    text-align: right;
}

.storage-note {
    font-size: 0.8em;
    color: #999;
    margin: 0;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
}

/* レスポンシブ対応（認証部分） */
@media (max-width: 768px) {
    header {
        padding: 15px 15px 20px;
    }

    .header-top {
        position: static;
        top: auto;
        right: auto;
        justify-content: center;
        margin-bottom: 15px;
    }

    .user-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        padding: 8px 12px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 20px;
        width: 100%;
    }

    .user-photo {
        width: 28px;
        height: 28px;
    }

    #userName {
        font-size: 0.85em;
        width: 100%;
        text-align: center;
    }

    .user-role {
        font-size: 0.75em;
        padding: 3px 8px;
    }

    .btn-admin-toggle,
    .btn-quick-memo,
    .btn-zoom-memo {
        width: 36px;
        height: 36px;
        font-size: 1.2em;
    }

    .btn-logout {
        font-size: 0.8em;
        padding: 5px 12px;
        width: 100%;
    }

    header h1 {
        font-size: 1.6em;
        margin-bottom: 8px;
    }

    header p {
        font-size: 0.9em;
    }

    .pending-user-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    /* ログインボタン */
    .btn-google {
        padding: 8px 16px;
        font-size: 0.9em;
        width: 100%;
        justify-content: center;
    }

    .btn-google img {
        width: 18px;
        height: 18px;
    }

    /* 月別タブをさらにコンパクトに */
    .month-tab {
        padding: 8px 12px;
        font-size: 0.8em;
    }

    .month-tab .count-badge {
        font-size: 0.7em;
        padding: 3px 6px;
        min-width: 18px;
    }

    /* リストヘッダーのボタンもコンパクトに */
    #quickMemoBtn2,
    #downloadImagesBtn,
    #exportBtn {
        font-size: 0.9em;
        padding: 10px 16px;
    }
}

/* 画像なしの場合のプレースホルダー */
.no-image {
    width: 100px;
    height: 100px;
    background: #e0e0e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.85em;
    border: 3px dashed #ccc;
}

/* カード内のメモプレビュー */
.notes-preview {
    font-size: 0.9em;
    color: #888;
    margin-top: 8px;
}

/* 詳細モーダル */
.detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.detail-modal-content {
    position: relative;
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.detail-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.8em;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.detail-modal-close:hover {
    color: #333;
}

.detail-modal-content h2 {
    margin: 0 0 20px 0;
    padding: 0;
    border: none;
    color: #333;
    font-size: 1.3em;
}

.detail-image-container {
    text-align: center;
    margin-bottom: 20px;
}

.detail-image {
    max-width: 100%;
    max-height: 250px;
    border-radius: 10px;
    cursor: pointer;
    border: 3px solid #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s;
}

.detail-image:hover {
    transform: scale(1.02);
}

.detail-image-hint {
    font-size: 0.8em;
    color: #999;
    margin-top: 8px;
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: #666;
    min-width: 100px;
}

.detail-value {
    text-align: right;
    color: #333;
    flex: 1;
    word-break: break-word;
}

.detail-amount {
    font-size: 1.4em;
    font-weight: bold;
}

.detail-amount.outgoing {
    color: #e53935;
}

.detail-amount.incoming {
    color: #2e7d32;
}

.detail-notes {
    white-space: pre-wrap;
    text-align: left;
    background: #f8f9ff;
    padding: 10px;
    border-radius: 6px;
    width: 100%;
}

.detail-meta {
    font-size: 0.85em;
    color: #999;
}

.detail-meta .detail-label,
.detail-meta .detail-value {
    color: #999;
}

.detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.detail-actions .btn {
    flex: 1;
}

/* レスポンシブ対応（モーダル） */
@media (max-width: 768px) {
    .detail-modal-content {
        padding: 20px;
        max-height: 85vh;
    }

    .detail-row {
        flex-direction: column;
        gap: 5px;
    }

    .detail-value {
        text-align: left;
    }
}

/* HEICプレビュー用プレースホルダー */
.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: #f0f0f0;
    border-radius: 10px;
    color: #666;
    font-size: 1.1em;
    border: 2px dashed #ccc;
}

/* 年度選択 */
.year-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
}

.year-nav-btn {
    width: 44px;
    height: 44px;
    border: 2px solid white;
    background: transparent;
    color: white;
    border-radius: 50%;
    font-size: 1.4em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.year-nav-btn:hover {
    background: white;
    color: #667eea;
    transform: scale(1.1);
}

.year-nav-btn:disabled {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.5);
    cursor: not-allowed;
    transform: none;
}

.current-year {
    font-size: 1.8em;
    font-weight: bold;
    color: white;
    min-width: 150px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 月別タブ */
.month-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
}

.month-tab {
    padding: 12px 20px;
    border: 2px solid #667eea;
    background: white;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    color: #667eea;
}

.month-tab:hover:not(.disabled) {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.month-tab.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.month-tab.disabled {
    background: #e9ecef;
    color: #adb5bd;
    border-color: #dee2e6;
    cursor: not-allowed;
    opacity: 0.5;
}

.month-tab.disabled:hover {
    transform: none;
    box-shadow: none;
}

.month-tab .count-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ff6b6b;
    color: white;
    font-size: 0.75em;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 22px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.4);
}

.month-tab.active .count-badge {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* サブフィルター */
.sub-filter {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.sub-filter .filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-filter input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95em;
    width: 200px;
}

.sub-filter select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95em;
}

/* レスポンシブ対応（タブ） */
@media (max-width: 768px) {
    .month-tabs {
        justify-content: center;
    }

    .month-tab {
        padding: 6px 10px;
        font-size: 0.85em;
    }

    .sub-filter {
        flex-direction: column;
    }

    .sub-filter input[type="text"] {
        width: 100%;
    }
}

/* 簡易メモボタン */
.btn-quick-memo {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.3em;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-quick-memo:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* ZOOMメモボタン */
.btn-zoom-memo {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.3em;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-zoom-memo:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* 簡易メモモーダル */
.quick-memo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
}

.quick-memo-overlay.hidden {
    display: none;
}

.quick-memo-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.quick-memo-modal.hidden {
    display: none;
}

.quick-memo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px 16px 0 0;
}

.quick-memo-header h3 {
    color: white;
    margin: 0;
    font-size: 1.3em;
}

.btn-close-quick {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5em;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
}

.btn-close-quick:hover {
    background: rgba(255, 255, 255, 0.3);
}

.quick-memo-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    overflow-y: auto;
}

.quick-memo-hint {
    color: #666;
    font-size: 0.9em;
    margin: 0;
    padding: 10px;
    background: #f8f9ff;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

#quickMemoTextarea {
    flex: 1;
    min-height: 300px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#quickMemoTextarea:focus {
    outline: none;
    border-color: #667eea;
}

.quick-memo-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.quick-memo-status {
    font-size: 0.85em;
    color: #2e7d32;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.quick-memo-status.visible {
    opacity: 1;
}

/* ZOOMメモモーダル */
.zoom-memo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
}

.zoom-memo-overlay.hidden {
    display: none;
}

.zoom-memo-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.zoom-memo-modal.hidden {
    display: none;
}

.zoom-memo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px 16px 0 0;
}

.zoom-memo-header h3 {
    color: white;
    margin: 0;
    font-size: 1.3em;
}

.btn-close-zoom {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5em;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
}

.btn-close-zoom:hover {
    background: rgba(255, 255, 255, 0.3);
}

.zoom-memo-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    overflow-y: auto;
}

.zoom-memo-hint {
    color: #666;
    font-size: 0.9em;
    margin: 0;
    padding: 10px;
    background: #f8f9ff;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

#zoomMemoTextarea {
    flex: 1;
    min-height: 300px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#zoomMemoTextarea:focus {
    outline: none;
    border-color: #667eea;
}

.zoom-memo-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.zoom-memo-status {
    font-size: 0.85em;
    color: #2e7d32;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.zoom-memo-status.visible {
    opacity: 1;
}

/* レスポンシブ対応（簡易メモ・ZOOMメモ） */
@media (max-width: 768px) {
    .quick-memo-modal,
    .zoom-memo-modal {
        width: 95%;
        max-height: 90vh;
    }

    #quickMemoTextarea,
    #zoomMemoTextarea {
        min-height: 250px;
    }
}

/* 確定申告モード切り替え */
.tax-mode-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.tax-mode-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tax-mode-btn:hover {
    background: #f0f0ff;
}

.tax-mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

/* ========== メインタブナビゲーション ========== */
.main-tabs {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: white;
    border-bottom: 2px solid #eee;
    margin-bottom: 0;
}

.main-tab {
    padding: 12px 30px;
    border: none;
    background: #f5f5f5;
    color: #666;
    border-radius: 8px 8px 0 0;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.main-tab:hover {
    background: #e8e8e8;
    color: #333;
}

.main-tab.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

.tab-content {
    display: block;
}

.tab-content.hidden {
    display: none;
}

/* ========== メモタブのレイアウト ========== */
.memo-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

.memo-section h2 {
    font-size: 2em;
    color: #333;
    margin-bottom: 30px;
    text-align: center;
}

.memo-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.memo-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: box-shadow 0.3s ease;
}

.memo-card:hover {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
}

.memo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.memo-card-header h3 {
    font-size: 1.3em;
    color: #333;
    margin: 0;
}

.memo-auto-save {
    font-size: 0.75em;
    color: #999;
    background: #f8f9ff;
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid #e0e0ff;
}

.memo-description {
    color: #666;
    font-size: 0.9em;
    margin: 0;
    line-height: 1.5;
}

.memo-textarea {
    width: 100%;
    min-height: 400px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
    line-height: 1.6;
}

.memo-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.memo-status {
    text-align: right;
    padding-top: 10px;
}

.memo-status span {
    font-size: 0.85em;
    color: #2e7d32;
    font-weight: 500;
}

/* レスポンシブ対応（メモタブ） */
@media (max-width: 1024px) {
    .memo-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-tabs {
        padding: 10px 15px;
    }

    .main-tab {
        padding: 10px 20px;
        font-size: 0.9em;
    }

    .memo-section {
        padding: 20px 15px;
    }

    .memo-section h2 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }

    .memo-card {
        padding: 20px;
    }

    .memo-textarea {
        min-height: 300px;
    }
}
