
:root, [data-theme="light"] {
  --bg: #f7f6f2; --surface: #ffffff; --surface2: #f3f0ec;
  --border: #d4d1ca; --text: #28251d; --muted: #6b6962; --faint: #b0afa9;
  --primary: #01696f; --primary-hover: #0c4e54;
  --warning-bg: #fff8f0; --warning-border: #f0c88a; --warning-text: #7a4e10;
  --code-bg: #1d1c1a; --code-text: #e6e4df;
  --shadow: 0 2px 8px rgba(40,37,29,0.07), 0 8px 24px rgba(40,37,29,0.05);
  --radius: 14px;
}

[data-theme="dark"] {
  --bg: #171614; --surface: #1c1b19; --surface2: #22211f;
  --border: #393836; --text: #cdccca; --muted: #797876; --faint: #5a5957;
  --primary: #4f98a3; --primary-hover: #227f8b;
  --warning-bg: #2a2015; --warning-border: #7a5e1a; --warning-text: #e8b46a;
  --code-bg: #111110; --code-text: #d4d2ce;
  --shadow: 0 2px 8px rgba(0,0,0,0.2), 0 8px 24px rgba(0,0,0,0.25);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #171614; --surface: #1c1b19; --surface2: #22211f;
    --border: #393836; --text: #cdccca; --muted: #797876; --faint: #5a5957;
    --primary: #4f98a3; --primary-hover: #227f8b;
    --warning-bg: #2a2015; --warning-border: #7a5e1a; --warning-text: #e8b46a;
    --code-bg: #111110; --code-text: #d4d2ce;
    --shadow: 0 2px 8px rgba(0,0,0,0.2), 0 8px 24px rgba(0,0,0,0.25);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: Inter, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; min-height: 100dvh; }

/* Header */
.header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1180px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-text { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.theme-toggle { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 7px; color: var(--muted); cursor: pointer; display: flex; align-items: center; transition: background 180ms, color 180ms; }
.theme-toggle:hover { background: var(--border); color: var(--text); }

/* Layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 32px 20px 56px; display: flex; flex-direction: column; gap: 24px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 28px 32px; }
.hero { padding: 32px; }
.two-col { display: grid; grid-template-columns: 1.25fr 1fr; gap: 24px; }

/* Hero */
.badge { display: inline-flex; align-items: center; background: color-mix(in oklch, var(--primary) 12%, var(--surface)); color: var(--primary); font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; margin-bottom: 14px; letter-spacing: 0.03em; text-transform: uppercase; }
h1 { font-size: clamp(22px, 3vw, 32px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 10px; }
h2 { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
h3 { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 20px 0 8px; }
p { color: var(--muted); max-width: 72ch; }
code { background: color-mix(in oklch, var(--primary) 10%, var(--surface)); color: var(--primary); padding: 2px 7px; border-radius: 5px; font-size: 13px; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* Form */
.section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); margin: 24px 0 12px; border-top: 1px solid var(--border); padding-top: 20px; }
.section-label:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.field { margin-bottom: 14px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--border); border-radius: 9px;
  font: inherit; font-size: 14px;
  background: var(--surface2); color: var(--text);
  transition: border-color 180ms, box-shadow 180ms;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 18%, transparent);
}
textarea { resize: vertical; min-height: 260px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* File drop */
.file-drop { position: relative; border: 2px dashed var(--border); border-radius: 9px; background: var(--surface2); padding: 18px; text-align: center; cursor: pointer; transition: border-color 180ms, background 180ms; }
.file-drop:hover, .file-drop.active { border-color: var(--primary); background: color-mix(in oklch, var(--primary) 6%, var(--surface2)); }
.file-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.file-drop span { font-size: 14px; color: var(--muted); pointer-events: none; }

/* Buttons */
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn-primary, .btn-secondary, .btn-ghost { display: inline-flex; align-items: center; gap: 7px; padding: 10px 18px; border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: background 180ms, color 180ms, box-shadow 180ms; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 12px color-mix(in oklch, var(--primary) 30%, transparent); }
.btn-secondary { background: color-mix(in oklch, var(--primary) 12%, var(--surface)); color: var(--primary); }
.btn-secondary:hover { background: color-mix(in oklch, var(--primary) 20%, var(--surface)); }
.btn-ghost { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.btn-xlsx { background: #1a7a3c; color: white; }
.btn-xlsx:hover { background: #145e2e; box-shadow: 0 4px 12px rgba(26,122,60,0.3); }

.btn-ghost:hover { background: var(--border); color: var(--text); }

/* Info panel */
.info-panel { display: flex; flex-direction: column; }
.info-box { background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 14px 16px; font-size: 14px; margin-bottom: 4px; }
.info-box p { color: var(--text); margin-bottom: 8px; }
.info-box p:last-child { margin-bottom: 0; }
.info-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.info-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--border); }
.info-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.check-list, .warn-list { list-style: none; padding: 0; font-size: 14px; display: flex; flex-direction: column; gap: 5px; }
.check-list li::before { content: "✓ "; color: var(--primary); font-weight: 700; }
.warn-list li::before { content: "! "; color: #c4820a; font-weight: 700; }
.check-list li, .warn-list li { color: var(--muted); }
.stat-box { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border); display: flex; align-items: baseline; gap: 8px; }
.stat-num { font-size: 42px; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-label { font-size: 14px; color: var(--muted); }

/* Output */
.output-section { margin-top: 0; }
.output-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.output-header h2 { margin-bottom: 0; }
.output-header .actions { margin-top: 0; }
.warnings-box { background: var(--warning-bg); border: 1px solid var(--warning-border); border-radius: 10px; padding: 14px 16px; margin-bottom: 18px; }
.warnings-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--warning-text); margin-bottom: 8px; }
.warnings-box ul { padding-left: 18px; }
.warnings-box li { font-size: 14px; color: var(--warning-text); margin-bottom: 4px; }
.output-code { background: var(--code-bg); color: var(--code-text); padding: 20px; border-radius: 10px; overflow: auto; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; white-space: pre; max-height: 600px; }

/* Footer */
.footer { text-align: center; padding: 24px 20px; color: var(--faint); font-size: 13px; border-top: 1px solid var(--border); }

/* Responsive */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .panel { padding: 20px; }
  .output-header { flex-direction: column; }
}
@media (max-width: 500px) {
  .header-inner { padding: 12px 16px; }
  .wrap { padding: 16px 12px 40px; }
}
