:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #68778c;
  --line: #e3e8ef;
  --accent: #1f6feb;
  --accent-dark: #1757bb;
  --green: #1a9e55;
  --orange: #e08a00;
  --red: #d64545;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161d;
    --card: #1a212b;
    --text: #e8edf4;
    --muted: #93a1b5;
    --line: #2a3442;
    --accent: #3b82f6;
    --accent-dark: #2a65c7;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
header {
  padding: 14px 16px 0;
  max-width: 1000px;
  margin: 0 auto;
}
h1 { margin: 0 0 10px; font-size: 1.5rem; }
h2 { margin: 0 0 12px; font-size: 1.1rem; }
nav { display: flex; gap: 8px; flex-wrap: wrap; }
nav button {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}
nav button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#status-badges { margin: 8px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--card);
}
.badge.on { color: var(--green); border-color: var(--green); }
main { max-width: 1000px; margin: 0 auto; padding: 8px 16px 48px; }
.tab { display: none; }
.tab.active { display: block; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
input, select, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
button.primary, button.secondary, button.small {
  font: inherit;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--line);
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  padding: 10px 18px;
  margin-top: 6px;
}
button.primary:hover { background: var(--accent-dark); }
button.secondary { background: var(--card); color: var(--text); padding: 8px 14px; }
button.small { padding: 4px 10px; font-size: 0.82rem; background: var(--card); color: var(--text); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 180px; }
.hint { color: var(--muted); font-size: 0.85rem; }
.equipment-row { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
#suggest-source { color: var(--muted); font-size: 0.82rem; }
#equipment-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
}
.chip button { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 0.9rem; padding: 0; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.task, .worker {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.task-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.task h3 { margin: 0; font-size: 1rem; }
.meta { color: var(--muted); font-size: 0.84rem; margin-top: 4px; }
.status {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  align-self: flex-start;
}
.status.nova { background: #8884; }
.status.poslata { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.status.prihvacena { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }
.status.u_toku { background: color-mix(in srgb, var(--orange) 25%, transparent); color: var(--orange); }
.status.zavrsena { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.status.problem, .status.otkazana { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tile {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.tile .num { font-size: 1.6rem; font-weight: 700; }
.tile .lbl { color: var(--muted); font-size: 0.8rem; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 110px; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 0.88rem; }
.bar { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; height: 18px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); }
.bar.green > div { background: var(--green); }
.bar-val { color: var(--muted); text-align: right; }
.worker-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
code.join { background: var(--bg); border: 1px dashed var(--line); padding: 2px 8px; border-radius: 6px; font-size: 0.95rem; letter-spacing: 1px; }
.tg-on { color: var(--green); font-size: 0.82rem; }
.tg-off { color: var(--muted); font-size: 0.82rem; }
.events { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; font-size: 0.82rem; color: var(--muted); }
/* Login screen — split layout */
#login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.login-wrapper {
  min-height: 100vh;
  display: flex;
  background: #0b1120;
}
.login-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 48px;
  background: linear-gradient(160deg, #0f172a 0%, #1e1b4b 40%, #1e3a5f 100%);
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -120px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.login-left::after {
  content: "";
  position: absolute;
  bottom: -80px;
  left: -80px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(139,92,246,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.login-hero-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 28px;
  filter: drop-shadow(0 8px 24px rgba(59,130,246,0.3));
}
.login-hero-title {
  color: #fff;
  font-size: 2.4rem;
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: -1px;
}
.login-hero-text {
  color: #94a3b8;
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0 0 36px;
  max-width: 380px;
}
.login-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.login-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  font-size: 0.9rem;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
}
.login-feature-icon { font-size: 1.2rem; }
.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  max-width: 520px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 20px;
  padding: 36px 32px 28px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.4);
}
.login-card-header {
  text-align: center;
  margin-bottom: 24px;
}
.login-card-logo {
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
}
.login-card-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 4px;
}
.login-card-subtitle {
  color: #64748b;
  font-size: 0.9rem;
  margin: 0;
}
.login-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
}
.login-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: #64748b;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.25s;
}
.login-tab.active {
  background: #fff;
  color: #1e293b;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.login-label {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 16px;
}
.login-label-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.login-input-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: #94a3b8;
  pointer-events: none;
}
.login-input-wrap input,
.login-input-wrap select {
  width: 100%;
  padding: 12px 14px 12px 40px;
  font-size: 0.95rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: #1e293b;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-input-wrap input:focus,
.login-input-wrap select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.login-submit {
  width: 100%;
  padding: 13px 18px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  color: #fff;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(59,130,246,0.3);
}
.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(59,130,246,0.4);
}
.login-submit:active {
  transform: translateY(0);
}
.login-footer {
  text-align: center;
  color: #94a3b8;
  font-size: 0.78rem;
  margin: 20px 0 0;
}
@media (max-width: 768px) {
  .login-wrapper { flex-direction: column; }
  .login-left {
    padding: 36px 24px 28px;
    min-height: auto;
  }
  .login-hero-title { font-size: 1.6rem; }
  .login-hero-text { display: none; }
  .login-features { display: none; }
  .login-right { max-width: 100%; padding: 0 16px 40px; }
  .login-card { padding: 28px 20px 24px; }
}

@media (max-width: 560px) {
  .bar-row { grid-template-columns: 100px 1fr 90px; }
}
