:root {
  --bg: #1b1f24;
  --panel: #242a32;
  --line: #3a4450;
  --text: #e8edf2;
  --muted: #9aa6b2;
  --accent: #d9772a;
  --good: #3c9d64;
  --warn: #c9a227;
  --bad: #c44c4c;
  --draft: #6b7784;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: #f0c089; text-decoration: none; }
a:hover { text-decoration: underline; }
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #12161b;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: 0.04em; }
nav { display: flex; gap: 16px; }
.userbar { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 14px; }
main { padding: 20px; max-width: 1200px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.card h3, .panel h2 { margin: 0 0 8px; font-size: 16px; }
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
form.inline, .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select, textarea, button {
  font: inherit;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #1b2128;
  color: var(--text);
}
button, .btn {
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
button.secondary { background: #3a4450; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #3a4450;
}
.badge.planned { background: #355a8c; }
.badge.in_progress { background: var(--warn); color: #1b1f24; }
.badge.completed { background: var(--good); }
.badge.cancelled, .badge.blocked { background: var(--bad); }
.badge.draft, .badge.pending { background: var(--draft); }
.error { background: #4a2323; border: 1px solid var(--bad); padding: 10px; border-radius: 6px; }
.login { max-width: 420px; margin: 8vh auto; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
table.nested { margin: 0 0 6px; font-size: 13px; }
table.nested th, table.nested td { padding: 4px 8px; }
details summary { cursor: pointer; margin-bottom: 8px; color: var(--muted); }

.tabs { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 16px; border-radius: 6px 6px 0 0; color: var(--muted); }
.tabs a.active { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-bottom: 1px solid var(--panel); margin-bottom: -1px; }
.gantt-controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); width: 100%; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 5px; vertical-align: -2px; }
.gantt { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; overflow: hidden; background: #1b2128; }
.scroller { position: relative; overflow: auto; }
.scroller canvas { position: sticky; top: 0; left: 0; display: block; }
.scroller #sizer { position: absolute; top: 0; left: 0; pointer-events: none; }
.gantt-tip { position: fixed; z-index: 20; max-width: 320px; background: #12161b; border: 1px solid var(--line); padding: 8px 10px; border-radius: 6px; font-size: 12px; line-height: 1.5; pointer-events: none; }
.machines-pick { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0; }
label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }

.notice { background: #1f3a2a; border: 1px solid var(--good); padding: 10px; border-radius: 6px; }
.roles-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.roles-grid .card p { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
td form.inline { gap: 6px; }
td form.inline input, td form.inline select { padding: 5px 8px; }

.credentials { border-color: var(--accent); }
.cred-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.cred-row input { font-family: Consolas, monospace; }
button:disabled { opacity: .5; cursor: not-allowed; }
