/* ==========================================================================
   Ishidaya Asset-Renew Navi - Style System
   株式会社石田屋（オネスティーハウス石田屋）
   Colors: Honesty Deep Blue (#0369a1), Warm Amber (#d97706), Emerald (#059669), Slate Navy (#0f172a)
   ========================================================================== */

:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-sub: #f1f5f9;
  --bg-highlight: #f0f9ff;
  --bg-warning: #fef2f2;
  --bg-amber-subtle: #fffbeb;
  --bg-emerald-subtle: #f0fdf4;
  
  --border-color: #e2e8f0;
  --border-dark: #cbd5e1;
  --border-focus: #0284c7;
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --ishidaya-blue: #0284c7;
  --ishidaya-blue-dark: #0369a1;
  --ishidaya-navy: #0f172a;
  --ishidaya-orange: #ea580c;
  --accent-red: #dc2626;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

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

body {
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Container */
.app-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-badge {
  background: linear-gradient(135deg, var(--ishidaya-blue-dark), var(--ishidaya-blue));
  color: #ffffff;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-titles h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-titles h1 span {
  font-size: 13px;
  font-weight: 500;
  color: var(--ishidaya-blue-dark);
  background: var(--bg-highlight);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid #bae6fd;
}

.brand-titles p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.btn-print {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ishidaya-blue);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn-print:hover {
  background: var(--ishidaya-blue-dark);
  transform: translateY(-1px);
}

.btn-settings {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-sub);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-settings:hover {
  background: #e2e8f0;
}

/* Layout Grid */
.main-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

/* Form Styles */
.form-group {
  margin-bottom: 18px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-label .badge-opt {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-select,
.form-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.form-select:focus,
.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.input-slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.input-slider-group input[type="range"] {
  flex: 1;
  accent-color: var(--ishidaya-blue);
}

.input-slider-group .slider-val {
  min-width: 72px;
  text-align: right;
  font-weight: 800;
  font-size: 14px;
  color: var(--ishidaya-blue-dark);
}

/* Radio Cards */
.radio-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.radio-card-label {
  display: flex;
  flex-direction: column;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  background: #ffffff;
}

.radio-card-label:hover {
  border-color: var(--border-focus);
  background: var(--bg-highlight);
}

.radio-card-label input {
  display: none;
}

.radio-card-label.active {
  border-color: var(--ishidaya-blue);
  background: var(--bg-highlight);
  box-shadow: 0 0 0 1px var(--ishidaya-blue);
}

.radio-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.radio-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Alert Boxes */
.alert-risk {
  background: var(--bg-warning);
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 20px;
}

.alert-risk-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-red);
  margin-bottom: 8px;
}

.alert-risk-body {
  font-size: 12px;
  color: #7f1d1d;
  line-height: 1.6;
}

/* Tax Simulation Hero Box */
.tax-hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.tax-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tax-stat-card.danger {
  border-color: #fca5a5;
  background: #fff5f5;
}

.tax-stat-card.highlight {
  border-color: #bae6fd;
  background: var(--bg-highlight);
}

.tax-stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tax-stat-value {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-primary);
  margin: 8px 0 4px;
}

.tax-stat-value.red {
  color: var(--accent-red);
}

.tax-stat-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* 10-Year Loss Bar */
.loss-bar-container {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 24px;
}

.loss-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.loss-bar-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

.loss-bar-total {
  font-size: 20px;
  font-weight: 900;
  color: var(--accent-red);
}

.progress-track {
  height: 14px;
  background: #f1f5f9;
  border-radius: 7px;
  display: flex;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-seg {
  height: 100%;
  transition: width 0.3s ease;
}

.seg-tax { background: #ef4444; }
.seg-maint { background: #f97316; }
.seg-risk { background: #fbbf24; }

.progress-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* 3-Plan Comparison Table / Cards */
.plans-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}

.plan-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.plan-card.recommended {
  border-color: var(--ishidaya-blue);
  box-shadow: 0 0 0 1px var(--ishidaya-blue), var(--shadow-sm);
}

.plan-badge {
  position: absolute;
  top: -10px;
  right: 14px;
  background: var(--ishidaya-blue);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
}

.plan-header {
  margin-bottom: 12px;
}

.plan-division {
  font-size: 11px;
  font-weight: 700;
  color: var(--ishidaya-blue-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.plan-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 2px;
}

.plan-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  min-height: 32px;
}

.plan-metrics {
  background: var(--bg-sub);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 12px 0;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed #e2e8f0;
}

.metric-row:last-child {
  border-bottom: none;
  font-weight: 800;
  font-size: 13px;
  color: var(--text-primary);
  margin-top: 4px;
  padding-top: 6px;
}

.metric-row .val {
  font-weight: 700;
}

.metric-row .val.green {
  color: var(--accent-emerald);
}

.metric-row .val.blue {
  color: var(--ishidaya-blue-dark);
}

.plan-footer {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
  background: #f8fafc;
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* Lead Support Area (Municipalities) */
.support-section {
  background: var(--bg-amber-subtle);
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}

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

.support-title {
  font-size: 14px;
  font-weight: 800;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 8px;
}

.support-badge {
  font-size: 11px;
  font-weight: 700;
  background: #fef3c7;
  color: #b45309;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid #fcd34d;
}

.support-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.support-item {
  background: #ffffff;
  border: 1px solid #fef3c7;
  border-radius: var(--radius-sm);
  padding: 12px;
}

.support-item-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.support-item-summary {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 4px 0 8px;
}

.support-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ishidaya-blue-dark);
  text-decoration: none;
}

.support-link-btn:hover {
  text-decoration: underline;
}

/* Sales Pitch / Disclaimer */
.pitch-box {
  background: var(--bg-card);
  border: 1px dashed var(--border-dark);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.pitch-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ishidaya-blue-dark);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pitch-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.disclaimer-box {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

/* Drawer for Unit Prices Settings */
.settings-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(2px);
}

.settings-modal.active {
  display: flex;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
}

.btn-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

/* ==========================================================================
   A4 Print Optimization (Print CSS)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    font-size: 11pt !important;
    color: #000000 !important;
  }
  
  .app-container {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .header-actions,
  .btn-print,
  .btn-settings,
  .settings-modal {
    display: none !important;
  }
  
  .main-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  
  .card-input-section {
    display: none !important; /* 印刷時は入力フォームを隠し、診断カルテのみ出力 */
  }
  
  .app-header {
    border: none !important;
    padding: 0 0 10px 0 !important;
    margin-bottom: 12px !important;
    border-bottom: 2px solid #0f172a !important;
  }
  
  .card {
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    padding: 12px !important;
    margin-bottom: 10px !important;
    break-inside: avoid;
  }
  
  .plans-grid {
    gap: 10px !important;
  }
  
  .plan-card {
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    padding: 10px !important;
  }
  
  .tax-stat-card {
    padding: 10px !important;
  }
  
  .tax-stat-value {
    font-size: 18pt !important;
  }
  
  .support-list {
    gap: 8px !important;
  }
  
  .support-item {
    padding: 8px !important;
  }
}
