:root {
  --bg: #f7f8fa;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --primary: #1e40af;
  --primary-light: #dbeafe;
  --primary-dark: #1e3a8a;
  --accent: #059669;
  --accent-light: #d1fae5;
  --danger: #dc2626;
  --border: #e5e7eb;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.hint { font-size: 0.85rem; color: var(--text-muted); }

/* Nav */
nav { background: white; border-bottom: 1px solid var(--border); padding: 12px 0; }
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.nav-brand { font-weight: 700; font-size: 1.1rem; color: var(--primary); text-decoration: none; }
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { color: var(--text); text-decoration: none; font-size: 0.9rem; }
.nav-links a:hover { color: var(--primary); }
.lang-switch {
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 0.85rem;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  padding: 60px 0 50px;
  text-align: center;
}
.hero h1 { font-size: 2rem; margin-bottom: 12px; line-height: 1.3; }
.hero p { font-size: 1.05rem; opacity: 0.9; max-width: 600px; margin: 0 auto; }
.hero-cta { margin-top: 28px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Buttons */
.btn-primary {
  display: inline-block;
  padding: 12px 28px;
  background: white;
  color: var(--primary);
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s;
}
.btn-primary:hover { transform: translateY(-1px); }

.hero .btn-primary { background: white; color: var(--primary); }
.section .btn-primary, .page .btn-primary, form .btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
  text-align: center;
  margin-top: 16px;
}

.btn-secondary {
  display: inline-block;
  padding: 12px 28px;
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn-secondary:hover { border-color: white; }

.btn-sm {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-sm:hover { background: var(--bg); }
.btn-success { color: var(--accent); border-color: var(--accent); }
.btn-danger { color: var(--danger); border-color: var(--danger); }

/* Sections */
.section { padding: 50px 0; }
.section.alt { background: white; }
.section h2 { text-align: center; font-size: 1.5rem; margin-bottom: 32px; }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.step { text-align: center; }
.step-num {
  width: 40px; height: 40px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 12px;
}
.step h3 { margin-bottom: 8px; }
.step p { color: var(--text-muted); font-size: 0.95rem; }

/* Features */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.feature { text-align: center; padding: 20px; }
.feature h3 { margin-bottom: 8px; color: var(--primary); }
.feature p { color: var(--text-muted); font-size: 0.95rem; }

/* Types grid */
.types-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 24px; }
.type-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  font-weight: 500;
}
.center-cta { text-align: center; }
.center-cta .btn-primary { width: auto; }

/* Page */
.page { padding: 32px 0; }
.page h1 { margin-bottom: 24px; }
.center-page { display: flex; align-items: center; justify-content: center; min-height: 60vh; }

/* Form */
.quote-form { max-width: 720px; }
.form-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-size: 0.9rem; font-weight: 500; }

input, select, textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: inherit;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
textarea { resize: vertical; }

/* Upload hero */
.upload-hero {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 2px solid var(--primary);
  position: relative;
}
.upload-hero h2 { color: var(--primary); border-bottom-color: var(--primary); font-size: 1.2rem; }
.upload-hero > p { color: var(--text); font-size: 0.95rem; margin-bottom: 16px; line-height: 1.6; }
.upload-benefits { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.upload-benefit { font-size: 0.9rem; color: var(--primary-dark); font-weight: 500; }
.upload-skip { text-align: center; margin-top: 12px; font-style: italic; }

/* Upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-top: 8px;
}
.upload-area-large {
  padding: 40px 24px;
  border-color: var(--primary);
  border-width: 3px;
  background: white;
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-area-large:hover, .upload-area-large.dragover {
  background: #f0f7ff;
}
.upload-icon { font-size: 2rem; margin-bottom: 6px; }
.upload-icon-large { font-size: 3.5rem; margin-bottom: 10px; }
.upload-main-text { font-size: 1.15rem; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.link-btn {
  background: none; border: none; color: var(--primary);
  text-decoration: underline; cursor: pointer; font-size: inherit; padding: 0;
}

.status {
  margin-top: 12px; padding: 10px 14px;
  border-radius: 4px; font-size: 0.9rem;
}
.status.loading { background: #fef3c7; color: #92400e; }
.status.success { background: var(--accent-light); color: #065f46; }
.status.error { background: #fee2e2; color: #991b1b; }

/* Parsed data */
.line-items-table {
  width: 100%; font-size: 0.85rem; border-collapse: collapse; margin-top: 12px;
}
.line-items-table th, .line-items-table td {
  padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border);
}
.line-items-table th { font-weight: 600; background: var(--bg); }
.line-items-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* Success */
.success-card {
  text-align: center; background: white;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 48px; max-width: 500px;
}
.success-icon {
  width: 60px; height: 60px; background: var(--accent-light); color: var(--accent);
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700; margin-bottom: 16px;
}
.success-card h1 { margin-bottom: 12px; }
.success-card p { color: var(--text-muted); margin-bottom: 24px; }
.success-card .btn-primary { width: auto; }

/* Login */
.login-card {
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; max-width: 360px; width: 100%;
}
.login-card h1 { text-align: center; margin-bottom: 20px; }

/* Admin */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.stat-card.highlight { background: var(--primary-light); }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background: var(--bg); font-weight: 600; }
.admin-table .empty { text-align: center; color: var(--text-muted); padding: 24px; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
}
.badge-new { background: #dbeafe; color: #1e40af; }
.badge-in_progress, .badge-contacting { background: #fef3c7; color: #92400e; }
.badge-quotes_received { background: #d1fae5; color: #065f46; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.detail-section { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.detail-section h3 { margin-bottom: 12px; border-bottom: 2px solid var(--primary-light); padding-bottom: 6px; }
.detail-table { width: 100%; font-size: 0.9rem; }
.detail-table td { padding: 4px 0; }
.detail-table td:first-child { color: var(--text-muted); width: 120px; }
.description-block { background: var(--bg); padding: 12px; border-radius: 4px; white-space: pre-wrap; font-size: 0.9rem; margin-top: 8px; }
.status-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Footer */
footer {
  text-align: center; padding: 30px 0; margin-top: 40px;
  border-top: 1px solid var(--border); font-size: 0.9rem;
}
footer a { color: var(--primary); }

/* Mobile */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.5rem; }
  .steps, .features { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
