* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font: 14px/1.4 -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #12141a; color: #dfe3ea;
  display: flex; flex-direction: column; overflow: hidden;
}
button {
  font: inherit; color: #dfe3ea; background: #262b38; border: 1px solid #333a4c;
  border-radius: 7px; padding: 5px 12px; cursor: pointer;
}
button:hover { background: #2f3648; }
button.pri { background: #3a6fd8; border-color: #3a6fd8; color: #fff; }
button.pri:hover { background: #4a7ee6; }
button.ghost { background: transparent; }
button.danger { background: #7a2f33; border-color: #8d3b40; color: #ffd9d9; }
button.danger:hover { background: #8d3b40; }
.hidden { display: none !important; }
.sp { flex: 1; }
input, select, textarea {
  font: inherit; color: #dfe3ea; background: #1a1e28; border: 1px solid #333a4c;
  border-radius: 7px; padding: 6px 9px; width: 100%;
}
input[type=color] { padding: 2px; height: 34px; cursor: pointer; }
input[type=range] { padding: 0; border: none; background: transparent; }
label { display: block; margin: 8px 0; font-size: 12px; color: #9aa3b5; }
label.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #dfe3ea; cursor: pointer; }
label.chk input { width: auto; }
label b { color: #dfe3ea; }

/* ---------- шапка ---------- */
#top {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: #1a1d25; border-bottom: 1px solid #262b38; flex: none; z-index: 100;
}
.logo { font-weight: 800; letter-spacing: 3px; color: #e0564f; margin-right: 6px; }
.zoom { display: flex; align-items: center; gap: 6px; }
.zoom button { width: 30px; padding: 5px 0; }
#zoomLbl { font-size: 12px; color: #9aa3b5; min-width: 42px; text-align: center; }
#meBadge { display: flex; align-items: center; gap: 7px; font-weight: 600; }
#meBadge .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

/* ---------- полотно ---------- */
#wrap { flex: 1; overflow: auto; position: relative; }
#head {
  position: sticky; top: 0; z-index: 50; height: 48px;
  background: #171a22; border-bottom: 1px solid #2a3040;
}
#head .corner {
  position: sticky; left: 0; z-index: 5; width: 170px; height: 100%;
  background: #171a22; border-right: 1px solid #2a3040;
  display: flex; align-items: center; padding: 0 12px;
  font-size: 11px; color: #6b7488; text-transform: uppercase; letter-spacing: 1px;
}
.dayCell { position: absolute; top: 0; height: 100%; border-left: 1px solid #2a3040; overflow: hidden; }
.dayCell .dn { font-size: 12px; font-weight: 600; color: #aeb7c9; padding: 4px 8px 0; white-space: nowrap; }
.dayCell .dn.today { color: #ff8b84; }
.dayCell .hrs { position: relative; height: 20px; }
.dayCell .hr { position: absolute; top: 1px; font-size: 10px; color: #5d6578; transform: translateX(2px); }

#chart { position: relative; }
.gridday {
  position: absolute; top: 0; bottom: 0; border-left: 1px solid #232838;
  background-image: repeating-linear-gradient(to right, rgba(255,255,255,.035) 0 1px, transparent 1px var(--hw));
}
.gridday.today { background-color: rgba(224,86,79,.045); }

.lane { position: absolute; left: 0; width: 100%; border-bottom: 1px solid #20242f; }
.lane .lab {
  position: sticky; left: 0; z-index: 30; width: 170px; height: 100%;
  background: #171a22; border-right: 1px solid #2a3040;
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  font-weight: 600; font-size: 13px; overflow: hidden; white-space: nowrap;
}
.lab .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lab .star { color: #d8b13a; font-size: 11px; }

.task {
  position: absolute; height: 30px; border-radius: 7px; z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,.35); cursor: grab; overflow: visible;
  user-select: none;
}
.task:active { cursor: grabbing; }
.task .prog {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(255,255,255,.28); border-radius: 7px 0 0 7px; pointer-events: none;
}
.task .tt {
  position: absolute; left: 8px; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 12px; font-weight: 600; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.task .rs {
  position: absolute; right: 0; top: 0; bottom: 0; width: 9px; cursor: ew-resize;
  border-radius: 0 7px 7px 0;
}
.task .rs:hover { background: rgba(255,255,255,.25); }
.task .ldot {
  position: absolute; right: -7px; top: 50%; transform: translateY(-50%);
  width: 13px; height: 13px; border-radius: 50%; background: #fff;
  border: 2px solid #12141a; cursor: crosshair; opacity: 0; transition: opacity .12s;
  z-index: 12;
}
.task:hover .ldot { opacity: 1; }
.task.linkTarget { outline: 2px solid #fff; }
.task:not(.mine) { opacity: .82; cursor: default; }

#links { position: absolute; left: 0; top: 0; z-index: 20; pointer-events: none; }
#links path.dep { pointer-events: stroke; cursor: pointer; }
#links path.dep:hover { stroke: #fff; }
#links .depdot { pointer-events: all; cursor: pointer; }

.nowline { position: absolute; top: 0; bottom: 0; width: 2px; background: #e0564f; z-index: 25; pointer-events: none; opacity: .8; }

#hint {
  flex: none; padding: 5px 14px; font-size: 11px; color: #5d6578;
  background: #14161c; border-top: 1px solid #20242f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- модалки ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(6,8,12,.66); z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.panel {
  background: #1e222c; border: 1px solid #333a4c; border-radius: 14px;
  padding: 20px 22px; width: 420px; max-width: 94vw; max-height: 90vh; overflow: auto;
  box-shadow: 0 18px 50px rgba(0,0,0,.5);
}
.panel.narrow { width: 320px; }
.panel.wide { width: 560px; }
.panel h2 { font-size: 17px; margin-bottom: 8px; }
.panel h3 { font-size: 13px; margin: 16px 0 6px; color: #9aa3b5; text-transform: uppercase; letter-spacing: 1px; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.row label { flex: 1; }
.row.btns { margin-top: 14px; align-items: center; }
.err { color: #ff8b84; font-size: 12px; min-height: 16px; margin: 4px 0; }

.wdays { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.wdays label {
  display: flex; gap: 5px; align-items: center; margin: 0; cursor: pointer;
  background: #1a1e28; border: 1px solid #333a4c; border-radius: 7px; padding: 5px 9px; font-size: 13px; color: #dfe3ea;
}
.wdays input { width: auto; }

.urow { display: flex; gap: 7px; align-items: center; margin: 5px 0; }
.urow input.uname { flex: 1.2; }
.urow input.upass { flex: 1; }
.urow input.ucolor { width: 40px; flex: none; }
.urow select { width: 110px; flex: none; }
.urow button { flex: none; padding: 5px 9px; }
.adduser { margin-top: 8px; align-items: center; }
.adduser input, .adduser select { width: auto; flex: 1; }
.adduser input[type=color] { flex: none; width: 40px; }

#tmDeps { margin-top: 10px; }
#tmDeps h4 { font-size: 12px; color: #9aa3b5; margin: 8px 0 4px; }
.deprow { display: flex; align-items: center; gap: 7px; margin: 4px 0; font-size: 13px; }
.deprow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deprow input { width: 62px; flex: none; padding: 3px 6px; }
.deprow button { padding: 2px 8px; }

.pop {
  position: fixed; z-index: 300; background: #1e222c; border: 1px solid #333a4c;
  border-radius: 10px; padding: 12px 14px; width: 230px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.poplbl { font-size: 12px; color: #9aa3b5; margin-bottom: 6px; }
.pop button { margin-top: 8px; width: 100%; }
