/* ==================== リセット・ベース ==================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: #F8FAFC;
  color: #1E293B;
  line-height: 1.6;
  min-width: 1280px;
}

a {
  color: #2563EB;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ==================== レイアウト ==================== */
.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: 32px 0;
}

/* ==================== ヘッダー ==================== */
.header {
  background: #FFFFFF;
  border-bottom: 1px solid #E2E8F0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: #2563EB;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.header-logo:hover {
  text-decoration: none;
  color: #1D4ED8;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user {
  font-size: 0.875rem;
  color: #64748B;
}

/* ==================== フッター ==================== */
.footer {
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
  padding: 16px 0;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 0.875rem;
}

.footer-copy {
  margin-left: auto;
  color: #94A3B8;
}

/* ==================== ページコンテナ ==================== */
.page-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-narrow {
  max-width: 800px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0F172A;
}

.page-actions {
  display: flex;
  gap: 12px;
}

/* ==================== カード ==================== */
.card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #F1F5F9;
}

.card-danger {
  border-color: #FCA5A5;
}

/* ==================== ボタン ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: #2563EB;
  color: #FFFFFF;
  border-color: #2563EB;
}

.btn-primary:hover:not(:disabled) {
  background: #1D4ED8;
  border-color: #1D4ED8;
  color: #FFFFFF;
}

.btn-secondary {
  background: #FFFFFF;
  color: #374151;
  border-color: #D1D5DB;
}

.btn-secondary:hover:not(:disabled) {
  background: #F9FAFB;
  color: #374151;
}

.btn-danger {
  background: #EF4444;
  color: #FFFFFF;
  border-color: #EF4444;
}

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
  border-color: #DC2626;
  color: #FFFFFF;
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 5px 14px;
  font-size: 0.825rem;
}

/* ==================== フォーム ==================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.required {
  color: #EF4444;
  margin-left: 2px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #1E293B;
  background: #FFFFFF;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input-error {
  border-color: #EF4444;
}

.input-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.field-error {
  display: block;
  color: #EF4444;
  font-size: 0.8rem;
  margin-top: 4px;
}

.form-hint {
  font-size: 0.8rem;
  color: #64748B;
  margin-top: 4px;
}

.form-checkbox-group {
  display: flex;
  align-items: flex-start;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #374151;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: #2563EB;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.form-actions-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.conv-rate-display {
  padding: 9px 12px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  color: #2563EB;
  min-height: 40px;
}

/* ==================== テーブル ==================== */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  background: #FFFFFF;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead {
  background: #F8FAFC;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid #E2E8F0;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #F1F5F9;
  color: #1E293B;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.table-row-hover {
  cursor: pointer;
  transition: background 0.1s;
}

.table-row-hover:hover {
  background: #EFF6FF;
}

.sortable {
  cursor: pointer;
  user-select: none;
}

.sortable:hover {
  background: #F1F5F9;
}

.sort-icon {
  color: #CBD5E1;
  font-size: 0.8rem;
  margin-left: 4px;
}

.sort-icon.active {
  color: #2563EB;
}

.table-empty {
  text-align: center;
  color: #94A3B8;
  padding: 40px;
}

/* ==================== 星マーク ==================== */
.star-mark {
  color: #F59E0B;
  margin-right: 4px;
  font-size: 1rem;
}

/* ==================== ページネーション ==================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.pagination-info {
  font-size: 0.875rem;
  color: #64748B;
}

/* ==================== アラート ==================== */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

.alert-error {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.alert-warning {
  background: #FFFBEB;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.alert-success {
  background: #F0FDF4;
  color: #166534;
  border: 1px solid #BBF7D0;
}

.success-inline {
  color: #16A34A;
  font-size: 0.875rem;
  margin-left: 12px;
}

.danger-text {
  color: #DC2626;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

/* ==================== ローディング ==================== */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  gap: 16px;
  color: #64748B;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #E2E8F0;
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== ログインページ ==================== */
.login-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #F1F5F9;
  padding: 24px;
}

.login-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0F172A;
  text-align: center;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 0.875rem;
  color: #64748B;
  text-align: center;
  margin-bottom: 28px;
}

.login-footer {
  margin-top: 24px;
  font-size: 0.8rem;
  color: #94A3B8;
}

/* ==================== 情報リスト ==================== */
.info-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  font-size: 0.9rem;
}

.info-list dt {
  font-weight: 500;
  color: #64748B;
}

.info-list dd {
  color: #1E293B;
}

/* ==================== ジョブステータス ==================== */
.job-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.job-status-waiting {
  background: #FEF3C7;
  color: #92400E;
}

.job-status-processing {
  background: #DBEAFE;
  color: #1E40AF;
}

.job-status-completed {
  background: #DCFCE7;
  color: #166534;
}

.job-status-error {
  background: #FEF2F2;
  color: #DC2626;
}

/* ==================== モーダル ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}

.modal-content {
  background: #FFFFFF;
  border-radius: 10px;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #E2E8F0;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #0F172A;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #94A3B8;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
}

.modal-close:hover {
  color: #1E293B;
  background: #F1F5F9;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #E2E8F0;
  display: flex;
  justify-content: flex-end;
}

.template-text {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 16px;
  font-size: 0.875rem;
  line-height: 1.7;
  color: #374151;
  white-space: pre-wrap;
}

.template-note {
  margin-top: 12px;
  font-size: 0.8rem;
  color: #64748B;
}

/* ==================== チャート ==================== */
.chart-note {
  font-size: 0.8rem;
  color: #64748B;
  margin-bottom: 16px;
}

/* ==================== プロース（文章ページ） ==================== */
.prose h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #0F172A;
  margin-top: 24px;
  margin-bottom: 8px;
}

.prose h3:first-child {
  margin-top: 0;
}

.prose p {
  font-size: 0.9rem;
  color: #374151;
  margin-bottom: 8px;
}

.prose ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.prose li {
  font-size: 0.9rem;
  color: #374151;
  margin-bottom: 4px;
}

.policy-date {
  margin-top: 32px;
  font-size: 0.8rem;
  color: #94A3B8;
}

/* ==================== OSSエントリ ==================== */
.oss-entry {
  border-bottom: 1px solid #F1F5F9;
  padding: 16px 0;
}

.oss-entry:last-child {
  border-bottom: none;
}

.oss-entry h3 {
  font-size: 0.975rem;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 4px;
}

.oss-entry p {
  font-size: 0.85rem;
  color: #64748B;
  margin-bottom: 2px;
}
