/* BA53-a 経理UI */
.acc-page { padding: 20px; max-width: 1200px; margin: 0 auto; }
.acc-loading, .acc-error { padding: 40px; text-align: center; color: #666; }
.acc-error { color: #d32f2f; }
.acc-empty-row { padding: 32px; text-align: center; color: #999; }

.acc-header { margin-bottom: 16px; }
.acc-header h2 { margin: 0 0 4px; font-size: 20px; }
.acc-hint { color: #666; font-size: 13px; margin: 0; }
.acc-hint a { color: #c2185b; }

.acc-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid #e0e0e0; }
.acc-tab { padding: 10px 20px; background: none; border: none; cursor: pointer; font-size: 14px; color: #666; border-bottom: 3px solid transparent; margin-bottom: -2px; font-family: inherit; font-weight: 500; }
.acc-tab:hover { color: #333; }
.acc-tab.active { color: #c2185b; border-bottom-color: #c2185b; font-weight: 700; }

.acc-toolbar { display: flex; gap: 16px; align-items: center; padding: 16px; background: #fff; border-radius: 8px; margin-bottom: 16px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); flex-wrap: wrap; }
.acc-period-nav { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.acc-period-nav select, .acc-search { padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; font-family: inherit; background: #fff; }
.acc-search { flex: 1; min-width: 180px; }
.acc-toolbar .btn-primary { padding: 8px 16px; background: #c2185b; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit; }
.acc-toolbar .btn-primary:hover { background: #880e4f; }

.acc-summary-box { padding: 8px 16px; background: #fce4ec; border-radius: 6px; text-align: center; min-width: 140px; }
.acc-summary-label { font-size: 11px; color: #880e4f; }
.acc-summary-value { font-size: 20px; font-weight: 700; color: #c2185b; line-height: 1.2; }
.acc-summary-count { font-size: 10px; color: #999; }

.acc-category-filter { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; background: #fff; padding: 10px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.acc-chip { display: inline-flex; gap: 4px; align-items: center; padding: 3px 10px; background: #f5f5f5; border-radius: 12px; font-size: 11px; cursor: pointer; }
.acc-chip:hover { background: #eee; }
.acc-chip input { margin: 0; }

.acc-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.acc-table th, .acc-table td { padding: 10px; text-align: left; border-bottom: 1px solid #eee; font-size: 13px; vertical-align: middle; }
.acc-table th { background: #fafafa; font-size: 11px; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: 0.04em; }
.acc-table tr:hover { background: #fafafa; }
.acc-table tbody tr:last-child td { border-bottom: none; }

.btn-mini { padding: 4px 10px; font-size: 11px; border-radius: 3px; cursor: pointer; background: #fff; border: 1px solid #ccc; font-family: inherit; }
.btn-mini:hover { background: #f5f5f5; }
.btn-mini-danger { padding: 4px 10px; font-size: 11px; border-radius: 3px; cursor: pointer; background: #fff; border: 1px solid #ef9a9a; color: #d32f2f; font-family: inherit; }
.btn-mini-danger:hover { background: #ffebee; }

.acc-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.acc-modal { background: #fff; padding: 24px; border-radius: 8px; max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.acc-modal h3 { margin: 0 0 16px; font-size: 17px; font-weight: 700; }
.acc-form { display: flex; flex-direction: column; gap: 12px; }
.acc-form label { display: flex; flex-direction: column; font-size: 12px; color: #666; gap: 4px; }
.acc-form input, .acc-form select { padding: 8px 12px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; font-family: inherit; background: #fff; }
.acc-form input:focus, .acc-form select:focus { outline: none; border-color: #c2185b; box-shadow: 0 0 0 2px rgba(194,24,91,0.08); }
.acc-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.acc-modal-actions .btn-primary { padding: 8px 16px; background: #c2185b; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit; }
.acc-modal-actions .btn-primary:hover { background: #880e4f; }
.acc-modal-actions .btn-secondary { padding: 8px 16px; background: #fff; color: #333; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; font-size: 13px; font-family: inherit; }
.acc-modal-actions .btn-secondary:hover { background: #f5f5f5; }

.acc-import { background: #fff; padding: 24px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.acc-import h3 { margin: 0 0 12px; }
.acc-import-dropzone { padding: 40px; background: #fafafa; border: 2px dashed #ccc; border-radius: 8px; text-align: center; margin: 16px 0; }
.acc-dropzone-label { color: #999; margin-bottom: 12px; }
#accFileInput { display: none; }
.acc-import-dropzone .btn-primary { padding: 10px 20px; background: #c2185b; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; font-weight: 600; font-family: inherit; }
.acc-import-dropzone .btn-primary:hover { background: #880e4f; }

.acc-import-result { padding: 16px; background: #e8f5e9; border-radius: 6px; margin-top: 16px; }
.acc-import-result h4 { margin: 0 0 8px; color: #388e3c; font-size: 14px; font-weight: 700; }
.acc-import-result ul { margin: 4px 0 0 20px; font-size: 12px; color: #d32f2f; }

/* BA53-c P&L ダッシュボード */
.pl-page { }
.pl-loading, .pl-error, .pl-empty-chart { padding: 30px; text-align: center; color: #666; }
.pl-error { color: #d32f2f; }

.pl-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.pl-header h2 { margin: 0; font-size: 18px; }
.pl-header-actions { display: flex; gap: 8px; }
.pl-header .btn-secondary { padding: 8px 16px; background: #fff; color: #333; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; font-size: 13px; font-family: inherit; }
.pl-header .btn-secondary:hover { background: #f5f5f5; }
.pl-hint { font-size: 13px; color: #666; margin-bottom: 8px; }

.pl-mode-switcher { display: inline-flex; gap: 4px; margin-bottom: 20px; background: #fafafa; padding: 4px; border-radius: 6px; }
.pl-mode { padding: 8px 16px; background: none; border: none; cursor: pointer; font-size: 13px; color: #666; border-radius: 4px; font-family: inherit; }
.pl-mode:hover { background: rgba(0,0,0,0.03); }
.pl-mode.active { background: #fff; color: #c2185b; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.pl-period-nav { display: flex; gap: 8px; align-items: center; margin-bottom: 20px; padding: 10px 16px; background: #fff; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); flex-wrap: wrap; }
.pl-period-nav button { padding: 6px 14px; background: #f5f5f5; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; font-family: inherit; }
.pl-period-nav button:hover { background: #eee; }
.pl-period-nav select { padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; font-family: inherit; background: #fff; }
.pl-period-info { font-size: 12px; color: #999; margin-left: auto; }

.pl-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.pl-kpi-card { background: #fff; padding: 16px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border-top: 3px solid transparent; }
.pl-kpi-revenue { border-top-color: #4caf50; }
.pl-kpi-expense { border-top-color: #f06292; }
.pl-kpi-profit { border-top-color: #ffa726; }
.pl-kpi-margin { border-top-color: #9c27b0; }
.pl-kpi-label { font-size: 12px; color: #666; margin-bottom: 8px; font-weight: 500; }
.pl-kpi-value { font-size: 22px; font-weight: 700; color: #333; }
.pl-kpi-hint { font-size: 11px; color: #999; margin-top: 8px; line-height: 1.5; }
.pl-kpi-trends { display: flex; gap: 6px; margin-top: 10px; font-size: 11px; flex-wrap: wrap; }
.pl-trend { padding: 2px 6px; border-radius: 3px; background: #f5f5f5; color: #666; white-space: nowrap; }
.pl-trend.up { background: #e8f5e9; color: #388e3c; }
.pl-trend.down { background: #ffebee; color: #d32f2f; }

.pl-section { background: #fff; padding: 20px; border-radius: 8px; margin-bottom: 16px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.pl-section h3 { margin: 0 0 16px; font-size: 15px; font-weight: 700; }
.pl-section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 16px; margin-bottom: 16px; }

.pl-chart-container { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.pl-pie-svg { width: 200px; height: 200px; flex-shrink: 0; }
.pl-trend-svg { width: 100%; max-width: 600px; height: auto; }

.pl-legend { display: flex; flex-wrap: wrap; gap: 10px; flex: 1; min-width: 200px; font-size: 12px; }
.pl-legend-item { display: flex; gap: 6px; align-items: center; }
.pl-legend-swatch { width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; }
.pl-legend-pct { color: #999; margin-left: 4px; }

.pl-category-table, .pl-compare-table, .pl-monthly-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.pl-category-table th, .pl-category-table td,
.pl-compare-table th, .pl-compare-table td,
.pl-monthly-table th, .pl-monthly-table td { padding: 8px; border-bottom: 1px solid #eee; text-align: left; vertical-align: middle; }
.pl-category-table th, .pl-compare-table th, .pl-monthly-table th { background: #fafafa; font-size: 11px; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: 0.04em; }

.pl-auto-info { padding: 10px 12px; background: #e3f2fd; border-radius: 6px; font-size: 12px; margin-top: 12px; color: #0d47a1; }
.pl-auto-info small { color: #1976d2; }

.pl-fiscal-preview { padding: 10px 12px; background: #fff3e0; border-radius: 4px; font-size: 13px; color: #e65100; margin-top: 8px; }

/* BA54-a レシート画像 */
.acc-form-group { display: flex; flex-direction: column; gap: 6px; }
.acc-receipt-dropzone { padding: 14px; background: #fafafa; border: 2px dashed #ccc; border-radius: 6px; text-align: center; }
.acc-receipt-dropzone .btn-secondary { padding: 8px 16px; background: #fff; color: #333; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; font-size: 13px; font-family: inherit; }
.acc-receipt-dropzone .btn-secondary:hover { background: #f5f5f5; }
.acc-receipt-dropzone .acc-hint { margin-top: 6px; font-size: 11px; }
.acc-receipt-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.acc-rcpt-thumb { position: relative; width: 80px; height: 80px; border-radius: 6px; overflow: hidden; border: 1px solid #ddd; background: #f5f5f5; }
.acc-rcpt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.acc-rcpt-remove { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; border: none; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; padding: 0; font-family: inherit; }
.acc-rcpt-remove:hover { background: rgba(0,0,0,0.8); }
.acc-rcpt-loading { position: absolute; inset: 0; background: rgba(255,255,255,0.8); display: flex; align-items: center; justify-content: center; font-size: 10px; color: #666; }
.acc-has-rcpt { cursor: pointer; color: #c2185b; font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 3px; background: #fce4ec; display: inline-block; }
.acc-has-rcpt:hover { background: #f8bbd0; }

.acc-rcpt-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.acc-rcpt-gallery-item { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid #ddd; background: #fafafa; }
.acc-rcpt-gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.acc-rcpt-gallery-item:hover img { transform: scale(1.05); }

@media (max-width: 640px) {
  .acc-toolbar { flex-direction: column; align-items: stretch; }
  .acc-summary-box { width: 100%; }
  .acc-table th, .acc-table td { padding: 6px; font-size: 11px; }
  .pl-kpi-value { font-size: 18px; }
  .pl-pie-svg { width: 160px; height: 160px; }
}

/* BA54-b Claude Vision AI */
.btn-ai {
  padding: 8px 14px;
  background: linear-gradient(135deg, #9c27b0 0%, #ec407a 100%);
  color: #fff;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  box-shadow: 0 2px 6px rgba(156, 39, 176, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-ai:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(156, 39, 176, 0.35); }
.btn-ai:disabled { background: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ai-spark { font-size: 14px; }

.acc-ai-panel {
  margin-top: 10px;
  padding: 12px;
  background: linear-gradient(135deg, #fce4ec 0%, #f3e5f5 100%);
  border: 1px solid #e1bee7;
  border-radius: 8px;
}
.acc-ai-panel h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: #6a1b9a; }
.acc-ai-panel .acc-ai-close { float: right; background: none; border: none; font-size: 14px; cursor: pointer; color: #999; padding: 0; line-height: 1; }
.acc-ai-loading { padding: 14px; text-align: center; color: #6a1b9a; font-size: 12px; }

.acc-ai-conf { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; margin-left: 6px; }
.acc-ai-conf.high { background: #c8e6c9; color: #1b5e20; }
.acc-ai-conf.mid  { background: #fff9c4; color: #f57f17; }
.acc-ai-conf.low  { background: #ffcdd2; color: #b71c1c; }

.acc-ai-extracted {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 8px 0;
}
.acc-ai-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #fff;
  border-radius: 6px;
  font-size: 12px;
}
.acc-ai-row-label { color: #888; font-size: 10px; min-width: 34px; flex-shrink: 0; }
.acc-ai-row-value { flex: 1; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-ai-apply-field {
  padding: 3px 8px;
  font-size: 10px;
  background: #fff;
  color: #6a1b9a;
  border: 1px solid #ce93d8;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}
.acc-ai-apply-field:hover { background: #f3e5f5; }

.acc-ai-apply-all {
  width: 100%;
  padding: 8px;
  background: #6a1b9a;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  font-family: inherit;
  margin-top: 6px;
}
.acc-ai-apply-all:hover { background: #4a148c; }

.acc-ai-alternatives { margin-top: 8px; }
.acc-ai-alternatives-label { font-size: 10px; color: #888; margin-bottom: 4px; }
.acc-ai-alt-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  margin-bottom: 4px;
  cursor: pointer;
  font-size: 11px;
}
.acc-ai-alt-item:hover { background: #fafafa; border-color: #ce93d8; }
.acc-ai-alt-name { font-weight: 600; color: #333; }
.acc-ai-alt-reason { color: #888; font-size: 10px; }

.acc-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: #f3e5f5;
  color: #6a1b9a;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 6px;
}
.acc-ai-badge.warn { background: #fff3e0; color: #e65100; }
.acc-ai-badge.low  { background: #ffcdd2; color: #b71c1c; }
.acc-ai-notes { font-size: 11px; color: #666; margin-top: 6px; font-style: italic; }
