:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --bg-light: #f3f4f6;
  --bg-dark: #111827;
  --card-bg-light: #ffffff;
  --card-bg-dark: #1f2937;
  --text-light: #111827;
  --text-dark: #f9fafb;
  --border-light: #e5e7eb;
  --border-dark: #374151;

  --radius: 10px;
  --shadow: 0 6px 16px rgba(0,0,0,0.12);
  --toast-bg: rgba(0,0,0,0.8);
  --toast-text: #fff;
}

[data-theme="light"] { --bg: var(--bg-light); --card-bg: var(--card-bg-light); --text: var(--text-light); --border: var(--border-light); }
[data-theme="dark"] { --bg: var(--bg-dark); --card-bg: var(--card-bg-dark); --text: var(--text-dark); --border: var(--border-dark); }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); }

.wrapper { width: 100%; max-width: 860px; margin: 0 auto; padding: 2rem 1rem 3rem; display: grid; gap: 1.25rem; }
.header { display: flex; align-items: center; justify-content: space-between; }
h1 { font-size: 1.7rem; margin: 0; }

.card, .how { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.card h2 { margin-top: 0; font-size: 1.2rem; }
.card p { margin: 0.25rem 0 0.75rem; color: var(--text); }

.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; outline: none; }
.dropzone:hover, .dropzone:focus { border-color: var(--primary); background: rgba(79,70,229,0.05); }
.dropzone-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.dropzone-text { font-size: 0.95rem; }

.file-meta { display: flex; gap: .75rem; font-size: .9rem; color: var(--text); opacity: .9; }

label { display: block; font-size: .9rem; margin: .5rem 0 .25rem; }
select, input[type="text"], input[type="number"] { width: 100%; padding: .65rem .75rem; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); border-radius: var(--radius); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.chk { display: inline-flex; align-items: center; gap: .5rem; user-select: none; }

button { width: 100%; padding: .8rem 1rem; font-size: 1rem; border: none; border-radius: var(--radius); background: var(--primary); color: #fff; cursor: pointer; transition: background .2s, transform .02s; }
button:active { transform: translateY(1px); }
button:hover:not([disabled]) { background: var(--primary-hover); }
button[disabled] { background: #a5b4fc; cursor: not-allowed; }

.secondary { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.secondary:hover:not([disabled]) { background: rgba(79,70,229,.08); }

.icon-btn { border: 1px solid var(--border); background: var(--card-bg); color: var(--text); border-radius: 999px; padding: .5rem .65rem; }

.status { margin-top: .25rem; font-size: .9rem; font-style: italic; min-height: 1.2em; }

.table-preview { margin-top: .5rem; border: 1px solid var(--border); border-radius: var(--radius); max-height: 360px; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid var(--border); padding: .5rem; font-size: .85rem; text-align: left; }
th { position: sticky; top: 0; background: var(--card-bg); z-index: 1; }
tr:nth-child(even) td { background: rgba(0,0,0,0.03); }

#progressBarContainer { height: 10px; background: var(--border); border-radius: var(--radius); overflow: hidden; margin-top: .5rem; }
#progressBar { height: 100%; width: 0%; background: var(--primary); transition: width .25s ease; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-text); padding: .75rem 1rem; border-radius: var(--radius); font-size: .9rem; display: none; z-index: 1000; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }


.btn-row { display: flex; gap: .75rem; align-items: center; margin-top: .5rem; }
.btn-row #splitBtn { flex: 1; }
.btn-row #resetBtn { flex: 0 0 auto; width: auto; padding: .8rem 1.25rem; font-size: .9rem; }

