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

:root {
  --bg:        #ffffff;
  --bg-2:      #f7f7f5;
  --bg-3:      #efefec;
  --text:      #1a1a18;
  --text-2:    #5a5a56;
  --text-3:    #8a8a84;
  --border:    rgba(0,0,0,0.10);
  --border-2:  rgba(0,0,0,0.18);
  --accent:    #3b6d11;
  --accent-bg: #eaf3de;
  --accent-tx: #27500a;
  --danger:    #a32d2d;
  --danger-bg: #fcebeb;
  --danger-tx: #791f1f;
  --radius:    8px;
  --radius-lg: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #1c1c1a;
    --bg-2:      #242422;
    --bg-3:      #2e2e2b;
    --text:      #f0efe8;
    --text-2:    #b4b2a9;
    --text-3:    #888780;
    --border:    rgba(255,255,255,0.10);
    --border-2:  rgba(255,255,255,0.18);
    --accent:    #97c459;
    --accent-bg: #173404;
    --accent-tx: #c0dd97;
    --danger:    #f09595;
    --danger-bg: #501313;
    --danger-tx: #f7c1c1;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-2);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}


h1 {
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
}

h2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}


header {
  background: var(--bg);
  border-bottom: 0.5px solid var(--border);
  padding: 0 1.5rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  font-size: 15px;
}

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


main {
  max-width: 860px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  main { grid-template-columns: 1fr; }
}

/* login page centers a single card */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

body.login-page main {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 0;
  padding: 1.5rem;
}

body.login-page h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}


.card {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.card-full { grid-column: 1 / -1; }

button,
input[type=submit],
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 36px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  border: 0.5px solid var(--border-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
  text-decoration: none;
}

button:hover,
input[type=submit]:hover { background: var(--bg-3); }

button:active,
input[type=submit]:active { transform: scale(0.98); }

button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

button.primary,
input[type=submit] {
  background: var(--accent-bg);
  color: var(--accent-tx);
  border-color: transparent;
}

button.primary:hover,
input[type=submit]:hover { filter: brightness(0.96); }

button.danger {
  background: var(--danger-bg);
  color: var(--danger-tx);
  border-color: transparent;
}

button.small { height: 26px; padding: 0 8px; font-size: 12px; }

/* login page: full-width submit */
body.login-page input[type=submit] {
  width: 100%;
  justify-content: center;
  height: 38px;
  font-size: 14px;
  margin-top: 0.5rem;
}


label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 4px;
}

input[type=text],
input[type=password],
input[type=file] {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-2);
  border: 0.5px solid var(--border-2);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
}

input[type=text]:focus,
input[type=password]:focus { border-color: var(--accent); }

input[type=file] { padding: 6px 10px; height: auto; cursor: pointer; }

/* login stacks labels + inputs with consistent spacing */
body.login-page label { margin-top: 1rem; }
body.login-page label:first-of-type { margin-top: 0; }
body.login-page input[type=text],
body.login-page input[type=password] { margin-top: 4px; }

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row input[type=text] { flex: 1; }


.param-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.param-row label {
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}


#preset-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}

#preset-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  background: var(--bg-2);
}

#preset-list li span {
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#preset-list .empty {
  color: var(--text-3);
  font-style: italic;
  font-size: 13px;
  border: none;
  background: none;
  padding: 4px 0;
}


.dropzone {
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  margin-bottom: 12px;
}

.dropzone.dragover {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent-tx);
}

.dropzone .filename {
  color: var(--text);
  font-weight: 500;
  margin-top: 4px;
}


#feedback {
  grid-column: 1 / -1;
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s;
}

#feedback.ok  { background: var(--accent-bg); color: var(--accent-tx); opacity: 1; }
#feedback.err { background: var(--danger-bg); color: var(--danger-tx); opacity: 1; }


svg.icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
