/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-700: #1D4ED8;
  --blue-600: #2563EB;
  --blue-500: #3B82F6;
  --blue-100: #DBEAFE;
  --blue-50: #EFF6FF;
  --gray-900: #111827;
  --gray-800: #1F2937;
  --gray-700: #374151;
  --gray-600: #4B5563;
  --gray-500: #6B7280;
  --gray-400: #9CA3AF;
  --gray-300: #D1D5DB;
  --gray-200: #E5E7EB;
  --gray-100: #F3F4F6;
  --gray-50: #F9FAFB;
  --white: #FFFFFF;
  --red-600: #DC2626;
  --red-50: #FEF2F2;
  --amber-50: #FFFBEB;
  --amber-700: #B45309;
  --green-50: #F0FDF4;
  --green-700: #15803D;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --max-width: 1120px;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--blue-700);
  color: var(--white);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  z-index: 9999;
  font-weight: 600;
}
.skip-link:focus { top: 8px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: .95rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
  font-family: var(--font);
  white-space: nowrap;
}
.btn-primary {
  background: var(--blue-600);
  color: var(--white);
  border-color: var(--blue-600);
}
.btn-primary:hover { background: var(--blue-700); border-color: var(--blue-700); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-ghost:hover { background: var(--gray-100); text-decoration: none; }
.btn-outline {
  background: transparent;
  color: var(--blue-600);
  border-color: var(--blue-600);
}
.btn-outline:hover { background: var(--blue-50); text-decoration: none; }
.btn-danger {
  background: transparent;
  color: var(--red-600);
  border-color: var(--red-600);
}
.btn-danger:hover { background: var(--red-50); text-decoration: none; }
.btn-small { padding: 6px 12px; font-size: .85rem; }
.btn-full { width: 100%; }
.btn-remove {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: var(--radius-sm);
}
.btn-remove:hover { color: var(--red-600); background: var(--red-50); }

/* ===== Header ===== */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--gray-900);
  font-weight: 700;
  font-size: 1rem;
}
.logo:hover { text-decoration: none; }
.site-nav ul {
  display: flex;
  list-style: none;
  gap: 24px;
}
.site-nav a {
  color: var(--gray-600);
  font-weight: 500;
  font-size: .9rem;
}
.site-nav a:hover { color: var(--blue-600); text-decoration: none; }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--blue-700) 0%, var(--blue-600) 60%, var(--blue-500) 100%);
  color: var(--white);
  padding: 64px 0 48px;
}
.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
}
.hero-sub {
  font-size: 1.1rem;
  opacity: .9;
  max-width: 540px;
  margin-bottom: 28px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-actions .btn-primary {
  background: var(--white);
  color: var(--blue-700);
  border-color: var(--white);
}
.hero-actions .btn-primary:hover { background: var(--blue-50); }
.hero-actions .btn-ghost {
  color: var(--white);
  border-color: rgba(255,255,255,.4);
}
.hero-actions .btn-ghost:hover { background: rgba(255,255,255,.1); }
.hero-stats {
  display: flex;
  gap: 32px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,.2);
}
.stat-num {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
}
.stat-label {
  font-size: .85rem;
  opacity: .8;
}

/* ===== Sections ===== */
section { padding: 56px 0; }
.section-header { margin-bottom: 32px; }
.section-header h2 { margin-bottom: 8px; }
.section-header p { color: var(--gray-600); max-width: 600px; }

h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-900);
}
h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gray-900);
}

/* ===== Generator Layout ===== */
.generator-section { background: var(--white); }
.generator-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.panel {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  flex-wrap: wrap;
  gap: 8px;
}
.panel-header h3 { font-size: 1rem; }
.panel-actions { display: flex; gap: 8px; }
.panel-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--gray-200);
  text-align: right;
}
.box-count {
  font-size: .85rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* ===== Preset Bar ===== */
.preset-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--gray-200);
  flex-wrap: wrap;
}
.preset-label {
  font-size: .85rem;
  color: var(--gray-600);
  font-weight: 500;
}
.preset-bar select {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: var(--font);
  background: var(--white);
  color: var(--gray-800);
  flex: 1;
  min-width: 140px;
}

