:root {
  --bg: #12141a;
  --panel: #1a1d26;
  --border: #2a2f3a;
  --text: #e8eaed;
  --muted: #8b93a7;
  --accent: #3d8bfd;
  --danger: #e35d6a;
  --ok: #3dbf8f;
  --mono: "Cascadia Code", "Consolas", "Liberation Mono", monospace;
  --sans: "Segoe UI", system-ui, sans-serif;
  --display: "Black Ops One", "Impact", "Arial Black", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
}

a { color: var(--accent); }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.logo {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.75rem;
  line-height: 1.1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  color: var(--text);
  margin: 0;
}
.logo--header {
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  text-align: left;
}
.task-desc {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #0f1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  min-height: 3.2em;
}
.extra-params { margin-top: 4px; }
.param-period {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #141822;
  max-width: 100%;
}
.param-legend {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.param-date {
  min-width: 0;
  max-width: 100%;
}
.param-date span { display: block; margin-bottom: 6px; }

input[type="date"] {
  color-scheme: dark;
  min-height: 2.6rem;
  font-size: 0.95rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.9;
  /* color-scheme: dark уже даёт светлую иконку; invert делал её чёрной */
  filter: none;
  width: 1.35rem;
  height: 1.35rem;
  padding: 2px;
  background-size: contain;
}

.year-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.year-check { margin-bottom: 0; }
.param-toggle { margin-top: 4px; margin-bottom: 12px; }
.output-checks {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 6px;
}
.output-checks .check {
  margin-bottom: 0;
}

.layout {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 16px;
  padding: 16px 20px 24px;
  min-height: calc(100vh - 56px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  min-width: 0;
}

.launch {
  grid-row: 1 / 3;
  overflow-x: hidden;
}
.jobs { grid-column: 2; }
.log-panel {
  grid-column: 2;
  min-height: 360px;
  display: flex;
  flex-direction: column;
}

h1, h2 { margin: 0 0 12px; font-size: 16px; font-weight: 650; }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

input, select, button, textarea {
  font: inherit;
  color: var(--text);
}

input, select {
  background: #0f1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

button {
  border: 1px solid var(--border);
  background: #222733;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover { border-color: #3a4254; }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  width: 100%;
  margin-top: 4px;
}
button.ghost { background: transparent; }
button.danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
  padding: 4px 8px;
  font-size: 12px;
}
button.linkish {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-family: var(--mono);
  font-size: 12px;
}

.muted { color: var(--muted); }
.error { color: var(--danger); margin: 0 0 8px; }
.ok { color: var(--ok); margin: 0 0 8px; }
.hint { font-size: 12px; min-height: 2.5em; }
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.extra-params .check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.check-danger {
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  border-radius: 8px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.check-danger input { accent-color: var(--danger); }

.jobs-scroll {
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #3a4254 transparent;
}
.jobs-scroll::-webkit-scrollbar {
  width: 6px;
}
.jobs-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.jobs-scroll::-webkit-scrollbar-thumb {
  background: #3a4254;
  border-radius: 999px;
}
.jobs-table {
  width: 100%;
  border-collapse: collapse;
}
.jobs-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}
.jobs-table th, .jobs-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.jobs-table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.truncate {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-running .badge, .badge.status-running { border-color: var(--accent); color: var(--accent); }
.status-done .badge, .badge.status-done { border-color: var(--ok); color: var(--ok); }
.status-failed .badge, .badge.status-failed { border-color: var(--danger); color: var(--danger); }
.status-killed .badge, .badge.status-killed { border-color: #c9a227; color: #c9a227; }
.status-queued .badge, .badge.status-queued { color: var(--muted); }

#log-box { flex: 1; min-height: 0; }
.log-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
pre.log {
  margin: 0;
  height: 420px;
  overflow: auto;
  background: #0b0d12;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 500px at 20% 0%, #1c2740 0%, transparent 60%),
    var(--bg);
}
.login-card {
  width: 340px;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.login-card .logo {
  margin-bottom: 16px;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  max-width: 100%;
}
.login-card button { width: 100%; margin-top: 8px; background: var(--accent); border-color: var(--accent); }
.login-card .error { margin-top: 0; }
.params-empty {
  margin: 0 0 12px;
  font-size: 12px;
}
.poll-hint {
  margin: 8px 0 0;
  font-size: 11px;
}

.uploads-panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logout-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.cron-dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--panel);
  color: var(--text);
  width: min(520px, calc(100vw - 32px));
  max-height: min(70vh, 520px);
}
.cron-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.cron-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.cron-dialog__head h2 {
  margin: 0;
  font-size: 16px;
}
.cron-hint {
  margin: 0 0 10px;
  font-size: 11px;
  line-height: 1.35;
}
.cron-scroll {
  max-height: 200px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #3a4254 transparent;
}
.cron-scroll::-webkit-scrollbar { width: 6px; }
.cron-scroll::-webkit-scrollbar-track { background: transparent; }
.cron-scroll::-webkit-scrollbar-thumb {
  background: #3a4254;
  border-radius: 999px;
}
.cron-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.cron-table th, .cron-table td {
  text-align: left;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.cron-table th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--muted);
  font-weight: 500;
  z-index: 1;
}
.cron-note {
  display: block;
  font-size: 11px;
  margin-top: 2px;
}
.uploads-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.uploads-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #3a4254 transparent;
}
.uploads-list::-webkit-scrollbar {
  width: 6px;
}
.uploads-list::-webkit-scrollbar-track {
  background: transparent;
}
.uploads-list::-webkit-scrollbar-thumb {
  background: #3a4254;
  border-radius: 999px;
}
.uploads-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: #141822;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.upload-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.upload-name {
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  background: #1a1d26;
}
.download-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .launch { grid-row: auto; }
}