/* ===== Box List ===== */
.box-list {
  max-height: 480px;
  overflow-y: auto;
  padding: 12px 20px;
}
.box-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-200);
}
.box-row:last-child { border-bottom: none; }
.box-row input[type="text"],
.box-row select {
  padding: 8px 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-family: var(--font);
  background: var(--white);
  color: var(--gray-800);
  width: 100%;
}
.box-row input:focus,
.box-row select:focus {
  outline: 2px solid var(--blue-500);
  outline-offset: -1px;
  border-color: var(--blue-500);
}
.box-number {
  font-size: .75rem;
  color: var(--gray-400);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 2px;
  display: none;
}
.priority-high { border-left: 3px solid var(--red-600); padding-left: 8px; }
.priority-medium { border-left: 3px solid var(--amber-700); padding-left: 8px; }
.priority-low { border-left: 3px solid var(--green-700); padding-left: 8px; }

.add-box-row {
  padding: 12px 20px;
  border-top: 1px solid var(--gray-200);
}

/* ===== Preview ===== */
.preview-area {
  padding: 20px;
  max-height: 420px;
  overflow-y: auto;
}
.empty-state {
  color: var(--gray-400);
  text-align: center;
  padding: 40px 20px;
  font-style: italic;
}
.preview-label {
  background: var(--white);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
  position: relative;
}
.preview-label:last-child { margin-bottom: 0; }
.label-room {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blue-700);
  margin-bottom: 2px;
}
.label-contents {
  font-size: .9rem;
  color: var(--gray-700);
}
.label-priority {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 2px 8px;
  border-radius: 100px;
}
.priority-badge-high { background: var(--red-50); color: var(--red-600); }
.priority-badge-medium { background: var(--amber-50); color: var(--amber-700); }
.priority-badge-low { background: var(--green-50); color: var(--green-700); }
.preview-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
}
.secondary-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
}

/* ===== How It Works ===== */
.how-section { background: var(--gray-50); }
.how-section h2 { text-align: center; margin-bottom: 40px; }
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}
.step {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
}
.step-num {
  width: 36px;
  height: 36px;
  background: var(--blue-600);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 14px;
}
.step h3 { margin-bottom: 8px; }
.step p { font-size: .9rem; color: var(--gray-600); }

.info-block {
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius);
  padding: 24px;
}
.info-block h3 { margin-bottom: 12px; }
.info-block ul { padding-left: 20px; }
.info-block li { font-size: .9rem; color: var(--gray-700); margin-bottom: 6px; }

/* ===== Tips ===== */
.tips-section { background: var(--white); }
.tips-section h2 { text-align: center; margin-bottom: 32px; }
.tips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}
.tip-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
}
.tip-card h3 {
  font-size: .95rem;
  margin-bottom: 8px;
  color: var(--gray-900);
}
.tip-card p { font-size: .88rem; color: var(--gray-600); }

.faq-block {
  max-width: 700px;
  margin: 0 auto;
}
.faq-block h3 {
  text-align: center;
  font-size: 1.15rem;
  margin-bottom: 20px;
}
details {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--gray-50);
}
details summary {
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: .93rem;
  color: var(--gray-800);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
details summary::-webkit-details-marker { display: none; }
details summary::before {
  content: '+';
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--blue-600);
  flex-shrink: 0;
}
details[open] summary::before { content: '-'; }
details p {
  padding: 0 18px 14px;
  font-size: .9rem;
  color: var(--gray-600);
  line-height: 1.5;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--gray-900);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: all .2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ===== Print Styles ===== */
@media print {
  body { background: white; }
  .site-header, .site-footer, .hero, .how-section, .tips-section,
  .input-panel, .preview-actions, .preset-bar, .add-box-row,
  .panel-footer, .panel-actions, .btn-remove, .toast,
  .section-header, .secondary-actions { display: none !important; }
  .generator-section { padding: 0; }
  .generator-layout { display: block; }
  .panel { border: none; }
  .panel-header { display: none; }
  .preview-area {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-height: none;
    overflow: visible;
    padding: 0;
  }
  .preview-label {
    border: 2px dashed #999;
    padding: 20px;
    page-break-inside: avoid;
    margin-bottom: 0;
  }
}

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .generator-layout { grid-template-columns: 1fr; }
  .steps-grid { grid-template-columns: 1fr; }
  .tips-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
  .hero-stats { gap: 20px; }
  .site-nav ul { gap: 14px; }
  .site-nav a { font-size: .82rem; }
  .box-row { grid-template-columns: 1fr 1fr; }
  .box-row .btn-remove { grid-column: span 2; justify-self: end; }
}

@media (max-width: 520px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
  .logo-text { font-size: .88rem; }
  .hero { padding: 40px 0 32px; }
  .hero h1 { font-size: 1.5rem; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .preset-bar { flex-direction: column; align-items: stretch; }
  .preset-bar select { width: 100%; }
  section { padding: 40px 0; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
